First, add a tooltip column definition to your header:
$data[] = Array('clock', 'Value', Array('type' => 'string', 'role' =>
'tooltip'));
then you can add the tooltip data to your array in the loop:
$data[] = Array($date, $history->value, $phist[$i]->value);
If that doesn't work, post the JSON output by your php.
On Tuesday, February 11, 2014 2:21:52 PM UTC-5, Robert Reilly wrote:
>
> *Hi, I have a chart i am generating with the following html/js: *
>
> html><head></head><body>
> <script language="javascript" type="text/javascript"
> src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js">
> </script><script type="text/javascript" src="https://www.google.com/jsapi
> "></script>
> <script type="text/javascript">
> google.load("visualization", "1", {packages:["corechart"]});
> google.setOnLoadCallback(drawChart);
>
> function drawChart() {
> var jsonData = $.ajax({
> url: "getJson_item.php",
> dataType: "json",
> async: false
> }).responseText;
>
>
> var obj = jQuery.parseJSON(jsonData);
> var data = google.visualization.arrayToDataTable(obj);
> var options = {
>
> };
>
> var chart = new
> google.visualization.LineChart(document.getElementById('chart_div'));
> chart.draw(data, options);
> }
>
> </script>
> <div id="chart_div" style="width: 900px; height: 500px;">
> </body>
> </html>
>
> *Here is my php code that generates the data:*
>
> <?php
> require 'ZabbixApiAbstract.class.php';
> require 'ZabbixApi.class.php';
> $server = "xxx";
> $user = "xxx";
> $pass = "xxx";
> $groupid = "2";
> $time_from = "1392078510";
> $time_till = "1392078510";
> session_start();
> $data = array();
> $hostid = "10120";
> $api = new ZabbixApi("http://$server/zabbix/api_jsonrpc.php", 'xxx',
> 'xxx');
>
> $itemIds = $api->itemGet(array('output' => 'extend','hostids' =>
> "$hostid", 'filter' => array('name' => 'Processor load (5 min average per
> core)')));
> //$procIds = $api->itemGet(array('output' => 'extend','hostids' =>
> "$hostid", 'filter' => array('name' => 'Process List')));
> //$procIds = $api->itemGet(array('output' => 'extend','hostids' =>
> '10108', 'filter' => array('name' => 'Process List')));
>
>
> $time_till = time();
> $time_from = time() - 3600;
>
> $hist = $api->historyGet(array('output' => 'extend', 'history' =>
> '0', 'itemids' => $itemIds[0]->itemid, 'time_from' => $time_from,
> 'time_till' => $time_till, 'sortfield' => 'clock', 'sortorder' => 'DESC'));
> // $phist = $api->historyGet(array('output' => 'extend', 'history' =>
> '4', 'itemids' => $procIds[0]->itemid, 'time_from' => $time_from,
> 'time_till' => $time_till, 'sortfield' => 'clock', 'sortorder' => 'DESC'));
>
> $data [] = Array('clock','Value');
>
> $i=0;
> foreach ($hist as $history){
>
> settype($history->value, "float");
> $date = date('Y-m-d H:i:s',$history->clock );
>
> // $data [] = Array($date, $history->value,$phist[$i]->value);
> $data [] = Array($date, $history->value);
> $i++;
> }
> header('content-type: application/json');
> echo json_encode($data);
>
> ?>
>
> *This works well for a single series graph, I want to be able to add a
> tool tip, the data query that is commented out would grab the tool tip. I
> cannot seem to get the data formated properly to *
> *add the tool tip. Any help is greatly appreciated*
> *Thanks!*
> *Robert*
>
>
--
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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/groups/opt_out.