Created
April 2, 2017 12:44
-
-
Save agustincl/4f7cee86484c62bc916cf1bb8ef43fc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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"> | |
// Load the Visualization API and the piechart package. | |
google.charts.load('current', {'packages':['corechart']}); | |
// Set a callback to run when the Google Visualization API is loaded. | |
google.charts.setOnLoadCallback(drawChart); | |
function drawChart() { | |
var jsonData = $.ajax({ | |
url: "http://10.7.0.12:5000/", | |
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.PieChart(document.getElementById('chart_div')); | |
chart.draw(data, {width: 400, height: 240}); | |
} | |
</script> | |
</head> | |
<body> | |
<!--Div that will hold the pie chart--> | |
<div id="chart_div"></div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment