@octanejs/recharts 0.1.16 → 0.1.18

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 (88) hide show
  1. package/package.json +4 -4
  2. package/src/animation/CSSTransitionAnimate.tsrx +142 -0
  3. package/src/cartesian/Area.tsrx +1096 -0
  4. package/src/cartesian/Area.tsrx.d.ts +340 -0
  5. package/src/cartesian/AreaRevealShape.tsrx +202 -0
  6. package/src/cartesian/CartesianGrid.tsrx +643 -0
  7. package/src/cartesian/CartesianGrid.tsrx.d.ts +219 -0
  8. package/src/cartesian/ErrorBar.tsrx +322 -0
  9. package/src/cartesian/ErrorBar.tsrx.d.ts +131 -0
  10. package/src/cartesian/Funnel.tsrx +833 -0
  11. package/src/cartesian/Funnel.tsrx.d.ts +274 -0
  12. package/src/cartesian/ReferenceLine.tsrx +452 -0
  13. package/src/cartesian/ReferenceLine.tsrx.d.ts +178 -0
  14. package/src/cartesian/Scatter.tsrx +1076 -0
  15. package/src/cartesian/Scatter.tsrx.d.ts +351 -0
  16. package/src/cartesian/ZAxis.tsrx +148 -0
  17. package/src/cartesian/ZAxis.tsrx.d.ts +102 -0
  18. package/src/chart/AreaChart.tsrx +22 -0
  19. package/src/chart/AreaChart.tsrx.d.ts +12 -0
  20. package/src/chart/ComposedChart.tsrx +22 -0
  21. package/src/chart/ComposedChart.tsrx.d.ts +12 -0
  22. package/src/chart/FunnelChart.tsrx +22 -0
  23. package/src/chart/FunnelChart.tsrx.d.ts +12 -0
  24. package/src/chart/PieChart.tsrx +31 -0
  25. package/src/chart/PieChart.tsrx.d.ts +31 -0
  26. package/src/chart/PolarChart.tsrx +121 -0
  27. package/src/chart/RadarChart.tsrx +53 -0
  28. package/src/chart/RadarChart.tsrx.d.ts +31 -0
  29. package/src/chart/RadialBarChart.tsrx +31 -0
  30. package/src/chart/RadialBarChart.tsrx.d.ts +31 -0
  31. package/src/chart/Sankey.tsrx +1542 -0
  32. package/src/chart/Sankey.tsrx.d.ts +253 -0
  33. package/src/chart/ScatterChart.tsrx +22 -0
  34. package/src/chart/ScatterChart.tsrx.d.ts +12 -0
  35. package/src/chart/SunburstChart.tsrx +495 -0
  36. package/src/chart/SunburstChart.tsrx.d.ts +146 -0
  37. package/src/chart/types.ts +19 -0
  38. package/src/component/Cursor.tsrx +157 -0
  39. package/src/component/DefaultLegendContent.tsrx +288 -0
  40. package/src/component/DefaultLegendContent.tsrx.d.ts +125 -0
  41. package/src/component/DefaultTooltipContent.tsrx +215 -0
  42. package/src/component/DefaultTooltipContent.tsrx.d.ts +87 -0
  43. package/src/component/Legend.tsrx +302 -0
  44. package/src/component/Legend.tsrx.d.ts +88 -0
  45. package/src/component/ResponsiveContainer.ts +1 -22
  46. package/src/component/ResponsiveContainer.tsrx +171 -0
  47. package/src/component/ResponsiveContainer.tsrx.d.ts +81 -0
  48. package/src/component/Tooltip.tsrx +425 -0
  49. package/src/component/Tooltip.tsrx.d.ts +246 -0
  50. package/src/component/TooltipBoundingBox.tsrx +135 -0
  51. package/src/context/CellsContext.ts +12 -0
  52. package/src/context/legendPayloadContext.tsrx +11 -0
  53. package/src/context/useTooltipAxis.ts +20 -0
  54. package/src/index.d.ts +236 -0
  55. package/src/index.ts +67 -0
  56. package/src/polar/Pie.tsrx +1224 -0
  57. package/src/polar/Pie.tsrx.d.ts +436 -0
  58. package/src/polar/PolarAngleAxis.tsrx +554 -0
  59. package/src/polar/PolarAngleAxis.tsrx.d.ts +215 -0
  60. package/src/polar/PolarGrid.tsrx +317 -0
  61. package/src/polar/PolarGrid.tsrx.d.ts +117 -0
  62. package/src/polar/PolarRadiusAxis.tsrx +463 -0
  63. package/src/polar/PolarRadiusAxis.tsrx.d.ts +209 -0
  64. package/src/polar/Radar.tsrx +696 -0
  65. package/src/polar/Radar.tsrx.d.ts +215 -0
  66. package/src/polar/RadialBar.tsrx +887 -0
  67. package/src/polar/RadialBar.tsrx.d.ts +340 -0
  68. package/src/state/ReportPolarOptions.tsrx +11 -0
  69. package/src/state/selectors/areaSelectors.ts +257 -0
  70. package/src/state/selectors/funnelSelectors.ts +86 -0
  71. package/src/state/selectors/pieSelectors.ts +134 -0
  72. package/src/state/selectors/polarGridSelectors.ts +43 -0
  73. package/src/state/selectors/polarScaleSelectors.ts +159 -0
  74. package/src/state/selectors/polarSelectors.ts +198 -0
  75. package/src/state/selectors/radarSelectors.ts +228 -0
  76. package/src/state/selectors/radialBarSelectors.ts +511 -0
  77. package/src/state/selectors/scatterSelectors.ts +168 -0
  78. package/src/util/FunnelUtils.tsrx +19 -0
  79. package/src/util/RadialBarUtils.tsrx +29 -0
  80. package/src/util/ScatterUtils.tsrx +34 -0
  81. package/src/util/cursor/getCursorPoints.ts +45 -0
  82. package/src/util/cursor/getCursorRectangle.ts +28 -0
  83. package/src/util/cursor/getRadialCursorPoints.ts +31 -0
  84. package/src/util/payload/getUniqPayload.ts +28 -0
  85. package/src/util/scale/CartesianScaleHelper.ts +71 -0
  86. package/src/util/tooltip/translate.ts +168 -0
  87. package/src/util/types.ts +3 -0
  88. package/src/util/useElementOffset.ts +147 -0
