@oliasoft-open-source/charts-library 3.4.4 → 3.4.5-beta-1

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
@@ -13161,7 +13161,9 @@ const ANNOTATION_DASH = [10, 2];
13161
13161
  const DEFAULT_FONT_SIZE = 13;
13162
13162
  const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
13163
13163
  const DEFAULT_COLOR = "rgba(0,0,0,.87)";
13164
- const LEGEND_LABEL_BOX_SIZE = 6;
13164
+ const LEGEND_LABEL_BOX_SIZE = 12;
13165
+ const TOOLTIP_PADDING = 8;
13166
+ const TOOLTIP_BOX_PADDING = 4;
13165
13167
  const LOGARITHMIC_STEPS = [1, 10, 100, 1e3, 1e4];
13166
13168
  const COLORS = [
13167
13169
  "#3366cc",
@@ -25092,7 +25094,7 @@ const getLineChartToolTips = (options) => {
25092
25094
  return `${roundedValue} ${titleAxisLabel}`;
25093
25095
  };
25094
25096
  const labelCallback = (tooltipItem) => {
25095
- const { showLabelsInTooltips, hideSimulationName } = options.tooltip;
25097
+ const { showLabelsInTooltips } = options.tooltip;
25096
25098
  let label = tooltipItem.dataset.label || "";
25097
25099
  const labels = getTooltipLabels(tooltipItem.dataset);
25098
25100
  const { valueLabel, valueAxisLabel } = labels;
@@ -25103,18 +25105,25 @@ const getLineChartToolTips = (options) => {
25103
25105
  roundScientificCoefficient: 4
25104
25106
  }) : displayNumber(labelNumber);
25105
25107
  };
25106
- const splitValueAxisLabel = valueAxisLabel.split(" ");
25107
- const newValueAxisLabel = hideSimulationName ? splitValueAxisLabel[splitValueAxisLabel.length - 1] : valueAxisLabel;
25108
+ const getTooltipItemUnits = () => {
25109
+ const matches = valueAxisLabel.match(/\[(.*?)\]/g);
25110
+ const units2 = matches && matches.length > 0 ? matches[0] : "";
25111
+ return units2;
25112
+ };
25108
25113
  const tooltipItemValue = getTooltipItemValue();
25109
- const valAxisLabel = label === valueAxisLabel || valueAxisLabel.includes(label) ? "" : newValueAxisLabel;
25114
+ const units = getTooltipItemUnits();
25110
25115
  const tooltipLabel = getTooltipLabel(tooltipItem, showLabelsInTooltips);
25111
- return `${label}: ${tooltipItemValue} ${valAxisLabel}${tooltipLabel}`;
25116
+ return `${label}: ${tooltipItemValue} ${units} ${tooltipLabel}`;
25112
25117
  };
25113
25118
  return {
25114
25119
  enabled: options.tooltip.tooltips,
25115
25120
  mode: ChartHoverMode.Nearest,
25116
25121
  intersect: true,
25117
- padding: 8,
25122
+ padding: TOOLTIP_PADDING,
25123
+ usePointStyle: true,
25124
+ boxWidth: LEGEND_LABEL_BOX_SIZE,
25125
+ boxHeight: LEGEND_LABEL_BOX_SIZE,
25126
+ boxPadding: TOOLTIP_BOX_PADDING,
25118
25127
  callbacks: {
25119
25128
  title: titleCallback,
25120
25129
  label: labelCallback,
@@ -26096,7 +26105,12 @@ const PieChart = (props) => {
26096
26105
  const formattedValue = Math.abs(labelValue) < 1 ? roundNumberToPrecision(labelValue, { n: 3 }) : round$2(labelValue, 3);
26097
26106
  return `${dataLabel} ${formattedValue} ${unit}`;
26098
26107
  }
26099
- }
26108
+ },
26109
+ padding: TOOLTIP_PADDING,
26110
+ boxWidth: LEGEND_LABEL_BOX_SIZE,
26111
+ boxHeight: LEGEND_LABEL_BOX_SIZE,
26112
+ boxPadding: TOOLTIP_BOX_PADDING,
26113
+ usePointStyle: true
26100
26114
  };
26101
26115
  };
26102
26116
  return /* @__PURE__ */ jsx(
@@ -38774,7 +38788,10 @@ const getBarChartToolTips = (options) => {
38774
38788
  enabled: options.tooltip.tooltips,
38775
38789
  mode: ChartHoverMode.Nearest,
38776
38790
  intersect: true,
38777
- padding: 8,
38791
+ padding: TOOLTIP_PADDING,
38792
+ boxWidth: LEGEND_LABEL_BOX_SIZE,
38793
+ boxHeight: LEGEND_LABEL_BOX_SIZE,
38794
+ boxPadding: TOOLTIP_BOX_PADDING,
38778
38795
  callbacks: {
38779
38796
  title: titleCallback,
38780
38797
  label: labelCallback,