I'm trying to create a custom toolbox feature in echarts 3.8.5, so the user can add marks or comments to the chart. I didn't find any demo with custom features, and documentation to Extension API is missing.
My questions:
How to set custom feature as "active" when user clicks on it (e.g., like when you select brush in predefined features)
How can I get coords of user click in chart
How to add custom element to chart
** When you have a custom toolbox feature (note: it must always start with my):
toolbox: {
feature: {
myFeature: {
show: true,
title: 'My custom feature',
icon: 'image:path/to/image-inactive.png'
onclick: function (){
// do something
}
}
}
},
You can manually update the icon to an active state by using:
chart.setOption({
toolbox: {
feature: {
myFeature: {
icon: 'image:path/to/image-active.png'
}
}
}
})
Echarts will detect the changes, and updates the icon. Of course, you can set it back to inactive with the same logic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With