@@ -0,0 +1,134 @@
1
+ import { createSelector } from 'reselect';
2
+ import { ReactElement } from 'octane';
3
+ import { CellProps } from '../..';
4
+ import { computePieSectors, PieSectorDataItem } from '../../polar/Pie';
5
+ import { RechartsRootState } from '../store';
6
+ import { selectChartDataAndAlwaysIgnoreIndexes } from './dataSelectors';
7
+ import { ChartData, ChartDataState } from '../chartDataSlice';
8
+ import { ChartOffsetInternal } from '../../util/types';
9
+ import { selectChartOffsetInternal } from './selectChartOffsetInternal';
10
+ import type { LegendPayload } from '../../component/DefaultLegendContent';
11
+ import { getTooltipNameProp, getValueByDataKey } from '../../util/ChartUtils';
12
+ import { selectUnfilteredPolarItems } from './polarSelectors';
13
+ import type { PieSettings } from '../types/PieSettings';
14
+ import { GraphicalItemId } from '../graphicalItemsSlice';
15
+
16
+ const pickId = (_state: RechartsRootState, id: GraphicalItemId): GraphicalItemId => id;
17
+
18
+ const selectSynchronisedPieSettings: (
19
+ state: RechartsRootState,
20
+ id: GraphicalItemId,
21
+ ) => PieSettings | undefined = createSelector(
22
+ [selectUnfilteredPolarItems, pickId],
23
+ (graphicalItems, id) =>
24
+ graphicalItems.filter((item) => item.type === 'pie').find((item) => item.id === id),
25
+ );
26
+
27
+ // Keep stable reference to an empty array to prevent re-renders
28
+ const emptyArray: ReadonlyArray<ReactElement> = [];
29
+ const pickCells = (
30
+ _state: RechartsRootState,
31
+ _id: GraphicalItemId,
32
+ cells: ReadonlyArray<ReactElement> | undefined,
33
+ ): ReadonlyArray<ReactElement> | undefined => {
34
+ if (cells?.length === 0) {
35
+ return emptyArray;
36
+ }
37
+ return cells;
38
+ };
39
+
40
+ export const selectDisplayedData: (
41
+ state: RechartsRootState,
42
+ id: GraphicalItemId,
43
+ cells: ReadonlyArray<ReactElement> | undefined,
44
+ ) => ChartData | undefined = createSelector(
45
+ [selectChartDataAndAlwaysIgnoreIndexes, selectSynchronisedPieSettings, pickCells],
46
+ (
47
+ { chartData }: ChartDataState,
48
+ pieSettings: PieSettings | undefined,
49
+ cells,
50
+ ): ChartData | undefined => {
51
+ if (pieSettings == null) {
52
+ return undefined;
53
+ }
54
+ let displayedData: ChartData | undefined;
55
+ if (pieSettings?.data != null && pieSettings.data.length > 0) {
56
+ displayedData = pieSettings.data;
57
+ } else {
58
+ displayedData = chartData;
59
+ }
60
+
61
+ if ((!displayedData || !displayedData.length) && cells != null) {
62
+ displayedData = cells.map((cell: ReactElement<CellProps>) => ({
63
+ ...pieSettings.presentationProps,
64
+ ...cell.props,
65
+ }));
66
+ }
67
+
68
+ if (displayedData == null) {
69
+ return undefined;
70
+ }
71
+
72
+ return displayedData;
73
+ },
74
+ );
75
+
76
+ export const selectPieLegend: (
77
+ state: RechartsRootState,
78
+ id: GraphicalItemId,
79
+ cells: ReadonlyArray<ReactElement> | undefined,
80
+ ) => ReadonlyArray<LegendPayload> | undefined = createSelector(
81
+ [selectDisplayedData, selectSynchronisedPieSettings, pickCells],
82
+ (
83
+ displayedData: ChartData | undefined,
84
+ pieSettings: PieSettings | undefined,
85
+ cells: ReadonlyArray<ReactElement> | undefined,
86
+ ): ReadonlyArray<LegendPayload> | undefined => {
87
+ if (displayedData == null || pieSettings == null) {
88
+ return undefined;
89
+ }
90
+ return displayedData.map((entry, i): LegendPayload => {
91
+ const name = getValueByDataKey(entry, pieSettings.nameKey, pieSettings.name);
92
+ let color;
93
+ if (cells?.[i]?.props?.fill) {
94
+ color = cells[i].props.fill;
95
+ } else if (typeof entry === 'object' && entry != null && 'fill' in entry) {
96
+ color = entry.fill;
97
+ } else {
98
+ color = pieSettings.fill;
99
+ }
100
+ return {
101
+ value: getTooltipNameProp(name, pieSettings.dataKey),
102
+ dataKey: pieSettings.dataKey,
103
+ color,
104
+ // @ts-expect-error Legend payload.payload says it wants objects but our data can be unknown
105
+ payload: entry,
106
+ type: pieSettings.legendType,
107
+ };
108
+ });
109
+ },
110
+ );
111
+
112
+ export const selectPieSectors: (
113
+ state: RechartsRootState,
114
+ id: GraphicalItemId,
115
+ cells: ReadonlyArray<ReactElement> | undefined,
116
+ ) => ReadonlyArray<PieSectorDataItem> | undefined = createSelector(
117
+ [selectDisplayedData, selectSynchronisedPieSettings, pickCells, selectChartOffsetInternal],
118
+ (
119
+ displayedData: ChartData | undefined,
120
+ pieSettings: PieSettings | undefined,
121
+ cells,
122
+ offset: ChartOffsetInternal,
123
+ ): ReadonlyArray<PieSectorDataItem> | undefined => {
124
+ if (pieSettings == null || displayedData == null) {
125
+ return undefined;
126
+ }
127
+ return computePieSectors({
128
+ offset,
129
+ pieSettings,
130
+ displayedData,
131
+ cells,
132
+ });
133
+ },
134
+ );
@@ -0,0 +1,43 @@
1
+ import { createSelector } from 'reselect';
2
+ import { RechartsRootState } from '../store';
3
+ import { AxisId } from '../cartesianAxisSlice';
4
+ import { selectPolarAxisTicks } from './polarScaleSelectors';
5
+ import { CartesianTickItem } from '../../util/types';
6
+
7
+ export type PolarAngles = Array<number>;
8
+
9
+ export type PolarRadius = Array<number>;
10
+
11
+ const selectAngleAxisTicks = (state: RechartsRootState, anglexisId: AxisId) =>
12
+ selectPolarAxisTicks(state, 'angleAxis', anglexisId, false);
13
+
14
+ export const selectPolarGridAngles: (
15
+ state: RechartsRootState,
16
+ angleAxisId: AxisId,
17
+ ) => PolarAngles | undefined = createSelector(
18
+ [selectAngleAxisTicks],
19
+ (ticks: ReadonlyArray<CartesianTickItem> | undefined): PolarAngles | undefined => {
20
+ if (!ticks) {
21
+ return undefined;
22
+ }
23
+
24
+ return ticks.map((tick) => tick.coordinate);
25
+ },
26
+ );
27
+
28
+ const selectRadiusAxisTicks = (state: RechartsRootState, radiusAxisId: AxisId) =>
29
+ selectPolarAxisTicks(state, 'radiusAxis', radiusAxisId, false);
30
+
31
+ export const selectPolarGridRadii: (
32
+ state: RechartsRootState,
33
+ radiusAxisId: AxisId,
34
+ ) => PolarRadius | undefined = createSelector(
35
+ [selectRadiusAxisTicks],
36
+ (ticks: ReadonlyArray<CartesianTickItem> | undefined): PolarRadius | undefined => {
37
+ if (!ticks) {
38
+ return undefined;
39
+ }
40
+
41
+ return ticks.map((tick) => tick.coordinate);
42
+ },
43
+ );
@@ -0,0 +1,159 @@
1
+ import { createSelector } from 'reselect';
2
+ import { RechartsRootState } from '../store';
3
+ import { AxisId } from '../cartesianAxisSlice';
4
+ import {
5
+ combineAxisTicks,
6
+ combineCategoricalDomain,
7
+ combineGraphicalItemTicks,
8
+ selectDuplicateDomain,
9
+ selectRealScaleType,
10
+ selectRenderableAxisSettings,
11
+ } from './axisSelectors';
12
+ import {
13
+ selectAngleAxis,
14
+ selectAngleAxisRangeWithReversed,
15
+ selectRadiusAxis,
16
+ selectRadiusAxisRangeWithReversed,
17
+ } from './polarAxisSelectors';
18
+ import { CartesianTickItem } from '../../util/types';
19
+ import { selectChartLayout } from '../../context/chartLayoutContext';
20
+ import {
21
+ selectPolarAppliedValues,
22
+ selectPolarAxisCheckedDomain,
23
+ selectPolarNiceTicks,
24
+ } from './polarSelectors';
25
+ import { pickAxisType } from './pickAxisType';
26
+ import { RechartsScale, rechartsScaleFactory } from '../../util/scale/RechartsScale';
27
+ import type { CustomScaleDefinition } from '../../util/scale/CustomScaleDefinition';
28
+ import { combineConfiguredScale } from './combiners/combineConfiguredScale';
29
+
30
+ export const selectPolarAxis = (
31
+ state: RechartsRootState,
32
+ axisType: 'angleAxis' | 'radiusAxis',
33
+ axisId: AxisId,
34
+ ) => {
35
+ switch (axisType) {
36
+ case 'angleAxis': {
37
+ return selectAngleAxis(state, axisId);
38
+ }
39
+ case 'radiusAxis': {
40
+ return selectRadiusAxis(state, axisId);
41
+ }
42
+ default: {
43
+ throw new Error(`Unexpected axis type: ${axisType}`);
44
+ }
45
+ }
46
+ };
47
+
48
+ const selectPolarAxisRangeWithReversed = (
49
+ state: RechartsRootState,
50
+ axisType: 'angleAxis' | 'radiusAxis',
51
+ axisId: AxisId,
52
+ ) => {
53
+ switch (axisType) {
54
+ case 'angleAxis': {
55
+ return selectAngleAxisRangeWithReversed(state, axisId);
56
+ }
57
+ case 'radiusAxis': {
58
+ return selectRadiusAxisRangeWithReversed(state, axisId);
59
+ }
60
+ default: {
61
+ throw new Error(`Unexpected axis type: ${axisType}`);
62
+ }
63
+ }
64
+ };
65
+
66
+ const selectPolarConfiguredScale: (
67
+ state: RechartsRootState,
68
+ axisType: 'angleAxis' | 'radiusAxis',
69
+ polarAxisId: AxisId,
70
+ ) => CustomScaleDefinition | undefined = createSelector(
71
+ [
72
+ selectPolarAxis,
73
+ selectRealScaleType,
74
+ selectPolarAxisCheckedDomain,
75
+ selectPolarAxisRangeWithReversed,
76
+ ],
77
+ combineConfiguredScale,
78
+ );
79
+
80
+ export const selectPolarAxisScale: (
81
+ state: RechartsRootState,
82
+ axisType: 'angleAxis' | 'radiusAxis',
83
+ polarAxisId: AxisId,
84
+ ) => RechartsScale | undefined = createSelector([selectPolarConfiguredScale], rechartsScaleFactory);
85
+
86
+ export const selectPolarCategoricalDomain: (
87
+ state: RechartsRootState,
88
+ axisType: 'angleAxis' | 'radiusAxis',
89
+ polarAxisId: AxisId,
90
+ ) => ReadonlyArray<unknown> | undefined = createSelector(
91
+ [selectChartLayout, selectPolarAppliedValues, selectRenderableAxisSettings, pickAxisType],
92
+ combineCategoricalDomain,
93
+ );
94
+
95
+ export const selectPolarAxisTicks: (
96
+ state: RechartsRootState,
97
+ axisType: 'angleAxis' | 'radiusAxis',
98
+ polarAxisId: AxisId,
99
+ isPanorama: boolean,
100
+ ) => ReadonlyArray<CartesianTickItem> | undefined = createSelector(
101
+ [
102
+ selectChartLayout,
103
+ selectPolarAxis,
104
+ selectRealScaleType,
105
+ selectPolarAxisScale,
106
+ selectPolarNiceTicks,
107
+ selectPolarAxisRangeWithReversed,
108
+ selectDuplicateDomain,
109
+ selectPolarCategoricalDomain,
110
+ pickAxisType,
111
+ ],
112
+ combineAxisTicks,
113
+ );
114
+
115
+ export const selectPolarAngleAxisTicks: (
116
+ state: RechartsRootState,
117
+ axisType: 'angleAxis',
118
+ polarAxisId: AxisId,
119
+ isPanorama: boolean,
120
+ ) => ReadonlyArray<CartesianTickItem> | undefined = createSelector(
121
+ [selectPolarAxisTicks],
122
+ (ticks) => {
123
+ /*
124
+ * Angle axis is circular; so here we need to look for ticks that overlap (i.e., 0 and 360 degrees)
125
+ * and remove the duplicate tick to avoid rendering issues.
126
+ */
127
+ if (!ticks) {
128
+ return undefined;
129
+ }
130
+
131
+ const uniqueTicksMap = new Map<number, CartesianTickItem>();
132
+ ticks.forEach((tick) => {
133
+ const normalizedCoordinate = (tick.coordinate + 360) % 360;
134
+ if (!uniqueTicksMap.has(normalizedCoordinate)) {
135
+ uniqueTicksMap.set(normalizedCoordinate, tick);
136
+ }
137
+ });
138
+
139
+ return Array.from(uniqueTicksMap.values());
140
+ },
141
+ );
142
+
143
+ export const selectPolarGraphicalItemAxisTicks: (
144
+ state: RechartsRootState,
145
+ axisType: 'angleAxis' | 'radiusAxis',
146
+ polarAxisId: AxisId,
147
+ isPanorama: boolean,
148
+ ) => ReadonlyArray<CartesianTickItem> | undefined = createSelector(
149
+ [
150
+ selectChartLayout,
151
+ selectPolarAxis,
152
+ selectPolarAxisScale,
153
+ selectPolarAxisRangeWithReversed,
154
+ selectDuplicateDomain,
155
+ selectPolarCategoricalDomain,
156
+ pickAxisType,
157
+ ],
158
+ combineGraphicalItemTicks,
159
+ );
@@ -0,0 +1,198 @@
1
+ import { createSelector } from 'reselect';
2
+ import { AppliedChartData, ChartData } from '../chartDataSlice';
3
+ import { RechartsRootState } from '../store';
4
+ import { AxisId, BaseCartesianAxis } from '../cartesianAxisSlice';
5
+ import {
6
+ selectChartDataAndAlwaysIgnoreIndexes,
7
+ selectChartDataSliceIgnoringIndexes,
8
+ } from './dataSelectors';
9
+ import {
10
+ AppliedChartDataWithErrorDomain,
11
+ combineAppliedValues,
12
+ combineAxisDomain,
13
+ combineAxisDomainWithNiceTicks,
14
+ combineDisplayedData,
15
+ combineDomainOfAllAppliedNumericalValuesIncludingErrorValues,
16
+ combineGraphicalItemsData,
17
+ combineGraphicalItemsSettings,
18
+ combineNiceTicks,
19
+ combineNumericalDomain,
20
+ itemAxisPredicate,
21
+ selectAllErrorBarSettings,
22
+ selectBaseAxis,
23
+ selectDomainDefinition,
24
+ selectDomainFromUserPreference,
25
+ selectRealScaleType,
26
+ selectRenderableAxisSettings,
27
+ } from './axisSelectors';
28
+ import { PolarGraphicalItemSettings } from '../graphicalItemsSlice';
29
+ import { CategoricalDomain, NumberDomain } from '../../util/types';
30
+ import { selectChartLayout } from '../../context/chartLayoutContext';
31
+ import { getValueByDataKey } from '../../util/ChartUtils';
32
+ import { pickAxisType } from './pickAxisType';
33
+ import { pickAxisId } from './pickAxisId';
34
+ import { selectStackOffsetType } from './rootPropsSelectors';
35
+ import { combineCheckedDomain } from './combiners/combineCheckedDomain';
36
+
37
+ export type PolarAxisType = 'angleAxis' | 'radiusAxis';
38
+
39
+ export const selectUnfilteredPolarItems = (state: RechartsRootState) =>
40
+ state.graphicalItems.polarItems;
41
+
42
+ const selectAxisPredicate: (
43
+ _state: RechartsRootState,
44
+ axisType: PolarAxisType,
45
+ axisId: AxisId,
46
+ ) => (item: PolarGraphicalItemSettings) => boolean = createSelector(
47
+ [pickAxisType, pickAxisId],
48
+ itemAxisPredicate,
49
+ );
50
+
51
+ export const selectPolarItemsSettings: (
52
+ state: RechartsRootState,
53
+ axisType: PolarAxisType,
54
+ polarAxisId: AxisId,
55
+ ) => ReadonlyArray<PolarGraphicalItemSettings> = createSelector(
56
+ [selectUnfilteredPolarItems, selectBaseAxis, selectAxisPredicate],
57
+ combineGraphicalItemsSettings,
58
+ );
59
+
60
+ const selectPolarGraphicalItemsData: (
61
+ state: RechartsRootState,
62
+ axisType: PolarAxisType,
63
+ polarAxisId: AxisId,
64
+ ) => ChartData = createSelector([selectPolarItemsSettings], combineGraphicalItemsData);
65
+
66
+ export const selectPolarDisplayedData: (
67
+ state: RechartsRootState,
68
+ axisType: PolarAxisType,
69
+ polarAxisId: AxisId,
70
+ ) => ChartData = createSelector(
71
+ [selectPolarGraphicalItemsData, selectChartDataAndAlwaysIgnoreIndexes],
72
+ combineDisplayedData,
73
+ );
74
+
75
+ export const selectPolarAppliedValues: (
76
+ state: RechartsRootState,
77
+ axisType: PolarAxisType,
78
+ axisId: AxisId,
79
+ ) => AppliedChartData = createSelector(
80
+ [selectPolarDisplayedData, selectBaseAxis, selectPolarItemsSettings],
81
+ combineAppliedValues,
82
+ );
83
+
84
+ export const selectAllPolarAppliedNumericalValues: (
85
+ state: RechartsRootState,
86
+ axisType: PolarAxisType,
87
+ axisId: AxisId,
88
+ ) => ReadonlyArray<AppliedChartDataWithErrorDomain> = createSelector(
89
+ [selectPolarDisplayedData, selectBaseAxis, selectPolarItemsSettings],
90
+ (
91
+ data: ChartData,
92
+ axisSettings: BaseCartesianAxis,
93
+ items: ReadonlyArray<PolarGraphicalItemSettings>,
94
+ ): ReadonlyArray<AppliedChartDataWithErrorDomain> => {
95
+ if (items.length > 0) {
96
+ return data
97
+ .flatMap((entry) => {
98
+ return items.flatMap((item): AppliedChartDataWithErrorDomain | undefined => {
99
+ const valueByDataKey: unknown = getValueByDataKey(
100
+ entry,
101
+ axisSettings.dataKey ?? item.dataKey,
102
+ );
103
+ return {
104
+ value: valueByDataKey,
105
+ errorDomain: [], // polar charts do not have error bars
106
+ };
107
+ });
108
+ })
109
+ .filter(Boolean);
110
+ }
111
+ if (axisSettings?.dataKey != null) {
112
+ return data.map((item): AppliedChartDataWithErrorDomain => ({
113
+ value: getValueByDataKey(item, axisSettings.dataKey),
114
+ errorDomain: [],
115
+ }));
116
+ }
117
+ return data.map((entry): AppliedChartDataWithErrorDomain => ({
118
+ value: entry,
119
+ errorDomain: [],
120
+ }));
121
+ },
122
+ );
123
+
124
+ const unsupportedInPolarChart = (): undefined => undefined;
125
+
126
+ const selectDomainOfAllPolarAppliedNumericalValues: (
127
+ state: RechartsRootState,
128
+ axisType: PolarAxisType,
129
+ axisId: AxisId,
130
+ ) => NumberDomain | undefined = createSelector(
131
+ [
132
+ selectPolarDisplayedData,
133
+ selectBaseAxis,
134
+ selectPolarItemsSettings,
135
+ selectAllErrorBarSettings,
136
+ pickAxisType,
137
+ selectChartDataSliceIgnoringIndexes,
138
+ ],
139
+ combineDomainOfAllAppliedNumericalValuesIncludingErrorValues,
140
+ );
141
+
142
+ const selectPolarNumericalDomain: (
143
+ state: RechartsRootState,
144
+ axisType: PolarAxisType,
145
+ axisId: AxisId,
146
+ ) => NumberDomain | undefined = createSelector(
147
+ [
148
+ selectBaseAxis,
149
+ selectDomainDefinition,
150
+ selectDomainFromUserPreference,
151
+ unsupportedInPolarChart,
152
+ selectDomainOfAllPolarAppliedNumericalValues,
153
+ unsupportedInPolarChart,
154
+ selectChartLayout,
155
+ pickAxisType,
156
+ ],
157
+ combineNumericalDomain,
158
+ );
159
+
160
+ export const selectPolarAxisDomain: (
161
+ state: RechartsRootState,
162
+ axisType: PolarAxisType,
163
+ polarAxisId: AxisId,
164
+ ) => NumberDomain | CategoricalDomain | undefined = createSelector(
165
+ [
166
+ selectBaseAxis,
167
+ selectChartLayout,
168
+ selectPolarDisplayedData,
169
+ selectPolarAppliedValues,
170
+ selectStackOffsetType,
171
+ pickAxisType,
172
+ selectPolarNumericalDomain,
173
+ ],
174
+ combineAxisDomain,
175
+ );
176
+
177
+ export const selectPolarNiceTicks = createSelector(
178
+ [selectPolarAxisDomain, selectRenderableAxisSettings, selectRealScaleType],
179
+ combineNiceTicks,
180
+ );
181
+
182
+ export const selectPolarAxisDomainIncludingNiceTicks: (
183
+ state: RechartsRootState,
184
+ axisType: PolarAxisType,
185
+ polarAxisId: AxisId,
186
+ ) => NumberDomain | CategoricalDomain | undefined = createSelector(
187
+ [selectBaseAxis, selectPolarAxisDomain, selectPolarNiceTicks, pickAxisType],
188
+ combineAxisDomainWithNiceTicks,
189
+ );
190
+
191
+ export const selectPolarAxisCheckedDomain: (
192
+ state: RechartsRootState,
193
+ axisType: PolarAxisType,
194
+ polarAxisId: AxisId,
195
+ ) => NumberDomain | CategoricalDomain | undefined = createSelector(
196
+ [selectRealScaleType, selectPolarAxisDomainIncludingNiceTicks],
197
+ combineCheckedDomain,
198
+ );