@oliasoft-open-source/charts-library 4.0.4 → 4.0.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
|
@@ -24962,7 +24962,8 @@ const defaultChartStyling$2 = (options) => ({
|
|
|
24962
24962
|
const defaultTooltip$2 = (tooltip) => ({
|
|
24963
24963
|
tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
|
|
24964
24964
|
showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) ?? false,
|
|
24965
|
-
hideSimulationName: (tooltip == null ? void 0 : tooltip.hideSimulationName) ?? false
|
|
24965
|
+
hideSimulationName: (tooltip == null ? void 0 : tooltip.hideSimulationName) ?? false,
|
|
24966
|
+
scientificNotation: (tooltip == null ? void 0 : tooltip.scientificNotation) ?? true
|
|
24966
24967
|
});
|
|
24967
24968
|
const defaultGraph$2 = (graph) => ({
|
|
24968
24969
|
lineTension: (graph == null ? void 0 : graph.lineTension) ?? 0.01,
|
|
@@ -25563,14 +25564,17 @@ const getUnitsFromLabel = (label) => {
|
|
|
25563
25564
|
const units = matches && matches.length > 0 ? matches[0] : "";
|
|
25564
25565
|
return units;
|
|
25565
25566
|
};
|
|
25566
|
-
const customFormatNumber = (labelNumber) => {
|
|
25567
|
+
const customFormatNumber = (labelNumber, scientificNotation) => {
|
|
25567
25568
|
let roundOptions = {};
|
|
25568
|
-
if (
|
|
25569
|
+
if (!scientificNotation) {
|
|
25570
|
+
roundOptions = { scientific: false };
|
|
25571
|
+
} else if (Math.abs(labelNumber) < LOWER_BOUND || Math.abs(labelNumber) > UPPER_BOUND) {
|
|
25569
25572
|
roundOptions = { roundScientificCoefficient: 3 };
|
|
25570
25573
|
}
|
|
25571
25574
|
return displayNumber(roundByMagnitude(labelNumber), roundOptions);
|
|
25572
25575
|
};
|
|
25573
25576
|
const getLineChartToolTips = (options) => {
|
|
25577
|
+
const { scientificNotation } = options.tooltip;
|
|
25574
25578
|
const getTooltipLabels = ({
|
|
25575
25579
|
xAxisID = "",
|
|
25576
25580
|
yAxisID = ""
|
|
@@ -25600,7 +25604,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25600
25604
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
25601
25605
|
const { titleLabel, titleAxisLabel } = labels ?? {};
|
|
25602
25606
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
25603
|
-
const roundedValue = customFormatNumber(formattedValue);
|
|
25607
|
+
const roundedValue = customFormatNumber(formattedValue, scientificNotation);
|
|
25604
25608
|
return `${roundedValue} ${titleAxisLabel}`;
|
|
25605
25609
|
};
|
|
25606
25610
|
const labelCallback = (tooltipItem) => {
|
|
@@ -25610,7 +25614,7 @@ const getLineChartToolTips = (options) => {
|
|
|
25610
25614
|
const { valueLabel = "", valueAxisLabel = "" } = labels ?? {};
|
|
25611
25615
|
const getTooltipItemValue = () => {
|
|
25612
25616
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
25613
|
-
return customFormatNumber(labelNumber);
|
|
25617
|
+
return customFormatNumber(labelNumber, scientificNotation);
|
|
25614
25618
|
};
|
|
25615
25619
|
const tooltipItemValue = getTooltipItemValue();
|
|
25616
25620
|
const units = getUnitsFromLabel(valueAxisLabel);
|