chart._animationsDisabled = isAnimationDisabled(newOptions);
}
-const KNOWN_POSITIONS = new Set(['top', 'bottom', 'left', 'right', 'chartArea']);
+const KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
function positionIsHorizontal(position, axis) {
- return position === 'top' || position === 'bottom' || (!KNOWN_POSITIONS.has(position) && axis === 'x');
+ return position === 'top' || position === 'bottom' || (KNOWN_POSITIONS.indexOf(position) === -1 && axis === 'x');
}
function compare2Level(l1, l2) {
* @param {number[]} items
*/
function arrayUnique(items) {
- const set = new Set();
- let i, ilen;
-
- for (i = 0, ilen = items.length; i < ilen; ++i) {
- set.add(items[i]);
- }
+ const unique = {};
- if (set.size === ilen) {
- return items;
+ for (let i = 0, ilen = items.length; i < ilen; ++i) {
+ unique[items[i]] = true;
}
- return [...set];
+ return Object.keys(unique).map(x => +x);
}
/**
/**
* @param {number[]} timestamps
- * @param {Set<object>} ticks
+ * @param {object} ticks
* @param {number} time
*/
function addTick(timestamps, ticks, time) {
}
const {lo, hi} = _lookup(timestamps, time);
const timestamp = timestamps[lo] >= time ? timestamps[lo] : timestamps[hi];
- ticks.add(timestamp);
+ ticks[timestamp] = true;
}
/**
const minor = timeOpts.unit || determineUnitForAutoTicks(timeOpts.minUnit, min, max, scale._getLabelCapacity(min));
const stepSize = valueOrDefault(timeOpts.stepSize, 1);
const weekday = minor === 'week' ? timeOpts.isoWeekday : false;
- const ticks = new Set();
+ const ticks = {};
let first = min;
let time;
}
} else {
for (time = first; time < max; time = +adapter.add(time, stepSize, minor)) {
- ticks.add(time);
+ ticks[time] = true;
}
if (time === max || options.bounds === 'ticks') {
- ticks.add(time);
+ ticks[time] = true;
}
}
- return [...ticks];
+ return Object.keys(ticks).map(x => +x);
}
/**