@oliasoft-open-source/charts-library 4.1.0 → 4.1.2
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
|
@@ -24808,18 +24808,19 @@ const getLineChartScales = (options, state) => {
|
|
|
24808
24808
|
};
|
|
24809
24809
|
};
|
|
24810
24810
|
const estimateDataSeriesHaveCloseValues = (generatedDatasets) => {
|
|
24811
|
+
var _a2;
|
|
24811
24812
|
if (!Array.isArray(generatedDatasets) || !generatedDatasets.length) {
|
|
24812
24813
|
return false;
|
|
24813
24814
|
}
|
|
24814
24815
|
const axesFirstLast = generatedDatasets.reduce((acc, dataset) => {
|
|
24815
|
-
var
|
|
24816
|
+
var _a3, _b2, _c2, _d2;
|
|
24816
24817
|
const xAxisId = (dataset == null ? void 0 : dataset.xAxisID) ?? "defaultX";
|
|
24817
24818
|
const yAxisId = (dataset == null ? void 0 : dataset.yAxisID) ?? "defaultY";
|
|
24818
|
-
const data = dataset == null ? void 0 : dataset.data;
|
|
24819
|
+
const data = (dataset == null ? void 0 : dataset.data) ?? [];
|
|
24819
24820
|
if (data && data.length) {
|
|
24820
24821
|
const { x: xFirstCurrent, y: yFirstCurrent } = (data == null ? void 0 : data[0]) ?? {};
|
|
24821
|
-
const { x: xLastCurrent = 0, y: yLastCurrent = 0 } = data.at(-1) ?? {};
|
|
24822
|
-
const xFirstAcc = ((
|
|
24822
|
+
const { x: xLastCurrent = 0, y: yLastCurrent = 0 } = (data == null ? void 0 : data.at(-1)) ?? {};
|
|
24823
|
+
const xFirstAcc = ((_a3 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _a3.xFirst) ?? xFirstCurrent;
|
|
24823
24824
|
const xLastAcc = ((_b2 = acc == null ? void 0 : acc[xAxisId]) == null ? void 0 : _b2.xLast) ?? xLastCurrent;
|
|
24824
24825
|
const yFirstAcc = ((_c2 = acc == null ? void 0 : acc[yAxisId]) == null ? void 0 : _c2.yFirst) ?? yFirstCurrent;
|
|
24825
24826
|
const yLastAcc = ((_d2 = acc == null ? void 0 : acc[yAxisId]) == null ? void 0 : _d2.yLast) ?? yLastCurrent;
|
|
@@ -24842,7 +24843,7 @@ const estimateDataSeriesHaveCloseValues = (generatedDatasets) => {
|
|
|
24842
24843
|
}
|
|
24843
24844
|
return acc;
|
|
24844
24845
|
}, {});
|
|
24845
|
-
return Object.values(axesFirstLast).some(({ xFirst, xLast, yFirst, yLast }) => {
|
|
24846
|
+
return (_a2 = Object.values(axesFirstLast)) == null ? void 0 : _a2.some(({ xFirst, xLast, yFirst, yLast }) => {
|
|
24846
24847
|
return isCloseTo(xFirst, xLast, { absoluteDiff: MAX_DECIMAL_DIFF }) || isCloseTo(yFirst, yLast, { absoluteDiff: MAX_DECIMAL_DIFF });
|
|
24847
24848
|
});
|
|
24848
24849
|
};
|
|
@@ -39258,6 +39259,8 @@ const getBarChartDataLabels = (options) => {
|
|
|
39258
39259
|
formatter: formatterCallback
|
|
39259
39260
|
} : { display: false };
|
|
39260
39261
|
};
|
|
39262
|
+
const DISPLAY_SCIENTIFIC_LOWER_BOUND = 1e-4;
|
|
39263
|
+
const DISPLAY_SCIENTIFIC_UPPER_BOUND = 1e7;
|
|
39261
39264
|
const getBarChartToolTips = (options) => {
|
|
39262
39265
|
var _a2;
|
|
39263
39266
|
const getTooltipLabels = (dataset) => {
|
|
@@ -39292,6 +39295,13 @@ const getBarChartToolTips = (options) => {
|
|
|
39292
39295
|
const axisLabel = !titleAxisLabel && !titleUnit ? "" : `${titleAxisLabel || titleUnit}: `;
|
|
39293
39296
|
return axisLabel + barLabel;
|
|
39294
39297
|
};
|
|
39298
|
+
const customFormatNumber2 = (labelNumber) => {
|
|
39299
|
+
let roundOptions = {};
|
|
39300
|
+
if (Math.abs(labelNumber) < DISPLAY_SCIENTIFIC_LOWER_BOUND || Math.abs(labelNumber) > DISPLAY_SCIENTIFIC_UPPER_BOUND) {
|
|
39301
|
+
roundOptions = { roundScientificCoefficient: 3 };
|
|
39302
|
+
}
|
|
39303
|
+
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
39304
|
+
};
|
|
39295
39305
|
const labelCallback = (tooltipItem) => {
|
|
39296
39306
|
var _a3;
|
|
39297
39307
|
const { showLabelsInTooltips = false } = (options == null ? void 0 : options.tooltip) || {};
|
|
@@ -39302,12 +39312,7 @@ const getBarChartToolTips = (options) => {
|
|
|
39302
39312
|
const { formattedValue } = tooltipItem;
|
|
39303
39313
|
const formattedValueWithDotSeparator = formattedValue.replace(",", ".");
|
|
39304
39314
|
const labelNumber = toNum(formattedValueWithDotSeparator);
|
|
39305
|
-
|
|
39306
|
-
if (Math.abs(labelNumber) < 1) {
|
|
39307
|
-
labelNumberFormatted = labelNumber.toPrecision(3);
|
|
39308
|
-
} else {
|
|
39309
|
-
labelNumberFormatted = Number.isInteger(labelNumber) ? labelNumber : labelNumber.toFixed(3);
|
|
39310
|
-
}
|
|
39315
|
+
const labelNumberFormatted = customFormatNumber2(labelNumber);
|
|
39311
39316
|
let tooltipItemValue2 = "";
|
|
39312
39317
|
if (typeof tooltipItem.raw === "number") {
|
|
39313
39318
|
tooltipItemValue2 = labelNumberFormatted;
|