Skip to content

Commit 4e3054e

Browse files
committed
docs: GradualColor demo fix
1 parent 1d7552c commit 4e3054e

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

packages/console-line-chart/demo/GradualColor.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ const config = {
1414
smooth: true,
1515
};
1616

17+
const onTooltipChange = evt => {
18+
let items = evt.items; // tooltip显示的项,不处理的话会有2项
19+
// 在这里 去掉你想去掉的item,这里选择只要纯色的(线的颜色)
20+
const newItems = items.filter(x => x.color === '#0072ff');
21+
items.splice(0); // 将原来的Tooltip Items清空
22+
items.push(newItems[0]); // 只展示你筛选后的结果
23+
}
24+
1725
export default () => (
18-
<ConsoleLineChart data={data} config={config} height={300} />
26+
<ConsoleLineChart
27+
data={data}
28+
config={config}
29+
height={300}
30+
event={{
31+
'tooltip:change': onTooltipChange,
32+
}}
33+
/>
1934
);

0 commit comments

Comments
 (0)