elementHighlight
Previous
chartIndex
Next
elementHighlightByColor
Loading...
高亮鼠标悬浮的元素。
{state: {inactive: { opacity: 0.5 }},interaction: {elementHighlight: true}}
属性 | 描述 | 类型 | 默认值 |
---|---|---|---|
background | 是否高亮背景 | boolean | false |
offset | 主方向的偏移量 | number | 0 |
background${StyleAttrs} | 背景的样式 | StyleAttrs | - |
let chart;const config = {onReady: (c) => chart = c}chart.emit('element:highlight', {data: { data: { population: 5038433 } },});chart.emit('element:unhighlight', {});
chart.on('element:highlight', (event) => {const { data, nativeEvent } = event;if (nativeEvent) console.log('element:highlight', data);});chart.on('element:unhighlight', (event) => {const { nativeEvent } = event;if (nativeEvent) console.log('reset');});