@gravity-ui/charts 1.46.1 → 1.48.0

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.
Files changed (195) hide show
  1. package/dist/cjs/components/AxisX/prepare-axis-data.js +9 -6
  2. package/dist/cjs/components/AxisY/prepare-axis-data.js +11 -4
  3. package/dist/cjs/components/ChartInner/index.js +1 -0
  4. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -0
  5. package/dist/cjs/components/ChartInner/useChartInnerProps.js +12 -5
  6. package/dist/cjs/core/axes/types.d.ts +4 -2
  7. package/dist/cjs/core/axes/x-axis.js +2 -0
  8. package/dist/cjs/core/axes/y-axis.js +2 -0
  9. package/dist/cjs/core/brush/index.d.ts +2 -0
  10. package/dist/cjs/core/brush/index.js +2 -0
  11. package/dist/cjs/{hooks/useBrush → core/brush}/types.d.ts +2 -2
  12. package/dist/{esm/hooks/useBrush → cjs/core/brush}/utils.d.ts +1 -1
  13. package/dist/cjs/core/chart/index.d.ts +1 -0
  14. package/dist/cjs/core/chart/index.js +1 -0
  15. package/dist/cjs/core/chart/types.d.ts +8 -0
  16. package/dist/cjs/core/index.d.ts +3 -0
  17. package/dist/cjs/core/index.js +3 -0
  18. package/dist/cjs/core/layout/chart-dimensions.d.ts +1 -1
  19. package/dist/cjs/core/range-slider/index.d.ts +2 -0
  20. package/dist/cjs/core/range-slider/index.js +2 -0
  21. package/dist/cjs/core/range-slider/types.d.ts +4 -0
  22. package/dist/cjs/{hooks/useRangeSlider → core/range-slider}/utils.d.ts +5 -5
  23. package/dist/cjs/{hooks/useRangeSlider → core/range-slider}/utils.js +1 -1
  24. package/dist/cjs/core/scales/x-scale.d.ts +2 -2
  25. package/dist/cjs/core/scales/y-scale.js +21 -0
  26. package/dist/cjs/core/series/prepare-legend.d.ts +1 -1
  27. package/dist/cjs/core/series/prepare-scatter.js +11 -3
  28. package/dist/cjs/core/series/types.d.ts +8 -0
  29. package/dist/cjs/core/shapes/area/prepare-data.js +8 -50
  30. package/dist/cjs/core/shapes/area/renderer.js +8 -14
  31. package/dist/cjs/core/shapes/area/types.d.ts +6 -5
  32. package/dist/cjs/core/shapes/bar-x/prepare-data.js +49 -35
  33. package/dist/cjs/core/shapes/bar-x/renderer.js +6 -12
  34. package/dist/cjs/core/shapes/bar-y/renderer.js +6 -12
  35. package/dist/cjs/core/shapes/data-labels.d.ts +15 -0
  36. package/dist/cjs/core/shapes/data-labels.js +15 -0
  37. package/dist/cjs/core/shapes/funnel/renderer.js +6 -11
  38. package/dist/cjs/core/shapes/heatmap/prepare-data.js +1 -0
  39. package/dist/cjs/core/shapes/heatmap/renderer.js +6 -11
  40. package/dist/cjs/core/shapes/heatmap/types.d.ts +1 -0
  41. package/dist/cjs/core/shapes/line/prepare-data.js +22 -59
  42. package/dist/cjs/core/shapes/line/renderer.js +7 -13
  43. package/dist/cjs/core/shapes/line/types.d.ts +5 -4
  44. package/dist/cjs/core/shapes/radar/renderer.js +8 -12
  45. package/dist/cjs/core/shapes/sankey/renderer.js +6 -12
  46. package/dist/cjs/core/shapes/scatter/prepare-data.d.ts +5 -2
  47. package/dist/cjs/core/shapes/scatter/prepare-data.js +43 -4
  48. package/dist/cjs/core/shapes/scatter/renderer.d.ts +2 -2
  49. package/dist/cjs/core/shapes/scatter/renderer.js +9 -1
  50. package/dist/cjs/core/shapes/scatter/types.d.ts +6 -1
  51. package/dist/cjs/core/shapes/utils.d.ts +24 -0
  52. package/dist/cjs/core/shapes/utils.js +48 -0
  53. package/dist/cjs/core/shapes/waterfall/renderer.js +6 -12
  54. package/dist/cjs/core/shapes/x-range/renderer.js +7 -13
  55. package/dist/cjs/core/types/chart/axis.d.ts +20 -0
  56. package/dist/cjs/core/types/chart/base.d.ts +17 -3
  57. package/dist/cjs/core/types/chart/scatter.d.ts +2 -0
  58. package/dist/cjs/core/types/chart/tooltip.d.ts +3 -3
  59. package/dist/cjs/core/types/formatter.d.ts +1 -40
  60. package/dist/cjs/core/utils/data-labels.d.ts +46 -0
  61. package/dist/cjs/core/utils/data-labels.js +64 -0
  62. package/dist/cjs/core/utils/format.d.ts +2 -2
  63. package/dist/cjs/core/utils/get-closest-data.js +13 -8
  64. package/dist/cjs/core/utils/index.d.ts +1 -0
  65. package/dist/cjs/core/utils/index.js +1 -0
  66. package/dist/cjs/core/zoom/index.d.ts +2 -0
  67. package/dist/cjs/core/zoom/index.js +2 -0
  68. package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.d.ts +3 -3
  69. package/dist/{esm/hooks/useZoom → cjs/core/zoom}/utils.js +1 -1
  70. package/dist/cjs/core/zoom/zoom.d.ts +3 -3
  71. package/dist/cjs/hooks/index.d.ts +2 -2
  72. package/dist/cjs/hooks/index.js +2 -2
  73. package/dist/cjs/hooks/types.d.ts +2 -8
  74. package/dist/cjs/hooks/useBrush/index.d.ts +1 -1
  75. package/dist/cjs/hooks/useBrush/index.js +1 -1
  76. package/dist/cjs/hooks/useRangeSlider/index.js +3 -3
  77. package/dist/cjs/hooks/useRangeSlider/types.d.ts +5 -7
  78. package/dist/cjs/hooks/useShapes/index.d.ts +1 -1
  79. package/dist/cjs/hooks/useShapes/index.js +5 -3
  80. package/dist/cjs/hooks/useShapes/scatter/index.d.ts +2 -2
  81. package/dist/cjs/hooks/useShapes/scatter/index.js +4 -1
  82. package/dist/cjs/hooks/useShapes/styles.css +8 -25
  83. package/dist/cjs/hooks/useShapes/utils.d.ts +1 -1
  84. package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
  85. package/dist/cjs/hooks/useZoom/index.js +1 -1
  86. package/dist/cjs/index.d.ts +1 -0
  87. package/dist/cjs/index.js +1 -0
  88. package/dist/cjs/libs/format-number/index.js +82 -14
  89. package/dist/cjs/libs/format-number/presets.d.ts +40 -0
  90. package/dist/cjs/libs/format-number/presets.js +66 -0
  91. package/dist/cjs/libs/format-number/types.d.ts +82 -3
  92. package/dist/esm/components/AxisX/prepare-axis-data.js +9 -6
  93. package/dist/esm/components/AxisY/prepare-axis-data.js +11 -4
  94. package/dist/esm/components/ChartInner/index.js +1 -0
  95. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -0
  96. package/dist/esm/components/ChartInner/useChartInnerProps.js +12 -5
  97. package/dist/esm/core/axes/types.d.ts +4 -2
  98. package/dist/esm/core/axes/x-axis.js +2 -0
  99. package/dist/esm/core/axes/y-axis.js +2 -0
  100. package/dist/esm/core/brush/index.d.ts +2 -0
  101. package/dist/esm/core/brush/index.js +2 -0
  102. package/dist/esm/{hooks/useBrush → core/brush}/types.d.ts +2 -2
  103. package/dist/esm/core/brush/types.js +1 -0
  104. package/dist/{cjs/hooks/useBrush → esm/core/brush}/utils.d.ts +1 -1
  105. package/dist/esm/core/chart/index.d.ts +1 -0
  106. package/dist/esm/core/chart/index.js +1 -0
  107. package/dist/esm/core/chart/types.d.ts +8 -0
  108. package/dist/esm/core/chart/types.js +1 -0
  109. package/dist/esm/core/index.d.ts +3 -0
  110. package/dist/esm/core/index.js +3 -0
  111. package/dist/esm/core/layout/chart-dimensions.d.ts +1 -1
  112. package/dist/esm/core/range-slider/index.d.ts +2 -0
  113. package/dist/esm/core/range-slider/index.js +2 -0
  114. package/dist/esm/core/range-slider/types.d.ts +4 -0
  115. package/dist/esm/core/range-slider/types.js +1 -0
  116. package/dist/esm/{hooks/useRangeSlider → core/range-slider}/utils.d.ts +5 -5
  117. package/dist/esm/{hooks/useRangeSlider → core/range-slider}/utils.js +1 -1
  118. package/dist/esm/core/scales/x-scale.d.ts +2 -2
  119. package/dist/esm/core/scales/y-scale.js +21 -0
  120. package/dist/esm/core/series/prepare-legend.d.ts +1 -1
  121. package/dist/esm/core/series/prepare-scatter.js +11 -3
  122. package/dist/esm/core/series/types.d.ts +8 -0
  123. package/dist/esm/core/shapes/area/prepare-data.js +8 -50
  124. package/dist/esm/core/shapes/area/renderer.js +8 -14
  125. package/dist/esm/core/shapes/area/types.d.ts +6 -5
  126. package/dist/esm/core/shapes/bar-x/prepare-data.js +49 -35
  127. package/dist/esm/core/shapes/bar-x/renderer.js +6 -12
  128. package/dist/esm/core/shapes/bar-y/renderer.js +6 -12
  129. package/dist/esm/core/shapes/data-labels.d.ts +15 -0
  130. package/dist/esm/core/shapes/data-labels.js +15 -0
  131. package/dist/esm/core/shapes/funnel/renderer.js +6 -11
  132. package/dist/esm/core/shapes/heatmap/prepare-data.js +1 -0
  133. package/dist/esm/core/shapes/heatmap/renderer.js +6 -11
  134. package/dist/esm/core/shapes/heatmap/types.d.ts +1 -0
  135. package/dist/esm/core/shapes/line/prepare-data.js +22 -59
  136. package/dist/esm/core/shapes/line/renderer.js +7 -13
  137. package/dist/esm/core/shapes/line/types.d.ts +5 -4
  138. package/dist/esm/core/shapes/radar/renderer.js +8 -12
  139. package/dist/esm/core/shapes/sankey/renderer.js +6 -12
  140. package/dist/esm/core/shapes/scatter/prepare-data.d.ts +5 -2
  141. package/dist/esm/core/shapes/scatter/prepare-data.js +43 -4
  142. package/dist/esm/core/shapes/scatter/renderer.d.ts +2 -2
  143. package/dist/esm/core/shapes/scatter/renderer.js +9 -1
  144. package/dist/esm/core/shapes/scatter/types.d.ts +6 -1
  145. package/dist/esm/core/shapes/utils.d.ts +24 -0
  146. package/dist/esm/core/shapes/utils.js +48 -0
  147. package/dist/esm/core/shapes/waterfall/renderer.js +6 -12
  148. package/dist/esm/core/shapes/x-range/renderer.js +7 -13
  149. package/dist/esm/core/types/chart/axis.d.ts +20 -0
  150. package/dist/esm/core/types/chart/base.d.ts +17 -3
  151. package/dist/esm/core/types/chart/scatter.d.ts +2 -0
  152. package/dist/esm/core/types/chart/tooltip.d.ts +3 -3
  153. package/dist/esm/core/types/formatter.d.ts +1 -40
  154. package/dist/esm/core/utils/data-labels.d.ts +46 -0
  155. package/dist/esm/core/utils/data-labels.js +64 -0
  156. package/dist/esm/core/utils/format.d.ts +2 -2
  157. package/dist/esm/core/utils/get-closest-data.js +13 -8
  158. package/dist/esm/core/utils/index.d.ts +1 -0
  159. package/dist/esm/core/utils/index.js +1 -0
  160. package/dist/esm/core/zoom/index.d.ts +2 -0
  161. package/dist/esm/core/zoom/index.js +2 -0
  162. package/dist/esm/core/zoom/types.js +1 -0
  163. package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.d.ts +3 -3
  164. package/dist/{cjs/hooks/useZoom → esm/core/zoom}/utils.js +1 -1
  165. package/dist/esm/core/zoom/zoom.d.ts +3 -3
  166. package/dist/esm/hooks/index.d.ts +2 -2
  167. package/dist/esm/hooks/index.js +2 -2
  168. package/dist/esm/hooks/types.d.ts +2 -8
  169. package/dist/esm/hooks/useBrush/index.d.ts +1 -1
  170. package/dist/esm/hooks/useBrush/index.js +1 -1
  171. package/dist/esm/hooks/useRangeSlider/index.js +3 -3
  172. package/dist/esm/hooks/useRangeSlider/types.d.ts +5 -7
  173. package/dist/esm/hooks/useShapes/index.d.ts +1 -1
  174. package/dist/esm/hooks/useShapes/index.js +5 -3
  175. package/dist/esm/hooks/useShapes/scatter/index.d.ts +2 -2
  176. package/dist/esm/hooks/useShapes/scatter/index.js +4 -1
  177. package/dist/esm/hooks/useShapes/styles.css +8 -25
  178. package/dist/esm/hooks/useShapes/utils.d.ts +1 -1
  179. package/dist/esm/hooks/useZoom/index.d.ts +1 -1
  180. package/dist/esm/hooks/useZoom/index.js +1 -1
  181. package/dist/esm/index.d.ts +1 -0
  182. package/dist/esm/index.js +1 -0
  183. package/dist/esm/libs/format-number/index.js +82 -14
  184. package/dist/esm/libs/format-number/presets.d.ts +40 -0
  185. package/dist/esm/libs/format-number/presets.js +66 -0
  186. package/dist/esm/libs/format-number/types.d.ts +82 -3
  187. package/package.json +1 -1
  188. /package/dist/cjs/{hooks/useBrush → core/brush}/types.js +0 -0
  189. /package/dist/cjs/{hooks/useBrush → core/brush}/utils.js +0 -0
  190. /package/dist/cjs/{hooks/useZoom → core/chart}/types.js +0 -0
  191. /package/dist/{esm/hooks/useBrush → cjs/core/range-slider}/types.js +0 -0
  192. /package/dist/cjs/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
  193. /package/dist/{esm/hooks/useZoom → cjs/core/zoom}/types.js +0 -0
  194. /package/dist/esm/{hooks/useBrush → core/brush}/utils.js +0 -0
  195. /package/dist/esm/{hooks/useZoom → core/zoom}/types.d.ts +0 -0
