@oliasoft-open-source/charts-library 4.1.9 → 4.1.11-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
@@ -8,7 +8,7 @@ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
8
8
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
9
9
  import React, { forwardRef, useRef, useEffect, createContext as createContext$2, memo, useLayoutEffect, useState, useCallback, useMemo, isValidElement, cloneElement, useContext, useReducer } from "react";
10
10
  import { produce } from "immer";
11
- import { round as round$2, displayNumber, isCloseTo, roundByMagnitude, toNum } from "@oliasoft-open-source/units";
11
+ import { round as round$2, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
12
12
  import cx from "classnames";
13
13
  import { Icon, Tooltip as Tooltip$2, Button, Flex, Text, Menu, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Portal } from "@oliasoft-open-source/react-ui-library";
14
14
  import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, map as map$3, find, get as get$1, values } from "lodash";
@@ -24598,26 +24598,25 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
24598
24598
  annotationsData = []
24599
24599
  } = annotations ?? {};
24600
24600
  if (controlAnnotation && showAnnotations) {
24601
- const annotationDatasets = annotationsData.map(
24602
- (annotation2, index2) => {
24603
- const color2 = annotation2.color ?? COLORS[index2];
24604
- const borderDash = ANNOTATION_DASH;
24605
- const borderWidth = BORDER_WIDTH.INITIAL;
24606
- return {
24607
- ...annotation2,
24608
- isAnnotation: true,
24609
- annotationType: annotation2.type,
24610
- label: annotation2.label,
24611
- annotationIndex: index2,
24612
- backgroundColor: color2,
24613
- pointBackgroundColor: color2,
24614
- borderColor: color2,
24615
- borderDash,
24616
- borderWidth,
24617
- data: [{}]
24618
- };
24619
- }
24620
- );
24601
+ const annotationDatasets = annotationsData.map((ann, index2) => {
24602
+ const { type, ...annotation2 } = ann;
24603
+ const color2 = annotation2.color ?? COLORS[index2];
24604
+ const borderDash = ANNOTATION_DASH;
24605
+ const borderWidth = BORDER_WIDTH.INITIAL;
24606
+ return {
24607
+ ...annotation2,
24608
+ isAnnotation: true,
24609
+ annotationType: type,
24610
+ label: annotation2.label,
24611
+ annotationIndex: index2,
24612
+ backgroundColor: color2,
24613
+ pointBackgroundColor: color2,
24614
+ borderColor: color2,
24615
+ borderDash,
24616
+ borderWidth,
24617
+ data: [{}]
24618
+ };
24619
+ });
24621
24620
  copyDataset.push(...annotationDatasets);
24622
24621
  }
24623
24622
  return copyDataset == null ? void 0 : copyDataset.map((line, i2) => {
@@ -39311,10 +39310,8 @@ const getBarChartToolTips = (options) => {
39311
39310
  const labels = getTooltipLabels(tooltipItem.dataset);
39312
39311
  const { valueUnit, valueAxisLabel } = labels;
39313
39312
  const getTooltipItemValue = () => {
39314
- const { formattedValue } = tooltipItem;
39315
- const formattedValueWithDotSeparator = formattedValue.replace(",", ".");
39316
- const labelNumber = toNum(formattedValueWithDotSeparator);
39317
- const labelNumberFormatted = customFormatNumber2(labelNumber);
39313
+ const tooltipValue = tooltipItem == null ? void 0 : tooltipItem.raw;
39314
+ const labelNumberFormatted = typeof tooltipValue === "number" ? customFormatNumber2(tooltipValue) : "";
39318
39315
  let tooltipItemValue2 = "";
39319
39316
  if (typeof tooltipItem.raw === "number") {
39320
39317
  tooltipItemValue2 = labelNumberFormatted;
@@ -39328,7 +39325,7 @@ const getBarChartToolTips = (options) => {
39328
39325
  );
39329
39326
  }
39330
39327
  if (typeof tooltipItem.raw === "object") {
39331
- tooltipItemValue2 = formattedValue;
39328
+ tooltipItemValue2 = labelNumberFormatted;
39332
39329
  }
39333
39330
  return tooltipItemValue2;
39334
39331
  };