@oliasoft-open-source/charts-library 3.3.6 → 3.3.8-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
@@ -7,7 +7,7 @@ var __publicField = (obj, key, value) => {
7
7
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
8
8
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
9
9
  import React, { forwardRef, useRef, useEffect, createContext as createContext$2, memo, isValidElement, cloneElement, useLayoutEffect, useMemo, useContext, useState, useCallback, useReducer } from "react";
10
- import { round as round$2, toNum, displayNumber, isCloseTo } from "@oliasoft-open-source/units";
10
+ import { round as round$2, to as to$2, toNum, displayNumber, isCloseTo } from "@oliasoft-open-source/units";
11
11
  import cx from "classnames";
12
12
  import { produce } from "immer";
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";
@@ -36030,11 +36030,14 @@ const AxesOptionsPopover = ({
36030
36030
  const onDone = (e2) => {
36031
36031
  e2.preventDefault();
36032
36032
  if (valid) {
36033
- const sanitizedFormState = formState.map((axis) => ({
36034
- ...axis,
36035
- min: toNum(axis.min),
36036
- max: toNum(axis.max)
36037
- }));
36033
+ const sanitizedFormState = formState.map((axis, i2) => {
36034
+ var _a3, _b2;
36035
+ return {
36036
+ ...axis,
36037
+ min: ((_a3 = axis == null ? void 0 : axis.unit) == null ? void 0 : _a3.selectedUnit) ? to$2(axis.min, axes[i2].unit.selectedUnit, axis.unit.selectedUnit) : toNum(axis.min),
36038
+ max: ((_b2 = axis == null ? void 0 : axis.unit) == null ? void 0 : _b2.selectedUnit) ? to$2(axis.max, axes[i2].unit.selectedUnit, axis.unit.selectedUnit) : toNum(axis.max)
36039
+ };
36040
+ });
36038
36041
  onUpdateAxes({
36039
36042
  axes: sanitizedFormState
36040
36043
  });
@@ -37545,7 +37548,10 @@ const getLineChartToolTips = (options) => {
37545
37548
  const labels = getTooltipLabels(tooltipItem[0].dataset);
37546
37549
  const { titleLabel, titleAxisLabel } = labels;
37547
37550
  const formattedValue = titleLabel === TooltipLabel.Y ? tooltipItem[0].parsed.y : tooltipItem[0].parsed.x;
37548
- const roundedValue = Math.abs(formattedValue) < 1 ? formattedValue.toPrecision(3) : formattedValue.toFixed(2);
37551
+ const roundedValue = Math.abs(formattedValue) < 1 ? displayNumber(formattedValue, {
37552
+ scientific: true,
37553
+ roundScientificCoefficient: 4
37554
+ }) : displayNumber(formattedValue);
37549
37555
  return `${roundedValue} ${titleAxisLabel}`;
37550
37556
  };
37551
37557
  const labelCallback = (tooltipItem) => {
@@ -37555,7 +37561,10 @@ const getLineChartToolTips = (options) => {
37555
37561
  const { valueLabel, valueAxisLabel } = labels;
37556
37562
  const getTooltipItemValue = () => {
37557
37563
  const labelNumber = valueLabel === TooltipLabel.X ? tooltipItem.parsed.x : tooltipItem.parsed.y;
37558
- return Math.abs(labelNumber) < 1 ? labelNumber.toPrecision(3) : labelNumber.toFixed(3);
37564
+ return Math.abs(labelNumber) < 1 ? displayNumber(labelNumber, {
37565
+ scientific: true,
37566
+ roundScientificCoefficient: 4
37567
+ }) : displayNumber(labelNumber);
37559
37568
  };
37560
37569
  const splitValueAxisLabel = valueAxisLabel.split(" ");
37561
37570
  const newValueAxisLabel = hideSimulationName ? splitValueAxisLabel[splitValueAxisLabel.length - 1] : valueAxisLabel;