vccs 0.0.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/animation/Animate.d.ts +72 -0
- package/dist/cartesian/GraphicalItemClipPath.d.ts +31 -0
- package/dist/cartesian/area/ActivePoints.d.ts +77 -0
- package/dist/cartesian/area/Area.d.ts +17 -0
- package/dist/cartesian/area/ClipRect.d.ts +1 -0
- package/dist/cartesian/area/RenderArea.d.ts +16 -0
- package/dist/cartesian/area/__stories__/config.d.ts +31 -0
- package/dist/cartesian/area/hooks/useArea.d.ts +27 -0
- package/dist/cartesian/area/index.d.ts +2 -0
- package/dist/cartesian/area/type.d.ts +173 -0
- package/dist/cartesian/area/utils.d.ts +19 -0
- package/dist/cartesian/axis/XAxis.d.ts +189 -0
- package/dist/cartesian/axis/YAxis.d.ts +192 -0
- package/dist/cartesian/axis/index.d.ts +2 -0
- package/dist/cartesian/axis/type.d.ts +57 -0
- package/dist/cartesian/bar/Bar.d.ts +2 -0
- package/dist/cartesian/bar/components/BarBackground.d.ts +1 -0
- package/dist/cartesian/bar/components/BarRectangles.d.ts +1 -0
- package/dist/cartesian/bar/hooks/useBar.d.ts +23 -0
- package/dist/cartesian/bar/index.d.ts +1 -0
- package/dist/cartesian/bar/type.d.ts +166 -0
- package/dist/cartesian/bar/utils.d.ts +31 -0
- package/dist/cartesian/brush/Brush.d.ts +2 -0
- package/dist/cartesian/brush/components/Background.d.ts +15 -0
- package/dist/cartesian/brush/components/BrushText.d.ts +27 -0
- package/dist/cartesian/brush/components/Panorama.d.ts +65 -0
- package/dist/cartesian/brush/components/Slide.d.ts +20 -0
- package/dist/cartesian/brush/components/Traveller.d.ts +13 -0
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +22 -0
- package/dist/cartesian/brush/hooks/useBrushHandlers.d.ts +25 -0
- package/dist/cartesian/brush/hooks/useBrushSetting.d.ts +6 -0
- package/dist/cartesian/brush/hooks/useBrushState.d.ts +29 -0
- package/dist/cartesian/brush/index.d.ts +2 -0
- package/dist/cartesian/brush/type.d.ts +103 -0
- package/dist/cartesian/brush/utils.d.ts +15 -0
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +209 -0
- package/dist/cartesian/cartesian-axis/const.d.ts +24 -0
- package/dist/cartesian/cartesian-axis/index.d.ts +1 -0
- package/dist/cartesian/cartesian-axis/use-axis-line.d.ts +7 -0
- package/dist/cartesian/cartesian-grid/Background.d.ts +18 -0
- package/dist/cartesian/cartesian-grid/CartesianGrid.d.ts +75 -0
- package/dist/cartesian/cartesian-grid/HorizontalGridLines.d.ts +37 -0
- package/dist/cartesian/cartesian-grid/HorizontalStripes.d.ts +20 -0
- package/dist/cartesian/cartesian-grid/VerticalGridLines.d.ts +26 -0
- package/dist/cartesian/cartesian-grid/VerticalStripes.d.ts +20 -0
- package/dist/cartesian/cartesian-grid/const.d.ts +6 -0
- package/dist/cartesian/cartesian-grid/index.d.ts +1 -0
- package/dist/cartesian/cartesian-grid/type.d.ts +145 -0
- package/dist/cartesian/cartesian-grid/utils.d.ts +5 -0
- package/dist/cartesian/error-bar/ErrorBar.d.ts +68 -0
- package/dist/cartesian/error-bar/ErrorBarContext.d.ts +27 -0
- package/dist/cartesian/error-bar/index.d.ts +2 -0
- package/dist/cartesian/funnel/Funnel.d.ts +2 -0
- package/dist/cartesian/funnel/index.d.ts +2 -0
- package/dist/cartesian/funnel/type.d.ts +106 -0
- package/dist/cartesian/funnel/utils.d.ts +12 -0
- package/dist/cartesian/index.d.ts +12 -0
- package/dist/cartesian/line/ActivePoints.d.ts +77 -0
- package/dist/cartesian/line/Line.d.ts +87 -0
- package/dist/cartesian/line/StaticLine.d.ts +16 -0
- package/dist/cartesian/line/hooks/useLine.d.ts +28 -0
- package/dist/cartesian/line/index.d.ts +3 -0
- package/dist/cartesian/line/type.d.ts +180 -0
- package/dist/cartesian/line/utils.d.ts +13 -0
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +191 -0
- package/dist/cartesian/reference-area/index.d.ts +1 -0
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +139 -0
- package/dist/cartesian/reference-line/index.d.ts +1 -0
- package/dist/cartesian/scatter/Scatter.d.ts +165 -0
- package/dist/cartesian/scatter/hooks/useScatter.d.ts +18 -0
- package/dist/cartesian/scatter/index.d.ts +1 -0
- package/dist/cartesian/type.d.ts +21 -0
- package/dist/cartesian/useNeedsClip.d.ts +6 -0
- package/dist/cartesian/utils/get-ticks.d.ts +16 -0
- package/dist/cartesian/z-axis/ZAxis.d.ts +81 -0
- package/dist/cartesian/z-axis/index.d.ts +1 -0
- package/dist/chart/AreaChart.d.ts +1 -0
- package/dist/chart/BarChart.d.ts +1 -0
- package/dist/chart/ComposedChart.d.ts +1 -0
- package/dist/chart/FunnelChart.d.ts +1 -0
- package/dist/chart/LegendPortalContext.d.ts +3 -0
- package/dist/chart/LineChart.d.ts +1 -0
- package/dist/chart/PieChart.d.ts +1 -0
- package/dist/chart/RadarChart.d.ts +1 -0
- package/dist/chart/RadialBarChart.d.ts +1 -0
- package/dist/chart/RechartsWrapper.d.ts +99 -0
- package/dist/chart/ScatterChart.d.ts +1 -0
- package/dist/chart/Surface.d.ts +40 -0
- package/dist/chart/TooltipPortalContext.d.ts +2 -0
- package/dist/chart/const.d.ts +6 -0
- package/dist/chart/generateCategoricalChart.d.ts +118 -0
- package/dist/chart/index.d.ts +9 -0
- package/dist/chart/provideClipPathId.d.ts +12 -0
- package/dist/components/Cell.d.ts +18 -0
- package/dist/components/DefaultLegendContent.d.ts +18 -0
- package/dist/components/Text.d.ts +149 -0
- package/dist/components/Tooltip.d.ts +250 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/label/Label.d.ts +81 -0
- package/dist/components/label/LabelList.d.ts +63 -0
- package/dist/components/label/index.d.ts +2 -0
- package/dist/components/label/types.d.ts +88 -0
- package/dist/components/label/utils.d.ts +24 -0
- package/dist/components/legend/Legend.d.ts +4 -0
- package/dist/components/legend/LegendSymbol.d.ts +27 -0
- package/dist/components/legend/hooks/useLegend.d.ts +19 -0
- package/dist/components/legend/hooks/useLegendContent.d.ts +36 -0
- package/dist/components/legend/index.d.ts +2 -0
- package/dist/components/legend/type.d.ts +54 -0
- package/dist/components/legend/utils.d.ts +18 -0
- package/dist/components/types.d.ts +9 -0
- package/dist/components/utils.d.ts +4 -0
- package/dist/container/ClipPath.d.ts +12 -0
- package/dist/container/Layer.d.ts +2 -0
- package/dist/container/ResponsiveContainer.d.ts +50 -0
- package/dist/container/RootSurface.d.ts +17 -0
- package/dist/container/Surface.d.ts +25 -0
- package/dist/container/index.d.ts +1 -0
- package/dist/container/useSizeContext.d.ts +11 -0
- package/dist/context/ChartDataContextProvider.d.ts +17 -0
- package/dist/context/PanoramaContextProvider.d.ts +22 -0
- package/dist/context/accessibilityContext.d.ts +1 -0
- package/dist/context/cartesianLabelListContext.d.ts +3 -0
- package/dist/context/chartLayoutContext.d.ts +8 -0
- package/dist/context/cursorLayerContext.d.ts +2 -0
- package/dist/context/graphicalLayerContext.d.ts +2 -0
- package/dist/context/labelLayerContext.d.ts +2 -0
- package/dist/context/polarLabelViewBoxContext.d.ts +4 -0
- package/dist/context/useTooltipAxis.d.ts +2 -0
- package/dist/es/animation/Animate.mjs +89 -0
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +37 -0
- package/dist/es/cartesian/area/ActivePoints.mjs +78 -0
- package/dist/es/cartesian/area/Area.mjs +52 -0
- package/dist/es/cartesian/area/ClipRect.mjs +125 -0
- package/dist/es/cartesian/area/RenderArea.mjs +185 -0
- package/dist/es/cartesian/area/hooks/useArea.mjs +81 -0
- package/dist/es/cartesian/area/type.mjs +136 -0
- package/dist/es/cartesian/area/utils.mjs +79 -0
- package/dist/es/cartesian/axis/XAxis.mjs +203 -0
- package/dist/es/cartesian/axis/YAxis.mjs +192 -0
- package/dist/es/cartesian/bar/Bar.mjs +111 -0
- package/dist/es/cartesian/bar/components/BarBackground.mjs +32 -0
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +143 -0
- package/dist/es/cartesian/bar/hooks/useBar.mjs +53 -0
- package/dist/es/cartesian/bar/type.mjs +131 -0
- package/dist/es/cartesian/bar/utils.mjs +111 -0
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +296 -0
- package/dist/es/cartesian/cartesian-grid/Background.mjs +33 -0
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +174 -0
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +50 -0
- package/dist/es/cartesian/cartesian-grid/HorizontalStripes.mjs +43 -0
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +45 -0
- package/dist/es/cartesian/cartesian-grid/VerticalStripes.mjs +43 -0
- package/dist/es/cartesian/cartesian-grid/const.mjs +336 -0
- package/dist/es/cartesian/cartesian-grid/utils.mjs +22 -0
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +143 -0
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +20 -0
- package/dist/es/cartesian/funnel/Funnel.mjs +177 -0
- package/dist/es/cartesian/funnel/type.mjs +80 -0
- package/dist/es/cartesian/funnel/utils.mjs +102 -0
- package/dist/es/cartesian/line/ActivePoints.mjs +79 -0
- package/dist/es/cartesian/line/Line.mjs +50 -0
- package/dist/es/cartesian/line/StaticLine.mjs +217 -0
- package/dist/es/cartesian/line/hooks/useLine.mjs +69 -0
- package/dist/es/cartesian/line/type.mjs +112 -0
- package/dist/es/cartesian/line/utils.mjs +34 -0
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +163 -0
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +165 -0
- package/dist/es/cartesian/scatter/Scatter.mjs +280 -0
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +23 -0
- package/dist/es/cartesian/useNeedsClip.mjs +23 -0
- package/dist/es/cartesian/utils/get-ticks.mjs +118 -0
- package/dist/es/cartesian/z-axis/ZAxis.mjs +72 -0
- package/dist/es/chart/AreaChart.mjs +9 -0
- package/dist/es/chart/BarChart.mjs +10 -0
- package/dist/es/chart/ComposedChart.mjs +10 -0
- package/dist/es/chart/FunnelChart.mjs +11 -0
- package/dist/es/chart/LegendPortalContext.mjs +5 -0
- package/dist/es/chart/LineChart.mjs +10 -0
- package/dist/es/chart/PieChart.mjs +16 -0
- package/dist/es/chart/RadarChart.mjs +16 -0
- package/dist/es/chart/RadialBarChart.mjs +16 -0
- package/dist/es/chart/RechartsWrapper.mjs +160 -0
- package/dist/es/chart/ScatterChart.mjs +10 -0
- package/dist/es/chart/Surface.mjs +5 -0
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +72 -0
- package/dist/es/chart/TooltipPortalContext.mjs +5 -0
- package/dist/es/chart/const.mjs +7 -0
- package/dist/es/chart/generateCategoricalChart.mjs +175 -0
- package/dist/es/chart/provideClipPathId.mjs +15 -0
- package/dist/es/components/Cell.mjs +23 -0
- package/dist/es/components/Text.mjs +5 -0
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +191 -0
- package/dist/es/components/Tooltip.mjs +463 -0
- package/dist/es/components/label/Label.mjs +40 -0
- package/dist/es/components/label/LabelList.mjs +55 -0
- package/dist/es/components/label/types.mjs +38 -0
- package/dist/es/components/label/utils.mjs +265 -0
- package/dist/es/components/legend/Legend.mjs +93 -0
- package/dist/es/components/legend/LegendSymbol.mjs +62 -0
- package/dist/es/components/legend/hooks/useLegend.mjs +72 -0
- package/dist/es/components/legend/hooks/useLegendContent.mjs +68 -0
- package/dist/es/components/legend/type.mjs +41 -0
- package/dist/es/components/legend/utils.mjs +25 -0
- package/dist/es/components/utils.mjs +44 -0
- package/dist/es/container/ClipPath.mjs +25 -0
- package/dist/es/container/Layer.mjs +14 -0
- package/dist/es/container/ResponsiveContainer.mjs +5 -0
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +144 -0
- package/dist/es/container/Surface.mjs +62 -0
- package/dist/es/container/useSizeContext.mjs +5 -0
- package/dist/es/context/ChartDataContextProvider.mjs +27 -0
- package/dist/es/context/PanoramaContextProvider.mjs +24 -0
- package/dist/es/context/accessibilityContext.mjs +5 -0
- package/dist/es/context/cartesianLabelListContext.mjs +5 -0
- package/dist/es/context/chartLayoutContext.mjs +49 -0
- package/dist/es/context/cursorLayerContext.mjs +5 -0
- package/dist/es/context/graphicalLayerContext.mjs +5 -0
- package/dist/es/context/labelLayerContext.mjs +5 -0
- package/dist/es/context/polarLabelViewBoxContext.mjs +8 -0
- package/dist/es/context/useTooltipAxis.mjs +17 -0
- package/dist/es/events/useChartSynchronisation.mjs +113 -0
- package/dist/es/hooks/useIsAnimating.mjs +28 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +66 -0
- package/dist/es/index.mjs +46 -0
- package/dist/es/polar/pie/Pie.mjs +161 -0
- package/dist/es/polar/pie/type.mjs +97 -0
- package/dist/es/polar/radar/PolarAngleAxis.mjs +180 -0
- package/dist/es/polar/radar/PolarGrid.mjs +115 -0
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +162 -0
- package/dist/es/polar/radar/Radar.mjs +284 -0
- package/dist/es/polar/radial-bar/RadialBar.mjs +197 -0
- package/dist/es/polar/radial-bar/type.mjs +97 -0
- package/dist/es/shape/Cross.mjs +16 -0
- package/dist/es/shape/Curve.mjs +86 -0
- package/dist/es/shape/Dot.mjs +24 -0
- package/dist/es/shape/Rectangle.mjs +83 -0
- package/dist/es/shape/Sector.mjs +156 -0
- package/dist/es/shape/Symbols.mjs +52 -0
- package/dist/es/shape/Trapezoid.mjs +52 -0
- package/dist/es/state/ReportChartProps.mjs +64 -0
- package/dist/es/state/ReportMainChartProps.mjs +46 -0
- package/dist/es/state/ReportPolarOptions.mjs +56 -0
- package/dist/es/state/SetGraphicalItem.mjs +49 -0
- package/dist/es/state/SetLegendPayload.mjs +20 -0
- package/dist/es/state/SetTooltipEntrySettings.mjs +19 -0
- package/dist/es/state/brushSlice.mjs +26 -0
- package/dist/es/state/cartesianAxisSlice.mjs +39 -0
- package/dist/es/state/chartDataSlice.mjs +33 -0
- package/dist/es/state/externalEventsMiddleware.mjs +30 -0
- package/dist/es/state/graphicalItemsSlice.mjs +47 -0
- package/dist/es/state/hooks.mjs +6 -0
- package/dist/es/state/keyboardEventsMiddleware.mjs +63 -0
- package/dist/es/state/layoutSlice.mjs +39 -0
- package/dist/es/state/legendSlice.mjs +40 -0
- package/dist/es/state/mouseEventsMiddleware.mjs +41 -0
- package/dist/es/state/optionsSlice.mjs +25 -0
- package/dist/es/state/polarAxisSlice.mjs +28 -0
- package/dist/es/state/polarOptionsSlice.mjs +13 -0
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +8 -0
- package/dist/es/state/referenceElementsSlice.mjs +36 -0
- package/dist/es/state/rootPropsSlice.mjs +32 -0
- package/dist/es/state/selectors/areaSelectors.mjs +77 -0
- package/dist/es/state/selectors/axisSelectors.mjs +879 -0
- package/dist/es/state/selectors/barSelectors.mjs +241 -0
- package/dist/es/state/selectors/brushSelectors.mjs +18 -0
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +9 -0
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +43 -0
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +8 -0
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +21 -0
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +37 -0
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +13 -0
- package/dist/es/state/selectors/common.mjs +4 -0
- package/dist/es/state/selectors/containerSelectors.mjs +7 -0
- package/dist/es/state/selectors/dataSelectors.mjs +35 -0
- package/dist/es/state/selectors/funnelSelectors.mjs +38 -0
- package/dist/es/state/selectors/legendSelectors.mjs +10 -0
- package/dist/es/state/selectors/lineSelectors.mjs +64 -0
- package/dist/es/state/selectors/pickAxisId.mjs +4 -0
- package/dist/es/state/selectors/pickAxisType.mjs +4 -0
- package/dist/es/state/selectors/pieSelectors.mjs +132 -0
- package/dist/es/state/selectors/polarAxisSelectors.mjs +167 -0
- package/dist/es/state/selectors/polarGridSelectors.mjs +19 -0
- package/dist/es/state/selectors/polarScaleSelectors.mjs +55 -0
- package/dist/es/state/selectors/polarSelectors.mjs +81 -0
- package/dist/es/state/selectors/radarSelectors.mjs +133 -0
- package/dist/es/state/selectors/radialBarSelectors.mjs +259 -0
- package/dist/es/state/selectors/rootPropsSelectors.mjs +14 -0
- package/dist/es/state/selectors/scatterSelectors.mjs +134 -0
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +20 -0
- package/dist/es/state/selectors/selectAllAxes.mjs +10 -0
- package/dist/es/state/selectors/selectChartOffset.mjs +69 -0
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +66 -0
- package/dist/es/state/selectors/selectTooltipEventType.mjs +22 -0
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +6 -0
- package/dist/es/state/selectors/selectTooltipSettings.mjs +4 -0
- package/dist/es/state/selectors/selectTooltipState.mjs +4 -0
- package/dist/es/state/selectors/selectors.mjs +104 -0
- package/dist/es/state/selectors/tooltipSelectors.mjs +269 -0
- package/dist/es/state/selectors/touchSelectors.mjs +19 -0
- package/dist/es/state/store.mjs +55 -0
- package/dist/es/state/tooltipSlice.mjs +102 -0
- package/dist/es/state/touchEventsMiddleware.mjs +44 -0
- package/dist/es/state/utils/useReportScale.mjs +19 -0
- package/dist/es/synchronisation/syncSelectors.mjs +6 -0
- package/dist/es/synchronisation/useChartSynchronisation.mjs +38 -0
- package/dist/es/types/event.mjs +166 -0
- package/dist/es/utils/ReduceCSSCalc.mjs +114 -0
- package/dist/es/utils/VueUtils.mjs +39 -0
- package/dist/es/utils/attrs.mjs +69 -0
- package/dist/es/utils/cartesian.mjs +54 -0
- package/dist/es/utils/chart.mjs +366 -0
- package/dist/es/utils/const.mjs +32 -0
- package/dist/es/utils/createContext.mjs +31 -0
- package/dist/es/utils/data-utils.mjs +13 -0
- package/dist/es/utils/data.mjs +41 -0
- package/dist/es/utils/events.mjs +7 -0
- package/dist/es/utils/getLinearRegression.mjs +34 -0
- package/dist/es/utils/grid.mjs +23 -0
- package/dist/es/utils/isDomainSpecifiedByUser.mjs +116 -0
- package/dist/es/utils/legend.mjs +19 -0
- package/dist/es/utils/log.mjs +14 -0
- package/dist/es/utils/payload/getUniqPayload.mjs +9 -0
- package/dist/es/utils/polar.mjs +59 -0
- package/dist/es/utils/props.mjs +20 -0
- package/dist/es/utils/resolveDefaultProps.mjs +26 -0
- package/dist/es/utils/scale/getNiceTickValues.mjs +137 -0
- package/dist/es/utils/scale/utils/arithmetic.mjs +54 -0
- package/dist/es/utils/scale/utils/utils.mjs +53 -0
- package/dist/es/utils/style.mjs +30 -0
- package/dist/es/utils/tick.mjs +42 -0
- package/dist/es/utils/tooltip/translate.mjs +73 -0
- package/dist/es/utils/validate.mjs +42 -0
- package/dist/events/useChartSynchronisation.d.ts +8 -0
- package/dist/hooks/useIsAnimating.d.ts +14 -0
- package/dist/hooks/useSetupGraphicalItem.d.ts +7 -0
- package/dist/index.d.ts +6 -0
- package/dist/polar/index.d.ts +3 -0
- package/dist/polar/pie/Pie.d.ts +2 -0
- package/dist/polar/pie/index.d.ts +2 -0
- package/dist/polar/pie/type.d.ts +88 -0
- package/dist/polar/radar/PolarAngleAxis.d.ts +145 -0
- package/dist/polar/radar/PolarGrid.d.ts +77 -0
- package/dist/polar/radar/PolarRadiusAxis.d.ts +125 -0
- package/dist/polar/radar/Radar.d.ts +160 -0
- package/dist/polar/radar/index.d.ts +4 -0
- package/dist/polar/radial-bar/RadialBar.d.ts +2 -0
- package/dist/polar/radial-bar/index.d.ts +2 -0
- package/dist/polar/radial-bar/type.d.ts +96 -0
- package/dist/shape/Cross.d.ts +10 -0
- package/dist/shape/Curve.d.ts +42 -0
- package/dist/shape/Dot.d.ts +18 -0
- package/dist/shape/Rectangle.d.ts +33 -0
- package/dist/shape/Sector.d.ts +48 -0
- package/dist/shape/Symbols.d.ts +15 -0
- package/dist/shape/Trapezoid.d.ts +31 -0
- package/dist/shape/index.d.ts +9 -0
- package/dist/shape/types.d.ts +20 -0
- package/dist/state/ReportBar.d.ts +1 -0
- package/dist/state/ReportChartProps.d.ts +88 -0
- package/dist/state/ReportMainChartProps.d.ts +37 -0
- package/dist/state/ReportPolarOptions.d.ts +59 -0
- package/dist/state/SetGraphicalItem.d.ts +9 -0
- package/dist/state/SetLegendPayload.d.ts +3 -0
- package/dist/state/SetTooltipEntrySettings.d.ts +8 -0
- package/dist/state/brushSlice.d.ts +18 -0
- package/dist/state/cartesianAxisSlice.d.ts +88 -0
- package/dist/state/chartDataSlice.d.ts +44 -0
- package/dist/state/externalEventsMiddleware.d.ts +17 -0
- package/dist/state/graphicalItemsSlice.d.ts +108 -0
- package/dist/state/hooks.d.ts +54 -0
- package/dist/state/keyboardEventsMiddleware.d.ts +3 -0
- package/dist/state/layoutSlice.d.ts +15 -0
- package/dist/state/legendSlice.d.ts +26 -0
- package/dist/state/mouseEventsMiddleware.d.ts +5 -0
- package/dist/state/optionsSlice.d.ts +27 -0
- package/dist/state/polarAxisSlice.d.ts +10 -0
- package/dist/state/polarOptionsSlice.d.ts +10 -0
- package/dist/state/reduxDevtoolsJsonStringifyReplacer.d.ts +1 -0
- package/dist/state/referenceElementsSlice.d.ts +40 -0
- package/dist/state/rootPropsSlice.d.ts +26 -0
- package/dist/state/selectors/areaSelectors.d.ts +24 -0
- package/dist/state/selectors/axisSelectors.d.ts +1828 -0
- package/dist/state/selectors/barSelectors.d.ts +944 -0
- package/dist/state/selectors/brushSelectors.d.ts +10 -0
- package/dist/state/selectors/combiners/combineActiveLabel.d.ts +3 -0
- package/dist/state/selectors/combiners/combineActiveTooltipIndex.d.ts +5 -0
- package/dist/state/selectors/combiners/combineAxisRangeWithReverse.d.ts +3 -0
- package/dist/state/selectors/combiners/combineCoordinateForDefaultIndex.d.ts +3 -0
- package/dist/state/selectors/combiners/combineTooltipInteractionState.d.ts +3 -0
- package/dist/state/selectors/combiners/combineTooltipPayloadConfigurations.d.ts +3 -0
- package/dist/state/selectors/common.d.ts +2 -0
- package/dist/state/selectors/containerSelectors.d.ts +6 -0
- package/dist/state/selectors/dataSelectors.d.ts +23 -0
- package/dist/state/selectors/funnelSelectors.d.ts +69 -0
- package/dist/state/selectors/legendSelectors.d.ts +7 -0
- package/dist/state/selectors/lineSelectors.d.ts +123 -0
- package/dist/state/selectors/pickAxisId.d.ts +3 -0
- package/dist/state/selectors/pickAxisType.d.ts +2 -0
- package/dist/state/selectors/pieSelectors.d.ts +55 -0
- package/dist/state/selectors/polarAxisSelectors.d.ts +49 -0
- package/dist/state/selectors/polarGridSelectors.d.ts +118 -0
- package/dist/state/selectors/polarScaleSelectors.d.ts +9 -0
- package/dist/state/selectors/polarSelectors.d.ts +70 -0
- package/dist/state/selectors/radarSelectors.d.ts +76 -0
- package/dist/state/selectors/radialBarSelectors.d.ts +61 -0
- package/dist/state/selectors/rootPropsSelectors.d.ts +11 -0
- package/dist/state/selectors/scatterSelectors.d.ts +21 -0
- package/dist/state/selectors/selectActivePropsFromChartPointer.d.ts +382 -0
- package/dist/state/selectors/selectAllAxes.d.ts +4 -0
- package/dist/state/selectors/selectChartOffset.d.ts +116 -0
- package/dist/state/selectors/selectChartOffsetInternal.d.ts +9 -0
- package/dist/state/selectors/selectTooltipEventType.d.ts +8 -0
- package/dist/state/selectors/selectTooltipPayloadSearcher.d.ts +3 -0
- package/dist/state/selectors/selectTooltipSettings.d.ts +3 -0
- package/dist/state/selectors/selectTooltipState.d.ts +3 -0
- package/dist/state/selectors/selectors.d.ts +184 -0
- package/dist/state/selectors/tooltipSelectors.d.ts +581 -0
- package/dist/state/selectors/touchSelectors.d.ts +4 -0
- package/dist/state/store.d.ts +74 -0
- package/dist/state/tooltipSlice.d.ts +204 -0
- package/dist/state/touchEventsMiddleware.d.ts +2 -0
- package/dist/state/utils/useReportScale.d.ts +1 -0
- package/dist/synchronisation/syncSelectors.d.ts +3 -0
- package/dist/synchronisation/useChartSynchronisation.d.ts +11 -0
- package/dist/types/area.d.ts +8 -0
- package/dist/types/axis.d.ts +127 -0
- package/dist/types/bar.d.ts +51 -0
- package/dist/types/categorical.d.ts +36 -0
- package/dist/types/common.d.ts +129 -0
- package/dist/types/event.d.ts +16 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/legend.d.ts +1 -0
- package/dist/types/offset.d.ts +8 -0
- package/dist/types/radar.d.ts +28 -0
- package/dist/types/scale.d.ts +11 -0
- package/dist/types/tick.d.ts +55 -0
- package/dist/types/tooltip.d.ts +33 -0
- package/dist/utils/ReduceCSSCalc.d.ts +2 -0
- package/dist/utils/VueUtils.d.ts +11 -0
- package/dist/utils/attrs.d.ts +46 -0
- package/dist/utils/cartesian.d.ts +20 -0
- package/dist/utils/chart.d.ts +99 -0
- package/dist/utils/const.d.ts +30 -0
- package/dist/utils/context.d.ts +8 -0
- package/dist/utils/createContext.d.ts +8 -0
- package/dist/utils/data-utils.d.ts +4 -0
- package/dist/utils/data.d.ts +13 -0
- package/dist/utils/events.d.ts +12 -0
- package/dist/utils/getLinearRegression.d.ts +15 -0
- package/dist/utils/getRelativeCoordinate.d.ts +11 -0
- package/dist/utils/grid.d.ts +37 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/isDomainSpecifiedByUser.d.ts +47 -0
- package/dist/utils/legend.d.ts +3 -0
- package/dist/utils/log.d.ts +1 -0
- package/dist/utils/payload/getUniqPayload.d.ts +4 -0
- package/dist/utils/polar.d.ts +21 -0
- package/dist/utils/props.d.ts +15 -0
- package/dist/utils/resolveDefaultProps.d.ts +52 -0
- package/dist/utils/scale/getNiceTickValues.d.ts +61 -0
- package/dist/utils/scale/utils/arithmetic.d.ts +50 -0
- package/dist/utils/scale/utils/utils.d.ts +9 -0
- package/dist/utils/style.d.ts +12 -0
- package/dist/utils/tick.d.ts +19 -0
- package/dist/utils/tooltip/translate.d.ts +47 -0
- package/dist/utils/types.d.ts +14 -0
- package/dist/utils/validate.d.ts +25 -0
- package/package.json +27 -10
|
@@ -0,0 +1,879 @@
|
|
|
1
|
+
import { isCategoricalAxis, isNan, isNumOrStr, isNumber, isWellBehavedNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectChartDataWithIndexes, selectChartDataWithIndexesIfNotInPanorama } from "./dataSelectors.mjs";
|
|
3
|
+
import { selectChartHeight, selectChartWidth } from "./containerSelectors.mjs";
|
|
4
|
+
import { selectAllXAxes, selectAllYAxes } from "./selectAllAxes.mjs";
|
|
5
|
+
import { selectChartOffset } from "./selectChartOffset.mjs";
|
|
6
|
+
import { selectBrushDimensions, selectBrushSettings } from "./brushSelectors.mjs";
|
|
7
|
+
import { selectBarCategoryGap, selectChartName, selectStackOffsetType } from "./rootPropsSelectors.mjs";
|
|
8
|
+
import { combineAxisRangeWithReverse } from "./combiners/combineAxisRangeWithReverse.mjs";
|
|
9
|
+
import { getPercentValue, hasDuplicate, mathSign } from "../../utils/data.mjs";
|
|
10
|
+
import { selectChartLayout } from "./common.mjs";
|
|
11
|
+
import { selectAngleAxis, selectAngleAxisRange, selectRadiusAxis, selectRadiusAxisRange } from "./polarAxisSelectors.mjs";
|
|
12
|
+
import { pickAxisType } from "./pickAxisType.mjs";
|
|
13
|
+
import { pickAxisId } from "./pickAxisId.mjs";
|
|
14
|
+
import { checkDomainOfScale, getDomainOfStackGroups, getStackedData, getValueByDataKey } from "../../utils/chart.mjs";
|
|
15
|
+
import { isWellFormedNumberDomain, numericalDomainSpecifiedWithoutRequiringData, parseNumericalUserDomain } from "../../utils/isDomainSpecifiedByUser.mjs";
|
|
16
|
+
import { getNiceTickValues, getTickValuesFixedDomain } from "../../utils/scale/getNiceTickValues.mjs";
|
|
17
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
18
|
+
import { range, upperFirst } from "lodash-es";
|
|
19
|
+
import * as d3Scales from "victory-vendor/d3-scale";
|
|
20
|
+
//#region src/state/selectors/axisSelectors.ts
|
|
21
|
+
var defaultNumericDomain = [0, "auto"];
|
|
22
|
+
/**
|
|
23
|
+
* If an axis is not explicitly defined as an element,
|
|
24
|
+
* we still need to render something in the chart and we need
|
|
25
|
+
* some object to hold the domain and default settings.
|
|
26
|
+
*/
|
|
27
|
+
var implicitXAxis = {
|
|
28
|
+
allowDataOverflow: false,
|
|
29
|
+
allowDecimals: true,
|
|
30
|
+
allowDuplicatedCategory: true,
|
|
31
|
+
angle: 0,
|
|
32
|
+
dataKey: void 0,
|
|
33
|
+
domain: void 0,
|
|
34
|
+
height: 30,
|
|
35
|
+
hide: true,
|
|
36
|
+
id: void 0,
|
|
37
|
+
includeHidden: false,
|
|
38
|
+
interval: "preserveEnd",
|
|
39
|
+
minTickGap: 5,
|
|
40
|
+
mirror: false,
|
|
41
|
+
name: void 0,
|
|
42
|
+
orientation: "bottom",
|
|
43
|
+
padding: {
|
|
44
|
+
left: 0,
|
|
45
|
+
right: 0
|
|
46
|
+
},
|
|
47
|
+
reversed: false,
|
|
48
|
+
scale: "auto",
|
|
49
|
+
tick: true,
|
|
50
|
+
tickCount: 5,
|
|
51
|
+
tickFormatter: void 0,
|
|
52
|
+
ticks: void 0,
|
|
53
|
+
type: "category",
|
|
54
|
+
unit: void 0
|
|
55
|
+
};
|
|
56
|
+
function selectXAxisSettings(state, axisId) {
|
|
57
|
+
const axis = state.cartesianAxis.xAxis[axisId];
|
|
58
|
+
if (axis == null) return implicitXAxis;
|
|
59
|
+
return axis;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* If an axis is not explicitly defined as an element,
|
|
63
|
+
* we still need to render something in the chart and we need
|
|
64
|
+
* some object to hold the domain and default settings.
|
|
65
|
+
*/
|
|
66
|
+
var implicitYAxis = {
|
|
67
|
+
allowDataOverflow: false,
|
|
68
|
+
allowDecimals: true,
|
|
69
|
+
allowDuplicatedCategory: true,
|
|
70
|
+
angle: 0,
|
|
71
|
+
dataKey: void 0,
|
|
72
|
+
domain: defaultNumericDomain,
|
|
73
|
+
hide: true,
|
|
74
|
+
id: void 0,
|
|
75
|
+
includeHidden: false,
|
|
76
|
+
interval: "preserveEnd",
|
|
77
|
+
minTickGap: 5,
|
|
78
|
+
mirror: false,
|
|
79
|
+
name: void 0,
|
|
80
|
+
orientation: "left",
|
|
81
|
+
padding: {
|
|
82
|
+
top: 0,
|
|
83
|
+
bottom: 0
|
|
84
|
+
},
|
|
85
|
+
reversed: false,
|
|
86
|
+
scale: "auto",
|
|
87
|
+
tick: true,
|
|
88
|
+
tickCount: 5,
|
|
89
|
+
tickFormatter: void 0,
|
|
90
|
+
ticks: void 0,
|
|
91
|
+
type: "number",
|
|
92
|
+
unit: void 0,
|
|
93
|
+
width: 60
|
|
94
|
+
};
|
|
95
|
+
function selectYAxisSettings(state, axisId) {
|
|
96
|
+
const axis = state.cartesianAxis.yAxis[axisId];
|
|
97
|
+
if (axis == null) return implicitYAxis;
|
|
98
|
+
return axis;
|
|
99
|
+
}
|
|
100
|
+
var implicitZAxis = {
|
|
101
|
+
domain: [0, "auto"],
|
|
102
|
+
includeHidden: false,
|
|
103
|
+
reversed: false,
|
|
104
|
+
allowDataOverflow: false,
|
|
105
|
+
allowDuplicatedCategory: false,
|
|
106
|
+
dataKey: void 0,
|
|
107
|
+
id: void 0,
|
|
108
|
+
name: "",
|
|
109
|
+
range: [64, 64],
|
|
110
|
+
scale: "auto",
|
|
111
|
+
type: "number",
|
|
112
|
+
unit: ""
|
|
113
|
+
};
|
|
114
|
+
function selectZAxisSettings(state, axisId) {
|
|
115
|
+
const axis = state.cartesianAxis.zAxis[axisId];
|
|
116
|
+
if (axis == null) return implicitZAxis;
|
|
117
|
+
return axis;
|
|
118
|
+
}
|
|
119
|
+
function selectBaseAxis(state, axisType, axisId) {
|
|
120
|
+
switch (axisType) {
|
|
121
|
+
case "xAxis": return selectXAxisSettings(state, axisId);
|
|
122
|
+
case "yAxis": return selectYAxisSettings(state, axisId);
|
|
123
|
+
case "zAxis": return selectZAxisSettings(state, axisId);
|
|
124
|
+
case "angleAxis": return selectAngleAxis(state, axisId);
|
|
125
|
+
case "radiusAxis": return selectRadiusAxis(state, axisId);
|
|
126
|
+
default: throw new Error(`Unexpected axis type: ${axisType}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function selectCartesianAxisSettings(state, axisType, axisId) {
|
|
130
|
+
switch (axisType) {
|
|
131
|
+
case "xAxis": return selectXAxisSettings(state, axisId);
|
|
132
|
+
case "yAxis": return selectYAxisSettings(state, axisId);
|
|
133
|
+
default: throw new Error(`Unexpected axis type: ${axisType}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Selects either an X or Y axis. Doesn't work with Z axis - for that, instead use selectBaseAxis.
|
|
138
|
+
* @param state Root state
|
|
139
|
+
* @param axisType xAxis | yAxis
|
|
140
|
+
* @param axisId xAxisId | yAxisId
|
|
141
|
+
* @returns axis settings object
|
|
142
|
+
*/
|
|
143
|
+
function selectAxisSettings(state, axisType, axisId = 0) {
|
|
144
|
+
switch (axisType) {
|
|
145
|
+
case "xAxis": return selectXAxisSettings(state, axisId);
|
|
146
|
+
case "yAxis": return selectYAxisSettings(state, axisId);
|
|
147
|
+
case "angleAxis": return selectAngleAxis(state, axisId);
|
|
148
|
+
case "radiusAxis": return selectRadiusAxis(state, axisId);
|
|
149
|
+
default: throw new Error(`Unexpected axis type: ${axisType}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* @param state RechartsRootState
|
|
154
|
+
* @return boolean true if there is at least one Bar or RadialBar
|
|
155
|
+
*/
|
|
156
|
+
function selectHasBar(state) {
|
|
157
|
+
return state.graphicalItems.cartesianItems.some((item) => item.type === "bar") || state.graphicalItems.polarItems.some((item) => item.type === "radialBar");
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Filters CartesianGraphicalItemSettings by the relevant axis ID
|
|
161
|
+
* @param axisType 'xAxis' | 'yAxis' | 'zAxis' | 'radiusAxis' | 'angleAxis'
|
|
162
|
+
* @param axisId from props, defaults to 0
|
|
163
|
+
*
|
|
164
|
+
* @returns Predicate function that return true for CartesianGraphicalItemSettings that are relevant to the specified axis
|
|
165
|
+
*/
|
|
166
|
+
function itemAxisPredicate(axisType, axisId) {
|
|
167
|
+
return (item) => {
|
|
168
|
+
switch (axisType) {
|
|
169
|
+
case "xAxis": return "xAxisId" in item && item.xAxisId === axisId;
|
|
170
|
+
case "yAxis": return "yAxisId" in item && item.yAxisId === axisId;
|
|
171
|
+
case "zAxis": return "zAxisId" in item && item.zAxisId === axisId;
|
|
172
|
+
case "angleAxis": return "angleAxisId" in item && item.angleAxisId === axisId;
|
|
173
|
+
case "radiusAxis": return "radiusAxisId" in item && item.radiusAxisId === axisId;
|
|
174
|
+
default: return false;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function selectUnfilteredCartesianItems(state) {
|
|
179
|
+
return state.graphicalItems.cartesianItems;
|
|
180
|
+
}
|
|
181
|
+
var selectAxisPredicate = createSelector([pickAxisType, pickAxisId], itemAxisPredicate);
|
|
182
|
+
function combineGraphicalItemsSettings(graphicalItems, axisSettings, axisPredicate) {
|
|
183
|
+
return graphicalItems.filter(axisPredicate).filter((item) => {
|
|
184
|
+
if (axisSettings?.includeHidden === true) return true;
|
|
185
|
+
return !item.hide;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
var selectCartesianItemsSettings = createSelector([
|
|
189
|
+
selectUnfilteredCartesianItems,
|
|
190
|
+
selectBaseAxis,
|
|
191
|
+
selectAxisPredicate
|
|
192
|
+
], combineGraphicalItemsSettings);
|
|
193
|
+
function filterGraphicalNotStackedItems(cartesianItems) {
|
|
194
|
+
return cartesianItems.filter((item) => item.stackId === void 0);
|
|
195
|
+
}
|
|
196
|
+
var selectCartesianItemsSettingsExceptStacked = createSelector([selectCartesianItemsSettings], filterGraphicalNotStackedItems);
|
|
197
|
+
function combineGraphicalItemsData(cartesianItems) {
|
|
198
|
+
return cartesianItems.map((item) => item.data).filter(Boolean).flat(1);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* This is a "cheap" selector - it returns the data but doesn't iterate them, so it is not sensitive on the array length.
|
|
202
|
+
* Also does not apply dataKey yet.
|
|
203
|
+
* @param state RechartsRootState
|
|
204
|
+
* @returns data defined on the chart graphical items, such as Line or Scatter or Pie, and filtered with appropriate dataKey
|
|
205
|
+
*/
|
|
206
|
+
var selectCartesianGraphicalItemsData = createSelector([selectCartesianItemsSettings], combineGraphicalItemsData);
|
|
207
|
+
function combineDisplayedData(graphicalItemsData, { chartData = [], dataStartIndex, dataEndIndex }) {
|
|
208
|
+
if (graphicalItemsData.length > 0) return graphicalItemsData;
|
|
209
|
+
return chartData.slice(dataStartIndex, dataEndIndex + 1);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* This selector will return all data there is in the chart: graphical items, chart root, all together.
|
|
213
|
+
* Useful for figuring out an axis domain (because that needs to know of everything),
|
|
214
|
+
* not useful for rendering individual graphical elements (because they need to know which data is theirs and which is not).
|
|
215
|
+
*
|
|
216
|
+
* This function will discard the original indexes, so it is also not useful for anything that depends on ordering.
|
|
217
|
+
*/
|
|
218
|
+
var selectDisplayedData = createSelector([selectCartesianGraphicalItemsData, selectChartDataWithIndexesIfNotInPanorama], combineDisplayedData);
|
|
219
|
+
function combineAppliedValues(data, axisSettings, items) {
|
|
220
|
+
if (axisSettings?.dataKey != null) return data.map((item) => ({ value: getValueByDataKey(item, axisSettings.dataKey) }));
|
|
221
|
+
if (items.length > 0) return items.map((item) => item.dataKey).flatMap((dataKey) => data.map((entry) => ({ value: getValueByDataKey(entry, dataKey) })));
|
|
222
|
+
return data.map((entry) => ({ value: entry }));
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* This selector will return all values with the appropriate dataKey applied on them.
|
|
226
|
+
* Which dataKey is appropriate depends on where it is defined.
|
|
227
|
+
*
|
|
228
|
+
* This is an expensive selector - it will iterate all data and compute their value using the provided dataKey.
|
|
229
|
+
*/
|
|
230
|
+
var selectAllAppliedValues = createSelector([
|
|
231
|
+
selectDisplayedData,
|
|
232
|
+
selectBaseAxis,
|
|
233
|
+
selectCartesianItemsSettings
|
|
234
|
+
], combineAppliedValues);
|
|
235
|
+
function isErrorBarRelevantForAxisType(axisType, errorBar) {
|
|
236
|
+
switch (axisType) {
|
|
237
|
+
case "xAxis": return errorBar.direction === "x";
|
|
238
|
+
case "yAxis": return errorBar.direction === "y";
|
|
239
|
+
default: return false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function onlyAllowNumbers(data) {
|
|
243
|
+
return data.filter((v) => isNumOrStr(v) || v instanceof Date).map(Number).filter((n) => isNan(n) === false);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @param entry One item in the 'data' array. Could be anything really - this is defined externally. This is the raw, before dataKey application
|
|
247
|
+
* @param appliedValue This is the result of applying the 'main' dataKey on the `entry`.
|
|
248
|
+
* @param relevantErrorBars Error bars that are relevant for the current axis and layout and all that.
|
|
249
|
+
* @return either undefined or an array of ErrorValue
|
|
250
|
+
*/
|
|
251
|
+
function getErrorDomainByDataKey(entry, appliedValue, relevantErrorBars) {
|
|
252
|
+
if (!relevantErrorBars || typeof appliedValue !== "number" || isNan(appliedValue)) return [];
|
|
253
|
+
if (!relevantErrorBars.length) return [];
|
|
254
|
+
return onlyAllowNumbers(relevantErrorBars.flatMap((eb) => {
|
|
255
|
+
const errorValue = getValueByDataKey(entry, eb.dataKey);
|
|
256
|
+
let lowBound, highBound;
|
|
257
|
+
if (Array.isArray(errorValue)) [lowBound, highBound] = errorValue;
|
|
258
|
+
else lowBound = highBound = errorValue;
|
|
259
|
+
if (!isWellBehavedNumber(lowBound) || !isWellBehavedNumber(highBound)) return;
|
|
260
|
+
return [appliedValue - lowBound, appliedValue + highBound];
|
|
261
|
+
}));
|
|
262
|
+
}
|
|
263
|
+
function combineStackGroups(displayedData, items, stackOffsetType) {
|
|
264
|
+
const itemsGroup = items.reduce((acc, item) => {
|
|
265
|
+
if (item.stackId == null) return acc;
|
|
266
|
+
if (acc[item.stackId] == null) acc[item.stackId] = [];
|
|
267
|
+
acc[item.stackId].push(item);
|
|
268
|
+
return acc;
|
|
269
|
+
}, {});
|
|
270
|
+
return Object.fromEntries(Object.entries(itemsGroup).map(([stackId, graphicalItems]) => {
|
|
271
|
+
return [stackId, {
|
|
272
|
+
stackedData: getStackedData(displayedData, graphicalItems.map((i) => i.dataKey), stackOffsetType),
|
|
273
|
+
graphicalItems
|
|
274
|
+
}];
|
|
275
|
+
}));
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Stack groups are groups of graphical items that stack on each other.
|
|
279
|
+
* Stack is a function of axis type (X, Y), axis ID, and stack ID.
|
|
280
|
+
* Graphical items that do not have a stack ID are not going to be present in stack groups.
|
|
281
|
+
*/
|
|
282
|
+
var selectStackGroups = createSelector([
|
|
283
|
+
selectDisplayedData,
|
|
284
|
+
selectCartesianItemsSettings,
|
|
285
|
+
selectStackOffsetType
|
|
286
|
+
], combineStackGroups);
|
|
287
|
+
function combineDomainOfStackGroups(stackGroups, { dataStartIndex, dataEndIndex }, axisType) {
|
|
288
|
+
if (axisType === "zAxis") return;
|
|
289
|
+
const domainOfStackGroups = getDomainOfStackGroups(stackGroups, dataStartIndex, dataEndIndex);
|
|
290
|
+
if (domainOfStackGroups != null && domainOfStackGroups[0] === 0 && domainOfStackGroups[1] === 0) return;
|
|
291
|
+
return domainOfStackGroups;
|
|
292
|
+
}
|
|
293
|
+
var selectDomainOfStackGroups = createSelector([
|
|
294
|
+
selectStackGroups,
|
|
295
|
+
selectChartDataWithIndexes,
|
|
296
|
+
pickAxisType
|
|
297
|
+
], combineDomainOfStackGroups);
|
|
298
|
+
function combineAppliedNumericalValuesIncludingErrorValues(data, axisSettings, items, axisType) {
|
|
299
|
+
if (items.length > 0) return data.flatMap((entry) => {
|
|
300
|
+
return items.flatMap((item) => {
|
|
301
|
+
const relevantErrorBars = item.errorBars?.filter((errorBar) => isErrorBarRelevantForAxisType(axisType, errorBar));
|
|
302
|
+
const valueByDataKey = getValueByDataKey(entry, axisSettings.dataKey || item.dataKey);
|
|
303
|
+
return {
|
|
304
|
+
value: valueByDataKey,
|
|
305
|
+
errorDomain: getErrorDomainByDataKey(entry, valueByDataKey, relevantErrorBars)
|
|
306
|
+
};
|
|
307
|
+
});
|
|
308
|
+
}).filter(Boolean);
|
|
309
|
+
if (axisSettings?.dataKey != null) return data.map((item) => ({
|
|
310
|
+
value: getValueByDataKey(item, axisSettings.dataKey),
|
|
311
|
+
errorDomain: []
|
|
312
|
+
}));
|
|
313
|
+
return data.map((entry) => ({
|
|
314
|
+
value: entry,
|
|
315
|
+
errorDomain: []
|
|
316
|
+
}));
|
|
317
|
+
}
|
|
318
|
+
var selectAllAppliedNumericalValuesIncludingErrorValues = createSelector(selectDisplayedData, selectBaseAxis, selectCartesianItemsSettingsExceptStacked, pickAxisType, combineAppliedNumericalValuesIncludingErrorValues);
|
|
319
|
+
function onlyAllowNumbersAndStringsAndDates(item) {
|
|
320
|
+
const { value } = item;
|
|
321
|
+
if (isNumOrStr(value) || value instanceof Date) return value;
|
|
322
|
+
}
|
|
323
|
+
function computeNumericalDomain(dataWithErrorDomains) {
|
|
324
|
+
const onlyNumbers = onlyAllowNumbers(dataWithErrorDomains.flatMap((d) => [d.value, d.errorDomain]).flat(1));
|
|
325
|
+
if (onlyNumbers.length === 0) return;
|
|
326
|
+
return [Math.min(...onlyNumbers), Math.max(...onlyNumbers)];
|
|
327
|
+
}
|
|
328
|
+
function computeDomainOfTypeCategory(allDataSquished, axisSettings, isCategorical) {
|
|
329
|
+
const categoricalDomain = allDataSquished.map(onlyAllowNumbersAndStringsAndDates).filter((v) => v != null);
|
|
330
|
+
if (isCategorical && (axisSettings.dataKey == null || axisSettings.allowDuplicatedCategory && hasDuplicate(categoricalDomain))) return range(0, allDataSquished.length);
|
|
331
|
+
if (axisSettings.allowDuplicatedCategory) return categoricalDomain;
|
|
332
|
+
return Array.from(new Set(categoricalDomain));
|
|
333
|
+
}
|
|
334
|
+
function getDomainDefinition(axisSettings) {
|
|
335
|
+
if (axisSettings == null || !("domain" in axisSettings)) return defaultNumericDomain;
|
|
336
|
+
if (axisSettings.domain != null) return axisSettings.domain;
|
|
337
|
+
if (axisSettings.ticks != null) {
|
|
338
|
+
if (axisSettings.type === "number") {
|
|
339
|
+
const allValues = onlyAllowNumbers(axisSettings.ticks);
|
|
340
|
+
return [Math.min(...allValues), Math.max(...allValues)];
|
|
341
|
+
}
|
|
342
|
+
if (axisSettings.type === "category") return axisSettings.ticks.map(String);
|
|
343
|
+
}
|
|
344
|
+
return axisSettings?.domain ?? defaultNumericDomain;
|
|
345
|
+
}
|
|
346
|
+
function mergeDomains(...domains) {
|
|
347
|
+
const allDomains = domains.filter(Boolean);
|
|
348
|
+
if (allDomains.length === 0) return;
|
|
349
|
+
const allNumbers = allDomains.flat().filter(isNumber);
|
|
350
|
+
return [Math.min(...allNumbers), Math.max(...allNumbers)];
|
|
351
|
+
}
|
|
352
|
+
function selectReferenceDots(state) {
|
|
353
|
+
return state.referenceElements.dots;
|
|
354
|
+
}
|
|
355
|
+
function filterReferenceElements(elements, axisType, axisId) {
|
|
356
|
+
return elements.filter((el) => el.ifOverflow === "extendDomain").filter((el) => {
|
|
357
|
+
if (axisType === "xAxis") return el.xAxisId === axisId;
|
|
358
|
+
return el.yAxisId === axisId;
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
var selectReferenceDotsByAxis = createSelector([
|
|
362
|
+
selectReferenceDots,
|
|
363
|
+
pickAxisType,
|
|
364
|
+
pickAxisId
|
|
365
|
+
], filterReferenceElements);
|
|
366
|
+
function selectReferenceAreas(state) {
|
|
367
|
+
return state.referenceElements.areas;
|
|
368
|
+
}
|
|
369
|
+
var selectReferenceAreasByAxis = createSelector([
|
|
370
|
+
selectReferenceAreas,
|
|
371
|
+
pickAxisType,
|
|
372
|
+
pickAxisId
|
|
373
|
+
], filterReferenceElements);
|
|
374
|
+
function selectReferenceLines(state) {
|
|
375
|
+
return state.referenceElements.lines;
|
|
376
|
+
}
|
|
377
|
+
var selectReferenceLinesByAxis = createSelector([
|
|
378
|
+
selectReferenceLines,
|
|
379
|
+
pickAxisType,
|
|
380
|
+
pickAxisId
|
|
381
|
+
], filterReferenceElements);
|
|
382
|
+
function combineDotsDomain(dots, axisType) {
|
|
383
|
+
const allCoords = onlyAllowNumbers(dots.map((dot) => axisType === "xAxis" ? dot.x : dot.y));
|
|
384
|
+
if (allCoords.length === 0) return;
|
|
385
|
+
return [Math.min(...allCoords), Math.max(...allCoords)];
|
|
386
|
+
}
|
|
387
|
+
var selectReferenceDotsDomain = createSelector(selectReferenceDotsByAxis, pickAxisType, combineDotsDomain);
|
|
388
|
+
function combineAreasDomain(areas, axisType) {
|
|
389
|
+
const allCoords = onlyAllowNumbers(areas.flatMap((area) => [axisType === "xAxis" ? area.x1 : area.y1, axisType === "xAxis" ? area.x2 : area.y2]));
|
|
390
|
+
if (allCoords.length === 0) return;
|
|
391
|
+
return [Math.min(...allCoords), Math.max(...allCoords)];
|
|
392
|
+
}
|
|
393
|
+
var selectReferenceAreasDomain = createSelector([selectReferenceAreasByAxis, pickAxisType], combineAreasDomain);
|
|
394
|
+
function combineLinesDomain(lines, axisType) {
|
|
395
|
+
const allCoords = onlyAllowNumbers(lines.map((line) => axisType === "xAxis" ? line.x : line.y));
|
|
396
|
+
if (allCoords.length === 0) return;
|
|
397
|
+
return [Math.min(...allCoords), Math.max(...allCoords)];
|
|
398
|
+
}
|
|
399
|
+
var selectReferenceElementsDomain = createSelector(selectReferenceDotsDomain, createSelector(selectReferenceLinesByAxis, pickAxisType, combineLinesDomain), selectReferenceAreasDomain, (dotsDomain, linesDomain, areasDomain) => {
|
|
400
|
+
return mergeDomains(dotsDomain, areasDomain, linesDomain);
|
|
401
|
+
});
|
|
402
|
+
var selectDomainDefinition = createSelector([selectBaseAxis], getDomainDefinition);
|
|
403
|
+
function combineNumericalDomain(axisSettings, domainDefinition, domainOfStackGroups, allDataWithErrorDomains, referenceElementsDomain) {
|
|
404
|
+
const domainFromUserPreference = numericalDomainSpecifiedWithoutRequiringData(domainDefinition, axisSettings.allowDataOverflow);
|
|
405
|
+
if (domainFromUserPreference != null) return domainFromUserPreference;
|
|
406
|
+
return parseNumericalUserDomain(domainDefinition, mergeDomains(domainOfStackGroups, referenceElementsDomain, computeNumericalDomain(allDataWithErrorDomains)), axisSettings.allowDataOverflow);
|
|
407
|
+
}
|
|
408
|
+
var selectNumericalDomain = createSelector([
|
|
409
|
+
selectBaseAxis,
|
|
410
|
+
selectDomainDefinition,
|
|
411
|
+
selectDomainOfStackGroups,
|
|
412
|
+
selectAllAppliedNumericalValuesIncludingErrorValues,
|
|
413
|
+
selectReferenceElementsDomain
|
|
414
|
+
], combineNumericalDomain);
|
|
415
|
+
/**
|
|
416
|
+
* Expand by design maps everything between 0 and 1,
|
|
417
|
+
* there is nothing to compute.
|
|
418
|
+
* See https://d3js.org/d3-shape/stack#stack-offsets
|
|
419
|
+
*/
|
|
420
|
+
var expandDomain = [0, 1];
|
|
421
|
+
function combineAxisDomain(axisSettings, layout, displayedData, allAppliedValues, stackOffsetType, axisType, numericalDomain) {
|
|
422
|
+
if ((axisSettings == null || displayedData == null || displayedData.length === 0) && numericalDomain === void 0) return;
|
|
423
|
+
const { dataKey, type } = axisSettings;
|
|
424
|
+
const isCategorical = isCategoricalAxis(layout, axisType);
|
|
425
|
+
if (isCategorical && dataKey == null) {
|
|
426
|
+
const domainLen = Array.isArray(axisSettings.domain) ? axisSettings.domain.length : 0;
|
|
427
|
+
return range(0, Math.max(displayedData.length, domainLen));
|
|
428
|
+
}
|
|
429
|
+
if (type === "category") return computeDomainOfTypeCategory(allAppliedValues, axisSettings, isCategorical);
|
|
430
|
+
if (stackOffsetType === "expand") return expandDomain;
|
|
431
|
+
return numericalDomain;
|
|
432
|
+
}
|
|
433
|
+
var selectAxisDomain = createSelector([
|
|
434
|
+
selectBaseAxis,
|
|
435
|
+
selectChartLayout,
|
|
436
|
+
selectDisplayedData,
|
|
437
|
+
selectAllAppliedValues,
|
|
438
|
+
selectStackOffsetType,
|
|
439
|
+
pickAxisType,
|
|
440
|
+
selectNumericalDomain
|
|
441
|
+
], combineAxisDomain);
|
|
442
|
+
function combineRealScaleType(axisConfig, hasBar, chartType) {
|
|
443
|
+
if (axisConfig == null) return;
|
|
444
|
+
const { scale, type } = axisConfig;
|
|
445
|
+
if (scale === "auto") {
|
|
446
|
+
if (type === "category" && chartType && (chartType.includes("LineChart") || chartType.includes("AreaChart") || chartType.includes("ComposedChart") && !hasBar)) return "point";
|
|
447
|
+
if (type === "category") return "band";
|
|
448
|
+
return "linear";
|
|
449
|
+
}
|
|
450
|
+
if (typeof scale === "string") {
|
|
451
|
+
const name = `scale${upperFirst(scale)}`;
|
|
452
|
+
return name in d3Scales ? name : "point";
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
var selectRealScaleType = createSelector([
|
|
456
|
+
selectBaseAxis,
|
|
457
|
+
selectHasBar,
|
|
458
|
+
selectChartName
|
|
459
|
+
], combineRealScaleType);
|
|
460
|
+
function getD3ScaleFromType(realScaleType) {
|
|
461
|
+
if (realScaleType == null) return;
|
|
462
|
+
if (realScaleType in d3Scales) return d3Scales[realScaleType]();
|
|
463
|
+
const name = `scale${upperFirst(realScaleType)}`;
|
|
464
|
+
if (name in d3Scales) return d3Scales[name]();
|
|
465
|
+
}
|
|
466
|
+
function combineScaleFunction(axis, realScaleType, axisDomain, axisRange) {
|
|
467
|
+
if (axisDomain == null || axisRange == null) return;
|
|
468
|
+
if (typeof axis.scale === "function") return axis.scale.copy().domain(axisDomain).range(axisRange);
|
|
469
|
+
const d3ScaleFunction = getD3ScaleFromType(realScaleType);
|
|
470
|
+
if (d3ScaleFunction == null) return;
|
|
471
|
+
const scale = d3ScaleFunction.domain(axisDomain).range(axisRange);
|
|
472
|
+
checkDomainOfScale(scale);
|
|
473
|
+
return scale;
|
|
474
|
+
}
|
|
475
|
+
function combineNiceTicks(axisDomain, axisSettings, realScaleType) {
|
|
476
|
+
const domainDefinition = getDomainDefinition(axisSettings);
|
|
477
|
+
if (realScaleType !== "auto" && realScaleType !== "linear") return;
|
|
478
|
+
if (axisSettings != null && axisSettings.tickCount && Array.isArray(domainDefinition) && (domainDefinition[0] === "auto" || domainDefinition[1] === "auto") && isWellFormedNumberDomain(axisDomain)) return getNiceTickValues(axisDomain, axisSettings.tickCount, axisSettings.allowDecimals);
|
|
479
|
+
if (axisSettings != null && axisSettings.tickCount && axisSettings.type === "number" && axisDomain != null) return getTickValuesFixedDomain(axisDomain, axisSettings.tickCount, axisSettings.allowDecimals);
|
|
480
|
+
}
|
|
481
|
+
var selectNiceTicks = createSelector([
|
|
482
|
+
selectAxisDomain,
|
|
483
|
+
selectAxisSettings,
|
|
484
|
+
selectRealScaleType
|
|
485
|
+
], combineNiceTicks);
|
|
486
|
+
function combineAxisDomainWithNiceTicks(axisSettings, domain, niceTicks, axisType) {
|
|
487
|
+
if (axisType !== "angleAxis" && axisSettings?.type === "number" && isWellFormedNumberDomain(domain) && Array.isArray(niceTicks) && niceTicks.length > 0) {
|
|
488
|
+
const minFromDomain = domain[0];
|
|
489
|
+
const minFromTicks = niceTicks[0];
|
|
490
|
+
const maxFromDomain = domain[1];
|
|
491
|
+
const maxFromTicks = niceTicks[niceTicks.length - 1];
|
|
492
|
+
return [Math.min(minFromDomain, minFromTicks), Math.max(maxFromDomain, maxFromTicks)];
|
|
493
|
+
}
|
|
494
|
+
return domain;
|
|
495
|
+
}
|
|
496
|
+
var selectAxisDomainIncludingNiceTicks = createSelector([
|
|
497
|
+
selectBaseAxis,
|
|
498
|
+
selectAxisDomain,
|
|
499
|
+
selectNiceTicks,
|
|
500
|
+
pickAxisType
|
|
501
|
+
], combineAxisDomainWithNiceTicks);
|
|
502
|
+
var selectCalculatedPadding = createSelector(createSelector(selectAllAppliedValues, selectBaseAxis, (allDataSquished, axisSettings) => {
|
|
503
|
+
if (!axisSettings || axisSettings.type !== "number") return;
|
|
504
|
+
let smallestDistanceBetweenValues = Infinity;
|
|
505
|
+
const sortedValues = Array.from(onlyAllowNumbers(allDataSquished.map((d) => d.value))).sort((a, b) => a - b);
|
|
506
|
+
if (sortedValues.length < 2) return Infinity;
|
|
507
|
+
const diff = sortedValues[sortedValues.length - 1] - sortedValues[0];
|
|
508
|
+
if (diff === 0) return Infinity;
|
|
509
|
+
for (let i = 0; i < sortedValues.length - 1; i++) {
|
|
510
|
+
const distance = sortedValues[i + 1] - sortedValues[i];
|
|
511
|
+
smallestDistanceBetweenValues = Math.min(smallestDistanceBetweenValues, distance);
|
|
512
|
+
}
|
|
513
|
+
return smallestDistanceBetweenValues / diff;
|
|
514
|
+
}), selectChartLayout, selectBarCategoryGap, selectChartOffset, (_1, _2, _3, padding) => padding, (smallestDistanceInPercent, layout, barCategoryGap, offset, padding) => {
|
|
515
|
+
if (!isWellBehavedNumber(smallestDistanceInPercent)) return 0;
|
|
516
|
+
const rangeWidth = layout === "vertical" ? offset.height : offset.width;
|
|
517
|
+
if (padding === "gap") return smallestDistanceInPercent * rangeWidth / 2;
|
|
518
|
+
if (padding === "no-gap") {
|
|
519
|
+
const gap = getPercentValue(barCategoryGap, smallestDistanceInPercent * rangeWidth);
|
|
520
|
+
const halfBand = smallestDistanceInPercent * rangeWidth / 2;
|
|
521
|
+
return halfBand - gap - (halfBand - gap) / rangeWidth * gap;
|
|
522
|
+
}
|
|
523
|
+
return 0;
|
|
524
|
+
});
|
|
525
|
+
var selectCalculatedXAxisPadding = (state, axisId) => {
|
|
526
|
+
const xAxisSettings = selectXAxisSettings(state, axisId);
|
|
527
|
+
if (xAxisSettings == null || typeof xAxisSettings.padding !== "string") return 0;
|
|
528
|
+
return selectCalculatedPadding(state, "xAxis", axisId, xAxisSettings.padding);
|
|
529
|
+
};
|
|
530
|
+
var selectCalculatedYAxisPadding = (state, axisId) => {
|
|
531
|
+
const yAxisSettings = selectYAxisSettings(state, axisId);
|
|
532
|
+
if (yAxisSettings == null || typeof yAxisSettings.padding !== "string") return 0;
|
|
533
|
+
return selectCalculatedPadding(state, "yAxis", axisId, yAxisSettings.padding);
|
|
534
|
+
};
|
|
535
|
+
var selectXAxisPadding = createSelector(selectXAxisSettings, selectCalculatedXAxisPadding, (xAxisSettings, calculated) => {
|
|
536
|
+
if (xAxisSettings == null) return {
|
|
537
|
+
left: 0,
|
|
538
|
+
right: 0
|
|
539
|
+
};
|
|
540
|
+
const { padding } = xAxisSettings;
|
|
541
|
+
if (typeof padding === "string") return {
|
|
542
|
+
left: calculated,
|
|
543
|
+
right: calculated
|
|
544
|
+
};
|
|
545
|
+
return {
|
|
546
|
+
left: (padding.left ?? 0) + calculated,
|
|
547
|
+
right: (padding.right ?? 0) + calculated
|
|
548
|
+
};
|
|
549
|
+
});
|
|
550
|
+
var selectYAxisPadding = createSelector(selectYAxisSettings, selectCalculatedYAxisPadding, (yAxisSettings, calculated) => {
|
|
551
|
+
if (yAxisSettings == null) return {
|
|
552
|
+
top: 0,
|
|
553
|
+
bottom: 0
|
|
554
|
+
};
|
|
555
|
+
const { padding } = yAxisSettings;
|
|
556
|
+
if (typeof padding === "string") return {
|
|
557
|
+
top: calculated,
|
|
558
|
+
bottom: calculated
|
|
559
|
+
};
|
|
560
|
+
return {
|
|
561
|
+
top: (padding.top ?? 0) + calculated,
|
|
562
|
+
bottom: (padding.bottom ?? 0) + calculated
|
|
563
|
+
};
|
|
564
|
+
});
|
|
565
|
+
var combineXAxisRange = createSelector([
|
|
566
|
+
selectChartOffset,
|
|
567
|
+
selectXAxisPadding,
|
|
568
|
+
selectBrushDimensions,
|
|
569
|
+
selectBrushSettings,
|
|
570
|
+
(_state, _axisId, isPanorama) => isPanorama
|
|
571
|
+
], (offset, padding, brushDimensions, { padding: brushPadding }, isPanorama) => {
|
|
572
|
+
if (isPanorama) return [brushPadding.left, brushDimensions.width - brushPadding.right];
|
|
573
|
+
return [offset.left + padding.left, offset.left + offset.width - padding.right];
|
|
574
|
+
});
|
|
575
|
+
var combineYAxisRange = createSelector([
|
|
576
|
+
selectChartOffset,
|
|
577
|
+
selectChartLayout,
|
|
578
|
+
selectYAxisPadding,
|
|
579
|
+
selectBrushDimensions,
|
|
580
|
+
selectBrushSettings,
|
|
581
|
+
(_state, _axisId, isPanorama) => isPanorama
|
|
582
|
+
], (offset, layout, padding, brushDimensions, { padding: brushPadding }, isPanorama) => {
|
|
583
|
+
if (isPanorama) return [brushDimensions.height - brushPadding.bottom, brushPadding.top];
|
|
584
|
+
if (layout === "horizontal") return [offset.top + offset.height - padding.bottom, offset.top + padding.top];
|
|
585
|
+
return [offset.top + padding.top, offset.top + offset.height - padding.bottom];
|
|
586
|
+
});
|
|
587
|
+
function selectAxisRange(state, axisType, axisId, isPanorama) {
|
|
588
|
+
switch (axisType) {
|
|
589
|
+
case "xAxis": return combineXAxisRange(state, axisId, isPanorama);
|
|
590
|
+
case "yAxis": return combineYAxisRange(state, axisId, isPanorama);
|
|
591
|
+
case "zAxis": return selectZAxisSettings(state, axisId)?.range;
|
|
592
|
+
case "angleAxis": return selectAngleAxisRange(state);
|
|
593
|
+
case "radiusAxis": return selectRadiusAxisRange(state, axisId);
|
|
594
|
+
default: return;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
var selectAxisRangeWithReverse = createSelector([selectBaseAxis, selectAxisRange], combineAxisRangeWithReverse);
|
|
598
|
+
var selectAxisScale = createSelector([
|
|
599
|
+
selectBaseAxis,
|
|
600
|
+
selectRealScaleType,
|
|
601
|
+
selectAxisDomainIncludingNiceTicks,
|
|
602
|
+
selectAxisRangeWithReverse
|
|
603
|
+
], combineScaleFunction);
|
|
604
|
+
createSelector(selectCartesianItemsSettings, pickAxisType, (items, axisType) => {
|
|
605
|
+
return items.flatMap((item) => {
|
|
606
|
+
return item.errorBars ?? [];
|
|
607
|
+
}).filter((e) => {
|
|
608
|
+
return isErrorBarRelevantForAxisType(axisType, e);
|
|
609
|
+
});
|
|
610
|
+
});
|
|
611
|
+
function compareIds(a, b) {
|
|
612
|
+
if (a.id < b.id) return -1;
|
|
613
|
+
if (a.id > b.id) return 1;
|
|
614
|
+
return 0;
|
|
615
|
+
}
|
|
616
|
+
var pickAxisOrientation = (_state, orientation) => orientation;
|
|
617
|
+
var pickMirror = (_state, _orientation, mirror) => mirror;
|
|
618
|
+
var selectAllXAxesWithOffsetType = createSelector(selectAllXAxes, pickAxisOrientation, pickMirror, (allAxes, orientation, mirror) => allAxes.filter((axis) => axis.orientation === orientation).filter((axis) => axis.mirror === mirror).sort(compareIds));
|
|
619
|
+
var selectAllYAxesWithOffsetType = createSelector(selectAllYAxes, pickAxisOrientation, pickMirror, (allAxes, orientation, mirror) => allAxes.filter((axis) => axis.orientation === orientation).filter((axis) => axis.mirror === mirror).sort(compareIds));
|
|
620
|
+
function getXAxisSize(offset, axisSettings) {
|
|
621
|
+
return {
|
|
622
|
+
width: offset.width,
|
|
623
|
+
height: axisSettings.height
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
function getYAxisSize(offset, axisSettings) {
|
|
627
|
+
return {
|
|
628
|
+
width: axisSettings.width,
|
|
629
|
+
height: offset.height
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
var selectXAxisSize = createSelector(selectChartOffset, selectXAxisSettings, getXAxisSize);
|
|
633
|
+
function combineXAxisPositionStartingPoint(offset, orientation, chartHeight) {
|
|
634
|
+
switch (orientation) {
|
|
635
|
+
case "top": return offset.top;
|
|
636
|
+
case "bottom": return chartHeight - offset.bottom;
|
|
637
|
+
default: return 0;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
function combineYAxisPositionStartingPoint(offset, orientation, chartWidth) {
|
|
641
|
+
switch (orientation) {
|
|
642
|
+
case "left": return offset.left;
|
|
643
|
+
case "right": return chartWidth - offset.right;
|
|
644
|
+
default: return 0;
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
var selectAllXAxesOffsetSteps = createSelector(selectChartHeight, selectChartOffset, selectAllXAxesWithOffsetType, pickAxisOrientation, pickMirror, (chartHeight, offset, allAxesWithSameOffsetType, orientation, mirror) => {
|
|
648
|
+
const steps = {};
|
|
649
|
+
let position;
|
|
650
|
+
allAxesWithSameOffsetType.forEach((axis) => {
|
|
651
|
+
const axisSize = getXAxisSize(offset, axis);
|
|
652
|
+
if (position == null) position = combineXAxisPositionStartingPoint(offset, orientation, chartHeight);
|
|
653
|
+
const needSpace = orientation === "top" && !mirror || orientation === "bottom" && mirror;
|
|
654
|
+
steps[axis.id] = position - Number(needSpace) * axisSize.height;
|
|
655
|
+
position += (needSpace ? -1 : 1) * axisSize.height;
|
|
656
|
+
});
|
|
657
|
+
return steps;
|
|
658
|
+
});
|
|
659
|
+
var selectAllYAxesOffsetSteps = createSelector(selectChartWidth, selectChartOffset, selectAllYAxesWithOffsetType, pickAxisOrientation, pickMirror, (chartWidth, offset, allAxesWithSameOffsetType, orientation, mirror) => {
|
|
660
|
+
const steps = {};
|
|
661
|
+
let position;
|
|
662
|
+
allAxesWithSameOffsetType.forEach((axis) => {
|
|
663
|
+
const axisSize = getYAxisSize(offset, axis);
|
|
664
|
+
if (position == null) position = combineYAxisPositionStartingPoint(offset, orientation, chartWidth);
|
|
665
|
+
const needSpace = orientation === "left" && !mirror || orientation === "right" && mirror;
|
|
666
|
+
steps[axis.id] = position - Number(needSpace) * axisSize.width;
|
|
667
|
+
position += (needSpace ? -1 : 1) * axisSize.width;
|
|
668
|
+
});
|
|
669
|
+
return steps;
|
|
670
|
+
});
|
|
671
|
+
function selectXAxisPosition(state, axisId) {
|
|
672
|
+
const offset = selectChartOffset(state);
|
|
673
|
+
const axisSettings = selectXAxisSettings(state, axisId);
|
|
674
|
+
if (axisSettings == null) return;
|
|
675
|
+
const stepOfThisAxis = selectAllXAxesOffsetSteps(state, axisSettings.orientation, axisSettings.mirror)[axisId];
|
|
676
|
+
if (stepOfThisAxis == null) return {
|
|
677
|
+
x: offset.left,
|
|
678
|
+
y: 0
|
|
679
|
+
};
|
|
680
|
+
return {
|
|
681
|
+
x: offset.left,
|
|
682
|
+
y: stepOfThisAxis
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function selectYAxisPosition(state, axisId) {
|
|
686
|
+
const offset = selectChartOffset(state);
|
|
687
|
+
const axisSettings = selectYAxisSettings(state, axisId);
|
|
688
|
+
if (axisSettings == null) return;
|
|
689
|
+
const stepOfThisAxis = selectAllYAxesOffsetSteps(state, axisSettings.orientation, axisSettings.mirror)[axisId];
|
|
690
|
+
if (stepOfThisAxis == null) return {
|
|
691
|
+
x: 0,
|
|
692
|
+
y: offset.top
|
|
693
|
+
};
|
|
694
|
+
return {
|
|
695
|
+
x: stepOfThisAxis,
|
|
696
|
+
y: offset.top
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
var selectYAxisSize = createSelector(selectChartOffset, selectYAxisSettings, (offset, axisSettings) => {
|
|
700
|
+
return {
|
|
701
|
+
width: axisSettings.width,
|
|
702
|
+
height: offset.height
|
|
703
|
+
};
|
|
704
|
+
});
|
|
705
|
+
function selectCartesianAxisSize(state, axisType, axisId) {
|
|
706
|
+
switch (axisType) {
|
|
707
|
+
case "xAxis": return selectXAxisSize(state, axisId).width;
|
|
708
|
+
case "yAxis": return selectYAxisSize(state, axisId).height;
|
|
709
|
+
default: return;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
function combineDuplicateDomain(chartLayout, appliedValues, axis, axisType) {
|
|
713
|
+
if (axis == null) return;
|
|
714
|
+
const { allowDuplicatedCategory, type, dataKey } = axis;
|
|
715
|
+
const isCategorical = isCategoricalAxis(chartLayout, axisType);
|
|
716
|
+
const allData = appliedValues.map((av) => av.value);
|
|
717
|
+
if (dataKey && isCategorical && type === "category" && allowDuplicatedCategory && hasDuplicate(allData)) return allData;
|
|
718
|
+
}
|
|
719
|
+
var selectDuplicateDomain = createSelector([
|
|
720
|
+
selectChartLayout,
|
|
721
|
+
selectAllAppliedValues,
|
|
722
|
+
selectBaseAxis,
|
|
723
|
+
pickAxisType
|
|
724
|
+
], combineDuplicateDomain);
|
|
725
|
+
function combineCategoricalDomain(layout, appliedValues, axis, axisType) {
|
|
726
|
+
if (axis == null || axis.dataKey == null) return;
|
|
727
|
+
const { type, scale } = axis;
|
|
728
|
+
if (isCategoricalAxis(layout, axisType) && (type === "number" || scale !== "auto")) return appliedValues.map((d) => d.value);
|
|
729
|
+
}
|
|
730
|
+
var selectCategoricalDomain = createSelector([
|
|
731
|
+
selectChartLayout,
|
|
732
|
+
selectAllAppliedValues,
|
|
733
|
+
selectAxisSettings,
|
|
734
|
+
pickAxisType
|
|
735
|
+
], combineCategoricalDomain);
|
|
736
|
+
var selectAxisPropsNeededForCartesianGridTicksGenerator = createSelector([
|
|
737
|
+
selectChartLayout,
|
|
738
|
+
selectCartesianAxisSettings,
|
|
739
|
+
selectRealScaleType,
|
|
740
|
+
selectAxisScale,
|
|
741
|
+
selectDuplicateDomain,
|
|
742
|
+
selectCategoricalDomain,
|
|
743
|
+
selectAxisRange,
|
|
744
|
+
selectNiceTicks,
|
|
745
|
+
pickAxisType
|
|
746
|
+
], (layout, axis, realScaleType, scale, duplicateDomain, categoricalDomain, axisRange, niceTicks, axisType) => {
|
|
747
|
+
if (axis == null) return null;
|
|
748
|
+
const isCategorical = isCategoricalAxis(layout, axisType);
|
|
749
|
+
return {
|
|
750
|
+
angle: axis.angle,
|
|
751
|
+
interval: axis.interval,
|
|
752
|
+
minTickGap: axis.minTickGap,
|
|
753
|
+
orientation: axis.orientation,
|
|
754
|
+
tick: axis.tick,
|
|
755
|
+
tickCount: axis.tickCount,
|
|
756
|
+
tickFormatter: axis.tickFormatter,
|
|
757
|
+
ticks: axis.ticks,
|
|
758
|
+
type: axis.type,
|
|
759
|
+
unit: axis.unit,
|
|
760
|
+
axisType,
|
|
761
|
+
categoricalDomain,
|
|
762
|
+
duplicateDomain,
|
|
763
|
+
isCategorical,
|
|
764
|
+
niceTicks,
|
|
765
|
+
range: axisRange,
|
|
766
|
+
realScaleType,
|
|
767
|
+
scale
|
|
768
|
+
};
|
|
769
|
+
});
|
|
770
|
+
function combineAxisTicks(layout, axis, realScaleType, scale, niceTicks, axisRange, duplicateDomain, categoricalDomain, axisType) {
|
|
771
|
+
if (axis == null || scale == null) return;
|
|
772
|
+
const isCategorical = isCategoricalAxis(layout, axisType);
|
|
773
|
+
const { type, ticks, tickCount } = axis;
|
|
774
|
+
const offsetForBand = realScaleType === "scaleBand" ? scale.bandwidth() / 2 : 2;
|
|
775
|
+
let offset = type === "category" && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
|
776
|
+
offset = axisType === "angleAxis" && axisRange?.length >= 2 ? mathSign(axisRange[0] - axisRange[1]) * 2 * offset : offset;
|
|
777
|
+
const ticksOrNiceTicks = ticks || niceTicks;
|
|
778
|
+
if (ticksOrNiceTicks) return ticksOrNiceTicks.map((entry, index) => {
|
|
779
|
+
return {
|
|
780
|
+
index,
|
|
781
|
+
coordinate: scale(duplicateDomain ? duplicateDomain.indexOf(entry) : entry) + offset,
|
|
782
|
+
value: entry,
|
|
783
|
+
offset
|
|
784
|
+
};
|
|
785
|
+
}).filter((row) => !isNan(row.coordinate));
|
|
786
|
+
if (isCategorical && categoricalDomain) return categoricalDomain.map((entry, index) => ({
|
|
787
|
+
coordinate: scale(entry) + offset,
|
|
788
|
+
value: entry,
|
|
789
|
+
index,
|
|
790
|
+
offset
|
|
791
|
+
}));
|
|
792
|
+
if (scale.ticks) return scale.ticks(tickCount).map((entry) => ({
|
|
793
|
+
coordinate: scale(entry) + offset,
|
|
794
|
+
value: entry,
|
|
795
|
+
offset
|
|
796
|
+
}));
|
|
797
|
+
return scale.domain().map((entry, index) => ({
|
|
798
|
+
coordinate: scale(entry) + offset,
|
|
799
|
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
|
800
|
+
index,
|
|
801
|
+
offset
|
|
802
|
+
}));
|
|
803
|
+
}
|
|
804
|
+
var selectTicksOfAxis = createSelector([
|
|
805
|
+
selectChartLayout,
|
|
806
|
+
selectAxisSettings,
|
|
807
|
+
selectRealScaleType,
|
|
808
|
+
selectAxisScale,
|
|
809
|
+
selectNiceTicks,
|
|
810
|
+
selectAxisRange,
|
|
811
|
+
selectDuplicateDomain,
|
|
812
|
+
selectCategoricalDomain,
|
|
813
|
+
pickAxisType
|
|
814
|
+
], combineAxisTicks);
|
|
815
|
+
function combineGraphicalItemTicks(layout, axis, scale, axisRange, duplicateDomain, categoricalDomain, axisType) {
|
|
816
|
+
if (axis == null || scale == null || axisRange == null || axisRange[0] === axisRange[1]) return null;
|
|
817
|
+
const isCategorical = isCategoricalAxis(layout, axisType);
|
|
818
|
+
const { tickCount } = axis;
|
|
819
|
+
let offset = 0;
|
|
820
|
+
offset = axisType === "angleAxis" && axisRange?.length >= 2 ? mathSign(axisRange[0] - axisRange[1]) * 2 * offset : offset;
|
|
821
|
+
if (isCategorical && categoricalDomain) return categoricalDomain.map((entry, index) => ({
|
|
822
|
+
coordinate: scale(entry) + offset,
|
|
823
|
+
value: entry,
|
|
824
|
+
index,
|
|
825
|
+
offset
|
|
826
|
+
}));
|
|
827
|
+
if (scale.ticks) return scale.ticks(tickCount).map((entry) => ({
|
|
828
|
+
coordinate: scale(entry) + offset,
|
|
829
|
+
value: entry,
|
|
830
|
+
offset
|
|
831
|
+
}));
|
|
832
|
+
return scale.domain().map((entry, index) => ({
|
|
833
|
+
coordinate: scale(entry) + offset,
|
|
834
|
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
|
835
|
+
index,
|
|
836
|
+
offset
|
|
837
|
+
}));
|
|
838
|
+
}
|
|
839
|
+
var selectTicksOfGraphicalItem = createSelector([
|
|
840
|
+
selectChartLayout,
|
|
841
|
+
selectAxisSettings,
|
|
842
|
+
selectAxisScale,
|
|
843
|
+
selectAxisRange,
|
|
844
|
+
selectDuplicateDomain,
|
|
845
|
+
selectCategoricalDomain,
|
|
846
|
+
pickAxisType
|
|
847
|
+
], combineGraphicalItemTicks);
|
|
848
|
+
var selectAxisWithScale = createSelector(selectBaseAxis, selectAxisScale, (axis, scale) => {
|
|
849
|
+
if (axis == null || scale == null) return;
|
|
850
|
+
return {
|
|
851
|
+
...axis,
|
|
852
|
+
scale
|
|
853
|
+
};
|
|
854
|
+
});
|
|
855
|
+
var selectZAxisWithScale = createSelector((state, _axisType, axisId) => selectZAxisSettings(state, axisId), createSelector([
|
|
856
|
+
selectBaseAxis,
|
|
857
|
+
selectRealScaleType,
|
|
858
|
+
selectAxisDomain,
|
|
859
|
+
selectAxisRangeWithReverse
|
|
860
|
+
], combineScaleFunction), (axis, scale) => {
|
|
861
|
+
if (axis == null || scale == null) return;
|
|
862
|
+
return {
|
|
863
|
+
...axis,
|
|
864
|
+
scale
|
|
865
|
+
};
|
|
866
|
+
});
|
|
867
|
+
var selectChartDirection = createSelector([
|
|
868
|
+
selectChartLayout,
|
|
869
|
+
selectAllXAxes,
|
|
870
|
+
selectAllYAxes
|
|
871
|
+
], (layout, allXAxes, allYAxes) => {
|
|
872
|
+
switch (layout) {
|
|
873
|
+
case "horizontal": return allXAxes.some((axis) => axis.reversed) ? "right-to-left" : "left-to-right";
|
|
874
|
+
case "vertical": return allYAxes.some((axis) => axis.reversed) ? "bottom-to-top" : "top-to-bottom";
|
|
875
|
+
default: return;
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
//#endregion
|
|
879
|
+
export { combineAppliedNumericalValuesIncludingErrorValues, combineAppliedValues, combineAreasDomain, combineAxisDomain, combineAxisDomainWithNiceTicks, combineAxisTicks, combineCategoricalDomain, combineDisplayedData, combineDomainOfStackGroups, combineDotsDomain, combineDuplicateDomain, combineGraphicalItemTicks, combineGraphicalItemsData, combineGraphicalItemsSettings, combineLinesDomain, combineNiceTicks, combineNumericalDomain, combineRealScaleType, combineScaleFunction, combineStackGroups, filterGraphicalNotStackedItems, filterReferenceElements, getDomainDefinition, implicitXAxis, implicitYAxis, implicitZAxis, itemAxisPredicate, mergeDomains, selectAxisPropsNeededForCartesianGridTicksGenerator, selectAxisRange, selectAxisScale, selectAxisSettings, selectAxisWithScale, selectBaseAxis, selectCartesianAxisSize, selectChartDirection, selectDomainDefinition, selectDuplicateDomain, selectHasBar, selectRealScaleType, selectReferenceAreas, selectReferenceDots, selectReferenceLines, selectStackGroups, selectTicksOfAxis, selectTicksOfGraphicalItem, selectUnfilteredCartesianItems, selectXAxisPosition, selectXAxisSettings, selectXAxisSize, selectYAxisPosition, selectYAxisSettings, selectYAxisSize, selectZAxisWithScale };
|