gpt4 book ai didi

javascript - 如何以编程方式清除echarts中的画笔选择

转载 作者:行者123 更新时间:2023-12-03 02:05:26 29 4
gpt4 key购买 nike

我正在使用echarts library 。我正在使用条形图创建直方图,并使用画笔选择来突出显示条形。我还想以编程方式选择/取消选择栏。根据 echarts 文档和示例,我了解到此类操作是通过使用 chart.dispatchAction 完成的,但没有记录或显示画笔操作。记录的唯一相关内容是一个选项 (brush.removeOnClick),仅当 brush.brushMode === 'single' 允许在单击时清除画笔选择。如何以编程方式创建/清除画笔选择?谢谢

最佳答案

有一个未记录的brush操作;

使用示例:

使用命令clear清除画笔:

chart.dispatchAction({
type: 'brush',
command: 'clear',
areas: [],
});

创建画笔选择(至少在带有 axisType === 'category' 的条形图中):

chart.dispatchAction({
type: 'brush',
areas: [
{
brushType: 'lineX',
xAxisIndex: 0,
coordRange: [from, to],
},
],
});

其中 coordRange 是 2 个轴刻度索引的数组。

echarts中有很多未记录的东西。

关于javascript - 如何以编程方式清除echarts中的画笔选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49830241/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com