-
Notifications
You must be signed in to change notification settings - Fork 0
/
graph.js
51 lines (50 loc) · 1.27 KB
/
graph.js
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
class Graph {
constructor() {
this.data = [];
this.options = {
chart: {
type: 'line'
},
title: {
text: '人数の遷移'
},
xAxis: {
categories: ['0','1']
},
yAxis: {
title: {
text: '人数 (人)'
}
},
plotOptions: {
line: {
dataLabels: {
enabled: true
},
enableMouseTracking: false
}
},
legend: {
enabled: false
},
series: [{
data: this.data
}]
};
this.graph = new Highcharts.chart('container', this.options);
}
append(n) {
this.data.push(n);
this.replot();
}
replot() {
this.graph.destroy();
this.graph = new Highcharts.chart('container', this.options);
}
}
var graph = new Graph();
graph.append(10);
graph.append(100);
graph.append(100);
graph.append(1000);
graph.append(10000);