Why this code is not working fine ? I have the php code that generates do jsontable but I cannot use it in the html? Any idea ?
<html> <head> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> google.charts.load('current', {'packages':['corechart']}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(<?php $conn = oci_connect('eri', 'senha123', 'localhost/orcl'); if (!$conn) { $erro = oci_error(); trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR); } $query = oci_parse($conn, "select tipo, tempo from eri"); oci_execute($query); $rows = array(); $table = array(); $table['cols'] = array( array('label' => 'tipo', 'type' => 'string'), array('label' => 'tempo', 'type' => 'int'), ); $rows = array(); while($r = oci_fetch_array($query, OCI_ASSOC+OCI_RETURN_NULLS)) { $temp = array(); $temp[] = array('v' => (string) $r['TIPO']); $temp[] = array('v' => (int) $r['TEMPO']); $rows[] = array('c' => $temp); } $table['rows'] = $rows; $jsontable = json_encode($table); echo $jsontable; ?> ); var options = { title:'Sensors Data', legend:{position:'bottom'}, chartArea:{width:'95%', height:'65%'} }; var chart = new google.visualization.LineChart(document.getElementById('line_chart')); chart.draw(data, options); } </script> <style> .page-wrapper { width:1000px; margin:0 auto; } </style> </head> <body> <div class="page-wrapper"> <br /> <h2 align="center">SHOW 1 - Display Google Line Chart with JSON PHP & Oracle </h2> <div id="line_chart" style="width: 100%; height: 500px"></div> </div> </body> </html> -- 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/bbd1b0c6-19dc-4685-9bff-f12e9bd5b231%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
