@oliasoft-open-source/charts-library 3.4.10-beta-1 → 3.4.10
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
|
@@ -24650,6 +24650,8 @@ const INIT_KEYS = {
|
|
|
24650
24650
|
TRANSLATIONS: "translations",
|
|
24651
24651
|
LANGUAGE_KEY: "languageKey"
|
|
24652
24652
|
};
|
|
24653
|
+
const LOWER_BOUND = 1e-4;
|
|
24654
|
+
const UPPER_BOUND = 1e7;
|
|
24653
24655
|
const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
24654
24656
|
const copyDataset = [...datasets];
|
|
24655
24657
|
const { annotations, graph } = options;
|
|
@@ -24747,7 +24749,7 @@ const formatAxisLabelNumbers = (tickValue, ticks, locale = "en-gb") => {
|
|
|
24747
24749
|
Math.abs(ticks[0].value),
|
|
24748
24750
|
Math.abs(ticks[ticks.length - 1].value)
|
|
24749
24751
|
);
|
|
24750
|
-
if (maxTick <
|
|
24752
|
+
if (maxTick < LOWER_BOUND || maxTick > UPPER_BOUND) {
|
|
24751
24753
|
notation = "scientific";
|
|
24752
24754
|
}
|
|
24753
24755
|
delta = calculateDelta$1(tickValue, ticks);
|
|
@@ -25096,6 +25098,13 @@ const getUnitsFromLabel = (label) => {
|
|
|
25096
25098
|
const units = matches && matches.length > 0 ? matches[0] : "";
|
|
25097
25099
|
return units;
|
|
25098
25100
|
};
|
|
25101
|
+
const customFormatNumber = (labelNumber) => {
|
|
25102
|
+
let roundOptions = {};
|
|
25103
|
+
if (Math.abs(labelNumber) < LOWER_BOUND || Math.abs(labelNumber) > UPPER_BOUND) {
|
|
25104
|
+
roundOptions = { roundScientificCoefficient: 3 };
|
|
25105
|
+
}
|
|
25106
|
+
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
25107
|
+
};
|
|
25099
25108
|
const getLineChartToolTips = (options) => {
|
|
25100
25109
|
const getTooltipLabels = (dataset) => {
|
|
25101
25110
|
var _a2, _b2, _c2, _d2, _e2;
|
|
@@ -25123,7 +25132,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25123
25132
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
25124
25133
|
const { titleLabel, titleAxisLabel } = labels;
|
|
25125
25134
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
25126
|
-
const roundedValue =
|
|
25135
|
+
const roundedValue = customFormatNumber(formattedValue);
|
|
25127
25136
|
return `${roundedValue} ${titleAxisLabel}`;
|
|
25128
25137
|
};
|
|
25129
25138
|
const labelCallback = (tooltipItem) => {
|
|
@@ -25133,7 +25142,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25133
25142
|
const { valueLabel, valueAxisLabel } = labels;
|
|
25134
25143
|
const getTooltipItemValue = () => {
|
|
25135
25144
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
25136
|
-
return
|
|
25145
|
+
return customFormatNumber(labelNumber);
|
|
25137
25146
|
};
|
|
25138
25147
|
const tooltipItemValue = getTooltipItemValue();
|
|
25139
25148
|
const units = getUnitsFromLabel(valueAxisLabel);
|