Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamically pass series in jqplot line chart

I have used jqplot line chart. I have get data from php page using ajax.In some condition I will display specific series.So

How to pass series dynamically in jqplot line chart and also set legend of series ?

I have manually write code for above requirement.I have apply click event on legend series and draw graph as per click on legend.

I have also change y-axis value as per select/deselect series legend.

like image 397
Hkachhia Avatar asked Mar 28 '26 08:03

Hkachhia


1 Answers

I originally tried the answer posted by @sdespont, but due to additional properties that need to be in place for the series, it wasn't working properly. I was able to get this working by doing the following:

plot1.data = data;
plot1.replot( data );

data is a 3D array of the same makeup as you would pass in when creating the plot. If I did either part without doing the other, it wouldn't refresh properly, but the combination of the two seems to do the trick. Refreshing the plot in this fashion would dynamically add or remove any series I added to the data array.

Hope that helps.

like image 74
dmccabe Avatar answered Mar 29 '26 22:03

dmccabe