Chart.js: Timescale relies on Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER

Created on 27 May 2017  Â·  4Comments  Â·  Source: chartjs/Chart.js

The implementation of the 'time' scale relies on Number.MAX_SAFE_INTEGER and Number.MIN_SAFE_INTEGER which are not available in IE 11 (and probably other IE versions).

This codepen link shows a basic chart with time scale, which displays data in chrome but doesn't show anything on IE 11:

https://codepen.io/anon/pen/GmaRYN

The ES6 definitions (9007199254740991 and -9007199254740991) seem to be sensible fallback values. I'll submit a pull request shortly.

help wanted bug

Most helpful comment

Insert these code before init Chart, it will work on IE:
if (Number.MAX_SAFE_INTEGER === undefined) {
Number.MAX_SAFE_INTEGER = 9007199254740991;
}
if (Number.MIN_SAFE_INTEGER === undefined) {
Number.MIN_SAFE_INTEGER = -9007199254740991;
}

All 4 comments

Does that mean v2.6 doesn't work on IE11?

If that's the case we may want to consider a v2.6.1

I can confirm the time scale feature does not work on IE11 in 2.6, you just get a blank chart:

image

Insert these code before init Chart, it will work on IE:
if (Number.MAX_SAFE_INTEGER === undefined) {
Number.MAX_SAFE_INTEGER = 9007199254740991;
}
if (Number.MIN_SAFE_INTEGER === undefined) {
Number.MIN_SAFE_INTEGER = -9007199254740991;
}

Was this page helpful?
0 / 5 - 0 ratings