How to animate diagrams with jQuery and jQplot (updating data)

前端 未结 1 1818
感情败类
感情败类 2021-02-02 03:36

I am \"animating\" diagrams over time by changing the data and redrawing them.

// initialization
var data = ...
var targetPlot = $.jqplot(\'#diagram\', data, dia         


        
相关标签:
1条回答
  • 2021-02-02 04:25

    This is the way I found after lots of investigation. I am writing this down to help someone reading this question.

    The correct place to update the data is in the series property, after updating the data you can redraw the plot:

    targetPlot.series[0].data = myData;
    targetPlot.redraw();
    

    If your axis changed, then you can rescale them by using replot() instead of redraw():

    targetPlot.replot({resetAxes:true});
    

    This is much faster than redrawing a new plot every time.

    0 讨论(0)
提交回复
热议问题