Reputation: 1542
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.
Upvotes: 3
Views: 2000
Reputation: 263
Bedi, unfortunately, I cannot respond to your comment 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.
Upvotes: 2