Skip to content

Commit bc6a5d0

Browse files
committed
Replace per-chart options with per-axis options in the sample charts
1 parent d76c0d6 commit bc6a5d0

13 files changed

+99
-119
lines changed

samples/annotation.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@
8888
},
8989
scales: {
9090
xAxes: [{
91-
type: 'realtime'
91+
type: 'realtime',
92+
realtime: {
93+
duration: 20000,
94+
refresh: 1000,
95+
delay: 2000,
96+
onRefresh: onRefresh
97+
}
9298
}],
9399
yAxes: [{
94100
scaleLabel: {
@@ -140,14 +146,6 @@
140146
}
141147
}
142148
]
143-
},
144-
plugins: {
145-
streaming: {
146-
duration: 20000,
147-
refresh: 1000,
148-
delay: 2000,
149-
onRefresh: onRefresh
150-
}
151149
}
152150
}
153151
};

samples/bar-horizontal.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@
7979
},
8080
scales: {
8181
xAxes: [{
82-
type: 'realtime'
82+
type: 'realtime',
83+
realtime: {
84+
duration: 20000,
85+
refresh: 1000,
86+
delay: 1000,
87+
onRefresh: onRefresh
88+
}
8389
}],
8490
yAxes: [{
8591
scaleLabel: {
@@ -95,14 +101,6 @@
95101
hover: {
96102
mode: 'nearest',
97103
intersect: false
98-
},
99-
plugins: {
100-
streaming: {
101-
duration: 20000,
102-
refresh: 1000,
103-
delay: 1000,
104-
onRefresh: onRefresh
105-
}
106104
}
107105
}
108106
};

samples/bar-vertical.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,13 @@
8484
}
8585
}],
8686
yAxes: [{
87-
type: 'realtime'
87+
type: 'realtime',
88+
realtime: {
89+
duration: 20000,
90+
refresh: 1000,
91+
delay: 1000,
92+
onRefresh: onRefresh
93+
}
8894
}]
8995
},
9096
tooltips: {
@@ -94,14 +100,6 @@
94100
hover: {
95101
mode: 'nearest',
96102
intersect: false
97-
},
98-
plugins: {
99-
streaming: {
100-
duration: 20000,
101-
refresh: 1000,
102-
delay: 1000,
103-
onRefresh: onRefresh
104-
}
105103
}
106104
}
107105
};

samples/bubble-horizontal.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@
8383
},
8484
scales: {
8585
xAxes: [{
86-
type: 'realtime'
86+
type: 'realtime',
87+
realtime: {
88+
duration: 20000,
89+
refresh: 1000,
90+
delay: 2000,
91+
onRefresh: onRefresh
92+
}
8793
}],
8894
yAxes: [{
8995
scaleLabel: {
@@ -99,14 +105,6 @@
99105
hover: {
100106
mode: 'nearest',
101107
intersect: false
102-
},
103-
plugins: {
104-
streaming: {
105-
duration: 20000,
106-
refresh: 1000,
107-
delay: 2000,
108-
onRefresh: onRefresh
109-
}
110108
}
111109
}
112110
};

samples/bubble-vertical.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,13 @@
8989
}
9090
}],
9191
yAxes: [{
92-
type: 'realtime'
92+
type: 'realtime',
93+
realtime: {
94+
duration: 20000,
95+
refresh: 1000,
96+
delay: 2000,
97+
onRefresh: onRefresh
98+
}
9399
}]
94100
},
95101
tooltips: {
@@ -99,14 +105,6 @@
99105
hover: {
100106
mode: 'nearest',
101107
intersect: false
102-
},
103-
plugins: {
104-
streaming: {
105-
duration: 20000,
106-
refresh: 1000,
107-
delay: 2000,
108-
onRefresh: onRefresh
109-
}
110108
}
111109
}
112110
};

samples/datalabels.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,13 @@
8888
},
8989
scales: {
9090
xAxes: [{
91-
type: 'realtime'
91+
type: 'realtime',
92+
realtime: {
93+
duration: 20000,
94+
refresh: 1000,
95+
delay: 2000,
96+
onRefresh: onRefresh
97+
}
9298
}],
9399
yAxes: [{
94100
type: 'linear',
@@ -121,12 +127,6 @@
121127
formatter: function(value) {
122128
return value.y;
123129
}
124-
},
125-
streaming: {
126-
duration: 20000,
127-
refresh: 1000,
128-
delay: 2000,
129-
onRefresh: onRefresh
130130
}
131131
}
132132
}

