With this solution I get the following Jason form the PHP:
{"cols":[{"label":"DatumZeit","type":"string"},{"label":"Origin AZ [ms]","type":"number"},{"label":"API AZ [ms]","type":"number"}],"rows":[{"c":[{"v":""},{"v":0},{"v":58}]},{"c":[{"v":""},{"v":0},{"v":72}]},{"c":[{"v":""},{"v":0},{"v":72}]},{"c":[{"v":""},{"v":0},{"v":67}]},{"c":[{"v":""},{"v":0},{"v":69}]},{"c":[{"v":""},{"v":0},{"v":88}]},{"c":[{"v":""},{"v":0},{"v":70}]},{"c":[{"v":""},{"v":0},{"v":68}]},{"c":[{"v":""},{"v":0},{"v":271}]},{"c":[{"v":""},{"v":0},{"v":70}]}]}
But I do not know, why the first v:-values are empty and the second v-values are all 0?
In fact with one line in the graph these values are not missing. (And they are present in the DB).
<?php
//$_ra = $_GET["ra"];
mysql_connect("XXXXXX:YYY","USer","PW");
mysql_select_db("test");
$result = mysql_query("SELECT (DATE_FORMAT(t, '%T')), rt FROM zdf_rt_testzdf Order by t DESC LIMIT 10");
$result_API = mysql_query("SELECT (DATE_FORMAT(t, '%T')), rt FROM zdf_rt_testzdf_API Order by t DESC LIMIT 10");
$table = array();
$table['cols'] = array(
// Labels for your chart, these represent the column titles
// Note that one column is in "string" format and another one is in "number" format as pie chart only required "numbers" for calculating percentage and string will be used for column title
array('label' => 'DatumZeit', 'type' => 'string'),
array('label' => 'Origin AZ [ms]', 'type' => 'number'),
array('label' => 'API AZ [ms]', 'type' => 'number')
);
$rows = array();
while($r = mysql_fetch_assoc($result) && $r_API = mysql_fetch_assoc($result_API)) {
$temp = array();
// the following line will be used to slice the Pie chart
$temp[] = array('v' => (string) $r["(DATE_FORMAT(t, '%T'))"]);
// Values of each slice
$temp[] = array('v' => (int) $r['rt']);
$temp[] = array('v' => (int) $r_API['rt']);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
echo $jsonTable;
//$json_data = json_encode($data);
//print $json_data;
//file_put_contents('your_json_file.json', $json_data);
mysql_close();
?>