Hey everyone,
To plot time-series data, I append new rows to my Line Chart frequently,
delete the oldest rows, and redraw the graph (code below). However, each
*google.visualization.LineChart.draw()* call takes about 35ms; specifically
gvjs_.draw from jsapi_compiled_ui_module.js (some more details attached).
If there is interest, I can share more profiling results.
Is there a more efficient way to let Line Chart only draw the new data and
move the unchanged part along the x-axis? If not, is it still a good idea
to use Line Chart for frequently live-updating data?
Thanks,
Ingo
For reference, this is the code that I currently use to create the graph
initially and redraw it:
// (1) initial creation & draw
data = new google.visualization.DataTable();
chart = new
google.visualization.LineChart(document.getElementById('chart'));
data.addColumn('date', 'Time');
data.addColumn('number', 'Value');
chart.draw(data, options);
// (2) new data arrived, insert & truncate, redraw
data.addRow([someTime, someFloat)])
if (data.getNumberOfRows() > threshold) {
data.removeRow(0);
}
chart.draw(data, options)
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/94f90c5b-2b5d-49d6-af1a-c6a0cd45567d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.