@octanejs/recharts 0.1.40 → 0.1.42
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 → LICENSE.recharts} +3 -2
- package/README.md +12 -0
- package/package.json +10 -9
- package/src/animation/AnimatedItems.tsrx +36 -3
- package/src/animation/AnimationController.ts +17 -65
- package/src/animation/{AnimationControllerImpl.js → AnimationControllerImpl.ts} +19 -12
- package/src/animation/{AnimationHandle.js → AnimationHandle.ts} +82 -65
- package/src/animation/CSSTransitionAnimate.tsrx +3 -2
- package/src/animation/JavascriptAnimate.tsrx +18 -2
- package/src/animation/easing.ts +235 -0
- package/src/animation/{matchBy.js → matchBy.ts} +76 -120
- package/src/animation/timeoutController.ts +71 -0
- package/src/animation/useAnimationController.ts +4 -1
- package/src/animation/useAnimationStartSnapshot.ts +3 -3
- package/src/animation/util.ts +12 -0
- package/src/cartesian/Area.tsrx +33 -31
- package/src/cartesian/AreaRevealShape.tsrx +4 -3
- package/src/cartesian/Bar.ts +1 -0
- package/src/cartesian/Bar.tsrx +293 -39
- package/src/cartesian/BarStack.tsrx +31 -9
- package/src/cartesian/CartesianAxis.tsrx +154 -22
- package/src/cartesian/CartesianGrid.tsrx +5 -6
- package/src/cartesian/ErrorBar.tsrx +9 -8
- package/src/cartesian/Funnel.tsrx +40 -37
- package/src/cartesian/GraphicalItemClipPath.tsrx +11 -4
- package/src/cartesian/Line.ts +1 -0
- package/src/cartesian/Line.tsrx +206 -28
- package/src/cartesian/LineDrawShape.tsrx +23 -10
- package/src/cartesian/ReferenceLine.tsrx +8 -8
- package/src/cartesian/Scatter.tsrx +61 -66
- package/src/cartesian/XAxis.tsrx +78 -9
- package/src/cartesian/YAxis.tsrx +85 -12
- package/src/cartesian/getCartesianPosition.ts +265 -0
- package/src/cartesian/getEquidistantTicks.ts +144 -0
- package/src/cartesian/getTicks.ts +221 -0
- package/src/chart/AreaChart.tsrx +5 -1
- package/src/chart/BarChart.tsrx +8 -2
- package/src/chart/CartesianChart.tsrx +17 -4
- package/src/chart/CategoricalChart.tsrx +4 -1
- package/src/chart/ComposedChart.tsrx +5 -1
- package/src/chart/FunnelChart.tsrx +5 -1
- package/src/chart/LineChart.tsrx +8 -2
- package/src/chart/PieChart.tsrx +6 -2
- package/src/chart/PolarChart.tsrx +5 -4
- package/src/chart/RadarChart.tsrx +6 -2
- package/src/chart/RadialBarChart.tsrx +6 -2
- package/src/chart/RechartsWrapper.tsrx +57 -21
- package/src/chart/Sankey.tsrx +89 -91
- package/src/chart/ScatterChart.tsrx +5 -1
- package/src/chart/SunburstChart.tsrx +21 -14
- package/src/chart/types.ts +0 -1
- package/src/component/ActivePoints.tsrx +30 -5
- package/src/component/Cell.ts +19 -1
- package/src/component/Cursor.tsrx +11 -10
- package/src/component/DefaultLegendContent.tsrx +15 -10
- package/src/component/DefaultTooltipContent.tsrx +11 -9
- package/src/component/Dots.tsrx +37 -6
- package/src/component/Label.tsrx +99 -19
- package/src/component/LabelList.tsrx +54 -5
- package/src/component/Legend.tsrx +9 -5
- package/src/component/ResponsiveContainer.tsrx +13 -10
- package/src/component/Text.tsrx +95 -32
- package/src/component/Tooltip.tsrx +11 -10
- package/src/component/TooltipBoundingBox.tsrx +4 -5
- package/src/component/{responsiveContainerUtils.js → responsiveContainerUtils.ts} +59 -36
- package/src/container/ClipPathProvider.tsrx +6 -2
- package/src/container/Layer.tsrx +8 -1
- package/src/container/RootSurface.tsrx +15 -4
- package/src/container/Surface.tsrx +15 -1
- package/src/context/CellsContext.ts +6 -5
- package/src/context/ErrorBarContext.tsrx +23 -4
- package/src/context/RegisterGraphicalItemId.tsrx +10 -2
- package/src/context/accessibilityContext.ts +5 -0
- package/src/context/brushUpdateContext.ts +11 -0
- package/src/context/chartDataContext.ts +5 -4
- package/src/context/chartLayoutContext.ts +22 -8
- package/src/context/legendPayloadContext.tsrx +1 -1
- package/src/context/tooltipContext.ts +83 -0
- package/src/{hooks.js → hooks.ts} +88 -66
- package/src/index.ts +37 -37
- package/src/internal.ts +4 -20
- package/src/legacy-props.ts +129 -0
- package/src/polar/Pie.tsrx +91 -69
- package/src/polar/PolarAngleAxis.tsrx +47 -47
- package/src/polar/PolarGrid.tsrx +7 -6
- package/src/polar/PolarRadiusAxis.tsrx +29 -21
- package/src/polar/Radar.tsrx +26 -19
- package/src/polar/RadialBar.tsrx +59 -42
- package/src/polar/{defaultPolarAngleAxisProps.js → defaultPolarAngleAxisProps.ts} +6 -6
- package/src/polar/{defaultPolarRadiusAxisProps.js → defaultPolarRadiusAxisProps.ts} +5 -4
- package/src/shape/Cross.tsrx +14 -2
- package/src/shape/Curve.tsrx +111 -23
- package/src/shape/Dot.tsrx +12 -1
- package/src/shape/Polygon.tsrx +28 -6
- package/src/shape/Rectangle.tsrx +30 -3
- package/src/shape/Sector.tsrx +48 -6
- package/src/shape/Symbols.tsrx +24 -6
- package/src/shape/Trapezoid.tsrx +33 -3
- package/src/state/RechartsStoreProvider.tsrx +11 -2
- package/src/state/ReportChartProps.ts +2 -2
- package/src/state/ReportMainChartProps.ts +2 -1
- package/src/state/SetGraphicalItem.ts +6 -4
- package/src/state/SetLegendPayload.ts +7 -4
- package/src/state/SetTooltipEntrySettings.ts +5 -2
- package/src/state/brushSlice.ts +40 -0
- package/src/state/cartesianAxisSlice.ts +291 -0
- package/src/state/chartDataSlice.ts +87 -0
- package/src/state/errorBarSlice.ts +78 -0
- package/src/state/eventSettingsSlice.ts +30 -0
- package/src/state/{externalEventsMiddleware.js → externalEventsMiddleware.ts} +55 -34
- package/src/state/graphicalItemsSlice.ts +180 -0
- package/src/state/{keyboardEventsMiddleware.js → keyboardEventsMiddleware.ts} +72 -57
- package/src/state/layoutSlice.ts +50 -0
- package/src/state/legendSlice.ts +109 -0
- package/src/state/{mouseEventsMiddleware.js → mouseEventsMiddleware.ts} +45 -35
- package/src/state/optionsSlice.ts +65 -0
- package/src/state/polarAxisSlice.ts +42 -0
- package/src/state/polarOptionsSlice.ts +43 -0
- package/src/state/reduxDevtoolsJsonStringifyReplacer.ts +13 -0
- package/src/state/referenceElementsSlice.ts +100 -0
- package/src/state/renderedTicksSlice.ts +60 -0
- package/src/state/rootPropsSlice.ts +72 -0
- package/src/state/selectors/areaSelectors.ts +1 -2
- package/src/state/selectors/{arrayEqualityCheck.js → arrayEqualityCheck.ts} +4 -5
- package/src/state/selectors/axisSelectors.ts +2502 -0
- package/src/state/selectors/barSelectors.ts +373 -0
- package/src/state/selectors/barStackSelectors.ts +99 -0
- package/src/state/selectors/brushSelectors.ts +28 -0
- package/src/state/selectors/combiners/combineActiveLabel.ts +16 -0
- package/src/state/selectors/combiners/{combineActiveTooltipIndex.js → combineActiveTooltipIndex.ts} +45 -23
- package/src/state/selectors/combiners/combineAllBarPositions.ts +130 -0
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.ts +16 -0
- package/src/state/selectors/combiners/combineBarPosition.ts +23 -0
- package/src/state/selectors/combiners/combineBarSizeList.ts +79 -0
- package/src/state/selectors/combiners/{combineCheckedDomain.js → combineCheckedDomain.ts} +9 -6
- package/src/state/selectors/combiners/combineConfiguredScale.ts +100 -0
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.ts +46 -0
- package/src/state/selectors/combiners/{combineDisplayedStackedData.js → combineDisplayedStackedData.ts} +23 -19
- package/src/state/selectors/combiners/combineInverseScaleFunction.ts +16 -0
- package/src/state/selectors/combiners/{combineRealScaleType.js → combineRealScaleType.ts} +16 -8
- package/src/state/selectors/combiners/combineStackedData.ts +27 -0
- package/src/state/selectors/combiners/combineTooltipInteractionState.ts +86 -0
- package/src/state/selectors/combiners/combineTooltipPayload.ts +201 -0
- package/src/state/selectors/combiners/{combineTooltipPayloadConfigurations.js → combineTooltipPayloadConfigurations.ts} +17 -18
- package/src/state/selectors/containerSelectors.ts +12 -0
- package/src/state/selectors/{dataSelectors.js → dataSelectors.ts} +43 -41
- package/src/state/selectors/funnelSelectors.ts +5 -5
- package/src/state/selectors/graphicalItemSelectors.ts +22 -0
- package/src/state/selectors/legendSelectors.ts +25 -0
- package/src/state/selectors/lineSelectors.ts +159 -0
- package/src/state/selectors/numberDomainEqualityCheck.ts +15 -0
- package/src/state/selectors/pickAxisId.ts +6 -0
- package/src/state/selectors/pickAxisType.ts +4 -0
- package/src/state/selectors/pieSelectors.ts +14 -13
- package/src/state/selectors/polarAxisSelectors.ts +223 -0
- package/src/state/selectors/polarSelectors.ts +1 -1
- package/src/state/selectors/radarSelectors.ts +1 -1
- package/src/state/selectors/radialBarSelectors.ts +17 -16
- package/src/state/selectors/rootPropsSelectors.ts +26 -0
- package/src/state/selectors/scatterSelectors.ts +11 -10
- package/src/state/selectors/{selectActivePropsFromChartPointer.js → selectActivePropsFromChartPointer.ts} +11 -4
- package/src/state/selectors/selectAllAxes.ts +20 -0
- package/src/state/selectors/selectChartOffset.ts +17 -0
- package/src/state/selectors/selectChartOffsetInternal.ts +147 -0
- package/src/state/selectors/{selectPlotArea.js → selectPlotArea.ts} +4 -3
- package/src/state/selectors/selectTooltipAxisId.ts +6 -0
- package/src/state/selectors/{selectTooltipAxisType.js → selectTooltipAxisType.ts} +10 -4
- package/src/state/selectors/selectTooltipEventType.ts +39 -0
- package/src/state/selectors/selectTooltipPayloadSearcher.ts +6 -0
- package/src/state/selectors/selectTooltipSettings.ts +6 -0
- package/src/state/selectors/selectTooltipState.ts +5 -0
- package/src/state/selectors/selectors.ts +315 -0
- package/src/state/selectors/tooltipSelectors.ts +611 -0
- package/src/state/selectors/touchSelectors.ts +52 -0
- package/src/state/{store.js → store.ts} +46 -36
- package/src/state/tooltipSlice.ts +507 -0
- package/src/state/{touchEventsMiddleware.js → touchEventsMiddleware.ts} +54 -42
- package/src/state/types/AreaSettings.ts +15 -0
- package/src/state/types/BarSettings.ts +15 -0
- package/src/state/types/LineSettings.ts +10 -0
- package/src/state/types/PieSettings.ts +32 -0
- package/src/state/types/RadarSettings.ts +6 -0
- package/src/state/types/RadialBarSettings.ts +10 -0
- package/src/state/types/ScatterSettings.ts +13 -0
- package/src/state/types/StackedGraphicalItem.ts +34 -0
- package/src/state/zIndexSlice.ts +137 -0
- package/src/synchronisation/syncSelectors.ts +7 -0
- package/src/synchronisation/types.ts +42 -0
- package/src/synchronisation/useChartSynchronisation.tsrx +26 -11
- package/src/types.ts +55 -0
- package/src/util/ActiveShapeUtils.tsrx +34 -10
- package/src/util/BarUtils.tsrx +43 -3
- package/src/util/{CartesianUtils.js → CartesianUtils.ts} +22 -39
- package/src/util/ChartUtils.ts +759 -0
- package/src/util/{Constants.js → Constants.ts} +6 -6
- package/src/util/DOMUtils.ts +135 -0
- package/src/util/{DataUtils.js → DataUtils.ts} +120 -47
- package/src/util/Events.ts +22 -0
- package/src/util/FunnelUtils.tsrx +3 -3
- package/src/util/Global.ts +13 -0
- package/src/util/IfOverflow.ts +16 -0
- package/src/util/LRUCache.ts +42 -0
- package/src/util/{LogUtils.js → LogUtils.ts} +7 -12
- package/src/util/OctaneTypes.ts +51 -0
- package/src/util/PolarUtils.ts +132 -0
- package/src/util/RadialBarUtils.tsrx +3 -3
- package/src/util/ReduceCSSCalc.ts +186 -0
- package/src/util/ScatterUtils.tsrx +9 -7
- package/src/util/{TickUtils.js → TickUtils.ts} +30 -13
- package/src/util/{YAxisUtils.js → YAxisUtils.ts} +27 -17
- package/src/util/axisPropsAreEqual.ts +49 -0
- package/src/util/createEventProxy.ts +20 -0
- package/src/util/{excludeEventProps.js → excludeEventProps.ts} +8 -6
- package/src/util/getActiveCoordinate.ts +210 -0
- package/src/util/{getAxisTypeBasedOnLayout.js → getAxisTypeBasedOnLayout.ts} +7 -3
- package/src/util/getClassNameFromUnknown.ts +7 -0
- package/src/util/{getEveryNth.js → getEveryNth.ts} +5 -6
- package/src/util/getRadiusAndStrokeWidthFromDot.ts +31 -0
- package/src/util/{getRelativeCoordinate.js → getRelativeCoordinate.ts} +26 -9
- package/src/util/getSliced.ts +14 -0
- package/src/util/{isDomainSpecifiedByUser.js → isDomainSpecifiedByUser.ts} +46 -100
- package/src/util/isWellBehavedNumber.ts +8 -0
- package/src/util/payload/getUniqPayload.ts +1 -1
- package/src/util/{propsAreEqual.js → propsAreEqual.ts} +10 -8
- package/src/util/{resolveDefaultProps.js → resolveDefaultProps.ts} +35 -57
- package/src/util/round.ts +33 -0
- package/src/util/scale/CustomScaleDefinition.ts +82 -0
- package/src/util/scale/RechartsScale.ts +131 -0
- package/src/util/scale/{createCategoricalInverse.js → createCategoricalInverse.ts} +24 -29
- package/src/util/scale/{getNiceTickValues.js → getNiceTickValues.ts} +125 -146
- package/src/util/scale/index.ts +2 -0
- package/src/util/scale/util/{arithmetic.js → arithmetic.ts} +12 -8
- package/src/util/stacks/getStackSeriesIdentifier.ts +21 -0
- package/src/util/stacks/stackTypes.ts +58 -0
- package/src/util/{svgPropertiesNoEvents.js → svgPropertiesNoEvents.ts} +52 -27
- package/src/util/tooltip/translate.ts +2 -1
- package/src/util/typedDataKey.ts +49 -0
- package/src/util/types.ts +1265 -7
- package/src/util/{useUniqueId.js → useUniqueId.ts} +9 -5
- package/src/zIndex/{DefaultZIndexes.js → DefaultZIndexes.ts} +13 -4
- package/src/zIndex/ZIndexLayer.tsrx +13 -4
- package/src/zIndex/ZIndexPortal.tsrx +14 -4
- package/src/zIndex/{getZIndexFromUnknown.js → getZIndexFromUnknown.ts} +3 -3
- package/src/zIndex/{zIndexSelectors.js → zIndexSelectors.ts} +17 -11
- package/src/animation/easing.js +0 -193
- package/src/animation/timeoutController.js +0 -49
- package/src/animation/util.js +0 -11
- package/src/cartesian/Area.tsrx.d.ts +0 -340
- package/src/cartesian/Bar.tsrx.d.ts +0 -4
- package/src/cartesian/BarStack.tsrx.d.ts +0 -6
- package/src/cartesian/CartesianAxis.tsrx.d.ts +0 -3
- package/src/cartesian/CartesianGrid.tsrx.d.ts +0 -219
- package/src/cartesian/ErrorBar.tsrx.d.ts +0 -131
- package/src/cartesian/Funnel.tsrx.d.ts +0 -274
- package/src/cartesian/Line.tsrx.d.ts +0 -4
- package/src/cartesian/LineDrawShape.tsrx.d.ts +0 -2
- package/src/cartesian/ReferenceLine.tsrx.d.ts +0 -178
- package/src/cartesian/Scatter.tsrx.d.ts +0 -351
- package/src/cartesian/XAxis.tsrx.d.ts +0 -3
- package/src/cartesian/YAxis.tsrx.d.ts +0 -3
- package/src/cartesian/ZAxis.tsrx.d.ts +0 -102
- package/src/cartesian/getCartesianPosition.js +0 -277
- package/src/cartesian/getEquidistantTicks.js +0 -133
- package/src/cartesian/getTicks.js +0 -280
- package/src/chart/AreaChart.tsrx.d.ts +0 -12
- package/src/chart/BarChart.tsrx.d.ts +0 -2
- package/src/chart/CartesianChart.tsrx.d.ts +0 -10
- package/src/chart/ComposedChart.tsrx.d.ts +0 -12
- package/src/chart/FunnelChart.tsrx.d.ts +0 -12
- package/src/chart/LineChart.tsrx.d.ts +0 -2
- package/src/chart/PieChart.tsrx.d.ts +0 -31
- package/src/chart/RadarChart.tsrx.d.ts +0 -31
- package/src/chart/RadialBarChart.tsrx.d.ts +0 -31
- package/src/chart/Sankey.tsrx.d.ts +0 -253
- package/src/chart/ScatterChart.tsrx.d.ts +0 -12
- package/src/chart/SunburstChart.tsrx.d.ts +0 -146
- package/src/component/DefaultLegendContent.tsrx.d.ts +0 -125
- package/src/component/DefaultTooltipContent.tsrx.d.ts +0 -87
- package/src/component/Label.tsrx.d.ts +0 -12
- package/src/component/LabelList.tsrx.d.ts +0 -8
- package/src/component/Legend.tsrx.d.ts +0 -88
- package/src/component/ResponsiveContainer.tsrx.d.ts +0 -81
- package/src/component/Text.tsrx.d.ts +0 -9
- package/src/component/Tooltip.tsrx.d.ts +0 -246
- package/src/container/Layer.tsrx.d.ts +0 -6
- package/src/container/Surface.tsrx.d.ts +0 -12
- package/src/context/accessibilityContext.js +0 -10
- package/src/context/tooltipContext.js +0 -55
- package/src/index.d.ts +0 -281
- package/src/polar/Pie.tsrx.d.ts +0 -436
- package/src/polar/PolarAngleAxis.tsrx.d.ts +0 -215
- package/src/polar/PolarGrid.tsrx.d.ts +0 -117
- package/src/polar/PolarRadiusAxis.tsrx.d.ts +0 -209
- package/src/polar/Radar.tsrx.d.ts +0 -215
- package/src/polar/RadialBar.tsrx.d.ts +0 -340
- package/src/shape/Cross.tsrx.d.ts +0 -12
- package/src/shape/Curve.tsrx.d.ts +0 -42
- package/src/shape/Dot.tsrx.d.ts +0 -9
- package/src/shape/Polygon.tsrx.d.ts +0 -13
- package/src/shape/Rectangle.tsrx.d.ts +0 -31
- package/src/shape/Sector.tsrx.d.ts +0 -29
- package/src/shape/Symbols.tsrx.d.ts +0 -15
- package/src/shape/Trapezoid.tsrx.d.ts +0 -29
- package/src/state/brushSlice.js +0 -36
- package/src/state/cartesianAxisSlice.js +0 -256
- package/src/state/chartDataSlice.js +0 -67
- package/src/state/errorBarSlice.js +0 -53
- package/src/state/eventSettingsSlice.js +0 -25
- package/src/state/graphicalItemsSlice.js +0 -91
- package/src/state/layoutSlice.js +0 -57
- package/src/state/legendSlice.js +0 -83
- package/src/state/optionsSlice.js +0 -45
- package/src/state/polarAxisSlice.js +0 -33
- package/src/state/polarOptionsSlice.js +0 -26
- package/src/state/reduxDevtoolsJsonStringifyReplacer.js +0 -14
- package/src/state/referenceElementsSlice.js +0 -51
- package/src/state/renderedTicksSlice.js +0 -41
- package/src/state/rootPropsSlice.js +0 -48
- package/src/state/selectors/axisSelectors.js +0 -2113
- package/src/state/selectors/barSelectors.js +0 -263
- package/src/state/selectors/barStackSelectors.js +0 -65
- package/src/state/selectors/brushSelectors.js +0 -21
- package/src/state/selectors/combiners/combineActiveLabel.js +0 -18
- package/src/state/selectors/combiners/combineAllBarPositions.js +0 -169
- package/src/state/selectors/combiners/combineAxisRangeWithReverse.js +0 -11
- package/src/state/selectors/combiners/combineBarPosition.js +0 -17
- package/src/state/selectors/combiners/combineBarSizeList.js +0 -115
- package/src/state/selectors/combiners/combineConfiguredScale.js +0 -46
- package/src/state/selectors/combiners/combineCoordinateForDefaultIndex.js +0 -48
- package/src/state/selectors/combiners/combineInverseScaleFunction.js +0 -12
- package/src/state/selectors/combiners/combineStackedData.js +0 -22
- package/src/state/selectors/combiners/combineTooltipInteractionState.js +0 -121
- package/src/state/selectors/combiners/combineTooltipPayload.js +0 -248
- package/src/state/selectors/containerSelectors.js +0 -6
- package/src/state/selectors/graphicalItemSelectors.js +0 -25
- package/src/state/selectors/legendSelectors.js +0 -18
- package/src/state/selectors/lineSelectors.js +0 -106
- package/src/state/selectors/numberDomainEqualityCheck.js +0 -11
- package/src/state/selectors/pickAxisId.js +0 -3
- package/src/state/selectors/pickAxisType.js +0 -3
- package/src/state/selectors/polarAxisSelectors.js +0 -237
- package/src/state/selectors/rootPropsSelectors.js +0 -13
- package/src/state/selectors/selectAllAxes.js +0 -15
- package/src/state/selectors/selectChartOffset.js +0 -12
- package/src/state/selectors/selectChartOffsetInternal.js +0 -174
- package/src/state/selectors/selectTooltipAxisId.js +0 -3
- package/src/state/selectors/selectTooltipEventType.js +0 -27
- package/src/state/selectors/selectTooltipPayloadSearcher.js +0 -3
- package/src/state/selectors/selectTooltipSettings.js +0 -3
- package/src/state/selectors/selectTooltipState.js +0 -3
- package/src/state/selectors/selectors.js +0 -222
- package/src/state/selectors/tooltipSelectors.js +0 -471
- package/src/state/selectors/touchSelectors.js +0 -31
- package/src/state/tooltipSlice.js +0 -237
- package/src/state/types/StackedGraphicalItem.js +0 -18
- package/src/state/zIndexSlice.js +0 -167
- package/src/synchronisation/syncSelectors.js +0 -5
- package/src/util/ChartUtils.js +0 -630
- package/src/util/DOMUtils.js +0 -180
- package/src/util/Events.js +0 -7
- package/src/util/Global.js +0 -13
- package/src/util/LRUCache.js +0 -58
- package/src/util/PolarUtils.js +0 -190
- package/src/util/ReduceCSSCalc.js +0 -260
- package/src/util/axisPropsAreEqual.js +0 -63
- package/src/util/createEventProxy.js +0 -18
- package/src/util/getActiveCoordinate.js +0 -253
- package/src/util/getClassNameFromUnknown.js +0 -8
- package/src/util/getRadiusAndStrokeWidthFromDot.js +0 -28
- package/src/util/getSliced.js +0 -11
- package/src/util/isWellBehavedNumber.js +0 -8
- package/src/util/round.js +0 -39
- package/src/util/scale/RechartsScale.js +0 -68
- package/src/util/scale/index.js +0 -3
- package/src/util/stacks/getStackSeriesIdentifier.js +0 -10
- package/src/zIndex/ZIndexLayer.tsrx.d.ts +0 -2
package/src/polar/Pie.tsrx.d.ts
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import * as React from 'octane';
|
|
2
|
-
import { ReactElement, ReactNode, SVGProps } from 'octane';
|
|
3
|
-
import {
|
|
4
|
-
ActiveShape,
|
|
5
|
-
AnimationDuration,
|
|
6
|
-
ChartOffsetInternal,
|
|
7
|
-
Coordinate,
|
|
8
|
-
DataConsumer,
|
|
9
|
-
DataKey,
|
|
10
|
-
DataProvider,
|
|
11
|
-
EasingInput,
|
|
12
|
-
GeometrySector,
|
|
13
|
-
LegendType,
|
|
14
|
-
PolarLayout,
|
|
15
|
-
PresentationAttributesAdaptChildEvent,
|
|
16
|
-
ShapeAnimationProps,
|
|
17
|
-
TooltipType,
|
|
18
|
-
} from '../util/types';
|
|
19
|
-
import { TooltipTriggerInfo } from '../context/tooltipContext';
|
|
20
|
-
import { Formatter } from '../component/DefaultTooltipContent';
|
|
21
|
-
import {
|
|
22
|
-
DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME,
|
|
23
|
-
DATA_ITEM_INDEX_ATTRIBUTE_NAME,
|
|
24
|
-
} from '../util/Constants';
|
|
25
|
-
import { AnimationInterpolateFn } from '../animation/AnimatedItems';
|
|
26
|
-
import { AnimationMatchByProp } from '../animation/matchBy';
|
|
27
|
-
import { PiePresentationProps, PieSettings } from '../state/types/PieSettings';
|
|
28
|
-
import { SVGPropsNoEvents } from '../util/svgPropertiesNoEvents';
|
|
29
|
-
import { Props as LabelListProps } from '../component/LabelList';
|
|
30
|
-
import { GraphicalItemId } from '../state/graphicalItemsSlice';
|
|
31
|
-
import { ZIndexable } from '../zIndex/ZIndexLayer';
|
|
32
|
-
import { ChartData } from '../state/chartDataSlice';
|
|
33
|
-
interface PieDef {
|
|
34
|
-
/**
|
|
35
|
-
* The x-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container width.
|
|
36
|
-
*/
|
|
37
|
-
cx?: number | string;
|
|
38
|
-
/**
|
|
39
|
-
* The y-coordinate of center. If set a percentage, the final value is obtained by multiplying the percentage of container height.
|
|
40
|
-
*/
|
|
41
|
-
cy?: number | string;
|
|
42
|
-
/**
|
|
43
|
-
* Angle in degrees from which the chart should start.
|
|
44
|
-
*/
|
|
45
|
-
startAngle?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Angle, in degrees, at which the chart should end.
|
|
48
|
-
*/
|
|
49
|
-
endAngle?: number;
|
|
50
|
-
/**
|
|
51
|
-
* The angle between two sectors.
|
|
52
|
-
*
|
|
53
|
-
* @example <Pie paddingAngle={5} />
|
|
54
|
-
* @example https://recharts.github.io/examples/PieChartWithPaddingAngle
|
|
55
|
-
*/
|
|
56
|
-
paddingAngle?: number;
|
|
57
|
-
/**
|
|
58
|
-
* The inner radius of the sectors.
|
|
59
|
-
* If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy.
|
|
60
|
-
*/
|
|
61
|
-
innerRadius?: number | string;
|
|
62
|
-
/**
|
|
63
|
-
* The outer radius of the sectors.
|
|
64
|
-
* If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy.
|
|
65
|
-
* Function should return a string percentage or number.
|
|
66
|
-
*/
|
|
67
|
-
outerRadius?: number | string | ((dataPoint: any) => number | string);
|
|
68
|
-
cornerRadius?: number | string;
|
|
69
|
-
}
|
|
70
|
-
type PieLabelLine =
|
|
71
|
-
| ReactElement<SVGElement>
|
|
72
|
-
| ((props: any) => ReactElement<SVGElement>)
|
|
73
|
-
| SVGProps<SVGPathElement>
|
|
74
|
-
| boolean;
|
|
75
|
-
interface PieLabelExtraProps {
|
|
76
|
-
stroke: string;
|
|
77
|
-
index: number;
|
|
78
|
-
textAnchor: string;
|
|
79
|
-
}
|
|
80
|
-
export type PieLabelRenderProps = Omit<SVGPropsNoEvents<PieSvgAttributes>, 'offset'> &
|
|
81
|
-
Omit<PieSectorDataItem, 'offset'> &
|
|
82
|
-
PieLabelExtraProps &
|
|
83
|
-
Coordinate;
|
|
84
|
-
export type LabelListPropsWithPosition = LabelListProps & {
|
|
85
|
-
position: LabelListProps['position'];
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* The `label` prop in Pie accepts a variety of alternatives.
|
|
89
|
-
*/
|
|
90
|
-
export type PieLabel =
|
|
91
|
-
| boolean
|
|
92
|
-
| LabelListPropsWithPosition
|
|
93
|
-
| Partial<PieLabelRenderProps>
|
|
94
|
-
| ((props: PieLabelRenderProps) => ReactNode | ReactElement<SVGElement>)
|
|
95
|
-
| ReactElement<SVGElement>;
|
|
96
|
-
export type PieSectorData = GeometrySector &
|
|
97
|
-
TooltipTriggerInfo & {
|
|
98
|
-
dataKey?: DataKey<any>;
|
|
99
|
-
midAngle?: number;
|
|
100
|
-
middleRadius?: number;
|
|
101
|
-
name?: string | number;
|
|
102
|
-
paddingAngle?: number;
|
|
103
|
-
payload?: any;
|
|
104
|
-
percent?: number;
|
|
105
|
-
value: number;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* We spread the data object into the sector data item,
|
|
109
|
-
* so we can't really know what is going to be inside.
|
|
110
|
-
*
|
|
111
|
-
* This type represents our best effort, but it all depends on the input data
|
|
112
|
-
* and what is inside of it.
|
|
113
|
-
*
|
|
114
|
-
* https://github.com/recharts/recharts/issues/6380
|
|
115
|
-
* https://github.com/recharts/recharts/discussions/6375
|
|
116
|
-
*/
|
|
117
|
-
export type PieSectorDataItem = PiePresentationProps &
|
|
118
|
-
PieCoordinate &
|
|
119
|
-
PieSectorData & {
|
|
120
|
-
cornerRadius: number | undefined;
|
|
121
|
-
};
|
|
122
|
-
export type PieSectorShapeProps = PieSectorDataItem &
|
|
123
|
-
ShapeAnimationProps & {
|
|
124
|
-
[DATA_ITEM_INDEX_ATTRIBUTE_NAME]: number;
|
|
125
|
-
[DATA_ITEM_GRAPHICAL_ITEM_ID_ATTRIBUTE_NAME]: GraphicalItemId;
|
|
126
|
-
isActive: boolean;
|
|
127
|
-
index: number;
|
|
128
|
-
} & SVGProps<SVGPathElement>;
|
|
129
|
-
export type PieShape = ActiveShape<PieSectorShapeProps, SVGPathElement>;
|
|
130
|
-
interface PieEvents {
|
|
131
|
-
/**
|
|
132
|
-
* The customized event handler of click on the sectors in this group.
|
|
133
|
-
*/
|
|
134
|
-
onClick?: (
|
|
135
|
-
data: PieSectorDataItem,
|
|
136
|
-
index: number,
|
|
137
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
138
|
-
) => void;
|
|
139
|
-
/**
|
|
140
|
-
* The customized event handler of mousedown on the sectors in this group.
|
|
141
|
-
*/
|
|
142
|
-
onMouseDown?: (
|
|
143
|
-
data: PieSectorDataItem,
|
|
144
|
-
index: number,
|
|
145
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
146
|
-
) => void;
|
|
147
|
-
/**
|
|
148
|
-
* The customized event handler of mouseup on the sectors in this group.
|
|
149
|
-
*/
|
|
150
|
-
onMouseUp?: (
|
|
151
|
-
data: PieSectorDataItem,
|
|
152
|
-
index: number,
|
|
153
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
154
|
-
) => void;
|
|
155
|
-
/**
|
|
156
|
-
* The customized event handler of mousemove on the sectors in this group.
|
|
157
|
-
*/
|
|
158
|
-
onMouseMove?: (
|
|
159
|
-
data: PieSectorDataItem,
|
|
160
|
-
index: number,
|
|
161
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
162
|
-
) => void;
|
|
163
|
-
/**
|
|
164
|
-
* The customized event handler of mouseover on the sectors in this group.
|
|
165
|
-
*/
|
|
166
|
-
onMouseOver?: (
|
|
167
|
-
data: PieSectorDataItem,
|
|
168
|
-
index: number,
|
|
169
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
170
|
-
) => void;
|
|
171
|
-
/**
|
|
172
|
-
* The customized event handler of mouseout on the sectors in this group.
|
|
173
|
-
*/
|
|
174
|
-
onMouseOut?: (
|
|
175
|
-
data: PieSectorDataItem,
|
|
176
|
-
index: number,
|
|
177
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
178
|
-
) => void;
|
|
179
|
-
/**
|
|
180
|
-
* The customized event handler of mouseenter on the sectors in this group.
|
|
181
|
-
*/
|
|
182
|
-
onMouseEnter?: (
|
|
183
|
-
data: PieSectorDataItem,
|
|
184
|
-
index: number,
|
|
185
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
186
|
-
) => void;
|
|
187
|
-
/**
|
|
188
|
-
* The customized event handler of mouseleave on the sectors in this group.
|
|
189
|
-
*/
|
|
190
|
-
onMouseLeave?: (
|
|
191
|
-
data: PieSectorDataItem,
|
|
192
|
-
index: number,
|
|
193
|
-
e: React.MouseEvent<SVGGraphicsElement>,
|
|
194
|
-
) => void;
|
|
195
|
-
onTouchStart?: (
|
|
196
|
-
data: PieSectorDataItem,
|
|
197
|
-
index: number,
|
|
198
|
-
e: React.TouchEvent<SVGGraphicsElement>,
|
|
199
|
-
) => void;
|
|
200
|
-
onTouchMove?: (
|
|
201
|
-
data: PieSectorDataItem,
|
|
202
|
-
index: number,
|
|
203
|
-
e: React.TouchEvent<SVGGraphicsElement>,
|
|
204
|
-
) => void;
|
|
205
|
-
onTouchEnd?: (
|
|
206
|
-
data: PieSectorDataItem,
|
|
207
|
-
index: number,
|
|
208
|
-
e: React.TouchEvent<SVGGraphicsElement>,
|
|
209
|
-
) => void;
|
|
210
|
-
}
|
|
211
|
-
interface PieProps<DataPointType = any, DataValueType = any>
|
|
212
|
-
extends
|
|
213
|
-
DataProvider<DataPointType>,
|
|
214
|
-
DataConsumer<DataPointType, DataValueType>,
|
|
215
|
-
PieDef,
|
|
216
|
-
PieEvents,
|
|
217
|
-
ZIndexable {
|
|
218
|
-
/**
|
|
219
|
-
* This component is rendered when this graphical item is activated
|
|
220
|
-
* (could be by mouse hover, touch, keyboard, programmatically).
|
|
221
|
-
*
|
|
222
|
-
* @deprecated Use the `shape` prop to create each sector. `isActive` designates the "active" shape.
|
|
223
|
-
* @example <Pie activeShape={<CustomActiveShape />} />
|
|
224
|
-
* @example https://recharts.github.io/examples/CustomActiveShapePieChart
|
|
225
|
-
*/
|
|
226
|
-
activeShape?: ActiveShape<PieSectorDataItem>;
|
|
227
|
-
/**
|
|
228
|
-
* Specifies when the animation should begin, the unit of this option is ms.
|
|
229
|
-
* @defaultValue 400
|
|
230
|
-
*/
|
|
231
|
-
animationBegin?: number;
|
|
232
|
-
/**
|
|
233
|
-
* Specifies the duration of animation, the unit of this option is ms.
|
|
234
|
-
* @defaultValue 1500
|
|
235
|
-
*/
|
|
236
|
-
animationDuration?: AnimationDuration;
|
|
237
|
-
/**
|
|
238
|
-
* The type of easing function.
|
|
239
|
-
* @defaultValue ease
|
|
240
|
-
*/
|
|
241
|
-
animationEasing?: EasingInput;
|
|
242
|
-
/**
|
|
243
|
-
* Custom animation function for interpolating data items.
|
|
244
|
-
* When provided, this replaces the default animation interpolation.
|
|
245
|
-
*
|
|
246
|
-
* @param prevItems The items from the previous animation frame, or null on first render
|
|
247
|
-
* @param nextItems The target items to animate towards
|
|
248
|
-
* @param animationElapsedTime A normalized time value (0 = start, 1 = end)
|
|
249
|
-
* @returns The interpolated items at time animationElapsedTime
|
|
250
|
-
*
|
|
251
|
-
* @since 3.9
|
|
252
|
-
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
253
|
-
*/
|
|
254
|
-
animationInterpolateFn?: AnimationInterpolateFn<PieSectorDataItem, PolarLayout>;
|
|
255
|
-
/**
|
|
256
|
-
* Strategy for matching previous items to next items during animation.
|
|
257
|
-
* Determines how Recharts pairs old data points with new data points
|
|
258
|
-
* to create smooth transitions.
|
|
259
|
-
*
|
|
260
|
-
* - `matchAppend` (default): match sequentially by index and treat newly appended items as new
|
|
261
|
-
* - `matchByIndex`: match by array position with proportional stretching
|
|
262
|
-
* - `matchByDataKey('someKey')`: match by a data key from the payload
|
|
263
|
-
* - Custom function `(item, index) => key`: match by the returned key
|
|
264
|
-
*
|
|
265
|
-
* @defaultValue append
|
|
266
|
-
* @see matchByIndex
|
|
267
|
-
* @see matchByDataKey
|
|
268
|
-
* @see matchAppend
|
|
269
|
-
*
|
|
270
|
-
* @since 3.9
|
|
271
|
-
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
272
|
-
*/
|
|
273
|
-
animationMatchBy?: AnimationMatchByProp<PieSectorDataItem>;
|
|
274
|
-
className?: string;
|
|
275
|
-
/**
|
|
276
|
-
* Hides the whole graphical element when true.
|
|
277
|
-
*
|
|
278
|
-
* Hiding an element is different from removing it from the chart:
|
|
279
|
-
* Hidden graphical elements are still visible in Legend,
|
|
280
|
-
* and can be included in axis domain calculations,
|
|
281
|
-
* depending on `includeHidden` props of your XAxis/YAxis.
|
|
282
|
-
*
|
|
283
|
-
* @defaultValue false
|
|
284
|
-
*/
|
|
285
|
-
hide?: boolean;
|
|
286
|
-
id?: string;
|
|
287
|
-
/**
|
|
288
|
-
* The shape of inactive sector.
|
|
289
|
-
* @deprecated Use the `shape` prop to modify each sector.
|
|
290
|
-
*/
|
|
291
|
-
inactiveShape?: ActiveShape<PieSectorDataItem>;
|
|
292
|
-
/**
|
|
293
|
-
* If set false, animation will be disabled.
|
|
294
|
-
* If set "auto", the animation will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility.
|
|
295
|
-
* @defaultValue auto
|
|
296
|
-
*/
|
|
297
|
-
isAnimationActive?: boolean | 'auto';
|
|
298
|
-
/**
|
|
299
|
-
* Renders one label for each pie sector. Options:
|
|
300
|
-
* - `true`: renders default labels;
|
|
301
|
-
* - `false`: no labels are rendered;
|
|
302
|
-
* - `object` that has `position` prop: the props of LabelList component;
|
|
303
|
-
* - `object` that does not have `position` prop: the props of a custom Pie label (similar to Label with position "outside"); this variant supports `labelLine`
|
|
304
|
-
* - `ReactElement`: a custom SVG label element, such as `<text>` or `<g>`.
|
|
305
|
-
* HTML elements such as `<div>` are not valid inside the chart SVG and may trigger React DOM warnings.
|
|
306
|
-
* - `function`: a render function of custom label.
|
|
307
|
-
*
|
|
308
|
-
* Also see the `labelLine` prop that draws a line connecting each label to the corresponding sector.
|
|
309
|
-
*
|
|
310
|
-
* @defaultValue false
|
|
311
|
-
* @example <Pie label={<CustomizedLabel />} />
|
|
312
|
-
* @example https://recharts.github.io/examples/PieChartWithCustomizedLabel
|
|
313
|
-
*/
|
|
314
|
-
label?: PieLabel;
|
|
315
|
-
/**
|
|
316
|
-
* If false set, label lines will not be drawn. If true set, label lines will be drawn which have the props calculated internally.
|
|
317
|
-
* If object set, label lines will be drawn which have the props merged by the internal calculated props and the option.
|
|
318
|
-
* If ReactElement set, the option can be the custom label line element.
|
|
319
|
-
* If set a function, the function will be called to render customized label line.
|
|
320
|
-
* @defaultValue true
|
|
321
|
-
* @example <Pie labelLine={<CustomizedLabelLine />} />
|
|
322
|
-
* @example https://recharts.github.io/examples/PieChartWithCustomizedLabel
|
|
323
|
-
*/
|
|
324
|
-
labelLine?: PieLabelLine;
|
|
325
|
-
/**
|
|
326
|
-
* The type of icon in legend. If set to 'none', no legend item will be rendered.
|
|
327
|
-
* @defaultValue rect
|
|
328
|
-
*/
|
|
329
|
-
legendType?: LegendType;
|
|
330
|
-
/** the max radius of pie */
|
|
331
|
-
maxRadius?: number;
|
|
332
|
-
/**
|
|
333
|
-
* The minimum angle of each unzero data.
|
|
334
|
-
* @defaultValue 0
|
|
335
|
-
*/
|
|
336
|
-
minAngle?: number;
|
|
337
|
-
/**
|
|
338
|
-
* Name represents each sector in the tooltip, and legend.
|
|
339
|
-
* This allows you to extract the name from the data:
|
|
340
|
-
*
|
|
341
|
-
* - `string`: the name of the field in the data object;
|
|
342
|
-
* - `number`: the index of the field in the data;
|
|
343
|
-
* - `function`: a function that receives the data object and returns the name.
|
|
344
|
-
*
|
|
345
|
-
* @defaultValue name
|
|
346
|
-
*/
|
|
347
|
-
nameKey?: DataKey<DataPointType, DataValueType>;
|
|
348
|
-
/**
|
|
349
|
-
* The customized event handler of animation end.
|
|
350
|
-
*/
|
|
351
|
-
onAnimationEnd?: () => void;
|
|
352
|
-
/**
|
|
353
|
-
* The customized event handler of animation start.
|
|
354
|
-
*/
|
|
355
|
-
onAnimationStart?: () => void;
|
|
356
|
-
/**
|
|
357
|
-
* The tabindex of wrapper surrounding the cells.
|
|
358
|
-
* @defaultValue 0
|
|
359
|
-
*/
|
|
360
|
-
rootTabIndex?: number;
|
|
361
|
-
/**
|
|
362
|
-
* The custom shape of a Pie Sector.
|
|
363
|
-
* Can also be used to render active sector by checking isActive.
|
|
364
|
-
* During animations, the function shape also receives `animationElapsedTime`, `isAnimating`, and `isEntrance`.
|
|
365
|
-
* If undefined, renders {@link Sector} shape.
|
|
366
|
-
*/
|
|
367
|
-
shape?: PieShape;
|
|
368
|
-
tooltipType?: TooltipType;
|
|
369
|
-
/**
|
|
370
|
-
* Formats the value displayed in the tooltip for this Pie.
|
|
371
|
-
* When set, takes precedence over the `formatter` prop on the Tooltip component.
|
|
372
|
-
*/
|
|
373
|
-
formatter?: Formatter;
|
|
374
|
-
/**
|
|
375
|
-
* @defaultValue 100
|
|
376
|
-
*/
|
|
377
|
-
zIndex?: number;
|
|
378
|
-
}
|
|
379
|
-
type PieSvgAttributes = Omit<
|
|
380
|
-
PresentationAttributesAdaptChildEvent<any, SVGElement>,
|
|
381
|
-
'ref' | keyof PieEvents
|
|
382
|
-
>;
|
|
383
|
-
export type Props<DataPointType = any, DataValueType = any> = PieSvgAttributes &
|
|
384
|
-
PieProps<DataPointType, DataValueType>;
|
|
385
|
-
export type PieCoordinate = {
|
|
386
|
-
cx: number;
|
|
387
|
-
cy: number;
|
|
388
|
-
innerRadius: number;
|
|
389
|
-
outerRadius: number;
|
|
390
|
-
maxRadius: number;
|
|
391
|
-
};
|
|
392
|
-
export declare function computePieSectors({
|
|
393
|
-
pieSettings,
|
|
394
|
-
displayedData,
|
|
395
|
-
cells,
|
|
396
|
-
offset,
|
|
397
|
-
}: {
|
|
398
|
-
pieSettings: PieSettings;
|
|
399
|
-
displayedData: ChartData;
|
|
400
|
-
cells: ReadonlyArray<ReactElement> | undefined;
|
|
401
|
-
offset: ChartOffsetInternal;
|
|
402
|
-
}): ReadonlyArray<PieSectorDataItem> | undefined;
|
|
403
|
-
export declare const defaultPieProps: {
|
|
404
|
-
readonly animationBegin: 400;
|
|
405
|
-
readonly animationDuration: 1500;
|
|
406
|
-
readonly animationEasing: 'ease';
|
|
407
|
-
readonly animationInterpolateFn: AnimationInterpolateFn<PieSectorDataItem, PolarLayout>;
|
|
408
|
-
readonly animationMatchBy: 'append';
|
|
409
|
-
readonly cx: '50%';
|
|
410
|
-
readonly cy: '50%';
|
|
411
|
-
readonly dataKey: 'value';
|
|
412
|
-
readonly endAngle: 360;
|
|
413
|
-
readonly fill: '#808080';
|
|
414
|
-
readonly hide: false;
|
|
415
|
-
readonly innerRadius: 0;
|
|
416
|
-
readonly isAnimationActive: 'auto';
|
|
417
|
-
readonly label: false;
|
|
418
|
-
readonly labelLine: true;
|
|
419
|
-
readonly legendType: 'rect';
|
|
420
|
-
readonly minAngle: 0;
|
|
421
|
-
readonly nameKey: 'name';
|
|
422
|
-
readonly outerRadius: '80%';
|
|
423
|
-
readonly paddingAngle: 0;
|
|
424
|
-
readonly rootTabIndex: 0;
|
|
425
|
-
readonly shape: React.FC<import('..').SectorProps>;
|
|
426
|
-
readonly startAngle: 0;
|
|
427
|
-
readonly stroke: '#fff';
|
|
428
|
-
readonly zIndex: 100;
|
|
429
|
-
};
|
|
430
|
-
export declare const Pie: {
|
|
431
|
-
<DataPointType = any, DataValueType = any>(
|
|
432
|
-
outsideProps: Props<DataPointType, DataValueType>,
|
|
433
|
-
): ReactElement;
|
|
434
|
-
(outsideProps: Props<any, any>): ReactElement;
|
|
435
|
-
};
|
|
436
|
-
export {};
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import * as React from 'octane';
|
|
2
|
-
import { FunctionComponent, SVGProps } from 'octane';
|
|
3
|
-
import {
|
|
4
|
-
AxisDomain,
|
|
5
|
-
AxisDomainTypeInput,
|
|
6
|
-
BaseTickContentProps,
|
|
7
|
-
PresentationAttributesAdaptChildEvent,
|
|
8
|
-
RenderableAxisProps,
|
|
9
|
-
ScaleType,
|
|
10
|
-
TickItem,
|
|
11
|
-
TickProp,
|
|
12
|
-
} from '../util/types';
|
|
13
|
-
import { NiceTicksAlgorithm } from '../state/cartesianAxisSlice';
|
|
14
|
-
import { defaultPolarAngleAxisProps } from './defaultPolarAngleAxisProps';
|
|
15
|
-
import { RequiresDefaultProps } from '../util/resolveDefaultProps';
|
|
16
|
-
import { ZIndexable } from '../zIndex/ZIndexLayer';
|
|
17
|
-
import { CustomScaleDefinition } from '../util/scale/CustomScaleDefinition';
|
|
18
|
-
export interface PolarAngleAxisProps<DataPointType = any, DataValueType = any>
|
|
19
|
-
extends
|
|
20
|
-
Omit<
|
|
21
|
-
RenderableAxisProps<DataPointType, DataValueType>,
|
|
22
|
-
'axisLine' | 'tickCount' | 'domain' | 'scale' | 'tick'
|
|
23
|
-
>,
|
|
24
|
-
ZIndexable {
|
|
25
|
-
/**
|
|
26
|
-
* Controls axis line element. These are be passed as props to SVG `<line>` element representing the axis line.
|
|
27
|
-
* If `true` then the axis line is drawn using props of the PolarAngleAxis component.
|
|
28
|
-
* If `false` then the axis line is not drawn.
|
|
29
|
-
*
|
|
30
|
-
* Also see `axisLineType` prop to change the shape of the axis line.
|
|
31
|
-
*
|
|
32
|
-
* @defaultValue true
|
|
33
|
-
*
|
|
34
|
-
* @example <PolarAngleAxis axisLine={{ stroke: 'red', strokeWidth: 2 }} />
|
|
35
|
-
* @example <PolarAngleAxis axisLine={false} />
|
|
36
|
-
* @example <PolarAngleAxis stroke='red' strokeWidth={2} strokeDasharray={4} />
|
|
37
|
-
*/
|
|
38
|
-
axisLine?: boolean | SVGProps<SVGLineElement>;
|
|
39
|
-
/**
|
|
40
|
-
* @defaultValue false
|
|
41
|
-
*/
|
|
42
|
-
allowDecimals?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Allow the axis has duplicated categories or not when the type of axis is "category".
|
|
45
|
-
* @defaultValue true
|
|
46
|
-
*/
|
|
47
|
-
allowDuplicatedCategory?: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* @defaultValue 0
|
|
50
|
-
*/
|
|
51
|
-
angleAxisId?: string | number;
|
|
52
|
-
/**
|
|
53
|
-
* The type of axis line.
|
|
54
|
-
* @defaultValue polygon
|
|
55
|
-
*/
|
|
56
|
-
axisLineType?: 'polygon' | 'circle';
|
|
57
|
-
/**
|
|
58
|
-
* The x-coordinate of center.
|
|
59
|
-
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
60
|
-
* and this prop is ignored.
|
|
61
|
-
*
|
|
62
|
-
* This is only used when rendered outside a chart context.
|
|
63
|
-
*/
|
|
64
|
-
cx?: number;
|
|
65
|
-
/**
|
|
66
|
-
* The y-coordinate of center.
|
|
67
|
-
* When used inside a chart context, this prop is calculated based on the chart's dimensions,
|
|
68
|
-
* and this prop is ignored.
|
|
69
|
-
*
|
|
70
|
-
* This is only used when rendered outside a chart context.
|
|
71
|
-
*/
|
|
72
|
-
cy?: number;
|
|
73
|
-
/**
|
|
74
|
-
* The orientation of axis text.
|
|
75
|
-
* @defaultValue 'outer'
|
|
76
|
-
*/
|
|
77
|
-
orientation?: 'inner' | 'outer';
|
|
78
|
-
/**
|
|
79
|
-
* Specify the domain of axis when the axis is a number axis.
|
|
80
|
-
*
|
|
81
|
-
* If undefined, then the domain is calculated based on the data and dataKeys.
|
|
82
|
-
*
|
|
83
|
-
* The length of domain should be 2, and we will validate the values in domain.
|
|
84
|
-
*
|
|
85
|
-
* Each element in the array can be a number, 'auto', 'dataMin', 'dataMax', a string like 'dataMin - 20', 'dataMax + 100',
|
|
86
|
-
* or a function that accepts a single argument and returns a number.
|
|
87
|
-
*
|
|
88
|
-
* If any element of domain is set to be 'auto', comprehensible scale ticks will be calculated, and the final domain of axis is generated by the ticks.
|
|
89
|
-
* If a function, receives '[dataMin, dataMax]', and must return a computed domain as '[min, max]'.
|
|
90
|
-
*
|
|
91
|
-
* @example <PolarAngleAxis type="number" domain={['dataMin', 'dataMax']} />
|
|
92
|
-
* @example <PolarAngleAxis type="number" domain={[0, 'dataMax']} />
|
|
93
|
-
* @example <PolarAngleAxis type="number" domain={['auto', 'auto']} />
|
|
94
|
-
* @example <PolarAngleAxis type="number" domain={[0, 'dataMax + 1000']} />
|
|
95
|
-
* @example <PolarAngleAxis type="number" domain={['dataMin - 100', 'dataMax + 100']} />
|
|
96
|
-
* @example <PolarAngleAxis type="number" domain={[dataMin => (0 - Math.abs(dataMin)), dataMax => (dataMax * 2)]} />
|
|
97
|
-
* @example <PolarAngleAxis type="number" domain={([dataMin, dataMax]) => { const absMax = Math.max(Math.abs(dataMin), Math.abs(dataMax)); return [-absMax, absMax]; }} />
|
|
98
|
-
* @example <PolarAngleAxis type="number" domain={[0, 100]} allowDataOverflow />
|
|
99
|
-
*/
|
|
100
|
-
domain?: AxisDomain;
|
|
101
|
-
/**
|
|
102
|
-
* Scale function determines how data values are mapped to visual values.
|
|
103
|
-
* In other words, decided the mapping between data domain and coordinate range.
|
|
104
|
-
*
|
|
105
|
-
* If undefined, or 'auto', the scale function is created internally according to the type of axis and data.
|
|
106
|
-
*
|
|
107
|
-
* You can define a custom scale, either as a string shortcut to a d3 scale, or as a complete scale definition object.
|
|
108
|
-
*
|
|
109
|
-
* @defaultValue auto
|
|
110
|
-
* @example <PolarAngleAxis scale="log" />
|
|
111
|
-
* @example
|
|
112
|
-
* import { scaleLog } from 'd3-scale';
|
|
113
|
-
* const scale = scaleLog().base(Math.E);
|
|
114
|
-
* <PolarAngleAxis scale={scale} />
|
|
115
|
-
*/
|
|
116
|
-
scale?:
|
|
117
|
-
| ScaleType
|
|
118
|
-
| CustomScaleDefinition
|
|
119
|
-
| CustomScaleDefinition<string>
|
|
120
|
-
| CustomScaleDefinition<number>
|
|
121
|
-
| CustomScaleDefinition<Date>;
|
|
122
|
-
/**
|
|
123
|
-
* The outer radius of circle grid.
|
|
124
|
-
* If set a percentage, the final value is obtained by multiplying the percentage of maxRadius which is calculated by the width, height, cx, cy.
|
|
125
|
-
*/
|
|
126
|
-
radius?: number | string;
|
|
127
|
-
/**
|
|
128
|
-
* Defines how the individual label text is rendered.
|
|
129
|
-
* This controls the settings for individual ticks; on a typical axis, there are multiple ticks, depending on your data.
|
|
130
|
-
*
|
|
131
|
-
* If you want to customize the overall axis label, use the `label` prop instead.
|
|
132
|
-
*
|
|
133
|
-
* Options:
|
|
134
|
-
* - `false`: Do not render any tick labels.
|
|
135
|
-
* - `true`: Render tick labels with default settings.
|
|
136
|
-
* - `object`: An object of props to be merged into the internally calculated tick props.
|
|
137
|
-
* - `ReactElement`: A custom React element to be used as the tick label.
|
|
138
|
-
* - `function`: A function that returns a React element for custom rendering of tick labels.
|
|
139
|
-
*
|
|
140
|
-
* @defaultValue true
|
|
141
|
-
*/
|
|
142
|
-
tick?: TickProp<BaseTickContentProps>;
|
|
143
|
-
/**
|
|
144
|
-
* The count of axis ticks. Not used if 'type' is 'category'.
|
|
145
|
-
*/
|
|
146
|
-
tickCount?: number;
|
|
147
|
-
/**
|
|
148
|
-
* Controls how Recharts calculates "nice" tick values for this axis.
|
|
149
|
-
* Options: `'none'`, `'auto'`, `'adaptive'`, `'snap125'`.
|
|
150
|
-
* See {@link NiceTicksAlgorithm} for a full description of each option.
|
|
151
|
-
*
|
|
152
|
-
* @defaultValue 'auto'
|
|
153
|
-
*/
|
|
154
|
-
niceTicks?: NiceTicksAlgorithm;
|
|
155
|
-
/**
|
|
156
|
-
* The formatter function of ticks.
|
|
157
|
-
*/
|
|
158
|
-
tickFormatter?: (value: any, index: number) => string;
|
|
159
|
-
/**
|
|
160
|
-
* The length of tick line.
|
|
161
|
-
* @defaultValue 8
|
|
162
|
-
*/
|
|
163
|
-
tickSize?: number;
|
|
164
|
-
/**
|
|
165
|
-
* The array of every tick's value and angle.
|
|
166
|
-
*/
|
|
167
|
-
ticks?: ReadonlyArray<TickItem>;
|
|
168
|
-
/**
|
|
169
|
-
* The type of axis.
|
|
170
|
-
*
|
|
171
|
-
* `category`: Treats data as distinct values.
|
|
172
|
-
* Each value is in the same distance from its neighbors, regardless of their actual numeric difference.
|
|
173
|
-
*
|
|
174
|
-
* `number`: Treats data as continuous range.
|
|
175
|
-
* Values that are numerically closer are placed closer together on the axis.
|
|
176
|
-
*
|
|
177
|
-
* `auto`: the type is inferred based on the chart layout.
|
|
178
|
-
*
|
|
179
|
-
* @defaultValue auto
|
|
180
|
-
*/
|
|
181
|
-
type?: AxisDomainTypeInput;
|
|
182
|
-
/**
|
|
183
|
-
* Z-Index of this component and its children. The higher the value,
|
|
184
|
-
* the more on top it will be rendered.
|
|
185
|
-
* Components with higher zIndex will appear in front of components with lower zIndex.
|
|
186
|
-
* If undefined or 0, the content is rendered in the default layer without portals.
|
|
187
|
-
*
|
|
188
|
-
* @since 3.4
|
|
189
|
-
* @defaultValue 500
|
|
190
|
-
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
|
|
191
|
-
*/
|
|
192
|
-
zIndex?: number;
|
|
193
|
-
}
|
|
194
|
-
type AxisSvgProps = Omit<
|
|
195
|
-
PresentationAttributesAdaptChildEvent<TickItem, SVGTextElement>,
|
|
196
|
-
'scale' | 'type' | 'dangerouslySetInnerHTML'
|
|
197
|
-
>;
|
|
198
|
-
export type Props<DataPointType = any, DataValueType = any> = AxisSvgProps &
|
|
199
|
-
PolarAngleAxisProps<DataPointType, DataValueType>;
|
|
200
|
-
type PropsWithDefaults<DataPointType = any, DataValueType = any> = RequiresDefaultProps<
|
|
201
|
-
Props<DataPointType, DataValueType>,
|
|
202
|
-
typeof defaultPolarAngleAxisProps
|
|
203
|
-
>;
|
|
204
|
-
export declare const PolarAngleAxisWrapper: FunctionComponent<PropsWithDefaults>;
|
|
205
|
-
/**
|
|
206
|
-
* @provides PolarLabelContext
|
|
207
|
-
* @consumes PolarViewBoxContext
|
|
208
|
-
*/
|
|
209
|
-
export declare function PolarAngleAxis<DataPointType = any, DataValueType = any>(
|
|
210
|
-
outsideProps: Props<DataPointType, DataValueType>,
|
|
211
|
-
): React.ReactNode;
|
|
212
|
-
export declare namespace PolarAngleAxis {
|
|
213
|
-
var displayName: string;
|
|
214
|
-
}
|
|
215
|
-
export {};
|