I have an Eclipse RCP application that uses an SWT browser to visualize data via D3.js. Additionally I'd like now to plot some live data using Cubism.js. The values to plot arrive at irregular intervals at the RCP application.
My current feeble attempt to feed data to the cubism chart from the RCP application is the following (sorry for my bad JavaScript):
function getGraphData(name) {
var value = 0,
values = [],
i = 0,
last;
return context.metric(function(start, stop, step, callback) {
start = +start, stop = +stop;
values = [];
if (isNaN(last)) last = start;
last += step;
// extVals is a global variable that is set by the RCP application
for(var j = 0; j < extVals.length; j++){
values.push(extVals[j]);
}
// Clear the array
extVals.length = 0;
callback(null, values)
}, name);
}
The current situation is that I can set new data from the RCP application using the global extVals
array but the graph will only show those new values if one of them is greater than the previous value in the graph.
Any help on this is greatly appreciated.