Nikita.
After you have extracted your values from your MySQL database, you will need to convert the MySQL date values to Unix time in milliseconds. I populated the $date array with MySQL $date values and iterated over the array, calling strtotime for the first conversion to Unix time and multiplying by 1000 to convert to milliseconds. To be able to directly modify array elements in a loop, I was also preceded by a $ value for assignment by reference.
foreach ($date as &$value){ $value = strtotime( $value ) * 1000; }
So now that the values in the $date array have been converted to the correct format, it's time to create a JavaScript array from the PHP array. This can be done using join ():
var dateValues = [<?php echo join($date, ',') ?>];
The resulting array is as follows:
var dateValues = [1356994800000,1357081200000,1357167600000, ... ];
To use this array in ZingChart, use the dateValues variable with the values in the scale-x object. To convert Unix time values to dates in ZingChart, add a "transform" object and set it to "type": "date".
"scale-x":{ "values": dateValues, "transform":{ "type":"date", "item":{ "visible":false } } }, ...
It takes care of scale. To get other values in the chart, you do almost the same thing. Convert PHP arrays to JavaScript arrays and use the array variable in your JSON diagram.
With an array of PHP $ rows:
var seriesValues = [<?php echo join($series, ',') ?>];
In your JSON diagram:
"series":[ { "values":seriesValues } ]
I put it all together for the Github Gist for you. Let me know if you have any questions!