-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
executable file
·102 lines (96 loc) · 4.13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="Pedro A. Melendez" />
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="http://yandex.st/highlightjs/7.5/styles/github.min.css">
<script src="http://yandex.st/highlightjs/7.5/highlight.min.js"></script>
<script type="text/javascript">
hljs.tabReplace = ' '; // 4 spaces
hljs.initHighlightingOnLoad();
</script>
<script src='canvasgauge.js'></script>
<title>Canvas Guage alpha</title>
</head>
<body>
<a href="https://github.com/lazychino/canvas_gauge">
<img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub">
</a>
<div class="container">
<div class="row">
<div class="col-md-8">
<p class="lead">This a live demo of the canvasgauge.js library</p>
<p class="lead">update every 5 seconds with random values</p>
</div>
</div>
<div>
<dl>
<dt>canvas 1</dt>
<dd>
<canvas id="canvas1" width="300" height="50"></canvas>
<script>
var gauge1 = new Gauge("canvas1", { 'color': "#0F0" ,'range': {'min':-50, 'max':50 } }); // gauge is not draw until Gauge.draw(value) runs;
</script>
<div class="form-group">
<button onClick="gauge1.draw( Math.floor(Math.random()*100)-50 );" class="btn btn-primary">Press to Draw</button>
</div>
<pre><code><canvas id="canvas1" width="300" height="50"></canvas>
<script>
var gauge1 = new Gauge("canvas1", { 'color': "#0F0" ,'range': {'min':-50, 'max':50 } }); // gauge is not draw until Gauge.draw(value) runs;
</script>
<div class="form-group">
<button onClick="gauge1.draw( Math.floor(Math.random()*100)-50 );" class="btn btn-primary">Press to Draw</button>
</div>
</code></pre>
</dd>
<dt>canvas 2</dt>
<dd>
<canvas id="canvas2" width="500" height="100"></canvas>
<script>
var gauge2 = new Gauge("canvas2");
gauge2.draw( Math.floor(Math.random()*100) );
var run = setInterval(function() { gauge2.draw( Math.floor(Math.random()*100) ); }, 5000);
</script>
<pre><code><canvas id="canvas2" width="500" height="100"></canvas>
<script>
var gauge2 = new Gauge("canvas2");
gauge2.draw( Math.floor(Math.random()*100) );
var run = setInterval(function() { gauge2.draw( Math.floor(Math.random()*100) ); }, 5000);
</script>
</code></pre>
</dd>
<dt>canvas 3</dt>
<dd><canvas id="canvas3" width="200" height="200"></canvas>
<script>
var gauge3 = new Gauge("canvas3", {'mode':'needle', 'range': {'min':-30, 'max':30 } });
gauge3.draw( Math.floor(Math.random()*60)-30 );
var run = setInterval(function() { gauge3.draw( Math.floor(Math.random()*60)-30 ); }, 5000);
</script>
<pre><code><canvas id="canvas3" width="200" height="200"></canvas>
<script>
var gauge3 = new Gauge("canvas3", {'mode':'needle', 'range': {'min':-30, 'max':30 } });
gauge3.draw( Math.floor(Math.random()*60)-30 );
var run = setInterval(function() { gauge3.draw( Math.floor(Math.random()*60)-30 ); }, 5000);
</script></code></pre>
</dd>
<dt>canvas 4</dt>
<dd><canvas id="canvas4" width="300" height="300"></canvas>
<script>
var gauge4 = new Gauge("canvas4", {'mode':'needle', 'range': {'min':0, 'max':140 } });
gauge4.draw( Math.floor(Math.random()*140) );
var run = setInterval(function() { gauge4.draw( Math.floor(Math.random()*140) ); }, 5000);
</script>
<pre><code><canvas id="canvas4" width="300" height="300"></canvas>
<script>
var gauge4 = new Gauge("canvas4", {'mode':'needle', 'range': {'min':0, 'max':140 } });
gauge4.draw( Math.floor(Math.random()*140) );
var run = setInterval(function() { gauge4.draw( Math.floor(Math.random()*140) ); }, 5000);
</script></code></pre>
</dd>
</dl>
</div>
</div>
</body>
</html>