JQPlot auto refresh chart with dynamic ajax data

后端 未结 2 1298
猫巷女王i
猫巷女王i 2020-12-06 02:39

I want to update the chart drawn by jqPlot sequentially in time intervals.

My use case is such that the AJAX call returns only a single value. For e.g.:



        
2条回答
  •  情书的邮戳
    2020-12-06 03:27

    Let me add to @charlietfl answer. When you use replot() it takes 2 times longer to redraw, rather than with destroying jqplot. So use destroy() to redraw plot.

    $.jqplot('chart1', [storedData]).replot();
    

    http://jsfiddle.net/zjjvm/ it takes 46sec to draw running sine using replot()

    plot1.destroy();
    plot1 = $.jqplot('chart1', [storedData])
    

    http://jsfiddle.net/p9SbP/ it takes 25sec to draw the same using destroy()

提交回复
热议问题