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
21
page.php
21
page.php
|
@ -39,8 +39,6 @@
|
||||||
// Set a callback to run when the Google Visualization API is loaded.
|
// Set a callback to run when the Google Visualization API is loaded.
|
||||||
google.setOnLoadCallback(drawChart);
|
google.setOnLoadCallback(drawChart);
|
||||||
|
|
||||||
/* THE ISSUE IS SOMEWHERE BETWEEN HERE...
|
|
||||||
|
|
||||||
// Callback that creates and populates a data table,
|
// Callback that creates and populates a data table,
|
||||||
// instantiates the pie chart, passes in the data and
|
// instantiates the pie chart, passes in the data and
|
||||||
// draws it.
|
// draws it.
|
||||||
|
@ -58,9 +56,9 @@
|
||||||
['PROD', <?php echo $hostType[4]; ?>],
|
['PROD', <?php echo $hostType[4]; ?>],
|
||||||
['SIT', <?php echo $hostType[5]; ?>],
|
['SIT', <?php echo $hostType[5]; ?>],
|
||||||
['UAT', <?php echo $hostType[6]; ?>],
|
['UAT', <?php echo $hostType[6]; ?>],
|
||||||
['UNCLASSIFIED', <?php echo $hostType[7]; ?>];
|
['UNCLASSIFIED', <?php echo $hostType[7]; ?>]
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Set chart options
|
// Set chart options
|
||||||
var options = {'title':'Types of Servers',
|
var options = {'title':'Types of Servers',
|
||||||
'width':400,
|
'width':400,
|
||||||
|
@ -69,12 +67,23 @@
|
||||||
// Instantiate and draw our chart, passing in some options.
|
// Instantiate and draw our chart, passing in some options.
|
||||||
var pie_chart = new google.visualization.PieChart(document.getElementById('pie_chart'));
|
var pie_chart = new google.visualization.PieChart(document.getElementById('pie_chart'));
|
||||||
var bar_chart = new google.visualization.BarChart(document.getElementById('bar_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);
|
pie_chart.draw(data, options);
|
||||||
bar_chart.draw(data, options);
|
bar_chart.draw(data, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
...AND HERE */
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
|
Reference in a new issue