Created
August 22, 2014 06:35
-
-
Save anonymous/fcc6985cadc1c728d49b 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
<!doctype html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Untitled Document</title> | |
</head> | |
<script type="text/javascript" src="https://www.google.com/jsapi"></script> // This is copied from link 2 | |
<script type="text/javascript"> | |
google.load("visualization", "1", {packages:["gauge"]}); | |
google.setOnLoadCallback(drawChart); | |
function drawChart() { | |
<script> | |
var gaugeData = new google.visualization.DataTable(); // Copied from link one | |
gaugeData.addColumn('number', 'Engine'); | |
gaugeData.addColumn('number', 'Torpedo'); | |
gaugeData.addRows(2); | |
gaugeData.setCell(0, 0, 120); | |
gaugeData.setCell(0, 1, 80); | |
var gaugeOptions = {min: 0, max: 280, | |
redFrom: 250, redTo: 280, minorTicks: 5}; | |
var gauge; | |
function drawGauge() { | |
gauge = new google.visualization.Gauge(document.getElementById('gauge_div')); | |
gauge.draw(gaugeData, gaugeOptions); | |
} | |
function changeTemp(dir) { | |
gaugeData.setValue(0, 0, gaugeData.getValue(0, 0) + dir * 25); | |
gaugeData.setValue(0, 1, gaugeData.getValue(0, 1) + dir * 20); | |
gauge.draw(gaugeData, gaugeOptions); | |
} | |
} | |
</script> | |
<input type='button' value='Go Faster' onclick='changeTemp(1)' /> | |
<input type='button' value='Slow down' onclick='changeTemp(-1)' /> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment