admin管理员组

文章数量:1418659

Right now I'm using plot.ly javascript library to visualise an array of numbers. I want to update this plot in every iteration. I tried to Plotly.newPlot('id',data); after values changed, however it takes time to re-define plot object every time.

I went through plot.ly documentation yet did not find a solution for my case.

I want to update graph in every interruption, maybe I need to update plot more 200 times after calling iterating function. Any solutions/suggestions for this problem? I can use another plotting library if there is one fits for this case.

Right now I'm using plot.ly javascript library to visualise an array of numbers. I want to update this plot in every iteration. I tried to Plotly.newPlot('id',data); after values changed, however it takes time to re-define plot object every time.

I went through plot.ly documentation yet did not find a solution for my case.

I want to update graph in every interruption, maybe I need to update plot more 200 times after calling iterating function. Any solutions/suggestions for this problem? I can use another plotting library if there is one fits for this case.

Share Improve this question asked Dec 17, 2015 at 21:58 Bedi EgilmezBedi Egilmez 1,5523 gold badges18 silver badges27 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

Try Plotly.extendTraces

Unfortunately no official examples are available at the moment.

I'd remend:

  • looking the source code here, and
  • the test cases here.

Bedi, unfortunately, I cannot respond to your ment directly. I don't have enough points (I need 50 and I have 15). Plotly.extendTraces() is what you need. The error you've noted is because update.y needs to be an array with a length equal to that of the indices argument to Plotly.extendTraces(). Looking at the source, indices is the third argument to the extendTraces. Your indices argument is only one item long ([0].length === 1). As long as itemList is an array of length 1 you should not be having a problem. Run console.log(itemList.length === [0].length) and I think you'll discover that you're trying to add too many points at once to your trace.

本文标签: bar chartVisualising data with javascript graphsdynamicallyStack Overflow