@gravity-ui/charts 1.16.0 → 1.18.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 (153) hide show
  1. package/dist/{esm/components/Axis → cjs/components/AxisX}/AxisX.js +1 -15
  2. package/dist/{esm/components/Axis → cjs/components/AxisY}/AxisY.d.ts +2 -10
  3. package/dist/cjs/components/AxisY/AxisY.js +173 -0
  4. package/dist/cjs/components/AxisY/prepare-axis-data.d.ts +10 -0
  5. package/dist/cjs/components/AxisY/prepare-axis-data.js +307 -0
  6. package/dist/cjs/components/AxisY/styles.css +15 -0
  7. package/dist/cjs/components/AxisY/types.d.ts +81 -0
  8. package/dist/cjs/components/AxisY/types.js +1 -0
  9. package/dist/cjs/components/AxisY/utils.d.ts +12 -0
  10. package/dist/cjs/components/AxisY/utils.js +62 -0
  11. package/dist/cjs/components/ChartInner/index.js +39 -6
  12. package/dist/cjs/components/ChartInner/useChartInnerProps.d.ts +1 -1
  13. package/dist/cjs/components/ChartInner/useChartInnerProps.js +15 -1
  14. package/dist/cjs/components/Tooltip/ChartTooltipContent.d.ts +1 -0
  15. package/dist/cjs/components/Tooltip/ChartTooltipContent.js +2 -2
  16. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.d.ts +2 -1
  17. package/dist/cjs/components/Tooltip/DefaultTooltipContent/index.js +8 -5
  18. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.d.ts +11 -4
  19. package/dist/cjs/components/Tooltip/DefaultTooltipContent/utils.js +17 -15
  20. package/dist/cjs/components/Tooltip/index.js +1 -1
  21. package/dist/cjs/constants/date.d.ts +1 -0
  22. package/dist/cjs/constants/date.js +1 -0
  23. package/dist/cjs/constants/index.d.ts +1 -0
  24. package/dist/cjs/constants/index.js +1 -0
  25. package/dist/cjs/hooks/useAxisScales/index.d.ts +3 -3
  26. package/dist/cjs/hooks/useAxisScales/index.js +40 -7
  27. package/dist/cjs/hooks/useChartOptions/index.d.ts +3 -1
  28. package/dist/cjs/hooks/useChartOptions/index.js +3 -3
  29. package/dist/cjs/hooks/useChartOptions/tooltip.d.ts +4 -1
  30. package/dist/cjs/hooks/useChartOptions/tooltip.js +18 -3
  31. package/dist/cjs/hooks/useChartOptions/types.d.ts +7 -1
  32. package/dist/cjs/hooks/useChartOptions/x-axis.js +23 -11
  33. package/dist/cjs/hooks/useChartOptions/y-axis.d.ts +3 -1
  34. package/dist/cjs/hooks/useChartOptions/y-axis.js +30 -17
  35. package/dist/cjs/hooks/useCrosshair/index.d.ts +1 -1
  36. package/dist/cjs/hooks/useCrosshair/index.js +4 -2
  37. package/dist/cjs/hooks/useShapes/area/prepare-data.d.ts +1 -1
  38. package/dist/cjs/hooks/useShapes/area/prepare-data.js +3 -0
  39. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.d.ts +1 -1
  40. package/dist/cjs/hooks/useShapes/bar-x/prepare-data.js +3 -0
  41. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.d.ts +1 -1
  42. package/dist/cjs/hooks/useShapes/bar-y/prepare-data.js +8 -1
  43. package/dist/cjs/hooks/useShapes/index.d.ts +1 -1
  44. package/dist/cjs/hooks/useShapes/line/prepare-data.d.ts +1 -1
  45. package/dist/cjs/hooks/useShapes/line/prepare-data.js +3 -0
  46. package/dist/cjs/hooks/useShapes/scatter/prepare-data.d.ts +1 -1
  47. package/dist/cjs/hooks/useShapes/scatter/prepare-data.js +6 -0
  48. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.d.ts +1 -1
  49. package/dist/cjs/hooks/useShapes/waterfall/prepare-data.js +6 -3
  50. package/dist/cjs/hooks/useZoom/index.d.ts +1 -1
  51. package/dist/cjs/hooks/useZoom/types.d.ts +1 -1
  52. package/dist/cjs/hooks/useZoom/utils.d.ts +1 -1
  53. package/dist/cjs/hooks/useZoom/utils.js +22 -10
  54. package/dist/cjs/index.d.ts +1 -1
  55. package/dist/cjs/index.js +1 -1
  56. package/dist/cjs/types/chart/axis.d.ts +11 -1
  57. package/dist/cjs/types/chart/base.d.ts +1 -0
  58. package/dist/cjs/types/chart/tooltip.d.ts +3 -0
  59. package/dist/cjs/utils/chart/array.d.ts +1 -0
  60. package/dist/cjs/utils/chart/array.js +9 -0
  61. package/dist/cjs/utils/chart/axis-generators/bottom.js +3 -3
  62. package/dist/cjs/utils/chart/axis.d.ts +14 -8
  63. package/dist/cjs/utils/chart/axis.js +34 -9
  64. package/dist/cjs/utils/chart/format.js +2 -1
  65. package/dist/cjs/utils/chart/index.d.ts +1 -7
  66. package/dist/cjs/utils/chart/index.js +1 -17
  67. package/dist/cjs/utils/chart/text.d.ts +2 -1
  68. package/dist/cjs/utils/chart/text.js +3 -10
  69. package/dist/cjs/utils/chart/zoom.js +14 -8
  70. package/dist/{cjs/components/Axis → esm/components/AxisX}/AxisX.js +1 -15
  71. package/dist/{cjs/components/Axis → esm/components/AxisY}/AxisY.d.ts +2 -10
  72. package/dist/esm/components/AxisY/AxisY.js +173 -0
  73. package/dist/esm/components/AxisY/prepare-axis-data.d.ts +10 -0
  74. package/dist/esm/components/AxisY/prepare-axis-data.js +307 -0
  75. package/dist/esm/components/AxisY/styles.css +15 -0
  76. package/dist/esm/components/AxisY/types.d.ts +81 -0
  77. package/dist/esm/components/AxisY/types.js +1 -0
  78. package/dist/esm/components/AxisY/utils.d.ts +12 -0
  79. package/dist/esm/components/AxisY/utils.js +62 -0
  80. package/dist/esm/components/ChartInner/index.js +39 -6
  81. package/dist/esm/components/ChartInner/useChartInnerProps.d.ts +1 -1
  82. package/dist/esm/components/ChartInner/useChartInnerProps.js +15 -1
  83. package/dist/esm/components/Tooltip/ChartTooltipContent.d.ts +1 -0
  84. package/dist/esm/components/Tooltip/ChartTooltipContent.js +2 -2
  85. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.d.ts +2 -1
  86. package/dist/esm/components/Tooltip/DefaultTooltipContent/index.js +8 -5
  87. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.d.ts +11 -4
  88. package/dist/esm/components/Tooltip/DefaultTooltipContent/utils.js +17 -15
  89. package/dist/esm/components/Tooltip/index.js +1 -1
  90. package/dist/esm/constants/date.d.ts +1 -0
  91. package/dist/esm/constants/date.js +1 -0
  92. package/dist/esm/constants/index.d.ts +1 -0
  93. package/dist/esm/constants/index.js +1 -0
  94. package/dist/esm/hooks/useAxisScales/index.d.ts +3 -3
  95. package/dist/esm/hooks/useAxisScales/index.js +40 -7
  96. package/dist/esm/hooks/useChartOptions/index.d.ts +3 -1
  97. package/dist/esm/hooks/useChartOptions/index.js +3 -3
  98. package/dist/esm/hooks/useChartOptions/tooltip.d.ts +4 -1
  99. package/dist/esm/hooks/useChartOptions/tooltip.js +18 -3
  100. package/dist/esm/hooks/useChartOptions/types.d.ts +7 -1
  101. package/dist/esm/hooks/useChartOptions/x-axis.js +23 -11
  102. package/dist/esm/hooks/useChartOptions/y-axis.d.ts +3 -1
  103. package/dist/esm/hooks/useChartOptions/y-axis.js +30 -17
  104. package/dist/esm/hooks/useCrosshair/index.d.ts +1 -1
  105. package/dist/esm/hooks/useCrosshair/index.js +4 -2
  106. package/dist/esm/hooks/useShapes/area/prepare-data.d.ts +1 -1
  107. package/dist/esm/hooks/useShapes/area/prepare-data.js +3 -0
  108. package/dist/esm/hooks/useShapes/bar-x/prepare-data.d.ts +1 -1
  109. package/dist/esm/hooks/useShapes/bar-x/prepare-data.js +3 -0
  110. package/dist/esm/hooks/useShapes/bar-y/prepare-data.d.ts +1 -1
  111. package/dist/esm/hooks/useShapes/bar-y/prepare-data.js +8 -1
  112. package/dist/esm/hooks/useShapes/index.d.ts +1 -1
  113. package/dist/esm/hooks/useShapes/line/prepare-data.d.ts +1 -1
  114. package/dist/esm/hooks/useShapes/line/prepare-data.js +3 -0
  115. package/dist/esm/hooks/useShapes/scatter/prepare-data.d.ts +1 -1
  116. package/dist/esm/hooks/useShapes/scatter/prepare-data.js +6 -0
  117. package/dist/esm/hooks/useShapes/waterfall/prepare-data.d.ts +1 -1
  118. package/dist/esm/hooks/useShapes/waterfall/prepare-data.js +6 -3
  119. package/dist/esm/hooks/useZoom/index.d.ts +1 -1
  120. package/dist/esm/hooks/useZoom/types.d.ts +1 -1
  121. package/dist/esm/hooks/useZoom/utils.d.ts +1 -1
  122. package/dist/esm/hooks/useZoom/utils.js +22 -10
  123. package/dist/esm/index.d.ts +1 -1
  124. package/dist/esm/index.js +1 -1
  125. package/dist/esm/types/chart/axis.d.ts +11 -1
  126. package/dist/esm/types/chart/base.d.ts +1 -0
  127. package/dist/esm/types/chart/tooltip.d.ts +3 -0
  128. package/dist/esm/utils/chart/array.d.ts +1 -0
  129. package/dist/esm/utils/chart/array.js +9 -0
  130. package/dist/esm/utils/chart/axis-generators/bottom.js +3 -3
  131. package/dist/esm/utils/chart/axis.d.ts +14 -8
  132. package/dist/esm/utils/chart/axis.js +34 -9
  133. package/dist/esm/utils/chart/format.js +2 -1
  134. package/dist/esm/utils/chart/index.d.ts +1 -7
  135. package/dist/esm/utils/chart/index.js +1 -17
  136. package/dist/esm/utils/chart/text.d.ts +2 -1
  137. package/dist/esm/utils/chart/text.js +3 -10
  138. package/dist/esm/utils/chart/zoom.js +14 -8
  139. package/package.json +1 -1
  140. package/dist/cjs/components/Axis/AxisY.js +0 -416
  141. package/dist/cjs/components/Axis/index.d.ts +0 -2
  142. package/dist/cjs/components/Axis/index.js +0 -2
  143. package/dist/cjs/components/Tooltip/utils.d.ts +0 -30
  144. package/dist/cjs/components/Tooltip/utils.js +0 -126
  145. package/dist/esm/components/Axis/AxisY.js +0 -416
  146. package/dist/esm/components/Axis/index.d.ts +0 -2
  147. package/dist/esm/components/Axis/index.js +0 -2
  148. package/dist/esm/components/Tooltip/utils.d.ts +0 -30
  149. package/dist/esm/components/Tooltip/utils.js +0 -126
  150. /package/dist/cjs/components/{Axis → AxisX}/AxisX.d.ts +0 -0
  151. /package/dist/cjs/components/{Axis → AxisX}/styles.css +0 -0
  152. /package/dist/esm/components/{Axis → AxisX}/AxisX.d.ts +0 -0
  153. /package/dist/esm/components/{Axis → AxisX}/styles.css +0 -0
