@oliasoft-open-source/charts-library 3.4.10-beta-1 → 3.4.10-beta-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 +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -25096,6 +25096,13 @@ const getUnitsFromLabel = (label) => {
|
|
|
25096
25096
|
const units = matches && matches.length > 0 ? matches[0] : "";
|
|
25097
25097
|
return units;
|
|
25098
25098
|
};
|
|
25099
|
+
const customFormatNumber = (labelNumber) => {
|
|
25100
|
+
let roundOptions = {};
|
|
25101
|
+
if (Math.abs(labelNumber) < 1e-4 || Math.abs(labelNumber) > 1e7) {
|
|
25102
|
+
roundOptions = { roundScientificCoefficient: 4 };
|
|
25103
|
+
}
|
|
25104
|
+
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
25105
|
+
};
|
|
25099
25106
|
const getLineChartToolTips = (options) => {
|
|
25100
25107
|
const getTooltipLabels = (dataset) => {
|
|
25101
25108
|
var _a2, _b2, _c2, _d2, _e2;
|
|
@@ -25123,7 +25130,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25123
25130
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
25124
25131
|
const { titleLabel, titleAxisLabel } = labels;
|
|
25125
25132
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
25126
|
-
const roundedValue =
|
|
25133
|
+
const roundedValue = customFormatNumber(formattedValue);
|
|
25127
25134
|
return `${roundedValue} ${titleAxisLabel}`;
|
|
25128
25135
|
};
|
|
25129
25136
|
const labelCallback = (tooltipItem) => {
|
|
@@ -25133,7 +25140,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25133
25140
|
const { valueLabel, valueAxisLabel } = labels;
|
|
25134
25141
|
const getTooltipItemValue = () => {
|
|
25135
25142
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
25136
|
-
return
|
|
25143
|
+
return customFormatNumber(labelNumber);
|
|
25137
25144
|
};
|
|
25138
25145
|
const tooltipItemValue = getTooltipItemValue();
|
|
25139
25146
|
const units = getUnitsFromLabel(valueAxisLabel);
|