Reputation: 1005
I am working on a Scatterplot + Plot lines chart, which has multiple legends. I have to change the value of the plot lines based on the scatterplot values. Could anyone help me out in getting the scatter plot value once I click on any legend items?
I have done this code, Which gives me an alert when I click on any legend. Next, I have to get the scatterplot value and change the plot line graph
events: {
legendItemClick: function(e) {
if(this.visible) {
alert('visible');
}
else {
console.log("result"+result);
alert('Not visible');
}
}
},
Upvotes: 0
Views: 1110
Reputation: 55
I have done something similar but for series Plot, but this will surely give you the approach you need to adopt.
if(series.name=='xyz'){//you can handle multiple legends by checking their name and have different calls for different legends
if (!this.visible) {// i want to make request for data only if when i click the legend and its visible
$.getJSON('xyzdata.php',{parameter1:xyz1,parameter2:xyz2}, function(data) {// making the call
series.setData(data.a);// with the returned data defining my plot
series.xAxis.setCategories(data.b);
});
};
Hope that helps!
Upvotes: 1