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.7.1/jquery.min.js"></script>
|
8
|
<script type="text/javascript">
|
9
|
$(function () {
|
10
|
var chart;
|
11
|
$(document).ready(function() {
|
12
|
chart = new Highcharts.Chart({
|
13
|
chart: {
|
14
|
renderTo: 'container'
|
15
|
},
|
16
|
title: {
|
17
|
text: 'Combination chart'
|
18
|
},
|
19
|
xAxis: {
|
20
|
categories: ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
|
21
|
},
|
22
|
tooltip: {
|
23
|
formatter: function() {
|
24
|
var s;
|
25
|
if (this.point.name) { // the pie chart
|
26
|
s = ''+
|
27
|
this.point.name +': '+ this.y +' fruits';
|
28
|
} else {
|
29
|
s = ''+
|
30
|
this.x +': '+ this.y;
|
31
|
}
|
32
|
return s;
|
33
|
}
|
34
|
},
|
35
|
labels: {
|
36
|
items: [{
|
37
|
html: 'Total fruit consumption',
|
38
|
style: {
|
39
|
left: '40px',
|
40
|
top: '8px',
|
41
|
color: 'black'
|
42
|
}
|
43
|
}]
|
44
|
},
|
45
|
series: [{
|
46
|
type: 'column',
|
47
|
name: 'Jane',
|
48
|
data: [3, 2, 1, 3, 4]
|
49
|
}, {
|
50
|
type: 'column',
|
51
|
name: 'John',
|
52
|
data: [2, 3, 5, 7, 6]
|
53
|
}, {
|
54
|
type: 'column',
|
55
|
name: 'Joe',
|
56
|
data: [4, 3, 3, 9, 0]
|
57
|
}, {
|
58
|
type: 'spline',
|
59
|
name: 'Average',
|
60
|
data: [3, 2.67, 3, 6.33, 3.33]
|
61
|
}, {
|
62
|
type: 'pie',
|
63
|
name: 'Total consumption',
|
64
|
data: [{
|
65
|
name: 'Jane',
|
66
|
y: 13,
|
67
|
color: '#4572A7' // Jane's color
|
68
|
}, {
|
69
|
name: 'John',
|
70
|
y: 23,
|
71
|
color: '#AA4643' // John's color
|
72
|
}, {
|
73
|
name: 'Joe',
|
74
|
y: 19,
|
75
|
color: '#89A54E' // Joe's color
|
76
|
}],
|
77
|
center: [100, 80],
|
78
|
size: 100,
|
79
|
showInLegend: false,
|
80
|
dataLabels: {
|
81
|
enabled: false
|
82
|
}
|
83
|
}]
|
84
|
});
|
85
|
});
|
86
|
|
87
|
});
|
88
|
</script>
|
89
|
</head>
|
90
|
<body>
|
91
|
<script src="http://code.highcharts.com/highcharts.js"></script>
|
92
|
<script src="http://code.highcharts.com/modules/exporting.js"></script>
|
93
|
|
94
|
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
|
95
|
|
96
|
</body>
|
97
|
</html>
|