the option explorer:{} does only work with continuous data types, like
number or date. My chart.draw gets its data in JSON format. Now how can I
put data type values for the x-axis into the JSON-array in my .PHP-script,
that reads that data with an sql-query from a data base. PHP does use the
string format and does not know any data format.
*Here comes the HTML:*
function drawChart() {
var jsonData = $.ajax({
url: "Antwortzeiten.php?seite=Start",
dataType:"json",
async: false
}).responseText;
// Create our data table out of JSON data loaded from server.
var data = new google.visualization.DataTable(jsonData);
// Instantiate and draw our chart, passing in some options.
var chart = new
google.visualization.LineChart(document.getElementById('chart_start_div'));
chart.draw(data, {explorer: {axis: 'horizontal'}, width: 800, height:
240});
}
*Here comes the PHP:*
<?php
$_seite = $_GET["seite"];
mysql_connect("localhost:XXXX","YYYY","PW");
mysql_select_db("test");
$result = mysql_query("SELECT (DATE_FORMAT(t, '%d.%m.%y')), rt FROM
zdf_zykl Where s='$_seite' Order by t DESC LIMIT 10");
$table = array();
$table['cols'] = array(
array('label' => 'DatumZeit', 'type' => 'string'),
array('label' => 'AZ [ms]', 'type' => 'number')
);
$rows = array();
while($r = mysql_fetch_assoc($result)) {
$temp = array();
// the following line will be used to slice the Pie chart
$temp[] = array('v' => (string) $r["(DATE_FORMAT(t, '%d.%m.%y'))"]);
// Values of each slice
$temp[] = array('v' => (float) $r['rt']);
$rows[] = array('c' => $temp);
}
$table['rows'] = $rows;
$jsonTable = json_encode($table);
echo $jsonTable;
mysql_close();
?>
--
You received this message because you are subscribed to the Google Groups
"Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-visualization-api/f275bd5a-4383-465a-aceb-59629a7b41b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.