samples/financial.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,17 @@
5858
},
5959
scales: {
6060
xAxes: [{
61-
type: 'realtime'
61+
type: 'realtime',
62+
realtime: {
63+
duration: 120000,
64+
refresh: 500,
65+
delay: 0,
66+
onRefresh: onRefresh
67+
}
6268
}]
6369
},
6470
tooltips: {
6571
enabled: false
66-
},
67-
plugins: {
68-
streaming: {
69-
duration: 120000,
70-
refresh: 500,
71-
delay: 0,
72-
onRefresh: onRefresh
73-
}
7472
}
7573
}
7674
};

samples/interactions.html

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,15 @@
134134
},
135135
scales: {
136136
xAxes: [{
137-
type: 'realtime'
137+
type: 'realtime',
138+
realtime: {
139+
duration: 20000,
140+
ttl: 60000,
141+
refresh: 1000,
142+
delay: 2000,
143+
pause: false,
144+
onRefresh: onRefresh
145+
}
138146
}],
139147
yAxes: [{
140148
type: 'linear',
@@ -155,13 +163,7 @@
155163
},
156164
plugins: {
157165
streaming: {
158-
duration: 20000,
159-
ttl: 60000,
160-
refresh: 1000,
161-
delay: 2000,
162-
frameRate: 30,
163-
pause: false,
164-
onRefresh: onRefresh
166+
frameRate: 30
165167
}
166168
}
167169
}
@@ -210,25 +212,25 @@
210212
});
211213

212214
document.getElementById('duration').addEventListener(isIE ? 'change' : 'input', function() {
213-
config.options.plugins.streaming.duration = +this.value;
215+
config.options.scales.xAxes[0].realtime.duration = +this.value;
214216
window.myChart.update({duration: 0});
215217
document.getElementById('durationValue').innerHTML = this.value;
216218
});
217219

218220
document.getElementById('ttl').addEventListener(isIE ? 'change' : 'input', function() {
219-
config.options.plugins.streaming.ttl = +this.value;
221+
config.options.scales.xAxes[0].realtime.ttl = +this.value;
220222
window.myChart.update({duration: 0});
221223
document.getElementById('ttlValue').innerHTML = this.value;
222224
});
223225

224226
document.getElementById('refresh').addEventListener(isIE ? 'change' : 'input', function() {
225-
config.options.plugins.streaming.refresh = +this.value;
227+
config.options.scales.xAxes[0].realtime.refresh = +this.value;
226228
window.myChart.update({duration: 0});
227229
document.getElementById('refreshValue').innerHTML = this.value;
228230
});
229231

230232
document.getElementById('delay').addEventListener(isIE ? 'change' : 'input', function() {
231-
config.options.plugins.streaming.delay = +this.value;
233+
config.options.scales.xAxes[0].realtime.delay = +this.value;
232234
window.myChart.update({duration: 0});
233235
document.getElementById('delayValue').innerHTML = this.value;
234236
});
@@ -240,7 +242,7 @@
240242
});
241243

242244
document.getElementById('pause').addEventListener('change', function() {
243-
config.options.plugins.streaming.pause = this.checked;
245+
config.options.scales.xAxes[0].realtime.pause = this.checked;
244246
window.myChart.update({duration: 0});
245247
document.getElementById('pauseValue').innerHTML = this.checked;
246248
});

samples/line-horizontal.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@
8787
},
8888
scales: {
8989
xAxes: [{
90-
type: 'realtime'
90+
type: 'realtime',
91+
realtime: {
92+
duration: 20000,
93+
refresh: 1000,
94+
delay: 2000,
95+
onRefresh: onRefresh
96+
}
9197
}],
9298
yAxes: [{
9399
scaleLabel: {
@@ -103,14 +109,6 @@
103109
hover: {
104110
mode: 'nearest',
105111
intersect: false
106-
},
107-
plugins: {
108-
streaming: {
109-
duration: 20000,
110-
refresh: 1000,
111-
delay: 2000,
112-
onRefresh: onRefresh
113-
}
114112
}
115113
}
116114
};

samples/line-vertical.html

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,13 @@
9494
}
9595
}],
9696
yAxes: [{
97-
type: 'realtime'
97+
type: 'realtime',
98+
realtime: {
99+
duration: 20000,
100+
refresh: 1000,
101+
delay: 2000,
102+
onRefresh: onRefresh
103+
}
98104
}]
99105
},
100106
tooltips: {
@@ -117,14 +123,6 @@
117123
hover: {
118124
mode: 'nearest',
119125
intersect: false
120-
},
121-
plugins: {
122-
streaming: {
123-
duration: 20000,
124-
refresh: 1000,
125-
delay: 2000,
126-
onRefresh: onRefresh
127-
}
128126
}
129127
}
130128
};

0 commit comments

Comments
 (0)