@oliasoft-open-source/charts-library 3.5.4 → 3.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -576,7 +576,7 @@ let Color$1 = class Color {
|
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
578
|
/*!
|
|
579
|
-
* Chart.js v4.
|
|
579
|
+
* Chart.js v4.4.0
|
|
580
580
|
* https://www.chartjs.org
|
|
581
581
|
* (c) 2023 Chart.js Contributors
|
|
582
582
|
* Released under the MIT License
|
|
@@ -1328,6 +1328,7 @@ function applyScaleDefaults(defaults2) {
|
|
|
1328
1328
|
reverse: false,
|
|
1329
1329
|
beginAtZero: false,
|
|
1330
1330
|
bounds: "ticks",
|
|
1331
|
+
clip: true,
|
|
1331
1332
|
grace: 0,
|
|
1332
1333
|
grid: {
|
|
1333
1334
|
display: true,
|
|
@@ -1769,7 +1770,7 @@ function renderText$1(ctx, text, x2, y2, font, opts = {}) {
|
|
|
1769
1770
|
}
|
|
1770
1771
|
function addRoundedRectPath$1(ctx, rect) {
|
|
1771
1772
|
const { x: x2, y: y2, w: w2, h: h3, radius } = rect;
|
|
1772
|
-
ctx.arc(x2 + radius.topLeft, y2 + radius.topLeft, radius.topLeft,
|
|
1773
|
+
ctx.arc(x2 + radius.topLeft, y2 + radius.topLeft, radius.topLeft, 1.5 * PI$1, PI$1, true);
|
|
1773
1774
|
ctx.lineTo(x2, y2 + h3 - radius.bottomLeft);
|
|
1774
1775
|
ctx.arc(x2 + radius.bottomLeft, y2 + h3 - radius.bottomLeft, radius.bottomLeft, PI$1, HALF_PI$1, true);
|
|
1775
1776
|
ctx.lineTo(x2 + w2 - radius.bottomRight, y2 + h3);
|
|
@@ -2891,7 +2892,7 @@ function styleChanged$1(style, prevStyle) {
|
|
|
2891
2892
|
return JSON.stringify(style, replacer) !== JSON.stringify(prevStyle, replacer);
|
|
2892
2893
|
}
|
|
2893
2894
|
/*!
|
|
2894
|
-
* Chart.js v4.
|
|
2895
|
+
* Chart.js v4.4.0
|
|
2895
2896
|
* https://www.chartjs.org
|
|
2896
2897
|
* (c) 2023 Chart.js Contributors
|
|
2897
2898
|
* Released under the MIT License
|
|
@@ -4825,7 +4826,7 @@ let LineController$1 = (_d = class extends DatasetController$1 {
|
|
|
4825
4826
|
line._chart = this.chart;
|
|
4826
4827
|
line._datasetIndex = this.index;
|
|
4827
4828
|
line._decimated = !!_dataset._decimated;
|
|
4828
|
-
line.points = points
|
|
4829
|
+
line.points = points;
|
|
4829
4830
|
const options = this.resolveDatasetElementOptions(mode);
|
|
4830
4831
|
if (!this.options.showLine) {
|
|
4831
4832
|
options.borderWidth = 0;
|
|
@@ -7962,7 +7963,7 @@ function needContext$1(proxy, names2) {
|
|
|
7962
7963
|
}
|
|
7963
7964
|
return false;
|
|
7964
7965
|
}
|
|
7965
|
-
var version$3 = "4.
|
|
7966
|
+
var version$3 = "4.4.0";
|
|
7966
7967
|
const KNOWN_POSITIONS$1 = [
|
|
7967
7968
|
"top",
|
|
7968
7969
|
"bottom",
|
|
@@ -8031,16 +8032,20 @@ function determineLastEvent$1(e2, lastEvent, inChartArea, isClick) {
|
|
|
8031
8032
|
}
|
|
8032
8033
|
return e2;
|
|
8033
8034
|
}
|
|
8034
|
-
function
|
|
8035
|
+
function getSizeForArea(scale, chartArea, field) {
|
|
8036
|
+
return scale.options.clip ? scale[field] : chartArea[field];
|
|
8037
|
+
}
|
|
8038
|
+
function getDatasetArea(meta, chartArea) {
|
|
8035
8039
|
const { xScale, yScale } = meta;
|
|
8036
8040
|
if (xScale && yScale) {
|
|
8037
8041
|
return {
|
|
8038
|
-
left: xScale
|
|
8039
|
-
right: xScale
|
|
8040
|
-
top: yScale
|
|
8041
|
-
bottom: yScale
|
|
8042
|
+
left: getSizeForArea(xScale, chartArea, "left"),
|
|
8043
|
+
right: getSizeForArea(xScale, chartArea, "right"),
|
|
8044
|
+
top: getSizeForArea(yScale, chartArea, "top"),
|
|
8045
|
+
bottom: getSizeForArea(yScale, chartArea, "bottom")
|
|
8042
8046
|
};
|
|
8043
8047
|
}
|
|
8048
|
+
return chartArea;
|
|
8044
8049
|
}
|
|
8045
8050
|
let Chart$2 = (_h = class {
|
|
8046
8051
|
static register(...items) {
|
|
@@ -8536,7 +8541,7 @@ let Chart$2 = (_h = class {
|
|
|
8536
8541
|
const ctx = this.ctx;
|
|
8537
8542
|
const clip = meta._clip;
|
|
8538
8543
|
const useClip = !clip.disabled;
|
|
8539
|
-
const area = getDatasetArea(meta
|
|
8544
|
+
const area = getDatasetArea(meta, this.chartArea);
|
|
8540
8545
|
const args = {
|
|
8541
8546
|
meta,
|
|
8542
8547
|
index: meta.index,
|
|
@@ -22218,7 +22223,7 @@ const isPrimitiveValue = (value) => typeof value === "string" || typeof value ==
|
|
|
22218
22223
|
const isRangeValid = (r2) => {
|
|
22219
22224
|
if (!r2)
|
|
22220
22225
|
return false;
|
|
22221
|
-
return Object.values(r2).
|
|
22226
|
+
return Object.values(r2).some((value) => !isNilOrEmpty(value));
|
|
22222
22227
|
};
|
|
22223
22228
|
const getChartStateFromStorage = (persistenceId) => {
|
|
22224
22229
|
if (!persistenceId)
|
|
@@ -23357,9 +23362,9 @@ var dist = { exports: {} };
|
|
|
23357
23362
|
var o2 = /* @__PURE__ */ Object.create(null);
|
|
23358
23363
|
if (n2.r(o2), Object.defineProperty(o2, "default", { enumerable: true, value: e4 }), 2 & t2 && "string" != typeof e4)
|
|
23359
23364
|
for (var r2 in e4)
|
|
23360
|
-
n2.d(o2, r2, function(t3) {
|
|
23365
|
+
n2.d(o2, r2, (function(t3) {
|
|
23361
23366
|
return e4[t3];
|
|
23362
|
-
}.bind(null, r2));
|
|
23367
|
+
}).bind(null, r2));
|
|
23363
23368
|
return o2;
|
|
23364
23369
|
}, n2.n = function(e4) {
|
|
23365
23370
|
var t2 = e4 && e4.__esModule ? function() {
|
|
@@ -23788,7 +23793,7 @@ const reducer = (state, action) => {
|
|
|
23788
23793
|
return produce(state, (draft) => {
|
|
23789
23794
|
const { name: name2, value, id } = action.payload;
|
|
23790
23795
|
const axis = draft.find((a2) => a2.id === id);
|
|
23791
|
-
if (axis) {
|
|
23796
|
+
if (axis && value) {
|
|
23792
23797
|
axis[name2] = value;
|
|
23793
23798
|
}
|
|
23794
23799
|
});
|
|
@@ -24539,8 +24544,8 @@ const TextLabelPosition = {
|
|
|
24539
24544
|
BOTTOM_RIGHT: "bottom-right"
|
|
24540
24545
|
};
|
|
24541
24546
|
const defaultAxes$1 = (axes) => ({
|
|
24542
|
-
x: (axes == null ? void 0 : axes.x) || [],
|
|
24543
|
-
y: (axes == null ? void 0 : axes.y) || []
|
|
24547
|
+
x: (axes == null ? void 0 : axes.x) || [{}],
|
|
24548
|
+
y: (axes == null ? void 0 : axes.y) || [{}]
|
|
24544
24549
|
});
|
|
24545
24550
|
const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
24546
24551
|
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
@@ -24549,7 +24554,7 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
|
24549
24554
|
stepSize: options == null ? void 0 : options.stepSize,
|
|
24550
24555
|
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
24551
24556
|
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
24552
|
-
range:
|
|
24557
|
+
range: options == null ? void 0 : options.range,
|
|
24553
24558
|
autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
|
|
24554
24559
|
});
|
|
24555
24560
|
const defaultChartStyling$2 = (options) => ({
|
|
@@ -24558,7 +24563,7 @@ const defaultChartStyling$2 = (options) => ({
|
|
|
24558
24563
|
maintainAspectRatio: (options == null ? void 0 : options.maintainAspectRatio) ?? false,
|
|
24559
24564
|
staticChartHeight: (options == null ? void 0 : options.staticChartHeight) ?? false,
|
|
24560
24565
|
performanceMode: (options == null ? void 0 : options.performanceMode) ?? true,
|
|
24561
|
-
squareAspectRatio: options == null ? void 0 : options.squareAspectRatio,
|
|
24566
|
+
squareAspectRatio: (options == null ? void 0 : options.squareAspectRatio) ?? false,
|
|
24562
24567
|
layoutPadding: (options == null ? void 0 : options.layoutPadding) || {
|
|
24563
24568
|
top: 0,
|
|
24564
24569
|
bottom: 20,
|
|
@@ -25264,7 +25269,7 @@ const useChartOptions = ({
|
|
|
25264
25269
|
);
|
|
25265
25270
|
const scales = useMemo(
|
|
25266
25271
|
() => autoScale(options, state, generatedDatasets, chartRef),
|
|
25267
|
-
[options, state, generatedDatasets]
|
|
25272
|
+
[options, state, generatedDatasets, chartRef]
|
|
25268
25273
|
);
|
|
25269
25274
|
const dragData = useMemo(
|
|
25270
25275
|
() => enableDragPoints && getDraggableData(options),
|
|
@@ -25347,7 +25352,7 @@ const useChartOptions = ({
|
|
|
25347
25352
|
plugins,
|
|
25348
25353
|
events: Object.values(Events)
|
|
25349
25354
|
}),
|
|
25350
|
-
[state, options]
|
|
25355
|
+
[state, options, chartRef]
|
|
25351
25356
|
);
|
|
25352
25357
|
};
|
|
25353
25358
|
const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
|
|
@@ -25421,20 +25426,32 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
|
|
|
25421
25426
|
memoState.zoomEnabled
|
|
25422
25427
|
]);
|
|
25423
25428
|
};
|
|
25424
|
-
const useUpdateAxesRanges = (
|
|
25425
|
-
|
|
25426
|
-
|
|
25427
|
-
|
|
25428
|
-
|
|
25429
|
-
|
|
25430
|
-
|
|
25431
|
-
|
|
25432
|
-
|
|
25433
|
-
|
|
25434
|
-
|
|
25435
|
-
|
|
25436
|
-
|
|
25437
|
-
|
|
25429
|
+
const useUpdateAxesRanges = ({
|
|
25430
|
+
range,
|
|
25431
|
+
state,
|
|
25432
|
+
dispatch
|
|
25433
|
+
}) => {
|
|
25434
|
+
const prevAxes = useRef(state.axes);
|
|
25435
|
+
useEffect(() => {
|
|
25436
|
+
if (range && isRangeValid(range)) {
|
|
25437
|
+
const newAxes = Object.entries(range).map(([key, { min, max }]) => ({
|
|
25438
|
+
id: key,
|
|
25439
|
+
min: min ?? 0,
|
|
25440
|
+
max: max ?? 0
|
|
25441
|
+
}));
|
|
25442
|
+
const mergedAxes = [...prevAxes.current ?? []].map((axis) => {
|
|
25443
|
+
const newAxis = newAxes.find((a2) => a2.id === axis.id);
|
|
25444
|
+
return newAxis ? { ...axis, ...newAxis } : axis;
|
|
25445
|
+
});
|
|
25446
|
+
if (!isEqual(mergedAxes, prevAxes.current)) {
|
|
25447
|
+
dispatch({
|
|
25448
|
+
type: UPDATE_AXES_RANGES,
|
|
25449
|
+
payload: { axes: mergedAxes }
|
|
25450
|
+
});
|
|
25451
|
+
prevAxes.current = mergedAxes;
|
|
25452
|
+
}
|
|
25453
|
+
}
|
|
25454
|
+
}, [range]);
|
|
25438
25455
|
};
|
|
25439
25456
|
const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) => {
|
|
25440
25457
|
const prevGeneratedDatasets = useRef();
|
|
@@ -25463,12 +25480,12 @@ const useChartState = ({
|
|
|
25463
25480
|
const memoState = useMemo(() => state, [state]);
|
|
25464
25481
|
const memoOptions = useMemo(() => options, [options]);
|
|
25465
25482
|
const {
|
|
25466
|
-
additionalAxesOptions: { range =
|
|
25483
|
+
additionalAxesOptions: { range = void 0 },
|
|
25467
25484
|
axes
|
|
25468
25485
|
} = memoOptions;
|
|
25469
25486
|
useStoreChartStateInStorage(memoState, persistenceId);
|
|
25470
25487
|
useToggleCustomLegendVisibility(memoState, memoOptions);
|
|
25471
|
-
useUpdateAxesRanges(range, dispatch);
|
|
25488
|
+
useUpdateAxesRanges({ range, state: memoState, dispatch });
|
|
25472
25489
|
useSaveInitialAxesRanges(chartRef, axes, generatedDatasets, dispatch);
|
|
25473
25490
|
};
|
|
25474
25491
|
const WORD_SEPARATOR = " ";
|