@octanejs/recharts 0.1.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.
- package/LICENSE +21 -0
- package/package.json +53 -0
- package/src/animation/AnimatedItems.tsrx +82 -0
- package/src/animation/AnimationControllerImpl.js +33 -0
- package/src/animation/AnimationHandle.js +291 -0
- package/src/animation/JavascriptAnimate.tsrx +81 -0
- package/src/animation/easing.js +193 -0
- package/src/animation/matchBy.js +279 -0
- package/src/animation/timeoutController.js +49 -0
- package/src/animation/useAnimationController.ts +22 -0
- package/src/animation/useAnimationStartSnapshot.ts +43 -0
- package/src/animation/util.js +11 -0
- package/src/cartesian/Bar.ts +4 -0
- package/src/cartesian/Bar.tsrx +716 -0
- package/src/cartesian/Bar.tsrx.d.ts +4 -0
- package/src/cartesian/BarStack.tsrx +97 -0
- package/src/cartesian/BarStack.tsrx.d.ts +6 -0
- package/src/cartesian/CartesianAxis.tsrx +413 -0
- package/src/cartesian/CartesianAxis.tsrx.d.ts +3 -0
- package/src/cartesian/GraphicalItemClipPath.tsrx +44 -0
- package/src/cartesian/Line.ts +4 -0
- package/src/cartesian/Line.tsrx +544 -0
- package/src/cartesian/Line.tsrx.d.ts +4 -0
- package/src/cartesian/LineDrawShape.tsrx +106 -0
- package/src/cartesian/LineDrawShape.tsrx.d.ts +2 -0
- package/src/cartesian/XAxis.tsrx +156 -0
- package/src/cartesian/XAxis.tsrx.d.ts +3 -0
- package/src/cartesian/YAxis.tsrx +183 -0
- package/src/cartesian/YAxis.tsrx.d.ts +3 -0
- package/src/cartesian/getCartesianPosition.js +277 -0
- package/src/cartesian/getEquidistantTicks.js +133 -0
- package/src/cartesian/getTicks.js +280 -0
- package/src/cartesian/useAnimatedLineLength.ts +33 -0
- package/src/chart/BarChart.tsrx +22 -0
- package/src/chart/BarChart.tsrx.d.ts +2 -0
- package/src/chart/CartesianChart.tsrx +76 -0
- package/src/chart/CartesianChart.tsrx.d.ts +10 -0
- package/src/chart/CategoricalChart.tsrx +54 -0
- package/src/chart/LineChart.tsrx +22 -0
- package/src/chart/LineChart.tsrx.d.ts +2 -0
- package/src/chart/RechartsWrapper.tsrx +294 -0
- package/src/component/ActivePoints.tsrx +76 -0
- package/src/component/Cell.ts +37 -0
- package/src/component/Dots.tsrx +74 -0
- package/src/component/Label.tsrx +309 -0
- package/src/component/Label.tsrx.d.ts +12 -0
- package/src/component/LabelList.tsrx +83 -0
- package/src/component/LabelList.tsrx.d.ts +8 -0
- package/src/component/ResponsiveContainer.ts +22 -0
- package/src/component/Text.tsrx +281 -0
- package/src/component/Text.tsrx.d.ts +9 -0
- package/src/component/responsiveContainerUtils.js +111 -0
- package/src/container/ClipPathProvider.tsrx +29 -0
- package/src/container/Layer.tsrx +9 -0
- package/src/container/Layer.tsrx.d.ts +6 -0
- package/src/container/RootSurface.tsrx +76 -0
- package/src/container/Surface.tsrx +23 -0
- package/src/container/Surface.tsrx.d.ts +12 -0
- package/src/context/CellsContext.ts +80 -0
- package/src/context/ErrorBarContext.tsrx +53 -0
- package/src/context/PanoramaContext.ts +10 -0
- package/src/context/RegisterGraphicalItemId.tsrx +19 -0
- package/src/context/accessibilityContext.js +10 -0
- package/src/context/chartDataContext.ts +57 -0
- package/src/context/chartLayoutContext.ts +171 -0
- package/src/context/legendPortalContext.ts +5 -0
- package/src/context/tooltipContext.js +55 -0
- package/src/context/tooltipPortalContext.ts +5 -0
- package/src/hooks.js +509 -0
- package/src/index.ts +64 -0
- package/src/internal.ts +37 -0
- package/src/polar/defaultPolarAngleAxisProps.js +27 -0
- package/src/polar/defaultPolarRadiusAxisProps.js +24 -0
- package/src/shape/Cross.tsrx +25 -0
- package/src/shape/Cross.tsrx.d.ts +12 -0
- package/src/shape/Curve.tsrx +132 -0
- package/src/shape/Curve.tsrx.d.ts +42 -0
- package/src/shape/Dot.tsrx +21 -0
- package/src/shape/Dot.tsrx.d.ts +9 -0
- package/src/shape/Polygon.tsrx +95 -0
- package/src/shape/Polygon.tsrx.d.ts +13 -0
- package/src/shape/Rectangle.tsrx +162 -0
- package/src/shape/Rectangle.tsrx.d.ts +31 -0
- package/src/shape/Sector.tsrx +219 -0
- package/src/shape/Sector.tsrx.d.ts +29 -0
- package/src/shape/Symbols.tsrx +95 -0
- package/src/shape/Symbols.tsrx.d.ts +15 -0
- package/src/shape/Trapezoid.tsrx +56 -0
- package/src/shape/Trapezoid.tsrx.d.ts +29 -0
- package/src/state/RechartsReduxContext.ts +7 -0
- package/src/state/RechartsStoreProvider.tsrx +24 -0
- package/src/state/ReportChartProps.ts +13 -0
- package/src/state/ReportEventSettings.ts +15 -0
- package/src/state/ReportMainChartProps.ts +22 -0
- package/src/state/SetGraphicalItem.ts +61 -0
- package/src/state/SetLegendPayload.ts +61 -0
- package/src/state/SetTooltipEntrySettings.ts +40 -0
- package/src/state/brushSlice.js +36 -0
- package/src/state/cartesianAxisSlice.js +256 -0
- package/src/state/chartDataSlice.js +67 -0
- package/src/state/errorBarSlice.js +53 -0
- package/src/state/eventSettingsSlice.js +25 -0
- package/src/state/externalEventsMiddleware.js +127 -0
- package/src/state/graphicalItemsSlice.js +91 -0
- package/src/state/hooks.ts +46 -0
- package/src/state/keyboardEventsMiddleware.js +226 -0
- package/src/state/layoutSlice.js +57 -0
- package/src/state/legendSlice.js +83 -0
- package/src/state/mouseEventsMiddleware.js +130 -0
- package/src/state/optionsSlice.js +45 -0
- package/src/state/polarAxisSlice.js +33 -0
- package/src/state/polarOptionsSlice.js +26 -0
- package/src/state/reduxDevtoolsJsonStringifyReplacer.js +14 -0
- package/src/state/referenceElementsSlice.js +51 -0
- package/src/state/renderedTicksSlice.js +41 -0
- package/src/state/rootPropsSlice.js +48 -0
- package/src/state/selectors/arrayEqualityCheck.js +32 -0
- package/src/state/selectors/axisSelectors.js +2113 -0
- package/src/state/selectors/barSelectors.js +263 -0
- package/src/state/selectors/barStackSelectors.js +65 -0
- package/src/state/selectors/brushSelectors.js +21 -0
- package/src/state/selectors/combiners/combineActiveLabel.js +18 -0
- package/src/state/selectors/combiners/combineActiveTooltipIndex.js +75 -0
- package/src/state/selectors/combiners/combineAllBarPositions.js +169 -0
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +11 -0
- package/src/state/selectors/combiners/combineBarPosition.js +17 -0
- package/src/state/selectors/combiners/combineBarSizeList.js +115 -0
- package/src/state/selectors/combiners/combineCheckedDomain.js +44 -0
- package/src/state/selectors/combiners/combineConfiguredScale.js +46 -0
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +48 -0
- package/src/state/selectors/combiners/combineDisplayedStackedData.js +54 -0
- package/src/state/selectors/combiners/combineInverseScaleFunction.js +12 -0
- package/src/state/selectors/combiners/combineRealScaleType.js +36 -0
- package/src/state/selectors/combiners/combineStackedData.js +22 -0
- package/src/state/selectors/combiners/combineTooltipInteractionState.js +121 -0
- package/src/state/selectors/combiners/combineTooltipPayload.js +248 -0
- package/src/state/selectors/combiners/combineTooltipPayloadConfigurations.js +59 -0
- package/src/state/selectors/containerSelectors.js +6 -0
- package/src/state/selectors/dataSelectors.js +97 -0
- package/src/state/selectors/graphicalItemSelectors.js +25 -0
- package/src/state/selectors/legendSelectors.js +18 -0
- package/src/state/selectors/lineSelectors.js +106 -0
- package/src/state/selectors/numberDomainEqualityCheck.js +11 -0
- package/src/state/selectors/pickAxisId.js +3 -0
- package/src/state/selectors/pickAxisType.js +3 -0
- package/src/state/selectors/polarAxisSelectors.js +237 -0
- package/src/state/selectors/rootPropsSelectors.js +13 -0
- package/src/state/selectors/selectActivePropsFromChartPointer.js +23 -0
- package/src/state/selectors/selectAllAxes.js +15 -0
- package/src/state/selectors/selectChartOffset.js +12 -0
- package/src/state/selectors/selectChartOffsetInternal.js +174 -0
- package/src/state/selectors/selectPlotArea.js +19 -0
- package/src/state/selectors/selectTooltipAxisId.js +3 -0
- package/src/state/selectors/selectTooltipAxisType.js +25 -0
- package/src/state/selectors/selectTooltipEventType.js +27 -0
- package/src/state/selectors/selectTooltipPayloadSearcher.js +3 -0
- package/src/state/selectors/selectTooltipSettings.js +3 -0
- package/src/state/selectors/selectTooltipState.js +3 -0
- package/src/state/selectors/selectors.js +222 -0
- package/src/state/selectors/tooltipSelectors.js +471 -0
- package/src/state/selectors/touchSelectors.js +31 -0
- package/src/state/store.js +101 -0
- package/src/state/tooltipSlice.js +237 -0
- package/src/state/touchEventsMiddleware.js +140 -0
- package/src/state/types/StackedGraphicalItem.js +18 -0
- package/src/state/zIndexSlice.js +167 -0
- package/src/synchronisation/syncSelectors.js +5 -0
- package/src/synchronisation/useChartSynchronisation.tsrx +285 -0
- package/src/util/ActiveShapeUtils.tsrx +62 -0
- package/src/util/BarUtils.tsrx +35 -0
- package/src/util/CartesianUtils.js +66 -0
- package/src/util/ChartUtils.js +630 -0
- package/src/util/Constants.js +42 -0
- package/src/util/DOMUtils.js +180 -0
- package/src/util/DataUtils.js +199 -0
- package/src/util/Events.js +7 -0
- package/src/util/Global.js +13 -0
- package/src/util/LRUCache.js +58 -0
- package/src/util/LogUtils.js +29 -0
- package/src/util/PolarUtils.js +190 -0
- package/src/util/ReactUtils.ts +94 -0
- package/src/util/ReduceCSSCalc.js +260 -0
- package/src/util/TickUtils.js +43 -0
- package/src/util/YAxisUtils.js +43 -0
- package/src/util/axisPropsAreEqual.js +63 -0
- package/src/util/createEventProxy.js +18 -0
- package/src/util/excludeEventProps.js +172 -0
- package/src/util/getActiveCoordinate.js +253 -0
- package/src/util/getAxisTypeBasedOnLayout.js +17 -0
- package/src/util/getClassNameFromUnknown.js +8 -0
- package/src/util/getEveryNth.js +29 -0
- package/src/util/getRadiusAndStrokeWidthFromDot.js +28 -0
- package/src/util/getRelativeCoordinate.js +96 -0
- package/src/util/getSliced.js +11 -0
- package/src/util/isDomainSpecifiedByUser.js +255 -0
- package/src/util/isWellBehavedNumber.js +8 -0
- package/src/util/propsAreEqual.js +96 -0
- package/src/util/resolveDefaultProps.js +131 -0
- package/src/util/round.js +39 -0
- package/src/util/scale/RechartsScale.js +68 -0
- package/src/util/scale/createCategoricalInverse.js +77 -0
- package/src/util/scale/getNiceTickValues.js +354 -0
- package/src/util/scale/index.js +3 -0
- package/src/util/scale/util/arithmetic.js +51 -0
- package/src/util/stacks/getStackSeriesIdentifier.js +10 -0
- package/src/util/svgPropertiesAndEvents.ts +29 -0
- package/src/util/svgPropertiesNoEvents.js +383 -0
- package/src/util/types.ts +59 -0
- package/src/util/useAnimationId.ts +14 -0
- package/src/util/useId.ts +13 -0
- package/src/util/usePrefersReducedMotion.ts +30 -0
- package/src/util/useReportScale.ts +26 -0
- package/src/util/useUniqueId.js +34 -0
- package/src/zIndex/DefaultZIndexes.js +75 -0
- package/src/zIndex/ZIndexLayer.tsrx +80 -0
- package/src/zIndex/ZIndexLayer.tsrx.d.ts +2 -0
- package/src/zIndex/ZIndexPortal.tsrx +43 -0
- package/src/zIndex/getZIndexFromUnknown.js +15 -0
- package/src/zIndex/zIndexSelectors.js +45 -0
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/selectors/selectors.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
// Sanctioned deviation: es-toolkit compat imports normalized to the ESM barrel
|
|
4
|
+
// ('es-toolkit/compat') — the per-function subpaths are CJS-only and break
|
|
5
|
+
// consumers that compile this binding from source (vite dev prebundle).
|
|
6
|
+
import { createSelector } from 'reselect';
|
|
7
|
+
import { sortBy } from 'es-toolkit/compat';
|
|
8
|
+
import { useAppSelector } from '../hooks';
|
|
9
|
+
import { calculateCartesianTooltipPos, calculatePolarTooltipPos } from '../../util/ChartUtils';
|
|
10
|
+
import { selectChartDataWithIndexes } from './dataSelectors';
|
|
11
|
+
import {
|
|
12
|
+
selectTooltipAxisDomain,
|
|
13
|
+
selectTooltipAxisTicks,
|
|
14
|
+
selectTooltipDisplayedData,
|
|
15
|
+
} from './tooltipSelectors';
|
|
16
|
+
import { selectTooltipAxisDataKey } from './axisSelectors';
|
|
17
|
+
import { selectChartName } from './rootPropsSelectors';
|
|
18
|
+
import { selectChartLayout } from '../../context/chartLayoutContext';
|
|
19
|
+
import { selectChartOffsetInternal } from './selectChartOffsetInternal';
|
|
20
|
+
import { selectChartHeight, selectChartWidth } from './containerSelectors';
|
|
21
|
+
import { combineActiveLabel } from './combiners/combineActiveLabel';
|
|
22
|
+
import { combineTooltipInteractionState } from './combiners/combineTooltipInteractionState';
|
|
23
|
+
import { combineActiveTooltipIndex } from './combiners/combineActiveTooltipIndex';
|
|
24
|
+
import { combineCoordinateForDefaultIndex } from './combiners/combineCoordinateForDefaultIndex';
|
|
25
|
+
import { combineTooltipPayloadConfigurations } from './combiners/combineTooltipPayloadConfigurations';
|
|
26
|
+
import { selectTooltipPayloadSearcher } from './selectTooltipPayloadSearcher';
|
|
27
|
+
import { selectTooltipState } from './selectTooltipState';
|
|
28
|
+
import { combineTooltipPayload } from './combiners/combineTooltipPayload';
|
|
29
|
+
import {
|
|
30
|
+
calculateActiveTickIndex,
|
|
31
|
+
getActiveCartesianCoordinate,
|
|
32
|
+
getActivePolarCoordinate,
|
|
33
|
+
isInCartesianRange,
|
|
34
|
+
} from '../../util/getActiveCoordinate';
|
|
35
|
+
import { inRangeOfSector } from '../../util/PolarUtils';
|
|
36
|
+
export var useChartName = () => {
|
|
37
|
+
return useAppSelector(selectChartName);
|
|
38
|
+
};
|
|
39
|
+
var pickTooltipEventType = (_state, tooltipEventType) => tooltipEventType;
|
|
40
|
+
var pickTrigger = (_state, _tooltipEventType, trigger) => trigger;
|
|
41
|
+
var pickDefaultIndex = (_state, _tooltipEventType, _trigger, defaultIndex) => defaultIndex;
|
|
42
|
+
export var selectOrderedTooltipTicks = createSelector(selectTooltipAxisTicks, (ticks) =>
|
|
43
|
+
sortBy(ticks, (o) => o.coordinate),
|
|
44
|
+
);
|
|
45
|
+
export var selectTooltipInteractionState = createSelector(
|
|
46
|
+
[selectTooltipState, pickTooltipEventType, pickTrigger, pickDefaultIndex],
|
|
47
|
+
combineTooltipInteractionState,
|
|
48
|
+
);
|
|
49
|
+
export var selectActiveIndex = createSelector(
|
|
50
|
+
[
|
|
51
|
+
selectTooltipInteractionState,
|
|
52
|
+
selectTooltipDisplayedData,
|
|
53
|
+
selectTooltipAxisDataKey,
|
|
54
|
+
selectTooltipAxisDomain,
|
|
55
|
+
],
|
|
56
|
+
combineActiveTooltipIndex,
|
|
57
|
+
);
|
|
58
|
+
export var selectTooltipDataKey = (state, tooltipEventType, trigger) => {
|
|
59
|
+
if (tooltipEventType == null) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
var tooltipState = selectTooltipState(state);
|
|
63
|
+
if (tooltipEventType === 'axis') {
|
|
64
|
+
if (trigger === 'hover') {
|
|
65
|
+
return tooltipState.axisInteraction.hover.dataKey;
|
|
66
|
+
}
|
|
67
|
+
return tooltipState.axisInteraction.click.dataKey;
|
|
68
|
+
}
|
|
69
|
+
if (trigger === 'hover') {
|
|
70
|
+
return tooltipState.itemInteraction.hover.dataKey;
|
|
71
|
+
}
|
|
72
|
+
return tooltipState.itemInteraction.click.dataKey;
|
|
73
|
+
};
|
|
74
|
+
export var selectTooltipPayloadConfigurations = createSelector(
|
|
75
|
+
[selectTooltipState, pickTooltipEventType, pickTrigger, pickDefaultIndex],
|
|
76
|
+
combineTooltipPayloadConfigurations,
|
|
77
|
+
);
|
|
78
|
+
export var selectCoordinateForDefaultIndex = createSelector(
|
|
79
|
+
[
|
|
80
|
+
selectChartWidth,
|
|
81
|
+
selectChartHeight,
|
|
82
|
+
selectChartLayout,
|
|
83
|
+
selectChartOffsetInternal,
|
|
84
|
+
selectTooltipAxisTicks,
|
|
85
|
+
pickDefaultIndex,
|
|
86
|
+
selectTooltipPayloadConfigurations,
|
|
87
|
+
],
|
|
88
|
+
combineCoordinateForDefaultIndex,
|
|
89
|
+
);
|
|
90
|
+
export var selectActiveCoordinate = createSelector(
|
|
91
|
+
[selectTooltipInteractionState, selectCoordinateForDefaultIndex],
|
|
92
|
+
(tooltipInteractionState, defaultIndexCoordinate) => {
|
|
93
|
+
var _tooltipInteractionSt;
|
|
94
|
+
return (_tooltipInteractionSt = tooltipInteractionState.coordinate) !== null &&
|
|
95
|
+
_tooltipInteractionSt !== void 0
|
|
96
|
+
? _tooltipInteractionSt
|
|
97
|
+
: defaultIndexCoordinate;
|
|
98
|
+
},
|
|
99
|
+
);
|
|
100
|
+
export var selectActiveLabel = createSelector(
|
|
101
|
+
[selectTooltipAxisTicks, selectActiveIndex],
|
|
102
|
+
combineActiveLabel,
|
|
103
|
+
);
|
|
104
|
+
export var selectTooltipPayload = createSelector(
|
|
105
|
+
[
|
|
106
|
+
selectTooltipPayloadConfigurations,
|
|
107
|
+
selectActiveIndex,
|
|
108
|
+
selectChartDataWithIndexes,
|
|
109
|
+
selectTooltipAxisDataKey,
|
|
110
|
+
selectActiveLabel,
|
|
111
|
+
selectTooltipPayloadSearcher,
|
|
112
|
+
pickTooltipEventType,
|
|
113
|
+
],
|
|
114
|
+
combineTooltipPayload,
|
|
115
|
+
);
|
|
116
|
+
export var selectIsTooltipActive = createSelector(
|
|
117
|
+
[selectTooltipInteractionState, selectActiveIndex],
|
|
118
|
+
(tooltipInteractionState, activeIndex) => {
|
|
119
|
+
return {
|
|
120
|
+
isActive: tooltipInteractionState.active && activeIndex != null,
|
|
121
|
+
activeIndex,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
var combineActiveCartesianProps = (
|
|
126
|
+
chartEvent,
|
|
127
|
+
layout,
|
|
128
|
+
tooltipAxisType,
|
|
129
|
+
tooltipAxisRange,
|
|
130
|
+
tooltipTicks,
|
|
131
|
+
orderedTooltipTicks,
|
|
132
|
+
offset,
|
|
133
|
+
) => {
|
|
134
|
+
if (!chartEvent || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks) {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
if (!isInCartesianRange(chartEvent, offset)) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
var pos = calculateCartesianTooltipPos(chartEvent, layout);
|
|
141
|
+
var activeIndex = calculateActiveTickIndex(
|
|
142
|
+
pos,
|
|
143
|
+
orderedTooltipTicks,
|
|
144
|
+
tooltipTicks,
|
|
145
|
+
tooltipAxisType,
|
|
146
|
+
tooltipAxisRange,
|
|
147
|
+
);
|
|
148
|
+
var activeCoordinate = getActiveCartesianCoordinate(
|
|
149
|
+
layout,
|
|
150
|
+
tooltipTicks,
|
|
151
|
+
activeIndex,
|
|
152
|
+
chartEvent,
|
|
153
|
+
);
|
|
154
|
+
return {
|
|
155
|
+
activeIndex: String(activeIndex),
|
|
156
|
+
activeCoordinate,
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
var combineActivePolarProps = (
|
|
160
|
+
chartEvent,
|
|
161
|
+
layout,
|
|
162
|
+
polarViewBox,
|
|
163
|
+
tooltipAxisType,
|
|
164
|
+
tooltipAxisRange,
|
|
165
|
+
tooltipTicks,
|
|
166
|
+
orderedTooltipTicks,
|
|
167
|
+
) => {
|
|
168
|
+
if (!chartEvent || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks || !polarViewBox) {
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
var rangeObj = inRangeOfSector(chartEvent, polarViewBox);
|
|
172
|
+
if (!rangeObj) {
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
var pos = calculatePolarTooltipPos(rangeObj, layout);
|
|
176
|
+
var activeIndex = calculateActiveTickIndex(
|
|
177
|
+
pos,
|
|
178
|
+
orderedTooltipTicks,
|
|
179
|
+
tooltipTicks,
|
|
180
|
+
tooltipAxisType,
|
|
181
|
+
tooltipAxisRange,
|
|
182
|
+
);
|
|
183
|
+
var activeCoordinate = getActivePolarCoordinate(layout, tooltipTicks, activeIndex, rangeObj);
|
|
184
|
+
return {
|
|
185
|
+
activeIndex: String(activeIndex),
|
|
186
|
+
activeCoordinate,
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
export var combineActiveProps = (
|
|
190
|
+
chartEvent,
|
|
191
|
+
layout,
|
|
192
|
+
polarViewBox,
|
|
193
|
+
tooltipAxisType,
|
|
194
|
+
tooltipAxisRange,
|
|
195
|
+
tooltipTicks,
|
|
196
|
+
orderedTooltipTicks,
|
|
197
|
+
offset,
|
|
198
|
+
) => {
|
|
199
|
+
if (!chartEvent || !layout || !tooltipAxisType || !tooltipAxisRange || !tooltipTicks) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
if (layout === 'horizontal' || layout === 'vertical') {
|
|
203
|
+
return combineActiveCartesianProps(
|
|
204
|
+
chartEvent,
|
|
205
|
+
layout,
|
|
206
|
+
tooltipAxisType,
|
|
207
|
+
tooltipAxisRange,
|
|
208
|
+
tooltipTicks,
|
|
209
|
+
orderedTooltipTicks,
|
|
210
|
+
offset,
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
return combineActivePolarProps(
|
|
214
|
+
chartEvent,
|
|
215
|
+
layout,
|
|
216
|
+
polarViewBox,
|
|
217
|
+
tooltipAxisType,
|
|
218
|
+
tooltipAxisRange,
|
|
219
|
+
tooltipTicks,
|
|
220
|
+
orderedTooltipTicks,
|
|
221
|
+
);
|
|
222
|
+
};
|
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
// Vendored verbatim from recharts@3.9.2 es6/state/selectors/tooltipSelectors.js (framework-agnostic).
|
|
2
|
+
// Do not edit — update by re-vendoring when the recharts devDependency moves.
|
|
3
|
+
import { createSelector } from 'reselect';
|
|
4
|
+
import {
|
|
5
|
+
combineAllAppliedValues,
|
|
6
|
+
combineAreasDomain,
|
|
7
|
+
combineAxisDomain,
|
|
8
|
+
combineAxisDomainWithNiceTicks,
|
|
9
|
+
combineCategoricalDomain,
|
|
10
|
+
combineDisplayedData,
|
|
11
|
+
combineDomainOfAllAppliedNumericalValuesIncludingErrorValues,
|
|
12
|
+
combineDomainOfStackGroups,
|
|
13
|
+
combineDotsDomain,
|
|
14
|
+
combineDuplicateDomain,
|
|
15
|
+
combineGraphicalItemsData,
|
|
16
|
+
combineGraphicalItemsSettings,
|
|
17
|
+
combineLinesDomain,
|
|
18
|
+
combineNiceTicks,
|
|
19
|
+
combineNumericalDomain,
|
|
20
|
+
combineStackGroups,
|
|
21
|
+
filterGraphicalNotStackedItems,
|
|
22
|
+
filterReferenceElements,
|
|
23
|
+
getDomainDefinition,
|
|
24
|
+
itemAxisPredicate,
|
|
25
|
+
mergeDomains,
|
|
26
|
+
selectAllErrorBarSettings,
|
|
27
|
+
selectAxisRange,
|
|
28
|
+
selectHasBar,
|
|
29
|
+
selectReferenceAreas,
|
|
30
|
+
selectReferenceDots,
|
|
31
|
+
selectReferenceLines,
|
|
32
|
+
selectTooltipAxis,
|
|
33
|
+
selectTooltipAxisDataKey,
|
|
34
|
+
} from './axisSelectors';
|
|
35
|
+
import { selectChartLayout } from '../../context/chartLayoutContext';
|
|
36
|
+
import { isCategoricalAxis } from '../../util/ChartUtils';
|
|
37
|
+
import { selectChartDataWithIndexes, selectChartDataSliceWithIndexes } from './dataSelectors';
|
|
38
|
+
import {
|
|
39
|
+
selectChartName,
|
|
40
|
+
selectReverseStackOrder,
|
|
41
|
+
selectStackOffsetType,
|
|
42
|
+
} from './rootPropsSelectors';
|
|
43
|
+
import { isNotNil, mathSign } from '../../util/DataUtils';
|
|
44
|
+
import { combineAxisRangeWithReverse } from './combiners/combineAxisRangeWithReverse';
|
|
45
|
+
import {
|
|
46
|
+
combineTooltipEventType,
|
|
47
|
+
selectDefaultTooltipEventType,
|
|
48
|
+
selectValidateTooltipEventTypes,
|
|
49
|
+
} from './selectTooltipEventType';
|
|
50
|
+
import { combineActiveLabel } from './combiners/combineActiveLabel';
|
|
51
|
+
import { selectTooltipSettings } from './selectTooltipSettings';
|
|
52
|
+
import { combineTooltipInteractionState } from './combiners/combineTooltipInteractionState';
|
|
53
|
+
import { combineActiveTooltipIndex } from './combiners/combineActiveTooltipIndex';
|
|
54
|
+
import { combineCoordinateForDefaultIndex } from './combiners/combineCoordinateForDefaultIndex';
|
|
55
|
+
import { selectChartHeight, selectChartWidth } from './containerSelectors';
|
|
56
|
+
import { selectChartOffsetInternal } from './selectChartOffsetInternal';
|
|
57
|
+
import { combineTooltipPayloadConfigurations } from './combiners/combineTooltipPayloadConfigurations';
|
|
58
|
+
import { selectTooltipPayloadSearcher } from './selectTooltipPayloadSearcher';
|
|
59
|
+
import { selectTooltipState } from './selectTooltipState';
|
|
60
|
+
import { combineTooltipPayload } from './combiners/combineTooltipPayload';
|
|
61
|
+
import { selectTooltipAxisId } from './selectTooltipAxisId';
|
|
62
|
+
import { selectTooltipAxisType } from './selectTooltipAxisType';
|
|
63
|
+
import { combineDisplayedStackedData } from './combiners/combineDisplayedStackedData';
|
|
64
|
+
import { isStacked } from '../types/StackedGraphicalItem';
|
|
65
|
+
import { numericalDomainSpecifiedWithoutRequiringData } from '../../util/isDomainSpecifiedByUser';
|
|
66
|
+
import { numberDomainEqualityCheck } from './numberDomainEqualityCheck';
|
|
67
|
+
import { emptyArraysAreEqualCheck } from './arrayEqualityCheck';
|
|
68
|
+
import { rechartsScaleFactory } from '../../util/scale/RechartsScale';
|
|
69
|
+
import { isWellBehavedNumber } from '../../util/isWellBehavedNumber';
|
|
70
|
+
import { combineRealScaleType } from './combiners/combineRealScaleType';
|
|
71
|
+
import { combineConfiguredScale } from './combiners/combineConfiguredScale';
|
|
72
|
+
export var selectTooltipAxisRealScaleType = createSelector(
|
|
73
|
+
[selectTooltipAxis, selectHasBar, selectChartName],
|
|
74
|
+
combineRealScaleType,
|
|
75
|
+
);
|
|
76
|
+
export var selectAllUnfilteredGraphicalItems = createSelector(
|
|
77
|
+
[(state) => state.graphicalItems.cartesianItems, (state) => state.graphicalItems.polarItems],
|
|
78
|
+
(cartesianItems, polarItems) => [...cartesianItems, ...polarItems],
|
|
79
|
+
);
|
|
80
|
+
var selectTooltipAxisPredicate = createSelector(
|
|
81
|
+
[selectTooltipAxisType, selectTooltipAxisId],
|
|
82
|
+
itemAxisPredicate,
|
|
83
|
+
);
|
|
84
|
+
export var selectAllGraphicalItemsSettings = createSelector(
|
|
85
|
+
[selectAllUnfilteredGraphicalItems, selectTooltipAxis, selectTooltipAxisPredicate],
|
|
86
|
+
combineGraphicalItemsSettings,
|
|
87
|
+
{
|
|
88
|
+
memoizeOptions: {
|
|
89
|
+
resultEqualityCheck: emptyArraysAreEqualCheck,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
var selectAllStackedGraphicalItemsSettings = createSelector(
|
|
94
|
+
[selectAllGraphicalItemsSettings],
|
|
95
|
+
(graphicalItems) => graphicalItems.filter(isStacked),
|
|
96
|
+
);
|
|
97
|
+
export var selectTooltipGraphicalItemsData = createSelector(
|
|
98
|
+
[selectAllGraphicalItemsSettings],
|
|
99
|
+
combineGraphicalItemsData,
|
|
100
|
+
{
|
|
101
|
+
memoizeOptions: {
|
|
102
|
+
resultEqualityCheck: emptyArraysAreEqualCheck,
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
var selectAnyTooltipItemUsesChartData = createSelector([selectAllGraphicalItemsSettings], (items) =>
|
|
107
|
+
items.some((item) => !item.data),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Data for tooltip always use the data with indexes set by a Brush,
|
|
112
|
+
* and never accept the isPanorama flag:
|
|
113
|
+
* because Tooltip never displays inside the panorama anyway
|
|
114
|
+
* so we don't need to worry what would happen there.
|
|
115
|
+
*/
|
|
116
|
+
export var selectTooltipDisplayedData = createSelector(
|
|
117
|
+
[selectTooltipGraphicalItemsData, selectChartDataWithIndexes],
|
|
118
|
+
combineDisplayedData,
|
|
119
|
+
);
|
|
120
|
+
var selectTooltipStackedData = createSelector(
|
|
121
|
+
[selectAllStackedGraphicalItemsSettings, selectChartDataWithIndexes, selectTooltipAxis],
|
|
122
|
+
combineDisplayedStackedData,
|
|
123
|
+
);
|
|
124
|
+
var selectAllTooltipAppliedValues = createSelector(
|
|
125
|
+
[
|
|
126
|
+
selectTooltipDisplayedData,
|
|
127
|
+
selectTooltipAxis,
|
|
128
|
+
selectAllGraphicalItemsSettings,
|
|
129
|
+
selectChartDataWithIndexes,
|
|
130
|
+
selectAnyTooltipItemUsesChartData,
|
|
131
|
+
selectTooltipGraphicalItemsData,
|
|
132
|
+
],
|
|
133
|
+
combineAllAppliedValues,
|
|
134
|
+
);
|
|
135
|
+
var selectTooltipAxisDomainDefinition = createSelector([selectTooltipAxis], getDomainDefinition);
|
|
136
|
+
var selectTooltipDataOverflow = createSelector(
|
|
137
|
+
[selectTooltipAxis],
|
|
138
|
+
(axisSettings) => axisSettings.allowDataOverflow,
|
|
139
|
+
);
|
|
140
|
+
var selectTooltipDomainFromUserPreferences = createSelector(
|
|
141
|
+
[selectTooltipAxisDomainDefinition, selectTooltipDataOverflow],
|
|
142
|
+
numericalDomainSpecifiedWithoutRequiringData,
|
|
143
|
+
);
|
|
144
|
+
var selectAllStackedGraphicalItems = createSelector(
|
|
145
|
+
[selectAllGraphicalItemsSettings],
|
|
146
|
+
(graphicalItems) => graphicalItems.filter(isStacked),
|
|
147
|
+
);
|
|
148
|
+
var selectTooltipStackGroups = createSelector(
|
|
149
|
+
[
|
|
150
|
+
selectTooltipStackedData,
|
|
151
|
+
selectAllStackedGraphicalItems,
|
|
152
|
+
selectStackOffsetType,
|
|
153
|
+
selectReverseStackOrder,
|
|
154
|
+
],
|
|
155
|
+
combineStackGroups,
|
|
156
|
+
);
|
|
157
|
+
var selectTooltipDomainOfStackGroups = createSelector(
|
|
158
|
+
[
|
|
159
|
+
selectTooltipStackGroups,
|
|
160
|
+
selectChartDataWithIndexes,
|
|
161
|
+
selectTooltipAxisType,
|
|
162
|
+
selectTooltipDomainFromUserPreferences,
|
|
163
|
+
],
|
|
164
|
+
combineDomainOfStackGroups,
|
|
165
|
+
);
|
|
166
|
+
var selectTooltipItemsSettingsExceptStacked = createSelector(
|
|
167
|
+
[selectAllGraphicalItemsSettings],
|
|
168
|
+
filterGraphicalNotStackedItems,
|
|
169
|
+
);
|
|
170
|
+
var selectDomainOfAllAppliedNumericalValuesIncludingErrorValues = createSelector(
|
|
171
|
+
[
|
|
172
|
+
selectTooltipDisplayedData,
|
|
173
|
+
selectTooltipAxis,
|
|
174
|
+
selectTooltipItemsSettingsExceptStacked,
|
|
175
|
+
selectAllErrorBarSettings,
|
|
176
|
+
selectTooltipAxisType,
|
|
177
|
+
selectChartDataSliceWithIndexes,
|
|
178
|
+
],
|
|
179
|
+
combineDomainOfAllAppliedNumericalValuesIncludingErrorValues,
|
|
180
|
+
{
|
|
181
|
+
memoizeOptions: {
|
|
182
|
+
resultEqualityCheck: numberDomainEqualityCheck,
|
|
183
|
+
},
|
|
184
|
+
},
|
|
185
|
+
);
|
|
186
|
+
var selectReferenceDotsByTooltipAxis = createSelector(
|
|
187
|
+
[selectReferenceDots, selectTooltipAxisType, selectTooltipAxisId],
|
|
188
|
+
filterReferenceElements,
|
|
189
|
+
);
|
|
190
|
+
var selectTooltipReferenceDotsDomain = createSelector(
|
|
191
|
+
[selectReferenceDotsByTooltipAxis, selectTooltipAxisType],
|
|
192
|
+
combineDotsDomain,
|
|
193
|
+
);
|
|
194
|
+
var selectReferenceAreasByTooltipAxis = createSelector(
|
|
195
|
+
[selectReferenceAreas, selectTooltipAxisType, selectTooltipAxisId],
|
|
196
|
+
filterReferenceElements,
|
|
197
|
+
);
|
|
198
|
+
var selectTooltipReferenceAreasDomain = createSelector(
|
|
199
|
+
[selectReferenceAreasByTooltipAxis, selectTooltipAxisType],
|
|
200
|
+
combineAreasDomain,
|
|
201
|
+
);
|
|
202
|
+
var selectReferenceLinesByTooltipAxis = createSelector(
|
|
203
|
+
[selectReferenceLines, selectTooltipAxisType, selectTooltipAxisId],
|
|
204
|
+
filterReferenceElements,
|
|
205
|
+
);
|
|
206
|
+
var selectTooltipReferenceLinesDomain = createSelector(
|
|
207
|
+
[selectReferenceLinesByTooltipAxis, selectTooltipAxisType],
|
|
208
|
+
combineLinesDomain,
|
|
209
|
+
);
|
|
210
|
+
var selectTooltipReferenceElementsDomain = createSelector(
|
|
211
|
+
[
|
|
212
|
+
selectTooltipReferenceDotsDomain,
|
|
213
|
+
selectTooltipReferenceLinesDomain,
|
|
214
|
+
selectTooltipReferenceAreasDomain,
|
|
215
|
+
],
|
|
216
|
+
mergeDomains,
|
|
217
|
+
);
|
|
218
|
+
var selectTooltipNumericalDomain = createSelector(
|
|
219
|
+
[
|
|
220
|
+
selectTooltipAxis,
|
|
221
|
+
selectTooltipAxisDomainDefinition,
|
|
222
|
+
selectTooltipDomainFromUserPreferences,
|
|
223
|
+
selectTooltipDomainOfStackGroups,
|
|
224
|
+
selectDomainOfAllAppliedNumericalValuesIncludingErrorValues,
|
|
225
|
+
selectTooltipReferenceElementsDomain,
|
|
226
|
+
selectChartLayout,
|
|
227
|
+
selectTooltipAxisType,
|
|
228
|
+
],
|
|
229
|
+
combineNumericalDomain,
|
|
230
|
+
);
|
|
231
|
+
export var selectTooltipAxisDomain = createSelector(
|
|
232
|
+
[
|
|
233
|
+
selectTooltipAxis,
|
|
234
|
+
selectChartLayout,
|
|
235
|
+
selectTooltipDisplayedData,
|
|
236
|
+
selectAllTooltipAppliedValues,
|
|
237
|
+
selectStackOffsetType,
|
|
238
|
+
selectTooltipAxisType,
|
|
239
|
+
selectTooltipNumericalDomain,
|
|
240
|
+
],
|
|
241
|
+
combineAxisDomain,
|
|
242
|
+
);
|
|
243
|
+
var selectTooltipNiceTicks = createSelector(
|
|
244
|
+
[selectTooltipAxisDomain, selectTooltipAxis, selectTooltipAxisRealScaleType],
|
|
245
|
+
combineNiceTicks,
|
|
246
|
+
);
|
|
247
|
+
export var selectTooltipAxisDomainIncludingNiceTicks = createSelector(
|
|
248
|
+
[selectTooltipAxis, selectTooltipAxisDomain, selectTooltipNiceTicks, selectTooltipAxisType],
|
|
249
|
+
combineAxisDomainWithNiceTicks,
|
|
250
|
+
);
|
|
251
|
+
var selectTooltipAxisRange = (state) => {
|
|
252
|
+
var axisType = selectTooltipAxisType(state);
|
|
253
|
+
var axisId = selectTooltipAxisId(state);
|
|
254
|
+
var isPanorama = false; // Tooltip never displays in panorama so this is safe to assume
|
|
255
|
+
return selectAxisRange(state, axisType, axisId, isPanorama);
|
|
256
|
+
};
|
|
257
|
+
export var selectTooltipAxisRangeWithReverse = createSelector(
|
|
258
|
+
[selectTooltipAxis, selectTooltipAxisRange],
|
|
259
|
+
combineAxisRangeWithReverse,
|
|
260
|
+
);
|
|
261
|
+
var selectTooltipConfiguredScale = createSelector(
|
|
262
|
+
[
|
|
263
|
+
selectTooltipAxis,
|
|
264
|
+
selectTooltipAxisRealScaleType,
|
|
265
|
+
selectTooltipAxisDomainIncludingNiceTicks,
|
|
266
|
+
selectTooltipAxisRangeWithReverse,
|
|
267
|
+
],
|
|
268
|
+
combineConfiguredScale,
|
|
269
|
+
);
|
|
270
|
+
export var selectTooltipAxisScale = createSelector(
|
|
271
|
+
[selectTooltipConfiguredScale],
|
|
272
|
+
rechartsScaleFactory,
|
|
273
|
+
);
|
|
274
|
+
var selectTooltipDuplicateDomain = createSelector(
|
|
275
|
+
[selectChartLayout, selectAllTooltipAppliedValues, selectTooltipAxis, selectTooltipAxisType],
|
|
276
|
+
combineDuplicateDomain,
|
|
277
|
+
);
|
|
278
|
+
export var selectTooltipCategoricalDomain = createSelector(
|
|
279
|
+
[selectChartLayout, selectAllTooltipAppliedValues, selectTooltipAxis, selectTooltipAxisType],
|
|
280
|
+
combineCategoricalDomain,
|
|
281
|
+
);
|
|
282
|
+
var combineTicksOfTooltipAxis = (
|
|
283
|
+
layout,
|
|
284
|
+
axis,
|
|
285
|
+
realScaleType,
|
|
286
|
+
scale,
|
|
287
|
+
range,
|
|
288
|
+
duplicateDomain,
|
|
289
|
+
categoricalDomain,
|
|
290
|
+
axisType,
|
|
291
|
+
) => {
|
|
292
|
+
if (!axis) {
|
|
293
|
+
return undefined;
|
|
294
|
+
}
|
|
295
|
+
var type = axis.type;
|
|
296
|
+
var isCategorical = isCategoricalAxis(layout, axisType);
|
|
297
|
+
if (!scale) {
|
|
298
|
+
return undefined;
|
|
299
|
+
}
|
|
300
|
+
var offsetForBand = realScaleType === 'scaleBand' && scale.bandwidth ? scale.bandwidth() / 2 : 2;
|
|
301
|
+
var offset = type === 'category' && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
|
302
|
+
offset =
|
|
303
|
+
axisType === 'angleAxis' &&
|
|
304
|
+
range != null &&
|
|
305
|
+
(range === null || range === void 0 ? void 0 : range.length) >= 2
|
|
306
|
+
? mathSign(range[0] - range[1]) * 2 * offset
|
|
307
|
+
: offset;
|
|
308
|
+
|
|
309
|
+
// When axis is a categorical axis, but the type of axis is number or the scale of axis is not "auto"
|
|
310
|
+
if (isCategorical && categoricalDomain) {
|
|
311
|
+
return categoricalDomain
|
|
312
|
+
.map((entry, index) => {
|
|
313
|
+
var scaled = scale.map(entry);
|
|
314
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
315
|
+
return null;
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
coordinate: scaled + offset,
|
|
319
|
+
value: entry,
|
|
320
|
+
index,
|
|
321
|
+
offset,
|
|
322
|
+
};
|
|
323
|
+
})
|
|
324
|
+
.filter(isNotNil);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// When axis has duplicated text, serial numbers are used to generate scale
|
|
328
|
+
return scale
|
|
329
|
+
.domain()
|
|
330
|
+
.map((entry, index) => {
|
|
331
|
+
var scaled = scale.map(entry);
|
|
332
|
+
if (!isWellBehavedNumber(scaled)) {
|
|
333
|
+
return null;
|
|
334
|
+
}
|
|
335
|
+
return {
|
|
336
|
+
coordinate: scaled + offset,
|
|
337
|
+
// @ts-expect-error can't use Date as an index
|
|
338
|
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
|
339
|
+
index,
|
|
340
|
+
offset,
|
|
341
|
+
};
|
|
342
|
+
})
|
|
343
|
+
.filter(isNotNil);
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Of on four almost identical implementations of tick generation.
|
|
348
|
+
* The four horsemen of tick generation are:
|
|
349
|
+
* - {@link selectTooltipAxisTicks}
|
|
350
|
+
* - {@link combineAxisTicks}
|
|
351
|
+
* - {@link getTicksOfAxis}.
|
|
352
|
+
* - {@link combineGraphicalItemTicks}
|
|
353
|
+
*/
|
|
354
|
+
export var selectTooltipAxisTicks = createSelector(
|
|
355
|
+
[
|
|
356
|
+
selectChartLayout,
|
|
357
|
+
selectTooltipAxis,
|
|
358
|
+
selectTooltipAxisRealScaleType,
|
|
359
|
+
selectTooltipAxisScale,
|
|
360
|
+
selectTooltipAxisRange,
|
|
361
|
+
selectTooltipDuplicateDomain,
|
|
362
|
+
selectTooltipCategoricalDomain,
|
|
363
|
+
selectTooltipAxisType,
|
|
364
|
+
],
|
|
365
|
+
combineTicksOfTooltipAxis,
|
|
366
|
+
);
|
|
367
|
+
var selectTooltipEventType = createSelector(
|
|
368
|
+
[selectDefaultTooltipEventType, selectValidateTooltipEventTypes, selectTooltipSettings],
|
|
369
|
+
(defaultTooltipEventType, validateTooltipEventType, settings) =>
|
|
370
|
+
combineTooltipEventType(settings.shared, defaultTooltipEventType, validateTooltipEventType),
|
|
371
|
+
);
|
|
372
|
+
var selectTooltipTrigger = (state) => state.tooltip.settings.trigger;
|
|
373
|
+
var selectDefaultIndex = (state) => state.tooltip.settings.defaultIndex;
|
|
374
|
+
var selectTooltipInteractionState = createSelector(
|
|
375
|
+
[selectTooltipState, selectTooltipEventType, selectTooltipTrigger, selectDefaultIndex],
|
|
376
|
+
combineTooltipInteractionState,
|
|
377
|
+
);
|
|
378
|
+
export var selectActiveTooltipIndex = createSelector(
|
|
379
|
+
[
|
|
380
|
+
selectTooltipInteractionState,
|
|
381
|
+
selectTooltipDisplayedData,
|
|
382
|
+
selectTooltipAxisDataKey,
|
|
383
|
+
selectTooltipAxisDomain,
|
|
384
|
+
],
|
|
385
|
+
combineActiveTooltipIndex,
|
|
386
|
+
);
|
|
387
|
+
export var selectActiveLabel = createSelector(
|
|
388
|
+
[selectTooltipAxisTicks, selectActiveTooltipIndex],
|
|
389
|
+
combineActiveLabel,
|
|
390
|
+
);
|
|
391
|
+
export var selectActiveTooltipDataKey = createSelector(
|
|
392
|
+
[selectTooltipInteractionState],
|
|
393
|
+
(tooltipInteraction) => {
|
|
394
|
+
if (!tooltipInteraction) {
|
|
395
|
+
return undefined;
|
|
396
|
+
}
|
|
397
|
+
return tooltipInteraction.dataKey;
|
|
398
|
+
},
|
|
399
|
+
);
|
|
400
|
+
export var selectActiveTooltipGraphicalItemId = createSelector(
|
|
401
|
+
[selectTooltipInteractionState],
|
|
402
|
+
(tooltipInteraction) => {
|
|
403
|
+
if (!tooltipInteraction) {
|
|
404
|
+
return undefined;
|
|
405
|
+
}
|
|
406
|
+
return tooltipInteraction.graphicalItemId;
|
|
407
|
+
},
|
|
408
|
+
);
|
|
409
|
+
var selectTooltipPayloadConfigurations = createSelector(
|
|
410
|
+
[selectTooltipState, selectTooltipEventType, selectTooltipTrigger, selectDefaultIndex],
|
|
411
|
+
combineTooltipPayloadConfigurations,
|
|
412
|
+
);
|
|
413
|
+
var selectTooltipCoordinateForDefaultIndex = createSelector(
|
|
414
|
+
[
|
|
415
|
+
selectChartWidth,
|
|
416
|
+
selectChartHeight,
|
|
417
|
+
selectChartLayout,
|
|
418
|
+
selectChartOffsetInternal,
|
|
419
|
+
selectTooltipAxisTicks,
|
|
420
|
+
selectDefaultIndex,
|
|
421
|
+
selectTooltipPayloadConfigurations,
|
|
422
|
+
],
|
|
423
|
+
combineCoordinateForDefaultIndex,
|
|
424
|
+
);
|
|
425
|
+
export var selectActiveTooltipCoordinate = createSelector(
|
|
426
|
+
[selectTooltipInteractionState, selectTooltipCoordinateForDefaultIndex],
|
|
427
|
+
(tooltipInteractionState, defaultIndexCoordinate) => {
|
|
428
|
+
if (
|
|
429
|
+
tooltipInteractionState !== null &&
|
|
430
|
+
tooltipInteractionState !== void 0 &&
|
|
431
|
+
tooltipInteractionState.coordinate
|
|
432
|
+
) {
|
|
433
|
+
return tooltipInteractionState.coordinate;
|
|
434
|
+
}
|
|
435
|
+
return defaultIndexCoordinate;
|
|
436
|
+
},
|
|
437
|
+
);
|
|
438
|
+
export var selectIsTooltipActive = createSelector(
|
|
439
|
+
[selectTooltipInteractionState],
|
|
440
|
+
(tooltipInteractionState) => {
|
|
441
|
+
var _tooltipInteractionSt;
|
|
442
|
+
return (_tooltipInteractionSt =
|
|
443
|
+
tooltipInteractionState === null || tooltipInteractionState === void 0
|
|
444
|
+
? void 0
|
|
445
|
+
: tooltipInteractionState.active) !== null && _tooltipInteractionSt !== void 0
|
|
446
|
+
? _tooltipInteractionSt
|
|
447
|
+
: false;
|
|
448
|
+
},
|
|
449
|
+
);
|
|
450
|
+
export var selectActiveTooltipPayload = createSelector(
|
|
451
|
+
[
|
|
452
|
+
selectTooltipPayloadConfigurations,
|
|
453
|
+
selectActiveTooltipIndex,
|
|
454
|
+
selectChartDataWithIndexes,
|
|
455
|
+
selectTooltipAxisDataKey,
|
|
456
|
+
selectActiveLabel,
|
|
457
|
+
selectTooltipPayloadSearcher,
|
|
458
|
+
selectTooltipEventType,
|
|
459
|
+
],
|
|
460
|
+
combineTooltipPayload,
|
|
461
|
+
);
|
|
462
|
+
export var selectActiveTooltipDataPoints = createSelector(
|
|
463
|
+
[selectActiveTooltipPayload],
|
|
464
|
+
(payload) => {
|
|
465
|
+
if (payload == null) {
|
|
466
|
+
return undefined;
|
|
467
|
+
}
|
|
468
|
+
var dataPoints = payload.map((p) => p.payload).filter((p) => p != null);
|
|
469
|
+
return Array.from(new Set(dataPoints));
|
|
470
|
+
},
|
|
471
|
+
);
|