current position:Home>When echarts clicks tooltips, the whole column of data will be recalled

When echarts clicks tooltips, the whole column of data will be recalled

2022-05-15 05:16:18A grain of rice

myChart.on('click', function(params) {
    
  //  The name of the console print data 
  console.log(params.name);
});

current echarts Click event , You need to click to a certain point to have a data callback , And the callback data is only the data of that point , Instead of a whole column of data where that point is located , If the chart has 2 More than one set of data , Just callback the data of that point in the point , This is not the result we want .
therefore , Can be in tooltips Do a good job in data monitoring and splicing , And then back .
 Insert picture description here
 Insert picture description here
Just modify the data in this function
 Insert picture description here
 Insert picture description here
Print the results
 Insert picture description here

 Insert picture description here
 Insert picture description here
The above is the implementation method . The specific code will not be developed .
You can use the previous package echarts Code modification at , In my other article .

copyright notice
author[A grain of rice],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/131/202205111246439353.html

Random recommended