@@ -16,8 +16,8 @@ import type { PreparedSankeyData } from '../../core/shapes/sankey/types';
16
16
  import type { PreparedScatterData } from '../../core/shapes/scatter/types';
17
17
  import type { PreparedWaterfallData } from '../../core/shapes/waterfall/types';
18
18
  import type { PreparedXRangeData } from '../../core/shapes/x-range/types';
19
+ import type { ZoomState } from '../../core/zoom/types';
19
20
  import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
20
- import type { ZoomState } from '../useZoom/types';
21
21
  import './styles.css';
22
22
  export type ShapeData = PreparedBarXData | PreparedBarYData | PreparedScatterData | PreparedLineData | PreparedPieData | PreparedAreaData | PreparedWaterfallData | PreparedSankeyData | PreparedRadarData | PreparedHeatmapData | PreparedFunnelData | PreparedXRangeData;
23
23
  export type ClipPathBySeriesType = Partial<Record<SeriesType, boolean>>;
@@ -146,18 +146,20 @@ export async function getShapes(args) {
146
146
  }
147
147
  case SERIES_TYPE.Scatter: {
148
148
  if (xAxis && xScale && (yScale === null || yScale === void 0 ? void 0 : yScale.length)) {
149
- const preparedData = prepareScatterData({
149
+ const scatterShapeData = await prepareScatterData({
150
150
  series: chartSeries,
151
151
  xAxis,
152
152
  xScale,
153
153
  yAxis,
154
154
  yScale,
155
+ split,
155
156
  isOutsideBounds,
157
+ isRangeSlider,
156
158
  });
157
159
  shapes[index] = (React.createElement(ScatterSeriesShape, { key: SERIES_TYPE.Scatter, clipPathId: shouldUseClipPathId(SERIES_TYPE.Scatter, clipPathBySeriesType)
158
160
  ? clipPathId
159
- : undefined, dispatcher: dispatcher, preparedData: preparedData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
160
- shapesData.splice(index, 0, ...preparedData);
161
+ : undefined, dispatcher: dispatcher, preparedData: scatterShapeData, seriesOptions: seriesOptions, htmlLayout: htmlLayout }));
162
+ shapesData.splice(index, 0, ...scatterShapeData.markers);
161
163
  }
162
164
  break;
163
165
  }
@@ -1,11 +1,11 @@
1
1
  import React from 'react';
2
2
  import type { Dispatch } from 'd3-dispatch';
3
3
  import type { PreparedSeriesOptions } from '../../../core/series/types';
4
- import type { PreparedScatterData } from '../../../core/shapes/scatter/types';
4
+ import type { PreparedScatterShapeData } from '../../../core/shapes/scatter/types';
5
5
  export { prepareScatterData } from '../../../core/shapes/scatter/prepare-data';
6
6
  type ScatterSeriesShapeProps = {
7
7
  htmlLayout: HTMLElement | null;
8
- preparedData: PreparedScatterData[];
8
+ preparedData: PreparedScatterShapeData;
9
9
  seriesOptions: PreparedSeriesOptions;
10
10
  clipPathId?: string;
11
11
  dispatcher?: Dispatch<object>;
@@ -13,7 +13,10 @@ export function ScatterSeriesShape(props) {
13
13
  }
14
14
  return renderScatter({ plot: ref.current }, preparedData, seriesOptions, dispatcher);
15
15
  }, [dispatcher, preparedData, seriesOptions]);
16
+ const htmlLayerData = React.useMemo(() => {
17
+ return { htmlElements: preparedData.htmlLabels };
18
+ }, [preparedData]);
16
19
  return (React.createElement(React.Fragment, null,
17
20
  React.createElement("g", { ref: ref, className: b(), clipPath: clipPathId ? `url(#${clipPathId})` : undefined }),
18
- React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
21
+ React.createElement(HtmlLayer, { preparedData: htmlLayerData, htmlLayout: htmlLayout })));
19
22
  }
@@ -1,8 +1,15 @@
1
1
  .gcharts-line__label,
2
2
  .gcharts-area__label,
3
3
  .gcharts-radar__label,
4
+ .gcharts-bar-x__label,
5
+ .gcharts-bar-y__label,
4
6
  .gcharts-heatmap__label,
5
- .gcharts-funnel__label {
7
+ .gcharts-funnel__label,
8
+ .gcharts-treemap__label,
9
+ .gcharts-pie__label,
10
+ .gcharts-scatter__label {
11
+ user-select: none;
12
+ pointer-events: none;
6
13
  dominant-baseline: hanging;
7
14
  }
8
15
 
@@ -13,30 +20,6 @@
13
20
  .gcharts-pie__segment {
14
21
  stroke: var(--g-color-base-background);
15
22
  }
16
- .gcharts-pie__label {
17
- font-size: 11px;
18
- font-weight: bold;
19
- fill: var(--g-color-text-complementary);
20
- dominant-baseline: hanging;
21
- }
22
-
23
- .gcharts-bar-x__label {
24
- user-select: none;
25
- fill: var(--g-color-text-complementary);
26
- }
27
-
28
- .gcharts-bar-y__label {
29
- user-select: none;
30
- fill: var(--g-color-text-complementary);
31
- dominant-baseline: hanging;
32
- }
33
-
34
- .gcharts-treemap__label {
35
- user-select: none;
36
- pointer-events: none;
37
- fill: var(--g-color-text-complementary);
38
- dominant-baseline: hanging;
39
- }
40
23
 
41
24
  .gcharts-waterfall__connector {
42
25
  stroke: var(--g-color-line-generic-active);
@@ -1,5 +1,5 @@
1
+ import type { ZoomState } from '../../core/zoom/types';
1
2
  import type { PreparedYAxis } from '../useAxis/types';
2
- import type { ZoomState } from '../useZoom/types';
3
3
  export * from '../../core/shapes/utils';
4
4
  export declare function getSeriesClipPathId(args: {
5
5
  clipPathId: string;
@@ -1,8 +1,8 @@
1
1
  import type { PreparedSplit } from '../../core/layout/split-types';
2
2
  import type { ChartScale } from '../../core/scales/types';
3
+ import type { ZoomState } from '../../core/zoom/types';
3
4
  import type { PreparedZoom } from '../types';
4
5
  import type { PreparedXAxis, PreparedYAxis } from '../useAxis/types';
5
- import type { ZoomState } from './types';
6
6
  interface UseZoomProps {
7
7
  node: SVGGElement | null;
8
8
  onUpdate: (zoomState: Partial<ZoomState>) => void;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { select } from 'd3-selection';
3
+ import { selectionToZoomBounds } from '../../core/zoom/utils';
3
4
  import { useBrush } from '../useBrush';
4
- import { selectionToZoomBounds } from './utils';
5
5
  export function useZoom(props) {
6
6
  const { node, onUpdate, plotContainerHeight, plotContainerWidth, preparedSplit, preparedZoom, rangeSliderDomain, xAxis, xScale, yAxis, yScale, } = props;
7
7
  const isBrushDisabled = Boolean(!xAxis || !yAxis || !xScale || !yScale);
@@ -1,5 +1,6 @@
1
1
  export { CustomShapeRenderer } from './utils';
2
2
  export { getFormattedValue } from './core/utils';
3
3
  export { getDefaultTooltipHeaderFormat } from './core/utils/tooltip';
4
+ export { FORMAT_UNITS_BITS, FORMAT_UNITS_BYTES, FORMAT_UNITS_NUMBERS, } from './libs/format-number/presets';
4
5
  export * from './components';
5
6
  export * from './types';
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  export { CustomShapeRenderer } from './utils';
2
2
  export { getFormattedValue } from './core/utils';
3
3
  export { getDefaultTooltipHeaderFormat } from './core/utils/tooltip';
4
+ export { FORMAT_UNITS_BITS, FORMAT_UNITS_BYTES, FORMAT_UNITS_NUMBERS, } from './libs/format-number/presets';
4
5
  export * from './components';
5
6
  export * from './types';
@@ -11,26 +11,30 @@ function getUnitRate(value, exponent, unitsI18nKeys) {
11
11
  }
12
12
  return resultUnitRate - 1;
13
13
  }
14
+ const formatScaledNumber = (value, options) => {
15
+ const { precision, showRankDelimiter = true, lang } = options;
16
+ let result = value;
17
+ if (typeof precision === 'number') {
18
+ result = Number(result.toFixed(precision));
19
+ }
20
+ else if (precision === 'auto' && result % 1 !== 0) {
21
+ result = Number(result.toFixed(Math.abs(result) > 1 ? 2 : 4));
22
+ }
23
+ return new Intl.NumberFormat(lang !== null && lang !== void 0 ? lang : i18nInstance.lang, {
24
+ minimumFractionDigits: typeof precision === 'number' ? precision : 0,
25
+ maximumFractionDigits: 20,
26
+ useGrouping: showRankDelimiter,
27
+ }).format(result);
28
+ };
14
29
  const unitFormatter = ({ exponent, unitsI18nKeys, unitDelimiterI18nKey, }) => {
15
30
  return function formatUnit(value, options = {}) {
16
- const { precision, unitRate, showRankDelimiter = true, lang } = options;
31
+ const { unitRate, lang } = options;
17
32
  const i18nLang = i18nInstance.lang;
18
33
  if (lang) {
19
34
  i18nInstance.setLang(lang);
20
35
  }
21
36
  const resultUnitRate = typeof unitRate === 'number' ? unitRate : getUnitRate(value, exponent, unitsI18nKeys);
22
- let result = value / Math.pow(exponent, resultUnitRate);
23
- if (typeof precision === 'number') {
24
- result = Number(result.toFixed(precision));
25
- }
26
- else if (precision === 'auto' && result % 1 !== 0) {
27
- result = Number(result.toFixed(Math.abs(result) > 1 ? 2 : 4));
28
- }
29
- result = new Intl.NumberFormat(lang !== null && lang !== void 0 ? lang : i18nLang, {
30
- minimumFractionDigits: typeof precision === 'number' ? precision : 0,
31
- maximumFractionDigits: 20,
32
- useGrouping: showRankDelimiter,
33
- }).format(result);
37
+ const result = formatScaledNumber(value / Math.pow(exponent, resultUnitRate), options);
34
38
  const unit = i18n(unitsI18nKeys[resultUnitRate]);
35
39
  const delimiter = i18n(unitDelimiterI18nKey);
36
40
  i18nInstance.setLang(i18nLang);
@@ -59,6 +63,65 @@ const baseFormatNumber = unitFormatter({
59
63
  unitDelimiterI18nKey: 'value_number-delimiter',
60
64
  unitsI18nKeys: BASE_NUMBER_FORMAT_UNIT_KEYS,
61
65
  });
66
+ const resolvePostfix = (postfix, lang) => {
67
+ var _a, _b;
68
+ if (typeof postfix === 'string') {
69
+ return postfix;
70
+ }
71
+ return (_b = (_a = postfix[lang]) !== null && _a !== void 0 ? _a : postfix.en) !== null && _b !== void 0 ? _b : '';
72
+ };
73
+ const FALLBACK_UNIT_ENTRY = { factor: 1, postfix: '' };
74
+ const normalizedUnitsCache = new WeakMap();
75
+ const normalizeUnits = (units) => {
76
+ const cached = normalizedUnitsCache.get(units);
77
+ if (cached) {
78
+ return cached;
79
+ }
80
+ const { scale } = units;
81
+ const rawEntries = Array.isArray(scale)
82
+ ? scale.map((e) => ({ factor: e.factor, postfix: e.postfix }))
83
+ : scale.postfixes.map((postfix, i) => ({ factor: Math.pow(scale.base, i), postfix }));
84
+ const valid = rawEntries.filter((e) => Number.isFinite(e.factor) && e.factor > 0);
85
+ valid.sort((a, b) => a.factor - b.factor);
86
+ const deduped = [];
87
+ for (const e of valid) {
88
+ if (deduped.length === 0 || deduped[deduped.length - 1].factor !== e.factor) {
89
+ deduped.push(e);
90
+ }
91
+ }
92
+ const result = deduped.length > 0 ? deduped : [FALLBACK_UNIT_ENTRY];
93
+ normalizedUnitsCache.set(units, result);
94
+ return result;
95
+ };
96
+ const pickUnitEntry = (value, scale) => {
97
+ const av = Math.abs(value);
98
+ let chosen = scale[0];
99
+ for (const e of scale) {
100
+ if (av / e.factor >= 1) {
101
+ chosen = e;
102
+ }
103
+ else {
104
+ break;
105
+ }
106
+ }
107
+ return chosen;
108
+ };
109
+ const customUnitFormatter = (value, units, options) => {
110
+ const { lang } = options;
111
+ const i18nLang = i18nInstance.lang;
112
+ if (lang) {
113
+ i18nInstance.setLang(lang);
114
+ }
115
+ const normalizedScale = normalizeUnits(units);
116
+ const entry = pickUnitEntry(value, normalizedScale);
117
+ const result = formatScaledNumber(value / entry.factor, options);
118
+ const effectiveLang = lang !== null && lang !== void 0 ? lang : i18nLang;
119
+ const resolvedPostfix = resolvePostfix(entry.postfix, effectiveLang);
120
+ const resolvedDelimiter = typeof units.delimiter === 'string' ? units.delimiter : ' ';
121
+ const delimiter = resolvedPostfix ? resolvedDelimiter : '';
122
+ i18nInstance.setLang(i18nLang);
123
+ return `${result}${delimiter}${resolvedPostfix}`;
124
+ };
62
125
  const NUMBER_UNIT_RATE_BY_UNIT = {
63
126
  default: 0,
64
127
  auto: undefined,
@@ -77,7 +140,7 @@ export const formatNumber = (value, options = {}) => {
77
140
  if (Number.isNaN(value) || Number.isNaN(Number(value))) {
78
141
  return new Intl.NumberFormat('en').format(Number(value));
79
142
  }
80
- const { format = 'number', multiplier = 1, prefix = '', postfix = '', unit, labelMode } = options;
143
+ const { format = 'number', multiplier = 1, prefix = '', postfix = '', unit, units, labelMode, } = options;
81
144
  let changedMultiplier = multiplier;
82
145
  let prePostfix = '';
83
146
  if (format === 'percent') {
@@ -87,6 +150,11 @@ export const formatNumber = (value, options = {}) => {
87
150
  if (labelMode === 'percent') {
88
151
  prePostfix = '%';
89
152
  }
153
+ if (units) {
154
+ const unitScale = 'scale' in units ? units : { scale: [units] };
155
+ const formattedValue = customUnitFormatter(Number(value) * changedMultiplier, unitScale, options);
156
+ return `${prefix}${formattedValue}${prePostfix}${postfix}`;
157
+ }
90
158
  const formattedValue = baseFormatNumber(Number(value) * changedMultiplier, Object.assign(Object.assign({}, options), { unitRate: NUMBER_UNIT_RATE_BY_UNIT[unit !== null && unit !== void 0 ? unit : 'default'] }));
91
159
  return `${prefix}${formattedValue}${prePostfix}${postfix}`;
92
160
  };
@@ -0,0 +1,40 @@
1
+ import type { FormatUnitScale } from './types';
2
+ /**
3
+ * Byte scale with binary base (`1024`) and localized postfixes.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * tooltip: {
8
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_BYTES, precision: 1},
9
+ * }
10
+ * ```
11
+ */
12
+ export declare const FORMAT_UNITS_BYTES: FormatUnitScale;
13
+ /**
14
+ * Short number scale with decimal base (`1000`). Renders large numbers
15
+ * compactly as `K/M/B/T`. Postfixes are plain Latin letters and stay the
16
+ * same regardless of language. The first entry has an empty postfix, so
17
+ * values below `1000` render as plain numbers without a delimiter.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * tooltip: {
22
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_NUMBERS, precision: 1},
23
+ * }
24
+ * // 300 → "300"
25
+ * // 1_500 → "1.5 K"
26
+ * // 1_500_000 → "1.5 M"
27
+ * ```
28
+ */
29
+ export declare const FORMAT_UNITS_NUMBERS: FormatUnitScale;
30
+ /**
31
+ * Bit scale with decimal base (`1000`) and localized postfixes.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * tooltip: {
36
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_BITS, precision: 1},
37
+ * }
38
+ * ```
39
+ */
40
+ export declare const FORMAT_UNITS_BITS: FormatUnitScale;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Byte scale with binary base (`1024`) and localized postfixes.
3
+ *
4
+ * @example
5
+ * ```ts
6
+ * tooltip: {
7
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_BYTES, precision: 1},
8
+ * }
9
+ * ```
10
+ */
11
+ export const FORMAT_UNITS_BYTES = {
12
+ scale: {
13
+ base: 1024,
14
+ postfixes: [
15
+ { en: 'B', ru: 'Б' },
16
+ { en: 'KB', ru: 'КБ' },
17
+ { en: 'MB', ru: 'МБ' },
18
+ { en: 'GB', ru: 'ГБ' },
19
+ { en: 'TB', ru: 'ТБ' },
20
+ ],
21
+ },
22
+ };
23
+ /**
24
+ * Short number scale with decimal base (`1000`). Renders large numbers
25
+ * compactly as `K/M/B/T`. Postfixes are plain Latin letters and stay the
26
+ * same regardless of language. The first entry has an empty postfix, so
27
+ * values below `1000` render as plain numbers without a delimiter.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * tooltip: {
32
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_NUMBERS, precision: 1},
33
+ * }
34
+ * // 300 → "300"
35
+ * // 1_500 → "1.5 K"
36
+ * // 1_500_000 → "1.5 M"
37
+ * ```
38
+ */
39
+ export const FORMAT_UNITS_NUMBERS = {
40
+ scale: {
41
+ base: 1000,
42
+ postfixes: ['', 'K', 'M', 'B', 'T'],
43
+ },
44
+ };
45
+ /**
46
+ * Bit scale with decimal base (`1000`) and localized postfixes.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * tooltip: {
51
+ * valueFormat: {type: 'number', units: FORMAT_UNITS_BITS, precision: 1},
52
+ * }
53
+ * ```
54
+ */
55
+ export const FORMAT_UNITS_BITS = {
56
+ scale: {
57
+ base: 1000,
58
+ postfixes: [
59
+ { en: 'bit', ru: 'бит' },
60
+ { en: 'Kbit', ru: 'Кбит' },
61
+ { en: 'Mbit', ru: 'Мбит' },
62
+ { en: 'Gbit', ru: 'Гбит' },
63
+ { en: 'Tbit', ru: 'Тбит' },
64
+ ],
65
+ },
66
+ };
@@ -1,13 +1,92 @@
1
- export type FormatOptions = {
1
+ export interface FormatOptions {
2
+ /**
3
+ * Number of decimal places to display.
4
+ * Use `'auto'` to determine precision automatically based on the value magnitude.
5
+ */
2
6
  precision?: number | 'auto';
7
+ /** When `true`, inserts a thousands separator (e.g. `1 500 000`). */
3
8
  showRankDelimiter?: boolean;
9
+ /**
10
+ * BCP 47 language tag used for locale-aware formatting (e.g. `'en'`, `'ru'`).
11
+ * Defaults to the application locale when omitted.
12
+ */
4
13
  lang?: string;
14
+ /** Internal rendering hint for axis label layout. Not intended for public use. */
5
15
  labelMode?: string;
16
+ }
17
+ /**
18
+ * Plain string or a per-language dictionary of strings.
19
+ * When a dictionary is used, the lookup chain is:
20
+ * current `lang` → `en` → empty string.
21
+ */
22
+ export type FormatI18nString = string | Partial<Record<string, string>>;
23
+ /** Single entry of a custom unit scale. */
24
+ export type FormatUnitScaleEntry = {
25
+ /** Positive multiplier applied to the value. The entry wins when `|value| / factor >= 1`. */
26
+ factor: number;
27
+ /**
28
+ * String appended after the scaled value (e.g. `'KB'`).
29
+ * Use an empty string to suppress the suffix and the delimiter.
30
+ * Pass a `{lang: string}` dictionary to localize the postfix — resolution falls back to `en`, then to empty.
31
+ */
32
+ postfix: FormatI18nString;
6
33
  };
7
- export type FormatNumberOptions = FormatOptions & {
34
+ /**
35
+ * Custom unit scale for numeric formatting.
36
+ *
37
+ * `scale` describes the unit table in one of two forms:
38
+ * - `{base, postfixes}` — geometric progression: `postfixes[i]` is bound to `factor = base^i` (e.g. `{base: 1024, postfixes: ['B','KB','MB']}`).
39
+ * - `FormatUnitScaleEntry[]` — arbitrary factors; required for non-linear scales (e.g. `[{factor:1,postfix:'s'},{factor:60,postfix:'min'},{factor:3600,postfix:'h'}]`).
40
+ *
41
+ * `delimiter` is the shared string placed between the scaled value and the
42
+ * postfix. Defaults to a locale-aware space; pass `''` to suppress it.
43
+ *
44
+ * The normalized scale is cached by object identity, so for best performance
45
+ * reuse the same `units` object across `formatNumber` calls instead of
46
+ * creating a new inline literal on every render.
47
+ */
48
+ export type FormatUnitScale = {
49
+ scale: {
50
+ base: number;
51
+ postfixes: FormatI18nString[];
52
+ } | FormatUnitScaleEntry[];
53
+ delimiter?: string;
54
+ };
55
+ export interface FormatNumberOptions extends FormatOptions {
56
+ /**
57
+ * Display mode for the numeric value.
58
+ * - `'number'` — plain number (default).
59
+ * - `'percent'` — value is multiplied by 100 and rendered with a `%` suffix.
60
+ *
61
+ * Combining `'percent'` with `units` is not meaningful and should be avoided.
62
+ */
8
63
  format?: 'number' | 'percent';
64
+ /** Factor applied to the value before formatting. For example, `multiplier: 1000` converts seconds to milliseconds. */
9
65
  multiplier?: number;
66
+ /** String prepended to the formatted value (e.g. `'$'`). */
10
67
  prefix?: string;
68
+ /** String appended to the formatted value (e.g. `' USD'`). */
11
69
  postfix?: string;
70
+ /**
71
+ * Compact unit suffix applied to large numbers.
72
+ * - `'auto'` — picks the most appropriate unit automatically (`k`, `m`, `b`, `t`).
73
+ * - `'k'` — thousands (÷ 1 000).
74
+ * - `'m'` — millions (÷ 1 000 000).
75
+ * - `'b'` — billions (÷ 1 000 000 000).
76
+ * - `'t'` — trillions (÷ 1 000 000 000 000).
77
+ * - `null` — no unit suffix.
78
+ *
79
+ * @deprecated Use `units` for custom scales. This option is fully ignored when `units` is set.
80
+ */
12
81
  unit?: 'auto' | 'k' | 'm' | 'b' | 't' | null;
13
- };
82
+ /**
83
+ * Custom unit scale, or a single `FormatUnitScaleEntry` as sugar for
84
+ * locking every value to one unit (equivalent to the legacy `unit: 'k'`).
85
+ * When set, fully overrides `unit`.
86
+ *
87
+ * Unit selection is always automatic: the entry with the largest `factor`
88
+ * such that `|value| / factor >= 1`, clamped to the smallest entry for
89
+ * very small values.
90
+ */
91
+ units?: FormatUnitScale | FormatUnitScaleEntry;
92
+ }
@@ -1,6 +1,6 @@
1
1
  import { getUniqId } from '@gravity-ui/uikit';
2
2
  import { select } from 'd3-selection';
3
- import { calculateCos, calculateSin, formatAxisTickLabel, getBandsPosition, getLabelsSize, getMinSpaceBetween, getTextSizeFn, getTextWithElipsis, } from '../../core/utils';
3
+ import { calculateCos, calculateNumericProperty, calculateSin, formatAxisTickLabel, getBandsPosition, getLabelsSize, getMinSpaceBetween, getTextSizeFn, getTextWithElipsis, } from '../../core/utils';
4
4
  import { getXAxisTickValues } from '../../core/utils/axis/x-axis';
5
5
  import { getMultilineTitleContentRows } from '../utils/axis-title';
6
6
  async function getSvgAxisLabel({ getTextSize, text, axis, top, left, labelMaxWidth, axisWidth, boundsOffsetLeft, boundsOffsetRight, }) {
@@ -72,7 +72,7 @@ async function getSvgAxisLabel({ getTextSize, text, axis, top, left, labelMaxWid
72
72
  return svgLabel;
73
73
  }
74
74
  export async function prepareXAxisData({ axis, boundsOffsetLeft, boundsOffsetRight, boundsWidth, height, scale, series, split, yAxis, }) {
75
- var _a, _b, _c, _d, _e, _f, _g, _h;
75
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
76
76
  const xAxisItems = [];
77
77
  const splitPlots = (_a = split === null || split === void 0 ? void 0 : split.plots) !== null && _a !== void 0 ? _a : [];
78
78
  for (let plotIndex = 0; plotIndex < splitPlots.length; plotIndex++) {
@@ -267,6 +267,9 @@ export async function prepareXAxisData({ axis, boundsOffsetLeft, boundsOffsetRig
267
267
  if (plotBandWidth < 0) {
268
268
  continue;
269
269
  }
270
+ const perpExtent = (_g = calculateNumericProperty({ value: plotBand.size, base: axisHeight })) !== null && _g !== void 0 ? _g : axisHeight;
271
+ // X axis is positioned at the bottom of the plot area, so 'start' = bottom edge.
272
+ const bandY = plotBand.align === 'end' ? axisTop : axisTop + axisHeight - perpExtent;
270
273
  const getPlotLabelSize = getTextSizeFn({ style: plotBand.label.style });
271
274
  const labelSize = plotBand.label.text
272
275
  ? await getPlotLabelSize(plotBand.label.text)
@@ -274,17 +277,17 @@ export async function prepareXAxisData({ axis, boundsOffsetLeft, boundsOffsetRig
274
277
  plotBands.push({
275
278
  layerPlacement: plotBand.layerPlacement,
276
279
  x: Math.max(0, startPos),
277
- y: axisTop,
280
+ y: bandY,
278
281
  width: plotBandWidth,
279
- height: axisHeight,
282
+ height: perpExtent,
280
283
  color: plotBand.color,
281
284
  opacity: plotBand.opacity,
282
285
  label: plotBand.label.text
283
286
  ? {
284
287
  text: plotBand.label.text,
285
288
  style: plotBand.label.style,
286
- x: plotBand.label.padding + ((_g = labelSize === null || labelSize === void 0 ? void 0 : labelSize.hangingOffset) !== null && _g !== void 0 ? _g : 0),
287
- y: plotBand.label.padding + ((_h = labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) !== null && _h !== void 0 ? _h : 0),
289
+ x: plotBand.label.padding + ((_h = labelSize === null || labelSize === void 0 ? void 0 : labelSize.hangingOffset) !== null && _h !== void 0 ? _h : 0),
290
+ y: plotBand.label.padding + ((_j = labelSize === null || labelSize === void 0 ? void 0 : labelSize.width) !== null && _j !== void 0 ? _j : 0),
288
291
  rotate: -90,
289
292
  qa: plotBand.label.qa,
290
293
  }
@@ -1,6 +1,6 @@
1
1
  import { getUniqId } from '@gravity-ui/uikit';
2
2
  import { select } from 'd3-selection';
3
- import { calculateCos, calculateSin, formatAxisTickLabel, getBandsPosition, getLabelsSize, getMinSpaceBetween, getTextSizeFn, getTextWithElipsis, wrapText, } from '../../core/utils';
3
+ import { calculateCos, calculateNumericProperty, calculateSin, formatAxisTickLabel, getBandsPosition, getLabelsSize, getMinSpaceBetween, getTextSizeFn, getTextWithElipsis, wrapText, } from '../../core/utils';
4
4
  import { prepareHtmlYAxisTitle, prepareSvgYAxisTitle } from './prepare-axis-title';
5
5
  import { getTickValues } from './utils';
6
6
  async function getSvgAxisLabel({ getTextSize, text, axis, top, left, labelMaxHeight, topOffset, }) {
@@ -113,7 +113,7 @@ async function getSvgAxisLabel({ getTextSize, text, axis, top, left, labelMaxHei
113
113
  return svgLabel;
114
114
  }
115
115
  export async function prepareYAxisData({ axis, split, scale, top: topOffset, width, height, series, }) {
116
- var _a, _b, _c, _d, _e;
116
+ var _a, _b, _c, _d, _e, _f;
117
117
  const axisPlotTopPosition = ((_a = split === null || split === void 0 ? void 0 : split.plots[axis.plotIndex]) === null || _a === void 0 ? void 0 : _a.top) || 0;
118
118
  const axisHeight = ((_b = split === null || split === void 0 ? void 0 : split.plots[axis.plotIndex]) === null || _b === void 0 ? void 0 : _b.height) || height;
119
119
  const domainX = axis.position === 'left' ? 0 : width;
@@ -231,11 +231,18 @@ export async function prepareYAxisData({ axis, split, scale, top: topOffset, wid
231
231
  if (plotBandHeight < 0) {
232
232
  continue;
233
233
  }
234
+ const perpExtent = (_f = calculateNumericProperty({ value: plotBand.size, base: width })) !== null && _f !== void 0 ? _f : width;
235
+ // 'start' = at the main Y axis line. For a left axis that's x=0;
236
+ // for a right axis that's x = width - perpExtent. 'end' is mirrored.
237
+ const isLeftAxis = axis.position === 'left';
238
+ const atMainAxis = isLeftAxis ? 0 : width - perpExtent;
239
+ const atOpposite = isLeftAxis ? width - perpExtent : 0;
240
+ const bandX = plotBand.align === 'end' ? atOpposite : atMainAxis;
234
241
  const plotBandItem = {
235
242
  layerPlacement: plotBand.layerPlacement,
236
- x: 0,
243
+ x: bandX,
237
244
  y: axisPlotTopPosition + top,
238
- width,
245
+ width: perpExtent,
239
246
  height: plotBandHeight,
240
247
  color: plotBand.color,
241
248
  opacity: plotBand.opacity,
@@ -55,6 +55,7 @@ export const ChartInner = (props) => {
55
55
  const { activeLegendItems, allPreparedSeries, boundsHeight, boundsOffsetLeft, boundsOffsetTop, boundsWidth, handleLegendItemClick, legendConfig, legendItems, preparedLegend, preparedSeries, preparedSeriesOptions, preparedSplit, shapes, shapesData, shapesReady, xAxis, xScale, yAxis, yScale, preparedTitle, preparedChart, } = useChartInnerProps(Object.assign(Object.assign({}, props), { clipPathId,
56
56
  dispatcher,
57
57
  htmlLayout, plotNode: plotRef.current, rangeSliderState,
58
+ updateRangeSliderState,
58
59
  updateZoomState,
59
60
  zoomState }));
60
61
  const prevWidth = usePrevious(width);
@@ -9,6 +9,7 @@ type Props = ChartInnerProps & {
9
9
  dispatcher: Dispatch<object>;
10
10
  htmlLayout: HTMLElement | null;
11
11
  plotNode: SVGGElement | null;
12
+ updateRangeSliderState: (nextState?: RangeSliderState) => void;
12
13
  updateZoomState: (nextZoomState: Partial<ZoomState>) => void;
13
14
  zoomState: Partial<ZoomState>;
14
15
  rangeSliderState?: RangeSliderState;
@@ -38,7 +38,7 @@ function getBoundsOffsetLeft(args) {
38
38
  }
39
39
  export function useChartInnerProps(props) {
40
40
  var _a, _b, _c, _d, _e, _f, _g, _h;
41
- const { clipPathId, data, dispatcher, height, htmlLayout, plotNode, rangeSliderState, width, updateZoomState, zoomState, } = props;
41
+ const { clipPathId, data, dispatcher, height, htmlLayout, plotNode, rangeSliderState, width, updateRangeSliderState, updateZoomState, zoomState, } = props;
42
42
  const [selectedLegendItems, setSelectedLegendItems] = React.useState(null);
43
43
  const [chartState, setState] = React.useState(null);
44
44
  const prevStateValue = React.useRef(chartState);
@@ -48,20 +48,26 @@ export function useChartInnerProps(props) {
48
48
  currentRunRef.current++;
49
49
  const currentRun = currentRunRef.current;
50
50
  (async function () {
51
- var _a, _b, _c, _d;
51
+ var _a, _b, _c, _d, _e, _f, _g;
52
52
  const chartDataChanged = !(previousChartData.current && isEqual(previousChartData.current, data));
53
+ const axisTypeChanged = ((_b = (_a = previousChartData.current) === null || _a === void 0 ? void 0 : _a.xAxis) === null || _b === void 0 ? void 0 : _b.type) !== undefined &&
54
+ previousChartData.current.xAxis.type !== ((_c = data.xAxis) === null || _c === void 0 ? void 0 : _c.type);
55
+ if (axisTypeChanged && rangeSliderState !== undefined) {
56
+ updateRangeSliderState(undefined);
57
+ return;
58
+ }
53
59
  const preparedTitle = await getPreparedTitle({
54
60
  title: data.title,
55
61
  chartWidth: width,
56
62
  chartHeight: height,
57
- chartMargin: (_a = data.chart) === null || _a === void 0 ? void 0 : _a.margin,
63
+ chartMargin: (_d = data.chart) === null || _d === void 0 ? void 0 : _d.margin,
58
64
  });
59
65
  const preparedChart = getPreparedChart({
60
66
  chart: data.chart,
61
67
  seriesData: data.series.data,
62
68
  preparedTitle,
63
69
  });
64
- const colors = (_b = data.colors) !== null && _b !== void 0 ? _b : DEFAULT_PALETTE;
70
+ const colors = (_e = data.colors) !== null && _e !== void 0 ? _e : DEFAULT_PALETTE;
65
71
  const normalizedSeriesData = getSortedSeriesData({
66
72
  seriesData: data.series.data,
67
73
  xAxis: data.xAxis,
@@ -84,7 +90,7 @@ export function useChartInnerProps(props) {
84
90
  });
85
91
  }
86
92
  else {
87
- allPreparedSeries = (_d = (_c = prevStateValue.current) === null || _c === void 0 ? void 0 : _c.allPreparedSeries) !== null && _d !== void 0 ? _d : [];
93
+ allPreparedSeries = (_g = (_f = prevStateValue.current) === null || _f === void 0 ? void 0 : _f.allPreparedSeries) !== null && _g !== void 0 ? _g : [];
88
94
  }
89
95
  const activeLegendItems = selectedLegendItems !== null && selectedLegendItems !== void 0 ? selectedLegendItems : getActiveLegendItems(allPreparedSeries);
90
96
  const visiblePreparedSeries = getVisibleSeries({
@@ -243,6 +249,7 @@ export function useChartInnerProps(props) {
243
249
  rangeSliderState,
244
250
  dispatcher,
245
251
  htmlLayout,
252
+ updateRangeSliderState,
246
253
  clipPathId,
247
254
  ]);
248
255
  // additional start