| 9 |
lars |
1 |
<!DOCTYPE HTML>
|
|
|
2 |
<html>
|
|
|
3 |
<head>
|
|
|
4 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
5 |
<title>Highcharts Example</title>
|
|
|
6 |
|
|
|
7 |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
|
|
|
8 |
<style type="text/css">
|
|
|
9 |
${demo.css}
|
|
|
10 |
</style>
|
|
|
11 |
<script type="text/javascript">
|
|
|
12 |
var chart;
|
|
|
13 |
$(function () {
|
|
|
14 |
$('#container').highcharts({
|
|
|
15 |
chart: {
|
|
|
16 |
zoomType: 'xy'
|
|
|
17 |
},
|
|
|
18 |
title: {
|
|
|
19 |
text: 'Temperature vs Rainfall'
|
|
|
20 |
},
|
|
|
21 |
xAxis: [{
|
|
|
22 |
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
|
|
23 |
}],
|
|
|
24 |
yAxis: [{ // Primary yAxis
|
|
|
25 |
labels: {
|
|
|
26 |
format: '{value} °C',
|
|
|
27 |
style: {
|
|
|
28 |
color: Highcharts.getOptions().colors[1]
|
|
|
29 |
}
|
|
|
30 |
},
|
|
|
31 |
title: {
|
|
|
32 |
text: 'Temperature',
|
|
|
33 |
style: {
|
|
|
34 |
color: Highcharts.getOptions().colors[1]
|
|
|
35 |
}
|
|
|
36 |
}
|
|
|
37 |
}, { // Secondary yAxis
|
|
|
38 |
title: {
|
|
|
39 |
text: 'Rainfall',
|
|
|
40 |
style: {
|
|
|
41 |
color: Highcharts.getOptions().colors[0]
|
|
|
42 |
}
|
|
|
43 |
},
|
|
|
44 |
labels: {
|
|
|
45 |
format: '{value} mm',
|
|
|
46 |
style: {
|
|
|
47 |
color: Highcharts.getOptions().colors[0]
|
|
|
48 |
}
|
|
|
49 |
},
|
|
|
50 |
opposite: true
|
|
|
51 |
}],
|
|
|
52 |
|
|
|
53 |
tooltip: {
|
|
|
54 |
shared: true
|
|
|
55 |
},
|
|
|
56 |
|
|
|
57 |
series: [{
|
|
|
58 |
name: 'Rainfall',
|
|
|
59 |
type: 'column',
|
|
|
60 |
yAxis: 1,
|
|
|
61 |
data: [49.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
|
|
|
62 |
tooltip: {
|
|
|
63 |
pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f} mm</b> '
|
|
|
64 |
}
|
|
|
65 |
}, {
|
|
|
66 |
name: 'Rainfall error',
|
|
|
67 |
type: 'errorbar',
|
|
|
68 |
yAxis: 1,
|
|
|
69 |
data: [[48, 51], [68, 73], [92, 110], [128, 136], [140, 150], [171, 179], [135, 143], [142, 149], [204, 220], [189, 199], [95, 110], [52, 56]],
|
|
|
70 |
tooltip: {
|
|
|
71 |
pointFormat: '(error range: {point.low}-{point.high} mm)<br/>'
|
|
|
72 |
}
|
|
|
73 |
}, {
|
|
|
74 |
name: 'Temperature',
|
|
|
75 |
type: 'spline',
|
|
|
76 |
data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6],
|
|
|
77 |
tooltip: {
|
|
|
78 |
pointFormat: '<span style="font-weight: bold; color: {series.color}">{series.name}</span>: <b>{point.y:.1f}°C</b> '
|
|
|
79 |
}
|
|
|
80 |
}, {
|
|
|
81 |
name: 'Temperature error',
|
|
|
82 |
type: 'errorbar',
|
|
|
83 |
data: [[6, 8], [5.9, 7.6], [9.4, 10.4], [14.1, 15.9], [18.0, 20.1], [21.0, 24.0], [23.2, 25.3], [26.1, 27.8], [23.2, 23.9], [18.0, 21.1], [12.9, 14.0], [7.6, 10.0]],
|
|
|
84 |
tooltip: {
|
|
|
85 |
pointFormat: '(error range: {point.low}-{point.high}°C)<br/>'
|
|
|
86 |
}
|
|
|
87 |
}]
|
|
|
88 |
});
|
|
|
89 |
});
|
|
|
90 |
</script>
|
|
|
91 |
</head>
|
|
|
92 |
<body>
|
|
|
93 |
<script src="../../js/highcharts.js"></script>
|
|
|
94 |
<script src="../../js/highcharts-more.js"></script>
|
|
|
95 |
<script src="../../js/modules/exporting.js"></script>
|
|
|
96 |
|
|
|
97 |
<div id="container" style="height: 400px; margin: auto; min-width: 310px; max-width: 600px"></div>
|
|
|
98 |
</body>
|
|
|
99 |
</html>
|