mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 20:29:12 +02:00
IE11 compatibility (#6872)
This commit is contained in:
parent
dbd835f4f3
commit
3427479a25
@ -42,6 +42,17 @@ function copyOptions(target, values) {
|
|||||||
delete values.options;
|
delete values.options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function extensibleConfig(animations) {
|
||||||
|
const result = {};
|
||||||
|
Object.keys(animations).forEach(key => {
|
||||||
|
const value = animations[key];
|
||||||
|
if (!isObject(value)) {
|
||||||
|
result[key] = value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
export default class Animations {
|
export default class Animations {
|
||||||
constructor(chart, animations) {
|
constructor(chart, animations) {
|
||||||
this._chart = chart;
|
this._chart = chart;
|
||||||
@ -50,12 +61,17 @@ export default class Animations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure(animations) {
|
configure(animations) {
|
||||||
const animatedProps = this._properties;
|
if (!isObject(animations)) {
|
||||||
const animDefaults = Object.fromEntries(Object.entries(animations).filter(({1: value}) => !isObject(value)));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (let [key, cfg] of Object.entries(animations)) {
|
const animatedProps = this._properties;
|
||||||
|
const animDefaults = extensibleConfig(animations);
|
||||||
|
|
||||||
|
Object.keys(animations).forEach(key => {
|
||||||
|
const cfg = animations[key];
|
||||||
if (!isObject(cfg)) {
|
if (!isObject(cfg)) {
|
||||||
continue;
|
return;
|
||||||
}
|
}
|
||||||
for (let prop of cfg.properties || [key]) {
|
for (let prop of cfg.properties || [key]) {
|
||||||
// Can have only one config per animation.
|
// Can have only one config per animation.
|
||||||
@ -66,7 +82,7 @@ export default class Animations {
|
|||||||
animatedProps.set(prop, extend({}, animatedProps.get(prop), cfg));
|
animatedProps.set(prop, extend({}, animatedProps.get(prop), cfg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,8 @@ function mergeScaleConfig(config, options) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// apply scale defaults, if not overridden by dataset defaults
|
// apply scale defaults, if not overridden by dataset defaults
|
||||||
Object.values(scales).forEach(scale => {
|
Object.keys(scales).forEach(key => {
|
||||||
|
const scale = scales[key];
|
||||||
helpers.mergeIf(scale, scaleService.getScaleDefaults(scale.type));
|
helpers.mergeIf(scale, scaleService.getScaleDefaults(scale.type));
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -139,9 +140,9 @@ function updateConfig(chart) {
|
|||||||
chart.tooltip.initialize();
|
chart.tooltip.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
const KNOWN_POSITIONS = ['top', 'bottom', 'left', 'right', 'chartArea'];
|
const KNOWN_POSITIONS = new Set(['top', 'bottom', 'left', 'right', 'chartArea']);
|
||||||
function positionIsHorizontal(position, axis) {
|
function positionIsHorizontal(position, axis) {
|
||||||
return position === 'top' || position === 'bottom' || (!KNOWN_POSITIONS.includes(position) && axis === 'x');
|
return position === 'top' || position === 'bottom' || (!KNOWN_POSITIONS.has(position) && axis === 'x');
|
||||||
}
|
}
|
||||||
|
|
||||||
function compare2Level(l1, l2) {
|
function compare2Level(l1, l2) {
|
||||||
|
Loading…
Reference in New Issue
Block a user