Skip to content
Advertisement

Echarts.js: Detect a click on a subset of data

I want to detect a click on a particular subset in a bar chart. As I want to init a new chart after the click, with the data from the clicked subset. Currently when I click on chart bars, I get data of the whole chart and can’t retrieve data of just one bar.

Here is what I have:

JavaScript

Advertisement

Answer

I managed to detect the clicked subset by adding a refs attribute and the click event to the component and passing a function. Then I put this function in methods:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement