Reputation: 183
lets say dygraph is already showing a chart with few series. Is it possible to add/insert a new series, or delete one existing series dynamically(via javascript)?
I could not find anything like it in examples/documentation.
Upvotes: 3
Views: 4988
Reputation: 319
You can't add those later on, however you can plot multiple series with the dygraph. If you have 2 time series t1 and t2, you can combine them and pass the date to dygraph
combined <- cbind(t1, t2)
dygraph(combined)
Upvotes: 0
Reputation: 6168
Keep your data and label arrays somewhere. When you want to add a new series, pull them up, update with new data and then
g.updateOptions({'file':data,'labels':labels});
"data" is the updated data array For this example I am using native data format. For CSV you would edit the original data csv file and update it similarly.
Upvotes: 3
Reputation: 16945
dygraphs doesn't take responsibility for managing your data. That's up to you.
That being said, you can show/hide series using the visibility option.
Upvotes: 3