Skip to content

Commit d3fdd1e

Browse files
devenbjbenmccann
authored andcommitted
Fix #280 - Deprecation warning with Chart JS 2.9.1 (#292)
Fix for chartjs v3.0 deprecated functions
1 parent efe833b commit d3fdd1e

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

src/plugin.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,15 @@ function zoomNumericalScale(scale, zoom, center, zoomOptions) {
167167
function zoomTimeScale(scale, zoom, center, zoomOptions) {
168168
zoomNumericalScale(scale, zoom, center, zoomOptions);
169169

170-
scale.options.time.min = scale.options.ticks.min;
171-
scale.options.time.max = scale.options.ticks.max;
170+
var options = scale.options;
171+
if (options.time) {
172+
if (options.time.min) {
173+
options.time.min = options.ticks.min;
174+
}
175+
if (options.time.max) {
176+
options.time.max = options.ticks.max;
177+
}
178+
}
172179
}
173180

174181
function zoomScale(scale, zoom, center, zoomOptions) {
@@ -290,8 +297,14 @@ function panTimeScale(scale, delta, panOptions) {
290297
panNumericalScale(scale, delta, panOptions);
291298

292299
var options = scale.options;
293-
options.time.min = options.ticks.min;
294-
options.time.max = options.ticks.max;
300+
if (options.time) {
301+
if (options.time.min) {
302+
options.time.min = options.ticks.min;
303+
}
304+
if (options.time.max) {
305+
options.time.max = options.ticks.max;
306+
}
307+
}
295308
}
296309

297310
function panScale(scale, delta, panOptions) {

0 commit comments

Comments
 (0)