In your zingchart.render () method, use the dataurl parameter instead of the data parameter and set it to the location of your PHP script in which you connect to your database.
window.onload=function(){ zingchart.render({ id:"myChart", width:"100%", height:400, dataurl:'feed.php' }); };
Now, in feed.php, create a connection and extract the values. Once you have the values ββin the array of PHP variables, use join() to combine the values ββwith a comma and set between the brackets so that the data is formatted in such a way that ZingChart understands (as a JavaScript array):
$dates = '[' . join($date, ',') . ']'; $values = '[' . join($series, ',') . ']';
Then from the same script, select the entire JSON configuration that will be used in the diagram:
echo ' { "type" : "line", "refresh" : { "type" : "full", "interval" : 10 }, "scale-x":{ "values":' . $dates . ', "transform":{ "type":"date", "all":"%m/%d/%y" } }, "series" : [ { "values" : ' . $values . ' } ] }';
It is important to note that the "type" property is set to "full" to allow the graph to be completely updated, rather than pulling values ββone by one.
I added this demo to the ZingChart-Demos repository on Github for your reading .
I am on the ZingChart team, so let me know if you need more help.