I have a line chart, that gets data from a DB by the use of a PHP-Script.

Now I would like to display a second line in the same chart getting data 
from the same DB but from another table.

Do I have to add code in the google graph HTML-page or just in the 
PHP-Script?

<?php
//$_ra = $_GET["ra"];
mysql_connect("<IP>:<PORT>","<USER>","<PW>");
mysql_select_db("test");

$result = mysql_query("SELECT (DATE_FORMAT(t, '%T')), rt FROM <Table> 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' => '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, '%T'))"]); 

    // Values of each slice
    $temp[] = array('v' => (int) $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 view this discussion on the web visit 
https://groups.google.com/d/msgid/google-visualization-api/bcaa4d33-b3f6-48cd-8de8-a04c4555b7d3n%40googlegroups.com.

Reply via email to