seo免费自助建站,ui设计培训内容,游戏平台网页版,wordpress手机app登陆不了触发图表行为#xff0c;通过dispatchAction触发。例如图例开关legendToggleSelect, 数据区域缩放dataZoom#xff0c;显示提示框showTip等等。
官网#xff1a;echarts
(在 ECharts 中主要通过 on 方法添加事件处理函数。)
events#xff1a;
ECharts 中的事件分为两种…触发图表行为通过dispatchAction触发。例如图例开关legendToggleSelect, 数据区域缩放dataZoom显示提示框showTip等等。
官网echarts
(在 ECharts 中主要通过 on 方法添加事件处理函数。)
events
ECharts 中的事件分为两种一种是鼠标事件在鼠标点击某个图形上会触发还有一种是调用 dispatchAction 后触发的事件。
action
ECharts 中支持的图表行为通过 dispatchAction 触发。
1.highlight 高亮指定的数据图形
dispatchAction({type: highlight,// 可选系列 index可以是一个数组指定多个系列seriesIndex?: number|Array,// 可选系列名称可以是一个数组指定多个系列seriesName?: string|Array,// 可选数据的 indexdataIndex?: number,// 可选数据的 名称name?: string
})
2.downplay 取消高亮指定的数据图形
dispatchAction({type: downplay,// 可选系列 index可以是一个数组指定多个系列seriesIndex?: number|Array,// 可选系列名称可以是一个数组指定多个系列seriesName?: string|Array,// 可选数据的 indexdataIndex?: number,// 可选数据的 名称name?: string
})
3.图例相关的行为必须引入图例组件之后才能使用
1legendSelect选中图例
dispatchAction({type: legendSelect,// 图例名称name: string
})
2legendUnSelect取消选中图例
dispatchAction({type: legendUnSelect,// 图例名称name: string
})
3legendToggleSelect切换图例的选中状态
dispatchAction({type: legendToggleSelect,// 图例名称name: string
})
4legendScroll控制图例的滚动当legend.type是scroll的时候有效
dispatchAction({type: legendScroll,scrollDataIndex: number,legendId: string
})
4. 提示框组件相关行为必须引入提示框组件之后才能引用
1showTip显示提示框 有两种使用方式 A指定在相对容器的位置处显示提示框如果指定的位置无法显示则无效。
dispatchAction({type:showTip,//屏幕上的x坐标x: number,//屏幕上的y坐标y: number,//本次显示tooltip的位置只在本次action生效。缺省则使用option中定义的tooltip位置position: Array.number | String | Function
})
B: 指定数据图形根据tooltip的配置项进行显示提示框
dispatch({type: showTip,// 系列的 index在 tooltip 的 trigger 为 axis 的时候可选。seriesIndex?: number,// 数据的 index如果不指定也可以通过 name 属性根据名称指定数据dataIndex?: number,// 可选数据名称在有 dataIndex 的时候忽略name?: string,// 本次显示 tooltip 的位置。只在本次 action 中生效。// 缺省则使用 option 中定义的 tooltip 位置。position: Array.number|string|Function,
})
2hideTip 隐藏提示框
dispatchAction({type:hideTip
})
其他相关方法或者属性 可以移步官网。此文借鉴Echarts 的 dispatchAction