legendHighlight
上一篇
legendFilter
下一篇
poptip
Loading...
图例高亮元素。
{"legend": {"color": {"state": {"inactive": {"labelOpacity": 0.5,"markerOpacity": 0.5}}}},"axis": {"y": {"labelFormatter": "~s"}},"interaction": {"legendHighlight": true}}
chart.on('legend:highlight', (e) => {const { nativeEvent, data } = e;if (!nativeEvent) return;console.log(data);});chart.on('legend:highlight', (e) => {const { nativeEvent, data } = e;if (!nativeEvent) return;console.log(data);});chart.on('legend:unhighlight', (e) => {const { nativeEvent } = e;if (!nativeEvent) return;console.log('unhighlight');});chart.on('legend:unhighlight', (e) => {const { nativeEvent } = e;if (!nativeEvent) return;console.log('unhighlight');});chart.on('legend:highlight', (e) => {const { nativeEvent, data } = e;if (!nativeEvent) return;console.log(data);});chart.on('legend:unhighlight', (e) => {const { nativeEvent } = e;if (!nativeEvent) return;console.log('unhighlight');});
chart.emit('legend:highlight', {data: { channel: 'color', value: 'Increase' },});chart.emit('legend:unhighlight', {});