@octanejs/recharts 0.1.41 → 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/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
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from 'octane';
|
|
2
|
-
import { CurveType, Props as CurveProps } from '../shape/Curve';
|
|
3
|
-
import { ImplicitLabelListType } from '../component/LabelList';
|
|
4
|
-
import { StackId } from '../util/ChartUtils';
|
|
5
|
-
import {
|
|
6
|
-
ActiveDotType,
|
|
7
|
-
ActiveShape,
|
|
8
|
-
AnimationDuration,
|
|
9
|
-
CartesianLayout,
|
|
10
|
-
DataConsumer,
|
|
11
|
-
DataProvider,
|
|
12
|
-
DotType,
|
|
13
|
-
EasingInput,
|
|
14
|
-
LegendType,
|
|
15
|
-
TickItem,
|
|
16
|
-
TooltipType,
|
|
17
|
-
} from '../util/types';
|
|
18
|
-
import { Formatter } from '../component/DefaultTooltipContent';
|
|
19
|
-
import { BaseAxisWithScale } from '../state/selectors/axisSelectors';
|
|
20
|
-
import { ChartData } from '../state/chartDataSlice';
|
|
21
|
-
import { AreaPointItem, ComputedArea } from '../state/selectors/areaSelectors';
|
|
22
|
-
import { AnimationInterpolateFn } from '../animation/AnimatedItems';
|
|
23
|
-
import { AnimationMatchByProp } from '../animation/matchBy';
|
|
24
|
-
import { AreaSettings } from '../state/types/AreaSettings';
|
|
25
|
-
import { ZIndexable } from '../zIndex/ZIndexLayer';
|
|
26
|
-
import { AxisId } from '../state/cartesianAxisSlice';
|
|
27
|
-
import { StackDataPoint } from '../util/stacks/stackTypes';
|
|
28
|
-
import { AreaRevealShape, AreaRevealShapeProps } from './AreaRevealShape';
|
|
29
|
-
/**
|
|
30
|
-
* @inline
|
|
31
|
-
*/
|
|
32
|
-
export type BaseValue = number | 'dataMin' | 'dataMax';
|
|
33
|
-
/**
|
|
34
|
-
* External props, intended for end users to fill in
|
|
35
|
-
*/
|
|
36
|
-
interface AreaProps<DataPointType = any, DataValueType = any>
|
|
37
|
-
extends
|
|
38
|
-
DataProvider<DataPointType>,
|
|
39
|
-
Required<DataConsumer<DataPointType, DataValueType>>,
|
|
40
|
-
ZIndexable {
|
|
41
|
-
/**
|
|
42
|
-
* The active dot is rendered on the closest data point when user interacts with the chart. Options:
|
|
43
|
-
*
|
|
44
|
-
* - `false`: dots do not change on user activity; both active and inactive dots follow the `dot` prop (see below)
|
|
45
|
-
* - `true`: renders the active dot with default settings
|
|
46
|
-
* - `object`: the props of the active dot. This will be merged with the internal calculated props of the active dot
|
|
47
|
-
* - `ReactElement`: the custom active dot element
|
|
48
|
-
* - `function`: a render function of the custom active dot
|
|
49
|
-
*
|
|
50
|
-
* @defaultValue true
|
|
51
|
-
* @example <Area dataKey="value" activeDot={false} />
|
|
52
|
-
* @example <Area dataKey="value" activeDot={{ stroke: 'red', strokeWidth: 2, r: 10 }} />
|
|
53
|
-
* @example <Area dataKey="value" activeDot={CustomizedActiveDot} />
|
|
54
|
-
*
|
|
55
|
-
* @see {@link https://recharts.github.io/en-US/examples/SimpleLineChart/ A line chart with customized active dot}
|
|
56
|
-
*/
|
|
57
|
-
activeDot?: ActiveDotType;
|
|
58
|
-
/**
|
|
59
|
-
* Specifies when the animation should begin, the unit of this option is ms.
|
|
60
|
-
* @defaultValue 0
|
|
61
|
-
*/
|
|
62
|
-
animationBegin?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Specifies the duration of animation, the unit of this option is ms.
|
|
65
|
-
* @defaultValue 1500
|
|
66
|
-
*/
|
|
67
|
-
animationDuration?: AnimationDuration;
|
|
68
|
-
/**
|
|
69
|
-
* The type of easing function.
|
|
70
|
-
* @defaultValue 'ease'
|
|
71
|
-
*/
|
|
72
|
-
animationEasing?: EasingInput;
|
|
73
|
-
/**
|
|
74
|
-
* Custom animation function for interpolating data items.
|
|
75
|
-
* When provided, this replaces the default animation interpolation.
|
|
76
|
-
*
|
|
77
|
-
* @param prevItems The items from the previous animation frame, or null on first render
|
|
78
|
-
* @param nextItems The target items to animate towards
|
|
79
|
-
* @param animationElapsedTime A normalized time value (0 = start, 1 = end)
|
|
80
|
-
* @returns The interpolated items at time animationElapsedTime
|
|
81
|
-
*
|
|
82
|
-
* @since 3.9
|
|
83
|
-
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
84
|
-
*/
|
|
85
|
-
animationInterpolateFn?: AnimationInterpolateFn<AreaPointItem, CartesianLayout>;
|
|
86
|
-
/**
|
|
87
|
-
* Strategy for matching previous items to next items during animation.
|
|
88
|
-
* Determines how Recharts pairs old data points with new data points
|
|
89
|
-
* to create smooth transitions.
|
|
90
|
-
*
|
|
91
|
-
* - `matchByIndex` (default): match by array position with proportional stretching
|
|
92
|
-
* - `matchAppend`: match sequentially by index and treat newly appended items as new
|
|
93
|
-
* - `matchByDataKey('someKey')`: match by a data key from the payload
|
|
94
|
-
* - Custom function `(item, index) => key`: match by the returned key
|
|
95
|
-
*
|
|
96
|
-
* @defaultValue index
|
|
97
|
-
* @see matchByIndex
|
|
98
|
-
* @see matchByDataKey
|
|
99
|
-
* @see matchAppend
|
|
100
|
-
*
|
|
101
|
-
* @since 3.9
|
|
102
|
-
* @see {@link https://recharts.github.io/en-US/guide/animations/ Animations guide}
|
|
103
|
-
*/
|
|
104
|
-
animationMatchBy?: AnimationMatchByProp<AreaPointItem>;
|
|
105
|
-
/**
|
|
106
|
-
* Configures the starting value used to build the internal baseline for non-ranged, non-stacked areas.
|
|
107
|
-
*
|
|
108
|
-
* WARNING despite the name `dataMin`|`dataMax` this actually reads the domain instead, so it should rather be
|
|
109
|
-
* `domainMin`|`domainMax`. This looks like a small detail,
|
|
110
|
-
* but it's actually important because domains are usually extended automatically.
|
|
111
|
-
* For example the default numerical domain starts from 0.
|
|
112
|
-
*
|
|
113
|
-
* - `number`: uses the corresponding axis value as a flat baseline
|
|
114
|
-
* - `dataMin`: uses the minimum of the value-axis domain
|
|
115
|
-
* - `dataMax`: uses the maximum of the value-axis domain
|
|
116
|
-
*
|
|
117
|
-
* Ignored when the area is stacked or when `dataKey` already returns `[min, max]` tuples.
|
|
118
|
-
*
|
|
119
|
-
* Note that the baseValue does not interact with `animationInterpolateFn`;
|
|
120
|
-
* baseValue is always animated by linear interpolation.
|
|
121
|
-
* If you want a custom animation then have your `dataKey` return a tuple of two values instead of a single number
|
|
122
|
-
* which will also render a ranged Area, and that does work with your custom `animationInterpolateFn`.
|
|
123
|
-
*/
|
|
124
|
-
baseValue?: BaseValue;
|
|
125
|
-
className?: string;
|
|
126
|
-
/**
|
|
127
|
-
* Whether to connect the area across null points.
|
|
128
|
-
*
|
|
129
|
-
* @defaultValue false
|
|
130
|
-
* @see {@link https://recharts.github.io/en-US/examples/AreaChartConnectNulls/ AreaChart with connectNull true and false}
|
|
131
|
-
*/
|
|
132
|
-
connectNulls?: boolean;
|
|
133
|
-
/**
|
|
134
|
-
* Renders a circle element at each data point. Options:
|
|
135
|
-
*
|
|
136
|
-
* - `false`: no dots are drawn;
|
|
137
|
-
* - `true`: renders the dots with default settings;
|
|
138
|
-
* - `object`: the props of the dot. This will be merged with the internal calculated props of each dot;
|
|
139
|
-
* - `ReactElement`: the custom dot element;
|
|
140
|
-
* - `function`: a render function of the custom dot.
|
|
141
|
-
*
|
|
142
|
-
* @defaultValue false
|
|
143
|
-
*/
|
|
144
|
-
dot?: DotType;
|
|
145
|
-
/**
|
|
146
|
-
* Hides the whole graphical element when true.
|
|
147
|
-
*
|
|
148
|
-
* Hiding an element is different from removing it from the chart:
|
|
149
|
-
* Hidden graphical elements are still visible in Legend,
|
|
150
|
-
* and can be included in axis domain calculations,
|
|
151
|
-
* depending on `includeHidden` props of your XAxis/YAxis.
|
|
152
|
-
*
|
|
153
|
-
* @defaultValue false
|
|
154
|
-
*/
|
|
155
|
-
hide?: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* Unique identifier of this component.
|
|
158
|
-
* Used as an HTML attribute `id`, and also to identify this element internally.
|
|
159
|
-
*
|
|
160
|
-
* If undefined, Recharts will generate a unique ID automatically.
|
|
161
|
-
*/
|
|
162
|
-
id?: string;
|
|
163
|
-
/**
|
|
164
|
-
* If set false, animation of area will be disabled.
|
|
165
|
-
* If set "auto", will be disabled in SSR and will respect the user's prefers-reduced-motion system preference for accessibility.
|
|
166
|
-
* @defaultValue 'auto'
|
|
167
|
-
*/
|
|
168
|
-
isAnimationActive?: boolean | 'auto';
|
|
169
|
-
/**
|
|
170
|
-
* Renders one label for each data point. Options:
|
|
171
|
-
*
|
|
172
|
-
* - `true`: renders default labels
|
|
173
|
-
* - `false`: no labels are rendered
|
|
174
|
-
* - `object`: the props of LabelList component
|
|
175
|
-
* - `ReactElement`: a custom SVG label element, such as `<text>` or `<g>`.
|
|
176
|
-
* HTML elements such as `<div>` are not valid inside the chart SVG and may trigger React DOM warnings.
|
|
177
|
-
* - `function`: a render function of custom label
|
|
178
|
-
*
|
|
179
|
-
* @defaultValue false
|
|
180
|
-
*/
|
|
181
|
-
label?: ImplicitLabelListType;
|
|
182
|
-
/**
|
|
183
|
-
* The type of icon in legend.
|
|
184
|
-
* If set to 'none', no legend item will be rendered.
|
|
185
|
-
* @defaultValue 'line'
|
|
186
|
-
*/
|
|
187
|
-
legendType?: LegendType;
|
|
188
|
-
/**
|
|
189
|
-
* The name of data.
|
|
190
|
-
* This option will be used in tooltip and legend to represent this graphical item.
|
|
191
|
-
* If no value was set to this option, the value of dataKey will be used alternatively.
|
|
192
|
-
*/
|
|
193
|
-
name?: string | number;
|
|
194
|
-
/**
|
|
195
|
-
* The customized event handler of animation end
|
|
196
|
-
*/
|
|
197
|
-
onAnimationEnd?: () => void;
|
|
198
|
-
/**
|
|
199
|
-
* The customized event handler of animation start
|
|
200
|
-
*/
|
|
201
|
-
onAnimationStart?: () => void;
|
|
202
|
-
/**
|
|
203
|
-
* If set a ReactElement, the shape of area can be customized.
|
|
204
|
-
* If set a function, the function will be called to render customized shape.
|
|
205
|
-
* By default, renders a filled curve path with a clipPath entrance animation.
|
|
206
|
-
*
|
|
207
|
-
* During animations the shape receives additional props: `animationElapsedTime`, `isAnimating`, and `isEntrance`.
|
|
208
|
-
* When a custom shape is provided, the built-in clipPath entrance animation is skipped.
|
|
209
|
-
*
|
|
210
|
-
* @see AreaRevealShape — the default entrance animation, available for import from recharts
|
|
211
|
-
* @example <Area dataKey="value" shape={CustomizedShapeComponent} />
|
|
212
|
-
* @example <Area dataKey="value" shape={renderShapeFunction} />
|
|
213
|
-
*/
|
|
214
|
-
shape?: ActiveShape<AreaRevealShapeProps, SVGPathElement>;
|
|
215
|
-
/**
|
|
216
|
-
* When two Areas have the same axisId and same stackId, then the two Areas are stacked in the chart.
|
|
217
|
-
*/
|
|
218
|
-
stackId?: StackId;
|
|
219
|
-
/**
|
|
220
|
-
* The stroke color. If "none", no line will be drawn.
|
|
221
|
-
* @defaultValue '#3182bd'
|
|
222
|
-
*/
|
|
223
|
-
stroke?: string;
|
|
224
|
-
/**
|
|
225
|
-
* The width of the stroke
|
|
226
|
-
* @defaultValue 1
|
|
227
|
-
*/
|
|
228
|
-
strokeWidth?: string | number;
|
|
229
|
-
tooltipType?: TooltipType;
|
|
230
|
-
/**
|
|
231
|
-
* The interpolation type of curve. Allows custom interpolation function.
|
|
232
|
-
*
|
|
233
|
-
* @defaultValue linear
|
|
234
|
-
* @link https://d3js.org/d3-shape/curve
|
|
235
|
-
* @see {@link https://recharts.github.io/en-US/examples/CardinalAreaChart/ An AreaChart which has two area with different interpolation.}
|
|
236
|
-
*/
|
|
237
|
-
type?: CurveType;
|
|
238
|
-
/**
|
|
239
|
-
* The unit of data. This option will be used in tooltip.
|
|
240
|
-
*/
|
|
241
|
-
unit?: string | number;
|
|
242
|
-
/**
|
|
243
|
-
* Formats the value displayed in the tooltip for this Area.
|
|
244
|
-
* When set, takes precedence over the `formatter` prop on the Tooltip component.
|
|
245
|
-
*/
|
|
246
|
-
formatter?: Formatter;
|
|
247
|
-
/**
|
|
248
|
-
* The id of XAxis which is corresponding to the data. Required when there are multiple XAxes.
|
|
249
|
-
* @defaultValue 0
|
|
250
|
-
*/
|
|
251
|
-
xAxisId?: AxisId;
|
|
252
|
-
/**
|
|
253
|
-
* The id of YAxis which is corresponding to the data. Required when there are multiple YAxes.
|
|
254
|
-
* @defaultValue 0
|
|
255
|
-
*/
|
|
256
|
-
yAxisId?: AxisId;
|
|
257
|
-
/**
|
|
258
|
-
* Z-Index of this component and its children. The higher the value,
|
|
259
|
-
* the more on top it will be rendered.
|
|
260
|
-
* Components with higher zIndex will appear in front of components with lower zIndex.
|
|
261
|
-
* If undefined or 0, the content is rendered in the default layer without portals.
|
|
262
|
-
*
|
|
263
|
-
* @since 3.4
|
|
264
|
-
* @defaultValue 100
|
|
265
|
-
* @see {@link https://recharts.github.io/en-US/guide/zIndex/ Z-Index and layers guide}
|
|
266
|
-
*/
|
|
267
|
-
zIndex?: number;
|
|
268
|
-
}
|
|
269
|
-
export declare const defaultAreaProps: {
|
|
270
|
-
readonly activeDot: true;
|
|
271
|
-
readonly animationBegin: 0;
|
|
272
|
-
readonly animationDuration: 1500;
|
|
273
|
-
readonly animationEasing: 'ease';
|
|
274
|
-
readonly animationMatchBy: 'index';
|
|
275
|
-
readonly animationInterpolateFn: AnimationInterpolateFn<AreaPointItem, CartesianLayout>;
|
|
276
|
-
readonly connectNulls: false;
|
|
277
|
-
readonly dot: false;
|
|
278
|
-
readonly fill: '#3182bd';
|
|
279
|
-
readonly fillOpacity: 0.6;
|
|
280
|
-
readonly hide: false;
|
|
281
|
-
readonly isAnimationActive: 'auto';
|
|
282
|
-
readonly legendType: 'line';
|
|
283
|
-
readonly stroke: '#3182bd';
|
|
284
|
-
readonly strokeWidth: 1;
|
|
285
|
-
readonly type: 'linear';
|
|
286
|
-
readonly label: false;
|
|
287
|
-
readonly shape: typeof AreaRevealShape;
|
|
288
|
-
readonly xAxisId: 0;
|
|
289
|
-
readonly yAxisId: 0;
|
|
290
|
-
readonly zIndex: 100;
|
|
291
|
-
};
|
|
292
|
-
/**
|
|
293
|
-
* Because of naming conflict, we are forced to ignore certain (valid) SVG attributes.
|
|
294
|
-
*/
|
|
295
|
-
type AreaSvgProps = Omit<
|
|
296
|
-
CurveProps,
|
|
297
|
-
'points' | 'ref' | 'layout' | 'path' | 'pathRef' | 'baseLine' | 'dangerouslySetInnerHTML'
|
|
298
|
-
>;
|
|
299
|
-
export type Props<DataPointType, ValueAxisType> = AreaSvgProps &
|
|
300
|
-
AreaProps<DataPointType, ValueAxisType>;
|
|
301
|
-
export declare const getBaseValue: (
|
|
302
|
-
layout: 'horizontal' | 'vertical',
|
|
303
|
-
chartBaseValue: BaseValue | undefined,
|
|
304
|
-
itemBaseValue: BaseValue | undefined,
|
|
305
|
-
xAxis: BaseAxisWithScale,
|
|
306
|
-
yAxis: BaseAxisWithScale,
|
|
307
|
-
) => number;
|
|
308
|
-
export declare function computeArea({
|
|
309
|
-
areaSettings: { connectNulls, baseValue: itemBaseValue, dataKey },
|
|
310
|
-
stackedData,
|
|
311
|
-
layout,
|
|
312
|
-
chartBaseValue,
|
|
313
|
-
xAxis,
|
|
314
|
-
yAxis,
|
|
315
|
-
displayedData,
|
|
316
|
-
dataStartIndex,
|
|
317
|
-
xAxisTicks,
|
|
318
|
-
yAxisTicks,
|
|
319
|
-
bandSize,
|
|
320
|
-
}: {
|
|
321
|
-
areaSettings: AreaSettings;
|
|
322
|
-
stackedData: ReadonlyArray<StackDataPoint> | undefined;
|
|
323
|
-
layout: 'horizontal' | 'vertical';
|
|
324
|
-
chartBaseValue: BaseValue | undefined;
|
|
325
|
-
xAxis: BaseAxisWithScale;
|
|
326
|
-
yAxis: BaseAxisWithScale;
|
|
327
|
-
displayedData: ChartData;
|
|
328
|
-
dataStartIndex: number;
|
|
329
|
-
xAxisTicks: TickItem[];
|
|
330
|
-
yAxisTicks: TickItem[];
|
|
331
|
-
bandSize: number;
|
|
332
|
-
}): ComputedArea;
|
|
333
|
-
/**
|
|
334
|
-
* @provides LabelListContext
|
|
335
|
-
* @consumes CartesianChartContext
|
|
336
|
-
*/
|
|
337
|
-
export declare const Area: <DataPointType = any, ValueAxisType = any>(
|
|
338
|
-
props: Props<DataPointType, ValueAxisType>,
|
|
339
|
-
) => ReactElement;
|
|
340
|
-
export {};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
// Type declaration for the .tsrx component (resolved by relative path).
|
|
2
|
-
export declare const defaultBarProps: Record<string, unknown>;
|
|
3
|
-
export declare const Bar: (props: Record<string, unknown>) => unknown;
|
|
4
|
-
export declare function computeBarRectangles(input: Record<string, unknown>): unknown[];
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// Type declaration for the .tsrx component (resolved by relative path).
|
|
2
|
-
export declare const defaultBarStackProps: Record<string, unknown>;
|
|
3
|
-
export declare const BarStack: (props: Record<string, unknown>) => unknown;
|
|
4
|
-
export declare function useStackId(childStackId?: unknown): string | undefined;
|
|
5
|
-
export declare function useBarStackClipPathUrl(index: number): string | undefined;
|
|
6
|
-
export declare const BarStackClipLayer: (props: Record<string, unknown>) => unknown;
|
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
import * as React from 'octane';
|
|
2
|
-
import { ReactElement, SVGProps } from 'octane';
|
|
3
|
-
import { ChartOffsetInternal } from '../util/types';
|
|
4
|
-
import { AxisPropsNeededForTicksGenerator } from '../util/ChartUtils';
|
|
5
|
-
import { GetTicksInput } from './getTicks';
|
|
6
|
-
import { AxisId } from '../state/cartesianAxisSlice';
|
|
7
|
-
import { ZIndexable } from '../zIndex/ZIndexLayer';
|
|
8
|
-
/**
|
|
9
|
-
* The <CartesianGrid horizontal
|
|
10
|
-
*/
|
|
11
|
-
export type GridLineTypeFunctionProps = Omit<LineItemProps, 'key'> & {
|
|
12
|
-
key: LineItemProps['key'] | undefined;
|
|
13
|
-
offset: ChartOffsetInternal;
|
|
14
|
-
};
|
|
15
|
-
export type AxisPropsForCartesianGridTicksGeneration = AxisPropsNeededForTicksGenerator &
|
|
16
|
-
Omit<GetTicksInput, 'ticks' | 'viewBox'>;
|
|
17
|
-
type GridLineType =
|
|
18
|
-
| SVGProps<SVGLineElement>
|
|
19
|
-
| ReactElement<SVGElement>
|
|
20
|
-
| ((props: GridLineTypeFunctionProps) => ReactElement<SVGElement>)
|
|
21
|
-
| boolean;
|
|
22
|
-
export type HorizontalCoordinatesGenerator = (
|
|
23
|
-
props: {
|
|
24
|
-
yAxis: AxisPropsForCartesianGridTicksGeneration | undefined;
|
|
25
|
-
width: number;
|
|
26
|
-
height: number;
|
|
27
|
-
offset: ChartOffsetInternal;
|
|
28
|
-
},
|
|
29
|
-
syncWithTicks: boolean,
|
|
30
|
-
) => number[];
|
|
31
|
-
export type VerticalCoordinatesGenerator = (
|
|
32
|
-
props: {
|
|
33
|
-
xAxis: AxisPropsForCartesianGridTicksGeneration | undefined;
|
|
34
|
-
width: number;
|
|
35
|
-
height: number;
|
|
36
|
-
offset: ChartOffsetInternal;
|
|
37
|
-
},
|
|
38
|
-
syncWithTicks: boolean,
|
|
39
|
-
) => number[];
|
|
40
|
-
interface CartesianGridProps extends ZIndexable {
|
|
41
|
-
/**
|
|
42
|
-
* The width of grid. If undefined, covers the full width of the chart plot area.
|
|
43
|
-
*/
|
|
44
|
-
width?: number;
|
|
45
|
-
/**
|
|
46
|
-
* The height of grid. If undefined, covers the full height of the chart plot area.
|
|
47
|
-
*/
|
|
48
|
-
height?: number;
|
|
49
|
-
/**
|
|
50
|
-
* A function that generates the y-coordinates of all horizontal lines.
|
|
51
|
-
*
|
|
52
|
-
* @see {@link https://codesandbox.io/p/sandbox/cartesian-grid-with-coordinate-generators-my38cg?file=%2Fsrc%2FApp.tsx Cartesian grid with coordinate generators}
|
|
53
|
-
*/
|
|
54
|
-
horizontalCoordinatesGenerator?: HorizontalCoordinatesGenerator;
|
|
55
|
-
/**
|
|
56
|
-
* A function that generates the x-coordinates of all vertical lines.
|
|
57
|
-
*
|
|
58
|
-
* @see {@link https://codesandbox.io/p/sandbox/cartesian-grid-with-coordinate-generators-my38cg?file=%2Fsrc%2FApp.tsx Cartesian grid with coordinate generators}
|
|
59
|
-
*/
|
|
60
|
-
verticalCoordinatesGenerator?: VerticalCoordinatesGenerator;
|
|
61
|
-
/**
|
|
62
|
-
* The x-coordinate of grid.
|
|
63
|
-
* If left undefined, it will be computed from the chart's offset and margins.
|
|
64
|
-
*/
|
|
65
|
-
x?: number;
|
|
66
|
-
/**
|
|
67
|
-
* The y-coordinate of grid.
|
|
68
|
-
* If left undefined, it will be computed from the chart's offset and margins.
|
|
69
|
-
*/
|
|
70
|
-
y?: number;
|
|
71
|
-
/**
|
|
72
|
-
* If set false, no horizontal grid lines will be drawn.
|
|
73
|
-
*
|
|
74
|
-
* @defaultValue true
|
|
75
|
-
*/
|
|
76
|
-
horizontal?: GridLineType;
|
|
77
|
-
/**
|
|
78
|
-
* If set false, no vertical grid lines will be drawn.
|
|
79
|
-
*
|
|
80
|
-
* @defaultValue true
|
|
81
|
-
*/
|
|
82
|
-
vertical?: GridLineType;
|
|
83
|
-
/**
|
|
84
|
-
* Array of coordinates in pixels where to draw horizontal grid lines.
|
|
85
|
-
* Has priority over syncWithTicks and horizontalValues.
|
|
86
|
-
*
|
|
87
|
-
* @defaultValue []
|
|
88
|
-
*/
|
|
89
|
-
horizontalPoints?: number[];
|
|
90
|
-
/**
|
|
91
|
-
* Array of coordinates in pixels where to draw vertical grid lines.
|
|
92
|
-
* Has priority over syncWithTicks and verticalValues.
|
|
93
|
-
*
|
|
94
|
-
* @defaultValue []
|
|
95
|
-
*/
|
|
96
|
-
verticalPoints?: number[];
|
|
97
|
-
/**
|
|
98
|
-
* The background color used to fill the space between grid lines
|
|
99
|
-
*
|
|
100
|
-
* @defaultValue none
|
|
101
|
-
* @example <CartesianGrid fill="red" />
|
|
102
|
-
* @example <CartesianGrid fill="#ccc" />
|
|
103
|
-
*/
|
|
104
|
-
fill?: string;
|
|
105
|
-
/**
|
|
106
|
-
* The opacity of the background used to fill the space between grid lines
|
|
107
|
-
*
|
|
108
|
-
* @example <CartesianGrid fill="red" fillOpacity={0.6} />
|
|
109
|
-
*/
|
|
110
|
-
fillOpacity?: number | string;
|
|
111
|
-
/**
|
|
112
|
-
* Defines background color of stripes.
|
|
113
|
-
*
|
|
114
|
-
* The values from this array will be passed in as the `fill` property in a `rect` SVG element.
|
|
115
|
-
* For possible values see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill#rect
|
|
116
|
-
*
|
|
117
|
-
* In case there are more stripes than colors, the colors will start from beginning.
|
|
118
|
-
* So for example: verticalFill['yellow', 'black'] produces a pattern of yellow|black|yellow|black
|
|
119
|
-
*
|
|
120
|
-
* If this is undefined, or an empty array, then there is no background fill.
|
|
121
|
-
* Note: Grid lines will be rendered above these background stripes.
|
|
122
|
-
*
|
|
123
|
-
* @defaultValue []
|
|
124
|
-
*/
|
|
125
|
-
verticalFill?: string[];
|
|
126
|
-
/**
|
|
127
|
-
* Defines background color of stripes.
|
|
128
|
-
*
|
|
129
|
-
* The values from this array will be passed in as the `fill` property in a `rect` SVG element.
|
|
130
|
-
* For possible values see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill#rect
|
|
131
|
-
*
|
|
132
|
-
* In case there are more stripes than colors, the colors will start from beginning.
|
|
133
|
-
* So for example: horizontalFill['yellow', 'black'] produces a pattern of yellow|black|yellow|black
|
|
134
|
-
*
|
|
135
|
-
* If this is undefined, or an empty array, then there is no background fill.
|
|
136
|
-
* Note: Grid lines will be rendered above these background stripes.
|
|
137
|
-
*
|
|
138
|
-
* @defaultValue []
|
|
139
|
-
*/
|
|
140
|
-
horizontalFill?: string[];
|
|
141
|
-
/**
|
|
142
|
-
* If true, only the lines that correspond to the axes ticks values will be drawn.
|
|
143
|
-
* If false, extra lines could be added for each axis (at min and max coordinates), if there will not such ticks.
|
|
144
|
-
* horizontalPoints, verticalPoints, horizontalValues, verticalValues have priority over syncWithTicks.
|
|
145
|
-
*
|
|
146
|
-
* @defaultValue false
|
|
147
|
-
*/
|
|
148
|
-
syncWithTicks?: boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Array of values, where horizontal lines will be drawn. Numbers or strings, in dependence on axis type.
|
|
151
|
-
* Has priority over syncWithTicks but not over horizontalPoints.
|
|
152
|
-
*/
|
|
153
|
-
horizontalValues?: number[] | string[];
|
|
154
|
-
/**
|
|
155
|
-
* Array of values, where vertical lines will be drawn. Numbers or strings, in dependence on axis type.
|
|
156
|
-
* Has priority over syncWithTicks but not over verticalPoints.
|
|
157
|
-
*/
|
|
158
|
-
verticalValues?: number[] | string[];
|
|
159
|
-
/**
|
|
160
|
-
* The pattern of dashes and gaps used to paint the lines of the grid
|
|
161
|
-
*
|
|
162
|
-
* @example <CartesianGrid strokeDasharray="3 3" />
|
|
163
|
-
* @example <CartesianGrid strokeDasharray={[5, 5, 1, 5]} />
|
|
164
|
-
* @example <CartesianGrid strokeDasharray="5 5 1 5" />
|
|
165
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray stroke-dasharray on MDN}
|
|
166
|
-
*/
|
|
167
|
-
strokeDasharray?: string | number[];
|
|
168
|
-
/**
|
|
169
|
-
* The id of XAxis which is corresponding to the data. Required when there are multiple XAxes.
|
|
170
|
-
* @defaultValue 0
|
|
171
|
-
*/
|
|
172
|
-
xAxisId?: AxisId;
|
|
173
|
-
/**
|
|
174
|
-
* The id of YAxis which is corresponding to the data. Required when there are multiple YAxes.
|
|
175
|
-
* @defaultValue 0
|
|
176
|
-
*/
|
|
177
|
-
yAxisId?: AxisId;
|
|
178
|
-
/**
|
|
179
|
-
* @defaultValue -100
|
|
180
|
-
*/
|
|
181
|
-
zIndex?: number;
|
|
182
|
-
}
|
|
183
|
-
type AcceptedSvgProps = Omit<SVGProps<SVGLineElement>, 'offset'>;
|
|
184
|
-
export type Props = AcceptedSvgProps & CartesianGridProps;
|
|
185
|
-
type LineItemProps = Props & {
|
|
186
|
-
offset: ChartOffsetInternal;
|
|
187
|
-
xAxis: undefined | AxisPropsForCartesianGridTicksGeneration;
|
|
188
|
-
yAxis: undefined | AxisPropsForCartesianGridTicksGeneration;
|
|
189
|
-
x1: number;
|
|
190
|
-
y1: number;
|
|
191
|
-
x2: number;
|
|
192
|
-
y2: number;
|
|
193
|
-
key: string;
|
|
194
|
-
index: number;
|
|
195
|
-
};
|
|
196
|
-
export declare const defaultCartesianGridProps: {
|
|
197
|
-
readonly horizontal: true;
|
|
198
|
-
readonly vertical: true;
|
|
199
|
-
readonly horizontalPoints: [];
|
|
200
|
-
readonly verticalPoints: [];
|
|
201
|
-
readonly stroke: '#ccc';
|
|
202
|
-
readonly fill: 'none';
|
|
203
|
-
readonly verticalFill: [];
|
|
204
|
-
readonly horizontalFill: [];
|
|
205
|
-
readonly xAxisId: 0;
|
|
206
|
-
readonly yAxisId: 0;
|
|
207
|
-
readonly syncWithTicks: false;
|
|
208
|
-
readonly zIndex: -100;
|
|
209
|
-
};
|
|
210
|
-
/**
|
|
211
|
-
* Renders background grid with lines and fill colors in a Cartesian chart.
|
|
212
|
-
*
|
|
213
|
-
* @consumes CartesianChartContext
|
|
214
|
-
*/
|
|
215
|
-
export declare function CartesianGrid(props: Props): React.JSX.Element | null;
|
|
216
|
-
export declare namespace CartesianGrid {
|
|
217
|
-
var displayName: string;
|
|
218
|
-
}
|
|
219
|
-
export {};
|