@@ -1,15 +1,22 @@
1
1
  import type { ChartSeriesData, ChartTooltip, ChartTooltipTotalsAggregationValue, ChartTooltipTotalsBuiltInAggregation, ChartXAxis, ChartYAxis, TooltipDataChunk, ValueFormat } from '../../../types';
2
2
  export type HoveredValue = string | number | null | undefined;
3
3
  export declare function getXRowData(data: ChartSeriesData, xAxis?: ChartXAxis | null): string | number | undefined;
4
- export declare function getDefaultValueFormat({ axis, }: {
4
+ export declare function getDefaultValueFormat({ axis, closestPointsRange, }: {
5
5
  axis?: ChartXAxis | ChartYAxis | null;
6
+ closestPointsRange?: number;
6
7
  }): ValueFormat | undefined;
7
- export declare const getMeasureValue: ({ data, xAxis, yAxis, valueFormat, }: {
8
+ export declare const getMeasureValue: ({ data, xAxis, yAxis, headerFormat, }: {
8
9
  data: TooltipDataChunk[];
9
10
  xAxis?: ChartXAxis | null;
10
11
  yAxis?: ChartYAxis;
11
- valueFormat?: ValueFormat;
12
- }) => string | null;
12
+ headerFormat?: ChartTooltip["headerFormat"];
13
+ }) => {
14
+ value: string | null;
15
+ formattedValue?: undefined;
16
+ } | {
17
+ value: string | number | undefined;
18
+ formattedValue: string;
19
+ } | null;
13
20
  export declare function getHoveredValues(args: {
14
21
  hovered: TooltipDataChunk[];
15
22
  xAxis?: ChartXAxis | null;
@@ -1,8 +1,7 @@
1
1
  import get from 'lodash/get';
2
2
  import { i18n } from '../../../i18n';
3
- import { getDataCategoryValue } from '../../../utils';
3
+ import { getDataCategoryValue, getDefaultDateFormat } from '../../../utils';
4
4
  import { getFormattedValue } from '../../../utils/chart/format';
5
- const DEFAULT_DATE_FORMAT = 'DD.MM.YY';
6
5
  function getRowData(fieldName, data, axis) {
7
6
  switch (axis === null || axis === void 0 ? void 0 : axis.type) {
8
7
  case 'category': {
@@ -20,7 +19,7 @@ export function getXRowData(data, xAxis) {
20
19
  function getYRowData(data, yAxis) {
21
20
  return getRowData('y', data, yAxis);
22
21
  }
23
- export function getDefaultValueFormat({ axis, }) {
22
+ export function getDefaultValueFormat({ axis, closestPointsRange, }) {
24
23
  switch (axis === null || axis === void 0 ? void 0 : axis.type) {
25
24
  case 'linear':
26
25
  case 'logarithmic': {
@@ -31,33 +30,36 @@ export function getDefaultValueFormat({ axis, }) {
31
30
  case 'datetime': {
32
31
  return {
33
32
  type: 'date',
34
- format: DEFAULT_DATE_FORMAT,
33
+ format: getDefaultDateFormat(closestPointsRange),
35
34
  };
36
35
  }
37
36
  default:
38
37
  return undefined;
39
38
  }
40
39
  }
41
- export const getMeasureValue = ({ data, xAxis, yAxis, valueFormat, }) => {
42
- var _a, _b, _c, _d;
40
+ export const getMeasureValue = ({ data, xAxis, yAxis, headerFormat, }) => {
41
+ var _a, _b, _c, _d, _e, _f;
43
42
  if (data.every((item) => ['pie', 'treemap', 'waterfall', 'sankey'].includes(item.series.type))) {
44
43
  return null;
45
44
  }
46
45
  if (data.some((item) => item.series.type === 'radar')) {
47
- return (_b = (_a = data[0].category) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : null;
46
+ const value = (_b = (_a = data[0].category) === null || _a === void 0 ? void 0 : _a.key) !== null && _b !== void 0 ? _b : null;
47
+ return { value };
48
48
  }
49
49
  if (data.some((item) => item.series.type === 'bar-y')) {
50
- const format = valueFormat !== null && valueFormat !== void 0 ? valueFormat : getDefaultValueFormat({ axis: yAxis });
51
- return getFormattedValue({
52
- value: getYRowData((_c = data[0]) === null || _c === void 0 ? void 0 : _c.data, yAxis),
53
- format,
50
+ const value = getYRowData((_c = data[0]) === null || _c === void 0 ? void 0 : _c.data, yAxis);
51
+ const formattedValue = getFormattedValue({
52
+ value: getYRowData((_d = data[0]) === null || _d === void 0 ? void 0 : _d.data, yAxis),
53
+ format: headerFormat,
54
54
  });
55
+ return { value, formattedValue };
55
56
  }
56
- const format = valueFormat !== null && valueFormat !== void 0 ? valueFormat : getDefaultValueFormat({ axis: xAxis });
57
- return getFormattedValue({
58
- value: getXRowData((_d = data[0]) === null || _d === void 0 ? void 0 : _d.data, xAxis),
59
- format,
57
+ const value = getXRowData((_e = data[0]) === null || _e === void 0 ? void 0 : _e.data, xAxis);
58
+ const formattedValue = getFormattedValue({
59
+ value: getXRowData((_f = data[0]) === null || _f === void 0 ? void 0 : _f.data, xAxis),
60
+ format: headerFormat,
60
61
  });
62
+ return { value, formattedValue };
61
63
  };
62
64
  export function getHoveredValues(args) {
63
65
  const { hovered, xAxis, yAxis } = args;
@@ -23,5 +23,5 @@ export const Tooltip = (props) => {
23
23
  }, [left, top]);
24
24
  return (hovered === null || hovered === void 0 ? void 0 : hovered.length) ? (React.createElement(Popup, { anchorElement: anchor, className: b({ pinned: tooltipPinned }), disableTransition: true, floatingStyles: tooltipPinned ? undefined : { pointerEvents: 'none' }, offset: { mainAxis: 20 }, onOpenChange: tooltipPinned ? handleOnOpenChange : undefined, open: true, placement: ['right', 'left', 'top', 'bottom'] },
25
25
  React.createElement("div", { className: b('popup-content') },
26
- React.createElement(ChartTooltipContent, { hovered: hovered, pinned: tooltipPinned, renderer: tooltip.renderer, rowRenderer: tooltip.rowRenderer, totals: tooltip.totals, valueFormat: tooltip.valueFormat, headerFormat: tooltip.headerFormat, xAxis: xAxis, yAxis: yAxis })))) : null;
26
+ React.createElement(ChartTooltipContent, { hovered: hovered, pinned: tooltipPinned, renderer: tooltip.renderer, rowRenderer: tooltip.rowRenderer, totals: tooltip.totals, valueFormat: tooltip.valueFormat, headerFormat: tooltip.headerFormat, xAxis: xAxis, yAxis: yAxis, qa: tooltip.qa })))) : null;
27
27
  };
@@ -0,0 +1 @@
1
+ export declare const DEFAULT_DATE_FORMAT = "DD.MM.YY";
@@ -0,0 +1 @@
1
+ export const DEFAULT_DATE_FORMAT = 'DD.MM.YY';
@@ -1,5 +1,6 @@
1
1
  export * from './axis';
2
2
  export * from './chart-types';
3
+ export * from './date';
3
4
  export * from './defaults';
4
5
  export * from './layout-algorithms';
5
6
  export * from './line-styles';
@@ -1,5 +1,6 @@
1
1
  export * from './axis';
2
2
  export * from './chart-types';
3
+ export * from './date';
3
4
  export * from './defaults';
4
5
  export * from './layout-algorithms';
5
6
  export * from './line-styles';
@@ -17,21 +17,21 @@ type Args = {
17
17
  };
18
18
  type ReturnValue = {
19
19
  xScale?: ChartScale;
20
- yScale?: ChartScale[];
20
+ yScale?: (ChartScale | undefined)[];
21
21
  };
22
22
  export declare function createYScale(args: {
23
23
  axis: PreparedAxis;
24
24
  boundsHeight: number;
25
25
  series: (PreparedSeries | ChartSeries)[];
26
26
  seriesOptions: PreparedSeriesOptions;
27
- }): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
27
+ }): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never> | undefined;
28
28
  export declare function createXScale(args: {
29
29
  axis: PreparedAxis | ChartAxis;
30
30
  boundsWidth: number;
31
31
  series: (PreparedSeries | ChartSeries)[];
32
32
  seriesOptions: PreparedSeriesOptions;
33
33
  hasZoomX?: boolean;
34
- }): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never>;
34
+ }): ScaleBand<string> | ScaleLinear<number, number, never> | ScaleTime<number, number, never> | undefined;
35
35
  /**
36
36
  * Uses to create scales for axis related series
37
37
  */
@@ -6,8 +6,23 @@ import { CHART_SERIES_WITH_VOLUME_ON_Y_AXIS, getAxisHeight, getDataCategoryValue
6
6
  import { getBarYLayoutForNumericScale, groupBarYDataByYValue } from '../utils';
7
7
  import { getBarXLayoutForNumericScale, groupBarXDataByXValue } from '../utils/bar-x';
8
8
  const X_AXIS_ZOOM_PADDING = 0.02;
9
- function isNumericalArrayData(data) {
10
- return data.every((d) => typeof d === 'number' || d === null);
9
+ function validateArrayData(data) {
10
+ let hasNumberAndNullValues;
11
+ let hasOnlyNullValues;
12
+ for (const d of data) {
13
+ const isNumber = typeof d === 'number';
14
+ const isNull = d === null;
15
+ hasNumberAndNullValues =
16
+ typeof hasNumberAndNullValues === 'undefined'
17
+ ? isNumber || isNull
18
+ : hasNumberAndNullValues && (isNumber || isNull);
19
+ hasOnlyNullValues =
20
+ typeof hasOnlyNullValues === 'undefined' ? isNull : hasOnlyNullValues && isNull;
21
+ if (!hasNumberAndNullValues) {
22
+ break;
23
+ }
24
+ }
25
+ return { hasNumberAndNullValues, hasOnlyNullValues };
11
26
  }
12
27
  function filterCategoriesByVisibleSeries(args) {
13
28
  const { axisDirection, categories, series } = args;
@@ -19,7 +34,8 @@ function filterCategoriesByVisibleSeries(args) {
19
34
  });
20
35
  }
21
36
  });
22
- return categories.filter((c) => visibleCategories.has(c));
37
+ const filteredCategories = categories.filter((c) => visibleCategories.has(c));
38
+ return filteredCategories.length > 0 ? filteredCategories : categories;
23
39
  }
24
40
  // axis is validated in `validation/index.ts`, so the value of `axis.type` is definitely valid.
25
41
  // eslint-disable-next-line consistent-return
@@ -56,6 +72,7 @@ function getYScaleRange(args) {
56
72
  }
57
73
  }
58
74
  }
75
+ // eslint-disable-next-line complexity
59
76
  export function createYScale(args) {
60
77
  const { axis, boundsHeight, series, seriesOptions } = args;
61
78
  const yMinProps = get(axis, 'min');
@@ -67,7 +84,11 @@ export function createYScale(args) {
67
84
  case 'linear':
68
85
  case 'logarithmic': {
69
86
  const domain = getDomainDataYBySeries(series);
70
- if (isNumericalArrayData(domain)) {
87
+ const { hasNumberAndNullValues, hasOnlyNullValues } = validateArrayData(domain);
88
+ if (hasOnlyNullValues || domain.length === 0) {
89
+ return undefined;
90
+ }
91
+ if (hasNumberAndNullValues) {
71
92
  const [yMinDomain, yMaxDomain] = extent(domain);
72
93
  const yMin = typeof yMinProps === 'number' ? yMinProps : yMinDomain;
73
94
  let yMax;
@@ -103,7 +124,11 @@ export function createYScale(args) {
103
124
  }
104
125
  else {
105
126
  const domain = getDomainDataYBySeries(series);
106
- if (isNumericalArrayData(domain)) {
127
+ const { hasNumberAndNullValues, hasOnlyNullValues } = validateArrayData(domain);
128
+ if (hasOnlyNullValues || domain.length === 0) {
129
+ return undefined;
130
+ }
131
+ if (hasNumberAndNullValues) {
107
132
  const [yMinTimestamp, yMaxTimestamp] = extent(domain);
108
133
  const yMin = typeof yMinProps === 'number' ? yMinProps : yMinTimestamp;
109
134
  const yMax = typeof yMaxProps === 'number' ? yMaxProps : yMaxTimestamp;
@@ -178,7 +203,11 @@ export function createXScale(args) {
178
203
  case 'linear':
179
204
  case 'logarithmic': {
180
205
  const domainData = getDomainDataXBySeries(series);
181
- if (isNumericalArrayData(domainData)) {
206
+ const { hasNumberAndNullValues, hasOnlyNullValues } = validateArrayData(domainData);
207
+ if (hasOnlyNullValues || domainData.length === 0) {
208
+ return undefined;
209
+ }
210
+ if (hasNumberAndNullValues) {
182
211
  const [xMinDomain, xMaxDomain] = extent(domainData);
183
212
  let xMin;
184
213
  let xMax;
@@ -227,7 +256,11 @@ export function createXScale(args) {
227
256
  case 'datetime': {
228
257
  let domain = null;
229
258
  const domainData = get(axis, 'timestamps') || getDomainDataXBySeries(series);
230
- if (isNumericalArrayData(domainData)) {
259
+ const { hasNumberAndNullValues, hasOnlyNullValues } = validateArrayData(domainData);
260
+ if (hasOnlyNullValues || domainData.length === 0) {
261
+ return undefined;
262
+ }
263
+ if (hasNumberAndNullValues) {
231
264
  const [xMinTimestamp, xMaxTimestamp] = extent(domainData);
232
265
  const xMin = typeof xMinProps === 'number' ? xMinProps : xMinTimestamp;
233
266
  const xMax = typeof xMaxProps === 'number' ? xMaxProps : xMaxTimestamp;
@@ -1,4 +1,4 @@
1
- import type { ChartSeries, ChartTitle, ChartTooltip, ChartOptions as GeneralChartOptions } from '../../types';
1
+ import type { ChartSeries, ChartTitle, ChartTooltip, ChartXAxis, ChartYAxis, ChartOptions as GeneralChartOptions } from '../../types';
2
2
  import type { ChartOptions } from './types';
3
3
  type Args = {
4
4
  seriesData: ChartSeries[];
@@ -6,6 +6,8 @@ type Args = {
6
6
  colors?: string[];
7
7
  title?: ChartTitle;
8
8
  tooltip?: ChartTooltip;
9
+ yAxes?: ChartYAxis[];
10
+ xAxis?: ChartXAxis;
9
11
  };
10
12
  export declare const useChartOptions: (args: Args) => ChartOptions;
11
13
  export {};
@@ -4,10 +4,10 @@ import { getPreparedChart } from './chart';
4
4
  import { getPreparedTitle } from './title';
5
5
  import { getPreparedTooltip } from './tooltip';
6
6
  export const useChartOptions = (args) => {
7
- const { chart, colors, seriesData, title, tooltip } = args;
7
+ const { chart, colors, seriesData, title, tooltip, yAxes, xAxis } = args;
8
8
  const options = React.useMemo(() => {
9
9
  const preparedTitle = getPreparedTitle({ title });
10
- const preparedTooltip = getPreparedTooltip({ tooltip });
10
+ const preparedTooltip = getPreparedTooltip({ tooltip, seriesData, yAxes, xAxis });
11
11
  const preparedChart = getPreparedChart({
12
12
  chart,
13
13
  preparedTitle,
@@ -19,6 +19,6 @@ export const useChartOptions = (args) => {
19
19
  title: preparedTitle,
20
20
  tooltip: preparedTooltip,
21
21
  };
22
- }, [chart, colors, seriesData, title, tooltip]);
22
+ }, [chart, colors, seriesData, title, tooltip, xAxis, yAxes]);
23
23
  return options;
24
24
  };
@@ -1,5 +1,8 @@
1
- import type { ChartData } from '../../types';
1
+ import type { ChartData, ChartSeries, ChartXAxis, ChartYAxis } from '../../types';
2
2
  import type { PreparedTooltip } from './types';
3
3
  export declare const getPreparedTooltip: (args: {
4
4
  tooltip: ChartData["tooltip"];
5
+ seriesData: ChartSeries[];
6
+ yAxes?: ChartYAxis[];
7
+ xAxis?: ChartXAxis;
5
8
  }) => PreparedTooltip;
@@ -1,6 +1,21 @@
1
1
  import get from 'lodash/get';
2
+ import { getDefaultValueFormat } from '../../components/Tooltip/DefaultTooltipContent/utils';
3
+ import { getDomainDataXBySeries, getDomainDataYBySeries, getMinSpaceBetween } from '../../utils';
4
+ function getDefaultHeaderFormat({ seriesData, yAxes, xAxis, }) {
5
+ if (seriesData.every((item) => ['pie', 'treemap', 'waterfall', 'sankey', 'radar'].includes(item.type))) {
6
+ return undefined;
7
+ }
8
+ if (seriesData.some((item) => item.type === 'bar-y')) {
9
+ const domainData = getDomainDataYBySeries(seriesData);
10
+ const closestPointsRange = getMinSpaceBetween(domainData, (d) => d);
11
+ return getDefaultValueFormat({ axis: yAxes === null || yAxes === void 0 ? void 0 : yAxes[0], closestPointsRange });
12
+ }
13
+ const domainData = getDomainDataXBySeries(seriesData);
14
+ const closestPointsRange = getMinSpaceBetween(domainData, (d) => d);
15
+ return getDefaultValueFormat({ axis: xAxis, closestPointsRange });
16
+ }
2
17
  export const getPreparedTooltip = (args) => {
3
- var _a;
4
- const { tooltip } = args;
5
- return Object.assign(Object.assign({}, tooltip), { enabled: get(tooltip, 'enabled', true), throttle: (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.throttle) !== null && _a !== void 0 ? _a : 0 });
18
+ var _a, _b;
19
+ const { tooltip, seriesData, yAxes, xAxis } = args;
20
+ return Object.assign(Object.assign({}, tooltip), { enabled: get(tooltip, 'enabled', true), throttle: (_a = tooltip === null || tooltip === void 0 ? void 0 : tooltip.throttle) !== null && _a !== void 0 ? _a : 0, headerFormat: (_b = tooltip === null || tooltip === void 0 ? void 0 : tooltip.headerFormat) !== null && _b !== void 0 ? _b : getDefaultHeaderFormat({ seriesData, yAxes, xAxis }) });
6
21
  };
@@ -13,7 +13,13 @@ export type PreparedChart = {
13
13
  margin: ChartMargin;
14
14
  zoom: PreparedZoom | null;
15
15
  };
16
- export type PreparedAxisPlotBand = Required<AxisPlotBand>;
16
+ export type PreparedAxisPlotBand = Required<AxisPlotBand> & {
17
+ label: {
18
+ text: string;
19
+ style: BaseTextStyle;
20
+ padding: number;
21
+ };
22
+ };
17
23
  export type PreparedAxisCrosshair = Required<AxisCrosshair>;
18
24
  export type PreparedAxisPlotLine = {
19
25
  value: number;
@@ -1,17 +1,25 @@
1
1
  import get from 'lodash/get';
2
2
  import { DASH_STYLE, DEFAULT_AXIS_LABEL_FONT_SIZE, axisCrosshairDefaults, axisLabelsDefaults, xAxisTitleDefaults, } from '../../constants';
3
- import { calculateCos, formatAxisTickLabel, getClosestPointsRange, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getMaxTickCount, getTicksCount, getXAxisItems, hasOverlappingLabels, wrapText, } from '../../utils';
3
+ import { calculateCos, calculateNumericProperty, formatAxisTickLabel, getAxisItems, getClosestPointsRange, getDefaultDateFormat, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getMaxTickCount, getTicksCount, hasOverlappingLabels, wrapText, } from '../../utils';
4
4
  import { createXScale } from '../useAxisScales';
5
5
  import { getAxisCategories, prepareAxisPlotLabel } from './utils';
6
- async function getLabelSettings({ axis, seriesData, seriesOptions, width, autoRotation = true, }) {
6
+ async function setLabelSettings({ axis, seriesData, seriesOptions, width, autoRotation = true, }) {
7
7
  const scale = createXScale({ axis, series: seriesData, seriesOptions, boundsWidth: width });
8
+ if (!scale) {
9
+ axis.labels.height = 0;
10
+ axis.labels.rotation = 0;
11
+ return;
12
+ }
8
13
  const tickCount = getTicksCount({ axis, range: width });
9
- const ticks = getXAxisItems({
14
+ const ticks = getAxisItems({
10
15
  scale: scale,
11
16
  count: tickCount,
12
17
  maxCount: getMaxTickCount({ width, axis }),
13
18
  });
14
19
  const step = getClosestPointsRange(axis, ticks);
20
+ if (axis.type === 'datetime' && !axis.labels.dateFormat) {
21
+ axis.labels.dateFormat = getDefaultDateFormat(step);
22
+ }
15
23
  const labels = ticks.map((value) => {
16
24
  return formatAxisTickLabel({
17
25
  axis,
@@ -38,10 +46,11 @@ async function getLabelSettings({ axis, seriesData, seriesOptions, width, autoRo
38
46
  })).maxHeight
39
47
  : axis.labels.lineHeight;
40
48
  const maxHeight = rotation ? calculateCos(rotation) * axis.labels.maxWidth : labelsHeight;
41
- return { height: Math.min(maxHeight, labelsHeight), rotation };
49
+ axis.labels.height = Math.min(maxHeight, labelsHeight);
50
+ axis.labels.rotation = rotation;
42
51
  }
43
52
  export const getPreparedXAxis = async ({ xAxis, seriesData, seriesOptions, width, }) => {
44
- var _a;
53
+ var _a, _b, _c, _d, _e;
45
54
  const titleText = get(xAxis, 'title.text', '');
46
55
  const titleStyle = Object.assign(Object.assign({}, xAxisTitleDefaults.style), get(xAxis, 'title.style'));
47
56
  const titleMaxRowsCount = get(xAxis, 'title.maxRowCount', xAxisTitleDefaults.maxRowCount);
@@ -74,7 +83,7 @@ export const getPreparedXAxis = async ({ xAxis, seriesData, seriesOptions, width
74
83
  width: 0,
75
84
  height: 0,
76
85
  lineHeight: labelsLineHeight,
77
- maxWidth: get(xAxis, 'labels.maxWidth', axisLabelsDefaults.maxWidth),
86
+ maxWidth: (_b = calculateNumericProperty({ base: width, value: (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.labels) === null || _a === void 0 ? void 0 : _a.maxWidth })) !== null && _b !== void 0 ? _b : axisLabelsDefaults.maxWidth,
78
87
  html: labelsHtml,
79
88
  },
80
89
  lineColor: get(xAxis, 'lineColor'),
@@ -96,7 +105,12 @@ export const getPreparedXAxis = async ({ xAxis, seriesData, seriesOptions, width
96
105
  enabled: get(xAxis, 'grid.enabled', true),
97
106
  },
98
107
  ticks: {
99
- pixelInterval: get(xAxis, 'ticks.pixelInterval'),
108
+ pixelInterval: ((_c = xAxis === null || xAxis === void 0 ? void 0 : xAxis.ticks) === null || _c === void 0 ? void 0 : _c.interval)
109
+ ? calculateNumericProperty({
110
+ base: width,
111
+ value: xAxis.ticks.interval,
112
+ })
113
+ : (_d = xAxis === null || xAxis === void 0 ? void 0 : xAxis.ticks) === null || _d === void 0 ? void 0 : _d.pixelInterval,
100
114
  },
101
115
  position: 'bottom',
102
116
  plotIndex: 0,
@@ -129,14 +143,12 @@ export const getPreparedXAxis = async ({ xAxis, seriesData, seriesOptions, width
129
143
  visible: get(xAxis, 'visible', true),
130
144
  order: xAxis === null || xAxis === void 0 ? void 0 : xAxis.order,
131
145
  };
132
- const { height, rotation } = await getLabelSettings({
146
+ await setLabelSettings({
133
147
  axis: preparedXAxis,
134
148
  seriesData,
135
149
  seriesOptions,
136
150
  width,
137
- autoRotation: (_a = xAxis === null || xAxis === void 0 ? void 0 : xAxis.labels) === null || _a === void 0 ? void 0 : _a.autoRotation,
151
+ autoRotation: (_e = xAxis === null || xAxis === void 0 ? void 0 : xAxis.labels) === null || _e === void 0 ? void 0 : _e.autoRotation,
138
152
  });
139
- preparedXAxis.labels.height = height;
140
- preparedXAxis.labels.rotation = rotation;
141
153
  return preparedXAxis;
142
154
  };
@@ -1,8 +1,10 @@
1
1
  import type { ChartSeries, ChartYAxis } from '../../types';
2
2
  import type { PreparedSeriesOptions } from '../useSeries/types';
3
3
  import type { PreparedAxis } from './types';
4
- export declare const getPreparedYAxis: ({ height, seriesData, seriesOptions, yAxis, }: {
4
+ export declare const getPreparedYAxis: ({ height, boundsHeight, width, seriesData, seriesOptions, yAxis, }: {
5
5
  height: number;
6
+ boundsHeight: number;
7
+ width: number;
6
8
  seriesData: ChartSeries[];
7
9
  seriesOptions: PreparedSeriesOptions;
8
10
  yAxis: ChartYAxis[] | undefined;
@@ -1,26 +1,35 @@
1
1
  import get from 'lodash/get';
2
+ import { getTickValues } from '../../components/AxisY/utils';
2
3
  import { DASH_STYLE, DEFAULT_AXIS_LABEL_FONT_SIZE, DEFAULT_AXIS_TYPE, axisCrosshairDefaults, axisLabelsDefaults, yAxisTitleDefaults, } from '../../constants';
3
- import { formatAxisTickLabel, getClosestPointsRange, getDefaultMinYAxisValue, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getScaleTicks, isAxisRelatedSeries, wrapText, } from '../../utils';
4
+ import { calculateNumericProperty, formatAxisTickLabel, getClosestPointsRange, getDefaultDateFormat, getDefaultMinYAxisValue, getHorizontalHtmlTextHeight, getHorizontalSvgTextHeight, getLabelsSize, getScaleTicks, getTextSizeFn, isAxisRelatedSeries, wrapText, } from '../../utils';
4
5
  import { createYScale } from '../useAxisScales';
5
6
  import { getAxisCategories, prepareAxisPlotLabel } from './utils';
6
7
  const getAxisLabelMaxWidth = async (args) => {
7
- const { axis, seriesData, seriesOptions } = args;
8
+ const { axis, seriesData, seriesOptions, height } = args;
8
9
  if (!axis.labels.enabled) {
9
10
  return { height: 0, width: 0 };
10
11
  }
11
12
  const scale = createYScale({
12
13
  axis,
13
- boundsHeight: 1,
14
+ boundsHeight: height,
14
15
  series: seriesData,
15
16
  seriesOptions,
16
17
  });
18
+ if (!scale) {
19
+ return { height: 0, width: 0 };
20
+ }
21
+ const getTextSize = getTextSizeFn({ style: axis.labels.style });
22
+ const labelLineHeight = (await getTextSize('Tmp')).height;
23
+ const tickValues = getTickValues({ axis, scale, labelLineHeight });
17
24
  const ticks = getScaleTicks(scale);
18
- // FIXME: it is necessary to filter data, since we do not draw overlapping ticks
19
- const step = getClosestPointsRange(axis, ticks);
20
- const labels = ticks.map((tick) => formatAxisTickLabel({
25
+ const tickStep = getClosestPointsRange(axis, ticks);
26
+ if (axis.type === 'datetime' && !axis.labels.dateFormat) {
27
+ axis.labels.dateFormat = getDefaultDateFormat(tickStep);
28
+ }
29
+ const labels = tickValues.map((tick) => formatAxisTickLabel({
21
30
  axis,
22
- value: tick,
23
- step,
31
+ value: tick.value,
32
+ step: tickStep,
24
33
  }));
25
34
  const size = await getLabelsSize({
26
35
  labels,
@@ -30,7 +39,7 @@ const getAxisLabelMaxWidth = async (args) => {
30
39
  });
31
40
  return { height: size.maxHeight, width: size.maxWidth };
32
41
  };
33
- export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, }) => {
42
+ export const getPreparedYAxis = ({ height, boundsHeight, width, seriesData, seriesOptions, yAxis, }) => {
34
43
  const axisByPlot = [];
35
44
  const axisItems = yAxis || [{}];
36
45
  const hasAxisRelatedSeries = seriesData.some(isAxisRelatedSeries);
@@ -38,7 +47,7 @@ export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, })
38
47
  return Promise.resolve([]);
39
48
  }
40
49
  return Promise.all(axisItems.map(async (axisItem) => {
41
- var _a, _b;
50
+ var _a, _b, _c, _d, _e, _f, _g;
42
51
  const plotIndex = get(axisItem, 'plotIndex', 0);
43
52
  const firstPlotAxis = !axisByPlot[plotIndex];
44
53
  if (firstPlotAxis) {
@@ -71,9 +80,7 @@ export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, })
71
80
  margin: labelsEnabled
72
81
  ? get(axisItem, 'labels.margin', axisLabelsDefaults.margin)
73
82
  : 0,
74
- padding: labelsEnabled
75
- ? get(axisItem, 'labels.padding', axisLabelsDefaults.padding)
76
- : 0,
83
+ padding: labelsEnabled ? get(axisItem, 'labels.padding', 4) : 0,
77
84
  dateFormat: get(axisItem, 'labels.dateFormat'),
78
85
  numberFormat: get(axisItem, 'labels.numberFormat'),
79
86
  style: labelsStyle,
@@ -81,7 +88,7 @@ export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, })
81
88
  width: 0,
82
89
  height: 0,
83
90
  lineHeight: labelsLineHeight,
84
- maxWidth: get(axisItem, 'labels.maxWidth', axisLabelsDefaults.maxWidth),
91
+ maxWidth: (_b = calculateNumericProperty({ base: width, value: (_a = axisItem.labels) === null || _a === void 0 ? void 0 : _a.maxWidth })) !== null && _b !== void 0 ? _b : axisLabelsDefaults.maxWidth,
85
92
  html: labelsHtml,
86
93
  },
87
94
  lineColor: get(axisItem, 'lineColor'),
@@ -96,15 +103,20 @@ export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, })
96
103
  align: get(axisItem, 'title.align', yAxisTitleDefaults.align),
97
104
  maxRowCount: titleMaxRowsCount,
98
105
  },
99
- min: (_a = get(axisItem, 'min')) !== null && _a !== void 0 ? _a : getDefaultMinYAxisValue(seriesData),
106
+ min: (_c = get(axisItem, 'min')) !== null && _c !== void 0 ? _c : getDefaultMinYAxisValue(seriesData),
100
107
  max: get(axisItem, 'max'),
101
108
  maxPadding: get(axisItem, 'maxPadding', 0.05),
102
109
  grid: {
103
110
  enabled: get(axisItem, 'grid.enabled', firstPlotAxis ||
104
- (!firstPlotAxis && !((_b = axisByPlot[plotIndex][0].visible) !== null && _b !== void 0 ? _b : true))),
111
+ (!firstPlotAxis && !((_d = axisByPlot[plotIndex][0].visible) !== null && _d !== void 0 ? _d : true))),
105
112
  },
106
113
  ticks: {
107
- pixelInterval: get(axisItem, 'ticks.pixelInterval'),
114
+ pixelInterval: ((_e = axisItem.ticks) === null || _e === void 0 ? void 0 : _e.interval)
115
+ ? calculateNumericProperty({
116
+ base: height,
117
+ value: (_f = axisItem.ticks) === null || _f === void 0 ? void 0 : _f.interval,
118
+ })
119
+ : (_g = axisItem.ticks) === null || _g === void 0 ? void 0 : _g.pixelInterval,
108
120
  },
109
121
  position: get(axisItem, 'position', defaultAxisPosition),
110
122
  plotIndex: get(axisItem, 'plotIndex', 0),
@@ -142,6 +154,7 @@ export const getPreparedYAxis = ({ height, seriesData, seriesOptions, yAxis, })
142
154
  axis: preparedAxis,
143
155
  seriesData,
144
156
  seriesOptions,
157
+ height: boundsHeight,
145
158
  });
146
159
  preparedAxis.labels.height = labelsHeight;
147
160
  preparedAxis.labels.width =
@@ -6,7 +6,7 @@ type Props = {
6
6
  width: number;
7
7
  height: number;
8
8
  xScale?: ChartScale;
9
- yScale?: ChartScale[];
9
+ yScale?: (ChartScale | undefined)[];
10
10
  split: PreparedSplit;
11
11
  plotElement: SVGGElement | null;
12
12
  dispatcher: Dispatch<object>;
@@ -63,11 +63,13 @@ export const useCrosshair = (props) => {
63
63
  }
64
64
  yAxes.forEach((yAxis, index, currentArr) => {
65
65
  const yAxisScale = yScale[index];
66
- if (index !== 0 && !yAxis.crosshair.snap && !currentArr[0].crosshair.snap) {
66
+ if (!yAxisScale ||
67
+ (index !== 0 && !yAxis.crosshair.snap && !currentArr[0].crosshair.snap)) {
67
68
  return;
68
69
  }
69
70
  if (yAxis.crosshair.enabled && (hovered === null || hovered === void 0 ? void 0 : hovered.length)) {
70
71
  const crosshairDataAttr = `data-crosshair-y-line-${index}`;
72
+ const crosshairPosition = getAxisPlotsPosition(yAxis, split);
71
73
  const crosshairSelection = svgElement
72
74
  .selectAll(`[${crosshairDataAttr}]`)
73
75
  .data(hovered.filter((node) => {
@@ -82,7 +84,7 @@ export const useCrosshair = (props) => {
82
84
  .attr(plotCrosshairDataAttr, 1)
83
85
  .attr(crosshairDataAttr, 1)
84
86
  .style('transform', yAxis.crosshair.snap
85
- ? getAxisPlotsPosition(yAxis, split)
87
+ ? `translate(${crosshairPosition[0]}px, ${crosshairPosition[1]}px)`
86
88
  : 'translate(0, 0)');
87
89
  crosshairSelection
88
90
  .append('path')
@@ -7,7 +7,7 @@ export declare const prepareAreaData: (args: {
7
7
  xAxis: PreparedAxis;
8
8
  xScale: ChartScale;
9
9
  yAxis: PreparedAxis[];
10
- yScale: ChartScale[];
10
+ yScale: (ChartScale | undefined)[];
11
11
  boundsHeight: number;
12
12
  isOutsideBounds: (x: number, y: number) => boolean;
13
13
  }) => Promise<PreparedAreaData[]>;
@@ -71,6 +71,9 @@ export const prepareAreaData = async (args) => {
71
71
  const yAxisIndex = s.yAxis;
72
72
  const seriesYAxis = yAxis[yAxisIndex];
73
73
  const seriesYScale = yScale[yAxisIndex];
74
+ if (!seriesYScale) {
75
+ continue;
76
+ }
74
77
  const yMin = getYValue({
75
78
  point: { y: 0 },
76
79
  points: s.data,
@@ -8,6 +8,6 @@ export declare const prepareBarXData: (args: {
8
8
  xAxis: PreparedAxis;
9
9
  xScale: ChartScale;
10
10
  yAxis: PreparedAxis[];
11
- yScale: ChartScale[];
11
+ yScale: (ChartScale | undefined)[];
12
12
  boundsHeight: number;
13
13
  }) => Promise<PreparedBarXData[]>;
@@ -112,6 +112,9 @@ export const prepareBarXData = async (args) => {
112
112
  const yValue = sortedData[yValueIndex];
113
113
  const yAxisIndex = yValue.series.yAxis;
114
114
  const seriesYScale = yScale[yAxisIndex];
115
+ if (!seriesYScale) {
116
+ continue;
117
+ }
115
118
  let xCenter;
116
119
  if (xAxis.type === 'category') {
117
120
  const xBandScale = xScale;
@@ -8,5 +8,5 @@ export declare const prepareBarYData: (args: {
8
8
  xAxis: PreparedAxis;
9
9
  xScale: ChartScale;
10
10
  yAxis: PreparedAxis[];
11
- yScale: ChartScale[];
11
+ yScale: (ChartScale | undefined)[];
12
12
  }) => Promise<BarYShapesArgs>;