This commit is contained in:
Sara Arjona
2024-03-07 17:47:20 +01:00
4 changed files with 34 additions and 18 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+31 -15
View File
@@ -1,7 +1,7 @@
/*!
* Chart.js v4.4.0
* Chart.js v4.4.2
* https://www.chartjs.org
* (c) 2023 Chart.js Contributors
* (c) 2024 Chart.js Contributors
* Released under the MIT License
*/
@@ -2010,8 +2010,10 @@ function getMaximumSize(canvas, bbWidth, bbHeight, aspectRatio) {
return false;
}
};
window.addEventListener('test', null, options);
window.removeEventListener('test', null, options);
if (_isDomSupported()) {
window.addEventListener('test', null, options);
window.removeEventListener('test', null, options);
}
} catch (e) {
// continue regardless of error
}
@@ -4265,10 +4267,14 @@ const eventListenerOptions = supportsEventListenerOptions ? {
passive: true
} : false;
function addListener(node, type, listener) {
node.addEventListener(type, listener, eventListenerOptions);
if (node) {
node.addEventListener(type, listener, eventListenerOptions);
}
}
function removeListener(chart, type, listener) {
chart.canvas.removeEventListener(type, listener, eventListenerOptions);
if (chart && chart.canvas) {
chart.canvas.removeEventListener(type, listener, eventListenerOptions);
}
}
function fromNativeEvent(event, chart) {
const type = EVENT_TYPES[event.type] || event.type;
@@ -6548,6 +6554,13 @@ class Scale extends Element {
case 'right':
left -= width;
break;
case 'inner':
if (i === ilen - 1) {
left -= width;
} else if (i > 0) {
left -= width / 2;
}
break;
}
backdrop = {
left,
@@ -7519,7 +7532,7 @@ function getResolver(resolverCache, scopes, prefixes) {
}
return cached;
}
const hasFunction = (value)=>isObject(value) && Object.getOwnPropertyNames(value).reduce((acc, key)=>acc || isFunction(value[key]), false);
const hasFunction = (value)=>isObject(value) && Object.getOwnPropertyNames(value).some((key)=>isFunction(value[key]));
function needContext(proxy, names) {
const { isScriptable , isIndexable } = _descriptors(proxy);
for (const prop of names){
@@ -7533,7 +7546,7 @@ function needContext(proxy, names) {
return false;
}
var version = "4.4.0";
var version = "4.4.2";
const KNOWN_POSITIONS = [
'top',
@@ -11739,7 +11752,7 @@ class RadialLinearScale extends LinearScaleBase {
}
if (grid.display) {
this.ticks.forEach((tick, index)=>{
if (index !== 0) {
if (index !== 0 || index === 0 && this.min < 0) {
offset = this.getDistanceFromCenterForValue(tick.value);
const context = this.getContext(index);
const optsAtIndex = grid.setContext(context);
@@ -11786,7 +11799,7 @@ class RadialLinearScale extends LinearScaleBase {
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
this.ticks.forEach((tick, index)=>{
if (index === 0 && !opts.reverse) {
if (index === 0 && this.min >= 0 && !opts.reverse) {
return;
}
const optsAtIndex = tickOpts.setContext(this.getContext(index));
@@ -13950,20 +13963,23 @@ const positioners = {
return false;
}
let i, len;
let x = 0;
let xSet = new Set();
let y = 0;
let count = 0;
for(i = 0, len = items.length; i < len; ++i){
const el = items[i].element;
if (el && el.hasValue()) {
const pos = el.tooltipPosition();
x += pos.x;
xSet.add(pos.x);
y += pos.y;
++count;
}
}
const xAverage = [
...xSet
].reduce((a, b)=>a + b) / xSet.size;
return {
x: x / count,
x: xAverage,
y: y / count
};
},
@@ -14779,7 +14795,7 @@ class Tooltip extends Element {
return [];
}
if (!inChartArea) {
return lastActive;
return lastActive.filter((i)=>this.chart.data.datasets[i.datasetIndex] && this.chart.getDatasetMeta(i.datasetIndex).controller.getParsed(i.index) !== undefined);
}
const active = this.chart.getElementsAtEventForMode(e, options.mode, options, replay);
if (options.reverse) {
@@ -14948,4 +14964,4 @@ if (typeof window !== 'undefined') {
return Chart;
}));
}));
+1 -1
View File
@@ -376,7 +376,7 @@ All rights reserved.</copyright>
<location>amd/src/chartjs-lazy.js</location>
<name>Chart.js</name>
<description>Simple yet flexible JavaScript charting for designers &amp; developers.</description>
<version>4.4.0</version>
<version>4.4.2</version>
<license>MIT</license>
<repository>https://github.com/chartjs/Chart.js</repository>
<copyrights>