]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Rename INTERVALS.major to INTERVALS.common (#4777)
authorBen McCann <benjamin.j.mccann@gmail.com>
Fri, 29 Sep 2017 11:06:09 +0000 (04:06 -0700)
committerEvert Timberg <evert.timberg+github@gmail.com>
Fri, 29 Sep 2017 11:06:09 +0000 (13:06 +0200)
src/scales/scale.time.js

index 27c6255fa0601ea9a86f344a8b06e777f7be99cd..a87920c6781da99afa5a8a425b1185b0e96b6544 100644 (file)
@@ -13,47 +13,47 @@ var MAX_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
 
 var INTERVALS = {
        millisecond: {
-               major: true,
+               common: true,
                size: 1,
                steps: [1, 2, 5, 10, 20, 50, 100, 250, 500]
        },
        second: {
-               major: true,
+               common: true,
                size: 1000,
                steps: [1, 2, 5, 10, 30]
        },
        minute: {
-               major: true,
+               common: true,
                size: 60000,
                steps: [1, 2, 5, 10, 30]
        },
        hour: {
-               major: true,
+               common: true,
                size: 3600000,
                steps: [1, 2, 3, 6, 12]
        },
        day: {
-               major: true,
+               common: true,
                size: 86400000,
                steps: [1, 2, 5]
        },
        week: {
-               major: false,
+               common: false,
                size: 604800000,
                steps: [1, 2, 3, 4]
        },
        month: {
-               major: true,
+               common: true,
                size: 2.628e9,
                steps: [1, 2, 3]
        },
        quarter: {
-               major: false,
+               common: false,
                size: 7.884e9,
                steps: [1, 2, 3, 4]
        },
        year: {
-               major: true,
+               common: true,
                size: 3.154e10
        }
 };
@@ -261,7 +261,7 @@ function determineUnit(minUnit, min, max, capacity) {
                interval = INTERVALS[UNITS[i]];
                factor = interval.steps ? interval.steps[interval.steps.length - 1] : MAX_INTEGER;
 
-               if (Math.ceil((max - min) / (factor * interval.size)) <= capacity) {
+               if (interval.common && Math.ceil((max - min) / (factor * interval.size)) <= capacity) {
                        return UNITS[i];
                }
        }
@@ -271,7 +271,7 @@ function determineUnit(minUnit, min, max, capacity) {
 
 function determineMajorUnit(unit) {
        for (var i = UNITS.indexOf(unit) + 1, ilen = UNITS.length; i < ilen; ++i) {
-               if (INTERVALS[UNITS[i]].major) {
+               if (INTERVALS[UNITS[i]].common) {
                        return UNITS[i];
                }
        }