Sandonet,
You seem to be passing wrong parameters to getJSON. Replacing
$.getJSON("test.json" + (dataPoints.length + 1) + (dataPoints[dataPoints.length - 1].y) + function(data)
with
$.getJSON("test.json", function(data) {
in updateChart function should work fine. Please find the working code below.
function updateChart() {
$.getJSON("test.json", function(data) {
$.each(data, function(key, value) {
dataPoints.push({
x: parseInt(value[0]),
y: parseInt(value[1]),
z: parseInt(value[2])
});
});
chart.render();
setTimeout(function(){updateChart()}, 1000);
});
}
—
Vishwas R
Team CanvasJS