Home Forums Chart Support How can I use PHP MySQL Dynamic data Reply To: How can I use PHP MySQL Dynamic data

#4645

Marco,

What is going wrong is that you are assigning a new array to dps while dataPoints is still pointing to old one. So instead you should either modify existing dps array or assign a totally new array to dataPoints.

1st Approach:

var updateChart = function () {
$.getJSON(“data.php”, function (result) {

dps.splice(0, dps.length);

$.each(result, function (index, value) {
dps.push(value);
});
});

chart.render();
};

2nd Approach:

var updateChart = function () {
$.getJSON(“data.php”, function (result) {

chart.options.data[0].dataPoints = result;

});

chart.render();
};