I need to set color in emphasis label using color in data that i have, but it appears that i can use only static color.
let dataItems = [
{ name: 'first', value: 10, id: 0, color: '#3dbe23', selected: true },
{ name: 'second', value: 10, id: 1, color: '#149397', selected: false },
{ name: 'third', value: 10, id: 2, color: '#5eca16', selected: false },
{ name: 'fourth', value: 10, id: 3, color: '#d1a11e', selected: false },
{ name: 'fifth', value: 10, id: 4, color: '#5f043c', selected: false },
{ name: 'sixth', value: 10, id: 5, color: '#6b94ee', selected: false },
]
i have this data, and i need different item to change label color on hover that refers to its color.
itemStyle: {
borderColor: '#000',
borderWidth: 1,
color: (data: any) => {
return data.dataIndex === 0 ? data.data.color : '#fff'
},
},
it appears that i can do this in series item style, but can't in emphasis error example
const handleMouseOver = (e: any) => {
const chart = (myChart as any).getEchartsInstance()
console.log({ e })
chart.setOption({
series: {
emphasis: {
label: {
color: e.data.color,
},
},
},
})
}
i tried this, it partially worked fine untill i move mouse before animation ended, and i don't think that it is a fine approach