@oliasoft-open-source/charts-library 3.4.10-beta-2 → 3.4.11

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
@@ -24642,7 +24642,6 @@ const DEFAULT_POINT_RADIUS = 2;
24642
24642
  const DEFAULT_HOVER_RADIUS = 5;
24643
24643
  const DEFAULT_BORDER_WIDTH = 1;
24644
24644
  const BORDER_JOIN_STYLE = "round";
24645
- const DEFAULT_LINE_POINT_RADIUS = 0;
24646
24645
  const DEFAULT_BACKGROUND_COLOR = "transparent";
24647
24646
  const ZOOM_BOX_BACKGROUND_COLOR = "rgba(0, 0, 0, 0.1)";
24648
24647
  const DOUBLE_CLICK = "dblclick";
@@ -24650,6 +24649,8 @@ const INIT_KEYS = {
24650
24649
  TRANSLATIONS: "translations",
24651
24650
  LANGUAGE_KEY: "languageKey"
24652
24651
  };
24652
+ const LOWER_BOUND = 1e-4;
24653
+ const UPPER_BOUND = 1e7;
24653
24654
  const generateLineChartDatasets = (datasets, state, options, { label }) => {
24654
24655
  const copyDataset = [...datasets];
24655
24656
  const { annotations, graph } = options;
@@ -24685,7 +24686,7 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
24685
24686
  const {
24686
24687
  formation,
24687
24688
  data = [],
24688
- pointRadius,
24689
+ pointRadius: pointRadiusProp,
24689
24690
  pointHoverRadius,
24690
24691
  borderWidth,
24691
24692
  borderColor,
@@ -24707,7 +24708,9 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
24707
24708
  }
24708
24709
  }
24709
24710
  const filteredData = data.filter(Boolean) || [];
24710
- const linePointRadius = parseFloat(pointRadius) || DEFAULT_POINT_RADIUS;
24711
+ const isSinglePoint = (filteredData == null ? void 0 : filteredData.length) === 1;
24712
+ const linePointRadius = parseFloat(pointRadiusProp) || DEFAULT_POINT_RADIUS;
24713
+ const pointRadius = pointsEnabled || isSinglePoint ? linePointRadius : 0;
24711
24714
  const hoverRadius = parseFloat(pointHoverRadius) || DEFAULT_HOVER_RADIUS;
24712
24715
  const indexedColor = COLORS[i2];
24713
24716
  return {
@@ -24723,7 +24726,7 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
24723
24726
  borderColor: borderColor ?? indexedColor ?? generateRandomColor(COLORS),
24724
24727
  backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,
24725
24728
  pointBackgroundColor: pointBackgroundColor ?? indexedColor ?? generateRandomColor(COLORS),
24726
- pointRadius: pointsEnabled ? linePointRadius : DEFAULT_LINE_POINT_RADIUS,
24729
+ pointRadius,
24727
24730
  pointHoverRadius: hoverRadius,
24728
24731
  pointHitRadius: line.pointHitRadius ?? hoverRadius
24729
24732
  };
@@ -24747,7 +24750,7 @@ const formatAxisLabelNumbers = (tickValue, ticks, locale = "en-gb") => {
24747
24750
  Math.abs(ticks[0].value),
24748
24751
  Math.abs(ticks[ticks.length - 1].value)
24749
24752
  );
24750
- if (maxTick < 1e-4 || maxTick > 1e7) {
24753
+ if (maxTick < LOWER_BOUND || maxTick > UPPER_BOUND) {
24751
24754
  notation = "scientific";
24752
24755
  }
24753
24756
  delta = calculateDelta$1(tickValue, ticks);
@@ -25098,8 +25101,8 @@ const getUnitsFromLabel = (label) => {
25098
25101
  };
25099
25102
  const customFormatNumber = (labelNumber) => {
25100
25103
  let roundOptions = {};
25101
- if (Math.abs(labelNumber) < 1e-4 || Math.abs(labelNumber) > 1e7) {
25102
- roundOptions = { roundScientificCoefficient: 4 };
25104
+ if (Math.abs(labelNumber) < LOWER_BOUND || Math.abs(labelNumber) > UPPER_BOUND) {
25105
+ roundOptions = { roundScientificCoefficient: 3 };
25103
25106
  }
25104
25107
  return displayNumber(roundByMagnitude(labelNumber), roundOptions);
25105
25108
  };