<html> <head> <!--Load the AJAX API--> <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">
var options = { animation: { duration: 3000, startup: true //This is the new option }, title: 'Verbrauch', hAxis: { title: 'month', format: 'Y', }, vAxis: { title: 'kWh' }, width: 1200, height: 500
};
// Load the Visualization API and the piechart package.// google.charts.load('current', {'packages':['corechart']}); google.charts.load('visualization', '1.1', {'packages': ['corechart']});
// Set a callback to run when the Google Visualization API is loaded. google.charts.setOnLoadCallback(drawChart);
function drawChart() { var jsonData = $.ajax({ url: "getData.php", 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.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options); }
</script> </head>
<body> <!--Div that will hold the pie chart--> <div id="chart_div"></div> </body></html>{<?php
// It reads a json formatted text file and outputs it.
$string = file_get_contents("data.json");echo $string;
// Instead you can query your database and parse into JSON.
?>
--
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 google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
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/ee3d0654-b8f7-420d-b32d-16d6f97f8e96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{
"cols": [
{"label":"Date","type":"date"},
{"label":"Basis Tarif","type":"number"},
{"label":"H/N Tarif","type":"number"},
],
"rows": [