Search code examples
javascriptjqueryjqplot

reuse jqplot object to load or replot data


I am using JqPlot for charts , my problem is i want to load different data on different click events.

But once the chart is created and loaded with the data for the first time; i don't know then how to load data when another event fires that means i want to reuse the chart object and want to load/replot the data when events get fired something like...

chartObj.data = [graphData]

Solution

  • That seems to work to replot data.

    chartObj.series[0].data = [[0, 4], [1, 7], [2, 3]];
    chartObj.replot();
    

    Also, you can check this: https://groups.google.com/group/jqplot-users/browse_thread/thread/59df82899617242b/77fe0972f88aef6d%3Fq%3D%2522Groups.%2BCom%2522%2377fe0972f88aef6d&ei=iGwTS6eaOpW8Qpmqic0O&sa=t&ct=res&cd=71&source=groups&usg=AFQjCNHotAa6Z5CIi_-BGTHr_k766ZXXLQ?hl=en, hope it helps.