-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.tt
108 lines (87 loc) · 3.11 KB
/
index.tt
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
103
104
105
106
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<!-- script type="text/javascript" src="http://code.jquery.com/jquery-1.7.js"></script -->
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript" src="/javascripts/highcharts/js/highcharts.js"></script>
<script type="text/javascript" src="/javascripts/highcharts/modules/exporting.js"></script>
<script type="text/javascript">
var example = 'dynamic-update',
theme = 'default';
</script>
<script type="text/javascript" src="/javascripts/highcharts/demo/scripts.js"></script>
<script type="text/javascript">
Highcharts.theme = { colors: ['#4572A7'] };// prevent errors in default theme
var highchartsOptions = Highcharts.getOptions();
</script>
<link rel="stylesheet" href="/javascripts/highchart/templates/yoo_symphony/css/template.css" type="text/css" />
<link rel="stylesheet" href="/javascripts/highchart/templates/yoo_symphony/css/variations/brown.css" type="text/css" />
<link href="/javascripts/highchart/demo/demo.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
Highcharts.setOptions({
global: {
useUTC: false
}
});
var chart;
jQuery(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: 'container',
defaultSeriesType: 'spline',
marginRight: 10,
events: {
load: function() {
// set up the updating of the chart every two seconds
var out = this;
setInterval(function() {
var series = out.series[0];
var shiftalong = series.data.length > 20;
$.getJSON('/getloadavg', function(response) {
var point = [ response.timestamp * 1000,
response.loadavg - 0 ];
series.addPoint(point, true, shiftalong);
})
}, 2000);
}
}
},
title: {
text: 'Live load average'
},
xAxis: {
type: 'datetime',
tickPixelInterval: 150
},
yAxis: {
title: {
text: 'Load average'
}
},
tooltip: {
formatter: function() {
return '<b>'+ this.series.name +'</b><br/>'+
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
Highcharts.numberFormat(this.y, 2);
}
},
legend: {
enabled: false
},
exporting: {
enabled: false
},
series: [{
name: 'Load average',
data: []
}]
});
});
</script>
<h1>Dancer AJAX Charting demo</h1>
<div id="container" class="highcharts-container"
style="height:410px; margin: 0 2em; clear:both; min-width: 600px">
<p>
The above is a simple graph fetching data asynchronously from our Dancer
application via AJAX.
</p>