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,241 @@
|
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectChartDataWithIndexesIfNotInPanorama } from "./dataSelectors.mjs";
|
|
3
|
+
import { selectChartOffset } from "./selectChartOffset.mjs";
|
|
4
|
+
import { selectBarCategoryGap, selectBarGap, selectRootBarSize, selectRootMaxBarSize } from "./rootPropsSelectors.mjs";
|
|
5
|
+
import { getPercentValue } from "../../utils/data.mjs";
|
|
6
|
+
import { selectChartLayout } from "./common.mjs";
|
|
7
|
+
import { getBandSizeOfAxis } from "../../utils/chart.mjs";
|
|
8
|
+
import { selectAxisWithScale, selectCartesianAxisSize, selectStackGroups, selectTicksOfGraphicalItem, selectUnfilteredCartesianItems } from "./axisSelectors.mjs";
|
|
9
|
+
import { computeBarRectangles } from "../../cartesian/bar/utils.mjs";
|
|
10
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
11
|
+
//#region src/state/selectors/barSelectors.ts
|
|
12
|
+
var pickXAxisId = (_state, xAxisId) => xAxisId;
|
|
13
|
+
var pickYAxisId = (_state, _xAxisId, yAxisId) => yAxisId;
|
|
14
|
+
function pickIsPanorama(_state, _xAxisId, _yAxisId, isPanorama) {
|
|
15
|
+
return isPanorama;
|
|
16
|
+
}
|
|
17
|
+
function pickBarSettings(_state, _xAxisId, _yAxisId, _isPanorama, barSettings) {
|
|
18
|
+
return barSettings;
|
|
19
|
+
}
|
|
20
|
+
function pickMaxBarSize(_state, _xAxisId, _yAxisId, _isPanorama, barSettings) {
|
|
21
|
+
return barSettings.maxBarSize;
|
|
22
|
+
}
|
|
23
|
+
function getBarSize(globalSize, totalSize, selfSize) {
|
|
24
|
+
const barSize = selfSize ?? globalSize;
|
|
25
|
+
return isNullish(barSize) ? void 0 : getPercentValue(barSize, totalSize, 0);
|
|
26
|
+
}
|
|
27
|
+
var selectAllVisibleBars = createSelector([
|
|
28
|
+
selectChartLayout,
|
|
29
|
+
selectUnfilteredCartesianItems,
|
|
30
|
+
pickXAxisId,
|
|
31
|
+
pickYAxisId,
|
|
32
|
+
pickIsPanorama
|
|
33
|
+
], (layout, allItems, xAxisId, yAxisId, isPanorama) => allItems.filter((i) => {
|
|
34
|
+
if (layout === "horizontal") return i.xAxisId === xAxisId;
|
|
35
|
+
return i.yAxisId === yAxisId;
|
|
36
|
+
}).filter((i) => i.isPanorama === isPanorama).filter((i) => i.hide === false).filter((i) => i.type === "bar"));
|
|
37
|
+
function selectBarStackGroups(state, xAxisId, yAxisId, isPanorama) {
|
|
38
|
+
if (selectChartLayout(state) === "horizontal") return selectStackGroups(state, "yAxis", yAxisId, isPanorama);
|
|
39
|
+
return selectStackGroups(state, "xAxis", xAxisId, isPanorama);
|
|
40
|
+
}
|
|
41
|
+
function selectBarCartesianAxisSize(state, xAxisId, yAxisId) {
|
|
42
|
+
if (selectChartLayout(state) === "horizontal") return selectCartesianAxisSize(state, "xAxis", xAxisId);
|
|
43
|
+
return selectCartesianAxisSize(state, "yAxis", yAxisId);
|
|
44
|
+
}
|
|
45
|
+
function combineBarSizeList(allBars, globalSize, totalSize) {
|
|
46
|
+
const initialValue = {};
|
|
47
|
+
const stackedBars = allBars.filter((b) => b.stackId != null);
|
|
48
|
+
const unstackedBars = allBars.filter((b) => b.stackId == null);
|
|
49
|
+
const groupByStack = stackedBars.reduce((acc, bar) => {
|
|
50
|
+
if (!acc[bar.stackId]) acc[bar.stackId] = [];
|
|
51
|
+
acc[bar.stackId].push(bar);
|
|
52
|
+
return acc;
|
|
53
|
+
}, initialValue);
|
|
54
|
+
const stackedSizeList = Object.entries(groupByStack).map(([stackId, bars]) => {
|
|
55
|
+
return {
|
|
56
|
+
stackId,
|
|
57
|
+
dataKeys: bars.map((b) => b.dataKey),
|
|
58
|
+
barSize: getBarSize(globalSize, totalSize, bars[0].barSize)
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
const unstackedSizeList = unstackedBars.map((b) => {
|
|
62
|
+
return {
|
|
63
|
+
stackId: void 0,
|
|
64
|
+
dataKeys: [b.dataKey],
|
|
65
|
+
barSize: getBarSize(globalSize, totalSize, b.barSize)
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
return [...stackedSizeList, ...unstackedSizeList];
|
|
69
|
+
}
|
|
70
|
+
var selectBarSizeList = createSelector([
|
|
71
|
+
selectAllVisibleBars,
|
|
72
|
+
selectRootBarSize,
|
|
73
|
+
selectBarCartesianAxisSize
|
|
74
|
+
], combineBarSizeList);
|
|
75
|
+
function selectBarBandSize(state, xAxisId, yAxisId, isPanorama, barSettings) {
|
|
76
|
+
const layout = selectChartLayout(state);
|
|
77
|
+
const globalMaxBarSize = selectRootMaxBarSize(state);
|
|
78
|
+
const { maxBarSize: childMaxBarSize } = barSettings;
|
|
79
|
+
const maxBarSize = isNullish(childMaxBarSize) ? globalMaxBarSize : childMaxBarSize;
|
|
80
|
+
let axis, ticks;
|
|
81
|
+
if (layout === "horizontal") {
|
|
82
|
+
axis = selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
83
|
+
ticks = selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
84
|
+
} else {
|
|
85
|
+
axis = selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
86
|
+
ticks = selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
87
|
+
}
|
|
88
|
+
return getBandSizeOfAxis(axis, ticks, true) ?? maxBarSize ?? 0;
|
|
89
|
+
}
|
|
90
|
+
function selectAxisBandSize(state, xAxisId, yAxisId, isPanorama) {
|
|
91
|
+
const layout = selectChartLayout(state);
|
|
92
|
+
let axis, ticks;
|
|
93
|
+
if (layout === "horizontal") {
|
|
94
|
+
axis = selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
95
|
+
ticks = selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
96
|
+
} else {
|
|
97
|
+
axis = selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
98
|
+
ticks = selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
99
|
+
}
|
|
100
|
+
return getBandSizeOfAxis(axis, ticks);
|
|
101
|
+
}
|
|
102
|
+
function getBarPositions(barGap, barCategoryGap, bandSize, sizeList, maxBarSize) {
|
|
103
|
+
const len = sizeList.length;
|
|
104
|
+
if (len < 1) return null;
|
|
105
|
+
let realBarGap = getPercentValue(barGap, bandSize, 0, true);
|
|
106
|
+
let result;
|
|
107
|
+
const initialValue = [];
|
|
108
|
+
if (sizeList[0].barSize === +sizeList[0].barSize) {
|
|
109
|
+
let useFull = false;
|
|
110
|
+
let fullBarSize = bandSize / len;
|
|
111
|
+
let sum = sizeList.reduce((res, entry) => res + entry.barSize || 0, 0);
|
|
112
|
+
sum += (len - 1) * realBarGap;
|
|
113
|
+
if (sum >= bandSize) {
|
|
114
|
+
sum -= (len - 1) * realBarGap;
|
|
115
|
+
realBarGap = 0;
|
|
116
|
+
}
|
|
117
|
+
if (sum >= bandSize && fullBarSize > 0) {
|
|
118
|
+
useFull = true;
|
|
119
|
+
fullBarSize *= .9;
|
|
120
|
+
sum = len * fullBarSize;
|
|
121
|
+
}
|
|
122
|
+
let prev = {
|
|
123
|
+
offset: ((bandSize - sum) / 2 >> 0) - realBarGap,
|
|
124
|
+
size: 0
|
|
125
|
+
};
|
|
126
|
+
result = sizeList.reduce((res, entry) => {
|
|
127
|
+
const newPosition = {
|
|
128
|
+
stackId: entry.stackId,
|
|
129
|
+
dataKeys: entry.dataKeys,
|
|
130
|
+
position: {
|
|
131
|
+
offset: prev.offset + prev.size + realBarGap,
|
|
132
|
+
size: useFull ? fullBarSize : entry.barSize
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const newRes = [...res, newPosition];
|
|
136
|
+
prev = newRes[newRes.length - 1].position;
|
|
137
|
+
return newRes;
|
|
138
|
+
}, initialValue);
|
|
139
|
+
} else {
|
|
140
|
+
const offset = getPercentValue(barCategoryGap, bandSize, 0, true);
|
|
141
|
+
if (bandSize - 2 * offset - (len - 1) * realBarGap <= 0) realBarGap = 0;
|
|
142
|
+
let originalSize = (bandSize - 2 * offset - (len - 1) * realBarGap) / len;
|
|
143
|
+
if (originalSize > 1) originalSize >>= 0;
|
|
144
|
+
const size = maxBarSize === +maxBarSize ? Math.min(originalSize, maxBarSize) : originalSize;
|
|
145
|
+
result = sizeList.reduce((res, entry, i) => [...res, {
|
|
146
|
+
stackId: entry.stackId,
|
|
147
|
+
dataKeys: entry.dataKeys,
|
|
148
|
+
position: {
|
|
149
|
+
offset: offset + (originalSize + realBarGap) * i + (originalSize - size) / 2,
|
|
150
|
+
size
|
|
151
|
+
}
|
|
152
|
+
}], initialValue);
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
function combineAllBarPositions(sizeList, globalMaxBarSize, barGap, barCategoryGap, barBandSize, bandSize, childMaxBarSize) {
|
|
157
|
+
const maxBarSize = isNullish(childMaxBarSize) ? globalMaxBarSize : childMaxBarSize;
|
|
158
|
+
let allBarPositions = getBarPositions(barGap, barCategoryGap, barBandSize !== bandSize ? barBandSize : bandSize, sizeList, maxBarSize);
|
|
159
|
+
if (barBandSize !== bandSize && allBarPositions != null) allBarPositions = allBarPositions.map((pos) => ({
|
|
160
|
+
...pos,
|
|
161
|
+
position: {
|
|
162
|
+
...pos.position,
|
|
163
|
+
offset: pos.position.offset - barBandSize / 2
|
|
164
|
+
}
|
|
165
|
+
}));
|
|
166
|
+
return allBarPositions;
|
|
167
|
+
}
|
|
168
|
+
var selectAllBarPositions = createSelector([
|
|
169
|
+
selectBarSizeList,
|
|
170
|
+
selectRootMaxBarSize,
|
|
171
|
+
selectBarGap,
|
|
172
|
+
selectBarCategoryGap,
|
|
173
|
+
selectBarBandSize,
|
|
174
|
+
selectAxisBandSize,
|
|
175
|
+
pickMaxBarSize
|
|
176
|
+
], combineAllBarPositions);
|
|
177
|
+
function selectXAxisWithScale(state, xAxisId, _yAxisId, isPanorama) {
|
|
178
|
+
return selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
179
|
+
}
|
|
180
|
+
function selectYAxisWithScale(state, _xAxisId, yAxisId, isPanorama) {
|
|
181
|
+
return selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
182
|
+
}
|
|
183
|
+
function selectXAxisTicks(state, xAxisId, _yAxisId, isPanorama) {
|
|
184
|
+
return selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
185
|
+
}
|
|
186
|
+
function selectYAxisTicks(state, _xAxisId, yAxisId, isPanorama) {
|
|
187
|
+
return selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
188
|
+
}
|
|
189
|
+
var selectBarPosition = createSelector([selectAllBarPositions, pickBarSettings], (allBarPositions, barSettings) => {
|
|
190
|
+
if (allBarPositions == null) return;
|
|
191
|
+
const position = allBarPositions.find((p) => p.stackId === barSettings.stackId && p.dataKeys.includes(barSettings.dataKey));
|
|
192
|
+
if (position == null) return;
|
|
193
|
+
return position.position;
|
|
194
|
+
});
|
|
195
|
+
function combineStackedData(stackGroups, barSettings) {
|
|
196
|
+
if (!stackGroups || barSettings?.dataKey == null) return;
|
|
197
|
+
const { stackId } = barSettings;
|
|
198
|
+
const stackGroup = stackGroups[stackId];
|
|
199
|
+
if (!stackGroup) return;
|
|
200
|
+
const { stackedData } = stackGroup;
|
|
201
|
+
if (!stackedData) return;
|
|
202
|
+
return stackedData.find((sd) => sd.key === barSettings.dataKey);
|
|
203
|
+
}
|
|
204
|
+
var selectSynchronisedBarSettings = createSelector([selectUnfilteredCartesianItems, pickBarSettings], (graphicalItems, barSettingsFromProps) => {
|
|
205
|
+
if (graphicalItems.some((cgis) => cgis.type === "bar" && barSettingsFromProps.dataKey === cgis.dataKey && barSettingsFromProps.stackId === cgis.stackId && barSettingsFromProps.stackId === cgis.stackId)) return barSettingsFromProps;
|
|
206
|
+
});
|
|
207
|
+
var selectBarRectangles = createSelector([
|
|
208
|
+
selectChartOffset,
|
|
209
|
+
selectXAxisWithScale,
|
|
210
|
+
selectYAxisWithScale,
|
|
211
|
+
selectXAxisTicks,
|
|
212
|
+
selectYAxisTicks,
|
|
213
|
+
selectBarPosition,
|
|
214
|
+
selectChartLayout,
|
|
215
|
+
selectChartDataWithIndexesIfNotInPanorama,
|
|
216
|
+
selectAxisBandSize,
|
|
217
|
+
createSelector([selectBarStackGroups, pickBarSettings], combineStackedData),
|
|
218
|
+
selectSynchronisedBarSettings
|
|
219
|
+
], (offset, xAxis, yAxis, xAxisTicks, yAxisTicks, pos, layout, { chartData, dataStartIndex, dataEndIndex }, bandSize, stackedData, barSettings) => {
|
|
220
|
+
if (barSettings == null || pos == null || layout !== "horizontal" && layout !== "vertical" || xAxis == null || yAxis == null || xAxisTicks == null || yAxisTicks == null) return;
|
|
221
|
+
const { data } = barSettings;
|
|
222
|
+
let displayedData;
|
|
223
|
+
if ((data?.length ?? 0) > 0) displayedData = data;
|
|
224
|
+
else displayedData = chartData?.slice(dataStartIndex, dataEndIndex + 1);
|
|
225
|
+
if (displayedData == null) return;
|
|
226
|
+
return computeBarRectangles({
|
|
227
|
+
layout,
|
|
228
|
+
barSettings,
|
|
229
|
+
pos,
|
|
230
|
+
bandSize,
|
|
231
|
+
xAxis,
|
|
232
|
+
yAxis,
|
|
233
|
+
xAxisTicks,
|
|
234
|
+
yAxisTicks,
|
|
235
|
+
stackedData,
|
|
236
|
+
displayedData,
|
|
237
|
+
offset
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
//#endregion
|
|
241
|
+
export { combineAllBarPositions, combineBarSizeList, combineStackedData, selectBarRectangles };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectMargin } from "./containerSelectors.mjs";
|
|
3
|
+
import { selectChartOffset } from "./selectChartOffset.mjs";
|
|
4
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
5
|
+
//#region src/state/selectors/brushSelectors.ts
|
|
6
|
+
var selectBrushSettings = (state) => state.brush;
|
|
7
|
+
var selectBrushDimensions = createSelector([
|
|
8
|
+
selectBrushSettings,
|
|
9
|
+
selectChartOffset,
|
|
10
|
+
selectMargin
|
|
11
|
+
], (brushSettings, offset, margin) => ({
|
|
12
|
+
height: brushSettings.height,
|
|
13
|
+
x: isNumber(brushSettings.x) ? brushSettings.x : offset.left,
|
|
14
|
+
y: isNumber(brushSettings.y) ? brushSettings.y : offset.top + offset.height + offset.brushBottom - (margin?.bottom || 0),
|
|
15
|
+
width: isNumber(brushSettings.width) ? brushSettings.width : offset.width
|
|
16
|
+
}));
|
|
17
|
+
//#endregion
|
|
18
|
+
export { selectBrushDimensions, selectBrushSettings };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isNan } from "../../../utils/validate.mjs";
|
|
2
|
+
//#region src/state/selectors/combiners/combineActiveLabel.ts
|
|
3
|
+
function combineActiveLabel(tooltipTicks, activeIndex) {
|
|
4
|
+
const n = Number(activeIndex);
|
|
5
|
+
if (isNan(n) || activeIndex == null) return;
|
|
6
|
+
return n >= 0 ? tooltipTicks?.[n]?.value : void 0;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { combineActiveLabel };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isWellBehavedNumber } from "../../../utils/validate.mjs";
|
|
2
|
+
import { getValueByDataKey } from "../../../utils/chart.mjs";
|
|
3
|
+
import { isWellFormedNumberDomain } from "../../../utils/isDomainSpecifiedByUser.mjs";
|
|
4
|
+
//#region src/state/selectors/combiners/combineActiveTooltipIndex.ts
|
|
5
|
+
function toFiniteNumber(value) {
|
|
6
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : void 0;
|
|
7
|
+
if (value instanceof Date) {
|
|
8
|
+
const numericValue = value.valueOf();
|
|
9
|
+
return Number.isFinite(numericValue) ? numericValue : void 0;
|
|
10
|
+
}
|
|
11
|
+
const parsed = Number(value);
|
|
12
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
13
|
+
}
|
|
14
|
+
function isValueWithinNumberDomain(value, domain) {
|
|
15
|
+
const numericValue = toFiniteNumber(value);
|
|
16
|
+
const lowerBound = domain[0];
|
|
17
|
+
const upperBound = domain[1];
|
|
18
|
+
if (numericValue === void 0) return false;
|
|
19
|
+
return numericValue >= Math.min(lowerBound, upperBound) && numericValue <= Math.max(lowerBound, upperBound);
|
|
20
|
+
}
|
|
21
|
+
function isValueWithinDomain(entry, axisDataKey, domain) {
|
|
22
|
+
if (domain == null || axisDataKey == null) return true;
|
|
23
|
+
const value = getValueByDataKey(entry, axisDataKey);
|
|
24
|
+
if (value == null) return true;
|
|
25
|
+
if (!isWellFormedNumberDomain(domain)) return true;
|
|
26
|
+
return isValueWithinNumberDomain(value, domain);
|
|
27
|
+
}
|
|
28
|
+
function combineActiveTooltipIndex(tooltipInteraction, chartData, axisDataKey, domain) {
|
|
29
|
+
const desiredIndex = tooltipInteraction?.index;
|
|
30
|
+
if (desiredIndex == null) return null;
|
|
31
|
+
const indexAsNumber = Number(desiredIndex);
|
|
32
|
+
if (!isWellBehavedNumber(indexAsNumber)) return desiredIndex;
|
|
33
|
+
const lowerLimit = 0;
|
|
34
|
+
let upperLimit = Infinity;
|
|
35
|
+
if (chartData.length > 0) upperLimit = chartData.length - 1;
|
|
36
|
+
const clampedIndex = Math.max(lowerLimit, Math.min(indexAsNumber, upperLimit));
|
|
37
|
+
const entry = chartData[clampedIndex];
|
|
38
|
+
if (entry == null) return String(clampedIndex);
|
|
39
|
+
if (!isValueWithinDomain(entry, axisDataKey, domain)) return null;
|
|
40
|
+
return String(clampedIndex);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { combineActiveTooltipIndex };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/state/selectors/combiners/combineAxisRangeWithReverse.ts
|
|
2
|
+
function combineAxisRangeWithReverse(axisSettings, axisRange) {
|
|
3
|
+
if (!axisSettings || !axisRange) return;
|
|
4
|
+
if (axisSettings?.reversed) return [axisRange[1], axisRange[0]];
|
|
5
|
+
return axisRange;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { combineAxisRangeWithReverse };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/state/selectors/combiners/combineCoordinateForDefaultIndex.ts
|
|
2
|
+
function combineCoordinateForDefaultIndex(width, height, layout, offset, tooltipTicks, defaultIndex, tooltipConfigurations, tooltipPayloadSearcher) {
|
|
3
|
+
if (defaultIndex == null || offset == null) return;
|
|
4
|
+
const firstConfiguration = tooltipConfigurations[0];
|
|
5
|
+
const maybePosition = firstConfiguration == null ? void 0 : tooltipPayloadSearcher?.(firstConfiguration.positions, defaultIndex);
|
|
6
|
+
if (maybePosition != null) return maybePosition;
|
|
7
|
+
const tick = tooltipTicks?.[Number(defaultIndex)];
|
|
8
|
+
if (!tick) return;
|
|
9
|
+
switch (layout) {
|
|
10
|
+
case "horizontal": return {
|
|
11
|
+
x: tick.coordinate,
|
|
12
|
+
y: (offset.top + height) / 2
|
|
13
|
+
};
|
|
14
|
+
default: return {
|
|
15
|
+
x: (offset.left + width) / 2,
|
|
16
|
+
y: tick.coordinate
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { combineCoordinateForDefaultIndex };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { noInteraction } from "../../tooltipSlice.mjs";
|
|
2
|
+
//#region src/state/selectors/combiners/combineTooltipInteractionState.ts
|
|
3
|
+
function chooseAppropriateMouseInteraction(tooltipState, tooltipEventType, trigger) {
|
|
4
|
+
if (tooltipEventType === "axis") {
|
|
5
|
+
if (trigger === "click") return tooltipState.axisInteraction.click;
|
|
6
|
+
return tooltipState.axisInteraction.hover;
|
|
7
|
+
}
|
|
8
|
+
if (trigger === "click") return tooltipState.itemInteraction.click;
|
|
9
|
+
return tooltipState.itemInteraction.hover;
|
|
10
|
+
}
|
|
11
|
+
function hasBeenActivePreviously(tooltipInteractionState) {
|
|
12
|
+
return tooltipInteractionState.index != null;
|
|
13
|
+
}
|
|
14
|
+
function combineTooltipInteractionState(tooltipState, tooltipEventType, trigger, defaultIndex) {
|
|
15
|
+
const appropriateMouseInteraction = chooseAppropriateMouseInteraction(tooltipState, tooltipEventType, trigger);
|
|
16
|
+
if (appropriateMouseInteraction?.active) return appropriateMouseInteraction;
|
|
17
|
+
if (tooltipState.keyboardInteraction.active) return tooltipState.keyboardInteraction;
|
|
18
|
+
if (tooltipState.syncInteraction.active && tooltipState.syncInteraction.index != null) return tooltipState.syncInteraction;
|
|
19
|
+
const activeFromProps = tooltipState.settings.active === true;
|
|
20
|
+
if (hasBeenActivePreviously(appropriateMouseInteraction)) {
|
|
21
|
+
if (activeFromProps) return {
|
|
22
|
+
...appropriateMouseInteraction,
|
|
23
|
+
active: true
|
|
24
|
+
};
|
|
25
|
+
} else if (defaultIndex != null) return {
|
|
26
|
+
active: true,
|
|
27
|
+
coordinate: void 0,
|
|
28
|
+
dataKey: void 0,
|
|
29
|
+
index: defaultIndex
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
...noInteraction,
|
|
33
|
+
coordinate: appropriateMouseInteraction?.coordinate
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { combineTooltipInteractionState };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/state/selectors/combiners/combineTooltipPayloadConfigurations.ts
|
|
2
|
+
function combineTooltipPayloadConfigurations(tooltipState, tooltipEventType, trigger, defaultIndex) {
|
|
3
|
+
if (tooltipEventType === "axis") return tooltipState.tooltipItemPayloads;
|
|
4
|
+
if (tooltipState.tooltipItemPayloads.length === 0) return [];
|
|
5
|
+
let filterByDataKey;
|
|
6
|
+
if (trigger === "hover") filterByDataKey = tooltipState.itemInteraction.hover.dataKey;
|
|
7
|
+
else filterByDataKey = tooltipState.itemInteraction.click.dataKey;
|
|
8
|
+
if (tooltipState.syncInteraction.active && filterByDataKey == null) return tooltipState.tooltipItemPayloads;
|
|
9
|
+
if (filterByDataKey == null && defaultIndex != null) return [tooltipState.tooltipItemPayloads[0]];
|
|
10
|
+
return tooltipState.tooltipItemPayloads.filter((tpc) => tpc.settings?.dataKey === filterByDataKey);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { combineTooltipPayloadConfigurations };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/state/selectors/containerSelectors.ts
|
|
2
|
+
var selectChartWidth = (state) => state.layout.width;
|
|
3
|
+
var selectChartHeight = (state) => state.layout.height;
|
|
4
|
+
var selectContainerScale = (state) => state.layout.scale;
|
|
5
|
+
var selectMargin = (state) => state.layout.margin;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { selectChartHeight, selectChartWidth, selectContainerScale, selectMargin };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
|
+
//#region src/state/selectors/dataSelectors.ts
|
|
3
|
+
/**
|
|
4
|
+
* This selector always returns the data with the indexes set by a Brush.
|
|
5
|
+
* Trouble is, that might or might not be what you want.
|
|
6
|
+
*
|
|
7
|
+
* In charts with Brush, you will sometimes want to select the full range of data, and sometimes the one decided by the Brush
|
|
8
|
+
* - even if the Brush is active, the panorama inside the Brush should show the full range of data.
|
|
9
|
+
*
|
|
10
|
+
* So instead of this selector, consider using either selectChartDataAndAlwaysIgnoreIndexes or selectChartDataWithIndexesIfNotInPanorama
|
|
11
|
+
*
|
|
12
|
+
* @param state RechartsRootState
|
|
13
|
+
* @returns data defined on the chart root element, such as BarChart or ScatterChart
|
|
14
|
+
*/
|
|
15
|
+
var selectChartDataWithIndexes = (state) => state.chartData;
|
|
16
|
+
/**
|
|
17
|
+
* This selector will always return the full range of data, ignoring the indexes set by a Brush.
|
|
18
|
+
* Useful for when you want to render the full range of data, even if a Brush is active.
|
|
19
|
+
* For example: in the Brush panorama, in Legend, in Tooltip.
|
|
20
|
+
*/
|
|
21
|
+
var selectChartDataAndAlwaysIgnoreIndexes = createSelector([selectChartDataWithIndexes], (dataState) => {
|
|
22
|
+
const dataEndIndex = dataState.chartData != null ? dataState.chartData.length - 1 : 0;
|
|
23
|
+
return {
|
|
24
|
+
chartData: dataState.chartData,
|
|
25
|
+
computedData: dataState.computedData,
|
|
26
|
+
dataEndIndex,
|
|
27
|
+
dataStartIndex: 0
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
function selectChartDataWithIndexesIfNotInPanorama(state, _xAxisId, _yAxisId, isPanorama) {
|
|
31
|
+
if (isPanorama) return selectChartDataAndAlwaysIgnoreIndexes(state);
|
|
32
|
+
return selectChartDataWithIndexes(state);
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { selectChartDataAndAlwaysIgnoreIndexes, selectChartDataWithIndexes, selectChartDataWithIndexesIfNotInPanorama };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { selectChartDataAndAlwaysIgnoreIndexes } from "./dataSelectors.mjs";
|
|
2
|
+
import { selectChartOffset } from "./selectChartOffset.mjs";
|
|
3
|
+
import { computeFunnelTrapezoids } from "../../cartesian/funnel/utils.mjs";
|
|
4
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
5
|
+
//#region src/state/selectors/funnelSelectors.ts
|
|
6
|
+
function pickFunnelSettings(_state, funnelSettings) {
|
|
7
|
+
return funnelSettings;
|
|
8
|
+
}
|
|
9
|
+
var selectFunnelTrapezoids = createSelector([
|
|
10
|
+
selectChartOffset,
|
|
11
|
+
pickFunnelSettings,
|
|
12
|
+
selectChartDataAndAlwaysIgnoreIndexes
|
|
13
|
+
], (offset, { data, dataKey, nameKey, tooltipType, lastShapeType, reversed, customWidth, presentationProps }, { chartData }) => {
|
|
14
|
+
let displayedData;
|
|
15
|
+
if (data != null && data.length > 0) displayedData = data;
|
|
16
|
+
else if (chartData != null && chartData.length > 0) displayedData = chartData;
|
|
17
|
+
if (displayedData && displayedData.length) displayedData = displayedData.map((entry, index) => ({
|
|
18
|
+
payload: entry,
|
|
19
|
+
...presentationProps,
|
|
20
|
+
...entry
|
|
21
|
+
}));
|
|
22
|
+
else return {
|
|
23
|
+
trapezoids: [],
|
|
24
|
+
data: displayedData
|
|
25
|
+
};
|
|
26
|
+
return computeFunnelTrapezoids({
|
|
27
|
+
dataKey,
|
|
28
|
+
nameKey,
|
|
29
|
+
displayedData,
|
|
30
|
+
tooltipType,
|
|
31
|
+
lastShapeType,
|
|
32
|
+
reversed,
|
|
33
|
+
offset,
|
|
34
|
+
customWidth
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
//#endregion
|
|
38
|
+
export { selectFunnelTrapezoids };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
|
+
//#region src/state/selectors/legendSelectors.ts
|
|
3
|
+
var selectLegendSettings = (state) => state.legend.settings;
|
|
4
|
+
var selectLegendSize = (state) => state.legend.size;
|
|
5
|
+
function selectAllLegendPayload2DArray(state) {
|
|
6
|
+
return state.legend.payload;
|
|
7
|
+
}
|
|
8
|
+
var selectLegendPayload = createSelector([selectAllLegendPayload2DArray], (payloads) => payloads.flat(1));
|
|
9
|
+
//#endregion
|
|
10
|
+
export { selectLegendPayload, selectLegendSettings, selectLegendSize };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { isCategoricalAxis } from "../../utils/validate.mjs";
|
|
2
|
+
import { selectChartDataWithIndexesIfNotInPanorama } from "./dataSelectors.mjs";
|
|
3
|
+
import { selectChartLayout } from "./common.mjs";
|
|
4
|
+
import { getBandSizeOfAxis } from "../../utils/chart.mjs";
|
|
5
|
+
import { selectAxisWithScale, selectTicksOfGraphicalItem, selectUnfilteredCartesianItems } from "./axisSelectors.mjs";
|
|
6
|
+
import { computeLinePoints } from "../../cartesian/line/utils.mjs";
|
|
7
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
8
|
+
//#region src/state/selectors/lineSelectors.ts
|
|
9
|
+
function selectXAxisWithScale(state, xAxisId, _yAxisId, isPanorama) {
|
|
10
|
+
return selectAxisWithScale(state, "xAxis", xAxisId, isPanorama);
|
|
11
|
+
}
|
|
12
|
+
function selectXAxisTicks(state, xAxisId, _yAxisId, isPanorama) {
|
|
13
|
+
return selectTicksOfGraphicalItem(state, "xAxis", xAxisId, isPanorama);
|
|
14
|
+
}
|
|
15
|
+
function selectYAxisWithScale(state, _xAxisId, yAxisId, isPanorama) {
|
|
16
|
+
return selectAxisWithScale(state, "yAxis", yAxisId, isPanorama);
|
|
17
|
+
}
|
|
18
|
+
function selectYAxisTicks(state, _xAxisId, yAxisId, isPanorama) {
|
|
19
|
+
return selectTicksOfGraphicalItem(state, "yAxis", yAxisId, isPanorama);
|
|
20
|
+
}
|
|
21
|
+
var selectBandSize = createSelector([
|
|
22
|
+
selectChartLayout,
|
|
23
|
+
selectXAxisWithScale,
|
|
24
|
+
selectYAxisWithScale,
|
|
25
|
+
selectXAxisTicks,
|
|
26
|
+
selectYAxisTicks
|
|
27
|
+
], (layout, xAxis, yAxis, xAxisTicks, yAxisTicks) => {
|
|
28
|
+
if (isCategoricalAxis(layout, "xAxis")) return getBandSizeOfAxis(xAxis, xAxisTicks, false);
|
|
29
|
+
return getBandSizeOfAxis(yAxis, yAxisTicks, false);
|
|
30
|
+
});
|
|
31
|
+
function pickLineSettings(_state, _xAxisId, _yAxisId, _isPanorama, lineSettings) {
|
|
32
|
+
return lineSettings;
|
|
33
|
+
}
|
|
34
|
+
var selectLinePoints = createSelector([
|
|
35
|
+
selectChartLayout,
|
|
36
|
+
selectXAxisWithScale,
|
|
37
|
+
selectYAxisWithScale,
|
|
38
|
+
selectXAxisTicks,
|
|
39
|
+
selectYAxisTicks,
|
|
40
|
+
createSelector([selectUnfilteredCartesianItems, pickLineSettings], (graphicalItems, lineSettingsFromProps) => {
|
|
41
|
+
if (graphicalItems.some((cgis) => cgis.type === "line" && lineSettingsFromProps.dataKey === cgis.dataKey && lineSettingsFromProps.data === cgis.data)) return lineSettingsFromProps;
|
|
42
|
+
}),
|
|
43
|
+
selectBandSize,
|
|
44
|
+
selectChartDataWithIndexesIfNotInPanorama
|
|
45
|
+
], (layout, xAxis, yAxis, xAxisTicks, yAxisTicks, lineSettings, bandSize, { chartData, dataStartIndex, dataEndIndex }) => {
|
|
46
|
+
if (lineSettings == null || xAxis == null || yAxis == null || xAxisTicks == null || yAxisTicks == null || xAxisTicks.length === 0 || yAxisTicks.length === 0) return;
|
|
47
|
+
const { dataKey, data } = lineSettings;
|
|
48
|
+
let displayedData;
|
|
49
|
+
if (data?.length > 0) displayedData = data;
|
|
50
|
+
else displayedData = chartData?.slice(dataStartIndex, dataEndIndex + 1);
|
|
51
|
+
if (displayedData == null) return;
|
|
52
|
+
return computeLinePoints({
|
|
53
|
+
layout,
|
|
54
|
+
xAxis,
|
|
55
|
+
yAxis,
|
|
56
|
+
xAxisTicks,
|
|
57
|
+
yAxisTicks,
|
|
58
|
+
dataKey,
|
|
59
|
+
bandSize,
|
|
60
|
+
displayedData
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//#endregion
|
|
64
|
+
export { selectLinePoints };
|