@oliasoft-open-source/charts-library 3.3.6-beta-2 → 3.3.6-beta-4
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 +12 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13059,9 +13059,7 @@ const ANNOTATION_DASH = [10, 2];
|
|
|
13059
13059
|
const DEFAULT_FONT_SIZE = 13;
|
|
13060
13060
|
const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
|
|
13061
13061
|
const DEFAULT_COLOR = "rgba(0,0,0,.87)";
|
|
13062
|
-
const LEGEND_LABEL_BOX_SIZE =
|
|
13063
|
-
const TOOLTIP_PADDING = 8;
|
|
13064
|
-
const TOOLTIP_BOX_PADDING = 4;
|
|
13062
|
+
const LEGEND_LABEL_BOX_SIZE = 6;
|
|
13065
13063
|
const LOGARITHMIC_STEPS = [1, 10, 100, 1e3, 1e4];
|
|
13066
13064
|
const COLORS = [
|
|
13067
13065
|
"#3366cc",
|
|
@@ -37332,7 +37330,7 @@ const getAnnotationsData = (data) => {
|
|
|
37332
37330
|
return data.reduce((acc, obj) => {
|
|
37333
37331
|
return {
|
|
37334
37332
|
...acc,
|
|
37335
|
-
[obj.annotationAxis]: [...acc[obj.annotationAxis] || [], obj.value]
|
|
37333
|
+
[obj.annotationAxis]: [...acc[obj.annotationAxis] || [], +obj.value]
|
|
37336
37334
|
};
|
|
37337
37335
|
}, {});
|
|
37338
37336
|
};
|
|
@@ -37357,15 +37355,14 @@ const getAxesData = (scalesKeys, datasets, annotationsData) => {
|
|
|
37357
37355
|
const reduceData = (arr, key) => arr.reduce((acc, { [key]: value }) => [...acc, value], []);
|
|
37358
37356
|
return datasets.reduce(
|
|
37359
37357
|
(acc, obj) => {
|
|
37360
|
-
const
|
|
37361
|
-
const key = include ? second : first;
|
|
37358
|
+
const key = Object.values(obj).find((val) => axes.includes(val));
|
|
37362
37359
|
return {
|
|
37363
37360
|
...acc,
|
|
37364
37361
|
[key]: [
|
|
37365
37362
|
.../* @__PURE__ */ new Set([
|
|
37366
37363
|
...acc[key],
|
|
37367
37364
|
...reduceData(obj == null ? void 0 : obj.data, multiAxesKey),
|
|
37368
|
-
|
|
37365
|
+
...key === multiAxesKey && (data == null ? void 0 : data[multiAxesKey]) || []
|
|
37369
37366
|
])
|
|
37370
37367
|
]
|
|
37371
37368
|
};
|
|
@@ -37544,22 +37541,12 @@ const getLineChartToolTips = (options) => {
|
|
|
37544
37541
|
};
|
|
37545
37542
|
}
|
|
37546
37543
|
};
|
|
37547
|
-
const truncateMiddle = (string) => {
|
|
37548
|
-
const STRING_MAX_LENGTH = 30;
|
|
37549
|
-
if (string.length <= STRING_MAX_LENGTH) {
|
|
37550
|
-
return string;
|
|
37551
|
-
}
|
|
37552
|
-
const start = string.substring(0, STRING_MAX_LENGTH / 2).trim();
|
|
37553
|
-
const end = string.substring(string.length - STRING_MAX_LENGTH / 2).trim();
|
|
37554
|
-
return `${start}…${end}`;
|
|
37555
|
-
};
|
|
37556
37544
|
const titleCallback = (tooltipItem, data) => {
|
|
37557
37545
|
const labels = getTooltipLabels(tooltipItem[0].dataset);
|
|
37558
37546
|
const { titleLabel, titleAxisLabel } = labels;
|
|
37559
37547
|
const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
|
|
37560
37548
|
const roundedValue = Math.abs(formattedValue) < 1 ? formattedValue.toPrecision(3) : formattedValue.toFixed(2);
|
|
37561
|
-
|
|
37562
|
-
return truncateMiddle(title);
|
|
37549
|
+
return `${roundedValue} ${titleAxisLabel}`;
|
|
37563
37550
|
};
|
|
37564
37551
|
const labelCallback = (tooltipItem) => {
|
|
37565
37552
|
const { showLabelsInTooltips, hideSimulationName } = options.tooltip;
|
|
@@ -37570,22 +37557,18 @@ const getLineChartToolTips = (options) => {
|
|
|
37570
37557
|
const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
|
|
37571
37558
|
return Math.abs(labelNumber) < 1 ? labelNumber.toPrecision(3) : labelNumber.toFixed(3);
|
|
37572
37559
|
};
|
|
37560
|
+
const splitValueAxisLabel = valueAxisLabel.split(" ");
|
|
37561
|
+
const newValueAxisLabel = hideSimulationName ? splitValueAxisLabel[splitValueAxisLabel.length - 1] : valueAxisLabel;
|
|
37573
37562
|
const tooltipItemValue = getTooltipItemValue();
|
|
37563
|
+
const valAxisLabel = label === valueAxisLabel || valueAxisLabel.includes(label) ? "" : newValueAxisLabel;
|
|
37574
37564
|
const tooltipLabel = getTooltipLabel(tooltipItem, showLabelsInTooltips);
|
|
37575
|
-
|
|
37576
|
-
const units = matches && matches.length > 0 ? matches[0] : "";
|
|
37577
|
-
const truncatedLabel = truncateMiddle(label);
|
|
37578
|
-
return `${truncatedLabel}: ${tooltipItemValue} ${units} ${tooltipLabel}`;
|
|
37565
|
+
return `${label}: ${tooltipItemValue} ${valAxisLabel}${tooltipLabel}`;
|
|
37579
37566
|
};
|
|
37580
37567
|
return {
|
|
37581
37568
|
enabled: options.tooltip.tooltips,
|
|
37582
37569
|
mode: ChartHoverMode.Nearest,
|
|
37583
37570
|
intersect: true,
|
|
37584
|
-
padding:
|
|
37585
|
-
usePointStyle: true,
|
|
37586
|
-
boxWidth: LEGEND_LABEL_BOX_SIZE,
|
|
37587
|
-
boxHeight: LEGEND_LABEL_BOX_SIZE,
|
|
37588
|
-
boxPadding: TOOLTIP_BOX_PADDING,
|
|
37571
|
+
padding: 8,
|
|
37589
37572
|
callbacks: {
|
|
37590
37573
|
title: titleCallback,
|
|
37591
37574
|
label: labelCallback,
|
|
@@ -38609,12 +38592,7 @@ const PieChart = (props) => {
|
|
|
38609
38592
|
const formattedValue = Math.abs(labelValue) < 1 ? roundNumberToPrecision(labelValue, { n: 3 }) : round$2(labelValue, 3);
|
|
38610
38593
|
return `${dataLabel} ${formattedValue} ${unit}`;
|
|
38611
38594
|
}
|
|
38612
|
-
}
|
|
38613
|
-
padding: TOOLTIP_PADDING,
|
|
38614
|
-
boxWidth: LEGEND_LABEL_BOX_SIZE,
|
|
38615
|
-
boxHeight: LEGEND_LABEL_BOX_SIZE,
|
|
38616
|
-
boxPadding: TOOLTIP_BOX_PADDING,
|
|
38617
|
-
usePointStyle: true
|
|
38595
|
+
}
|
|
38618
38596
|
};
|
|
38619
38597
|
};
|
|
38620
38598
|
return /* @__PURE__ */ jsx(
|
|
@@ -39031,10 +39009,7 @@ const getBarChartToolTips = (options) => {
|
|
|
39031
39009
|
enabled: options.tooltip.tooltips,
|
|
39032
39010
|
mode: ChartHoverMode.Nearest,
|
|
39033
39011
|
intersect: true,
|
|
39034
|
-
padding:
|
|
39035
|
-
boxWidth: LEGEND_LABEL_BOX_SIZE,
|
|
39036
|
-
boxHeight: LEGEND_LABEL_BOX_SIZE,
|
|
39037
|
-
boxPadding: TOOLTIP_BOX_PADDING,
|
|
39012
|
+
padding: 8,
|
|
39038
39013
|
callbacks: {
|
|
39039
39014
|
title: titleCallback,
|
|
39040
39015
|
label: labelCallback,
|