Waaaay the charts work, fuck semicolons mang
This commit is contained in:
parent
4696e7c651
commit
23ad2584de
1 changed files with 15 additions and 6 deletions
19
page.php
19
page.php
|
@ -39,8 +39,6 @@
|
|||
// Set a callback to run when the Google Visualization API is loaded.
|
||||
google.setOnLoadCallback(drawChart);
|
||||
|
||||
/* THE ISSUE IS SOMEWHERE BETWEEN HERE...
|
||||
|
||||
// Callback that creates and populates a data table,
|
||||
// instantiates the pie chart, passes in the data and
|
||||
// draws it.
|
||||
|
@ -58,7 +56,7 @@
|
|||
['PROD', <?php echo $hostType[4]; ?>],
|
||||
['SIT', <?php echo $hostType[5]; ?>],
|
||||
['UAT', <?php echo $hostType[6]; ?>],
|
||||
['UNCLASSIFIED', <?php echo $hostType[7]; ?>];
|
||||
['UNCLASSIFIED', <?php echo $hostType[7]; ?>]
|
||||
]);
|
||||
|
||||
// Set chart options
|
||||
|
@ -70,11 +68,22 @@
|
|||
var pie_chart = new google.visualization.PieChart(document.getElementById('pie_chart'));
|
||||
var bar_chart = new google.visualization.BarChart(document.getElementById('bar_chart'));
|
||||
|
||||
// The select handler. Call the chart's getSelection() method
|
||||
function selectHandler() {
|
||||
var selectedItem = pie_chart.getSelection()[0];
|
||||
if (selectedItem) {
|
||||
var hostType = data.getValue(selectedItem.row, 1);
|
||||
var hostTypeNum = data.getValue(selectedItem.row, 0);
|
||||
alert('There are ' + hostType + ' machines running as ' + hostTypeNum);
|
||||
}
|
||||
}
|
||||
// Listen for the 'select' event, and call my function selectHandler() when
|
||||
// the user selects something on the chart.
|
||||
google.visualization.events.addListener(pie_chart, 'select', selectHandler);
|
||||
|
||||
pie_chart.draw(data, options);
|
||||
bar_chart.draw(data, options);
|
||||
}
|
||||
|
||||
...AND HERE */
|
||||
</script>
|
||||
</head>
|
||||
|
||||
|
|
Reference in a new issue