legendHighlight
Previous
legendFilter
Next
poptip
Loading...
图例高亮元素。
{state: {inactive: { opacity: 0.5 },},interaction: {legendHighlight: true}}
let chart;const config = {onReady: (c) => chart = c}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', {});