Skip to content

Commit

Permalink
fix(HotMap): 修改HotMap hover的时样式 (#384)
Browse files Browse the repository at this point in the history
Co-authored-by: Zhang Rui <[email protected]>
  • Loading branch information
Quesle and Zhang Rui authored Apr 18, 2024
1 parent be20c7f commit a8c361a
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/hot-map/framework.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from 'lodash';
import { get, isEmpty } from 'lodash';
import { ChartConfig, ChartOptions, ChartType } from '../interfaces';
import { BaseChart, fetchConfig, generateChart } from '../core/framework';
import { getShapeConfig } from '../utils/tools/shapeConfig';
Expand Down Expand Up @@ -51,10 +51,9 @@ export class HotMap extends BaseChart {
style: {
fill: '#fff',
fontSize: 14,
// shadowBlur: 2,
shadowColor: 'rgba(0, 0, 0)',
},
content:
shapeConfig?.label?.content ||
shapeConfig?.content ||
((val) => {
return `${formatPercent(val?.[zField] || 0)}`;
Expand All @@ -63,6 +62,21 @@ export class HotMap extends BaseChart {
.style({
lineWidth: 1,
stroke: '#fff',
})
.state({
active: {
style: (style) => {
const currentColor = get(style, 'shape.cfg.attrs.fill');
return {
lineWidth: 1,
stroke: '#fff',
shadowColor: `${currentColor}10`,
shadowBlur: 5,
cursor: 'pointer',
fill: currentColor,
};
},
},
});

this.instance.interaction('element-active');
Expand Down

0 comments on commit a8c361a

Please sign in to comment.