Last active
December 12, 2015 12:19
-
-
Save sajanp/4771617 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
$numbers = array( | |
mt_rand(1, 200), | |
mt_rand(1, 200) | |
); | |
echo $json_encode($numbers); | |
?> |
This file contains hidden or 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
function drawGauge() { | |
// THIS IS WHERE WE CALL THE PHP AND GET THE NUMBERS AND TURN THEM INTO JS VARIABLES. | |
$.getJSON('num_gen.php', function(numbers) { | |
var num1 = numbers.1; | |
var num2 = numbers.2; | |
} | |
gaugeData = new google.visualization.DataTable(); | |
gaugeData.addColumn('number', 'CPU'); | |
gaugeData.addColumn('number', 'RAM'); | |
gaugeData.addRows(2); | |
gaugeData.setCell(0, 0, num1); | |
gaugeData.setCell(0, 1, num2); | |
gauge = new google.visualization.Gauge(document.getElementById('gauge_div')); | |
gauge.draw(gaugeData, gaugeOptions); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment