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,366 @@
|
|
|
1
|
+
import { isNan, isNullish, isNumOrStr, isNumber } from "./validate.mjs";
|
|
2
|
+
import { formatAngleOfSector, getAngleOfPoint, polarToCartesian, reverseFormatAngleOfSector } from "./polar.mjs";
|
|
3
|
+
import { findEntryInArray, mathSign } from "./data.mjs";
|
|
4
|
+
import { toRaw } from "vue";
|
|
5
|
+
import { stack, stackOffsetExpand, stackOffsetNone, stackOffsetSilhouette, stackOffsetWiggle, stackOrderNone } from "victory-vendor/d3-shape";
|
|
6
|
+
import { get, isNaN, sortBy } from "lodash-es";
|
|
7
|
+
//#region src/utils/chart.ts
|
|
8
|
+
/**
|
|
9
|
+
* Get the ticks of an axis
|
|
10
|
+
* @param {object} axis The configuration of an axis
|
|
11
|
+
* @param {boolean} isGrid Whether or not are the ticks in grid
|
|
12
|
+
* @param {boolean} isAll Return the ticks of all the points or not
|
|
13
|
+
* @return {Array} Ticks
|
|
14
|
+
*/
|
|
15
|
+
function getTicksOfAxis(axis, isGrid, isAll) {
|
|
16
|
+
if (!axis) return null;
|
|
17
|
+
const { duplicateDomain, type, range, scale, realScaleType, isCategorical, categoricalDomain, tickCount, ticks, niceTicks, axisType } = axis;
|
|
18
|
+
if (!scale) return null;
|
|
19
|
+
const offsetForBand = realScaleType === "scaleBand" ? scale.bandwidth() / 2 : 2;
|
|
20
|
+
let offset = (isGrid || isAll) && type === "category" && scale.bandwidth ? scale.bandwidth() / offsetForBand : 0;
|
|
21
|
+
offset = axisType === "angleAxis" && range.length >= 2 ? mathSign(range[0] - range[1]) * 2 * offset : offset;
|
|
22
|
+
if (isGrid && (ticks || niceTicks)) return (ticks || niceTicks).map((entry, index) => {
|
|
23
|
+
return {
|
|
24
|
+
coordinate: scale(duplicateDomain ? duplicateDomain.indexOf(entry) : entry) + offset,
|
|
25
|
+
value: entry,
|
|
26
|
+
offset,
|
|
27
|
+
index
|
|
28
|
+
};
|
|
29
|
+
}).filter((row) => !isNaN(row.coordinate));
|
|
30
|
+
if (isCategorical && categoricalDomain) return categoricalDomain.map((entry, index) => ({
|
|
31
|
+
coordinate: scale(entry) + offset,
|
|
32
|
+
value: entry,
|
|
33
|
+
index,
|
|
34
|
+
offset
|
|
35
|
+
}));
|
|
36
|
+
if (scale.ticks && !isAll) return scale.ticks(tickCount).map((entry, index) => ({
|
|
37
|
+
coordinate: scale(entry) + offset,
|
|
38
|
+
value: entry,
|
|
39
|
+
offset,
|
|
40
|
+
index
|
|
41
|
+
}));
|
|
42
|
+
return scale.domain().map((entry, index) => ({
|
|
43
|
+
coordinate: scale(entry) + offset,
|
|
44
|
+
value: duplicateDomain ? duplicateDomain[entry] : entry,
|
|
45
|
+
index,
|
|
46
|
+
offset
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function getValueByDataKey(obj, dataKey, defaultValue) {
|
|
50
|
+
if (isNullish(obj) || isNullish(dataKey)) return defaultValue;
|
|
51
|
+
if (isNumOrStr(dataKey)) return get(toRaw(obj), dataKey, defaultValue);
|
|
52
|
+
if (typeof dataKey === "function") return dataKey(obj);
|
|
53
|
+
return defaultValue;
|
|
54
|
+
}
|
|
55
|
+
var MIN_VALUE_REG = /^dataMin\s*-\s*(\d+(\.\d+)?)$/;
|
|
56
|
+
var MAX_VALUE_REG = /^dataMax\s*\+\s*(\d+(\.\d+)?)$/;
|
|
57
|
+
/**
|
|
58
|
+
* Calculate the size between two category
|
|
59
|
+
* @param {object} axis The options of axis
|
|
60
|
+
* @param {Array} ticks The ticks of axis
|
|
61
|
+
* @param {boolean} isBar if items in axis are bars
|
|
62
|
+
* @return {number} Size
|
|
63
|
+
*/
|
|
64
|
+
function getBandSizeOfAxis(axis, ticks, isBar) {
|
|
65
|
+
if (axis && axis.scale && axis.scale.bandwidth) {
|
|
66
|
+
const bandWidth = axis.scale.bandwidth();
|
|
67
|
+
if (!isBar || bandWidth > 0) return bandWidth;
|
|
68
|
+
}
|
|
69
|
+
if (axis && ticks && ticks.length >= 2) {
|
|
70
|
+
const orderedTicks = sortBy(ticks, (o) => o.coordinate);
|
|
71
|
+
let bandSize = Infinity;
|
|
72
|
+
for (let i = 1, len = orderedTicks.length; i < len; i++) {
|
|
73
|
+
const cur = orderedTicks[i];
|
|
74
|
+
const prev = orderedTicks[i - 1];
|
|
75
|
+
bandSize = Math.min((cur.coordinate || 0) - (prev.coordinate || 0), bandSize);
|
|
76
|
+
}
|
|
77
|
+
return bandSize === Infinity ? 0 : bandSize;
|
|
78
|
+
}
|
|
79
|
+
return isBar ? void 0 : 0;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Both value and domain are tuples of two numbers
|
|
83
|
+
* - but the type stays as array of numbers until we have better support in rest of the app
|
|
84
|
+
* @param value input that will be truncated
|
|
85
|
+
* @param domain boundaries
|
|
86
|
+
* @returns tuple of two numbers
|
|
87
|
+
*/
|
|
88
|
+
function truncateByDomain(value, domain) {
|
|
89
|
+
if (!domain || domain.length !== 2 || !isNumber(domain[0]) || !isNumber(domain[1])) return value;
|
|
90
|
+
const minValue = Math.min(domain[0], domain[1]);
|
|
91
|
+
const maxValue = Math.max(domain[0], domain[1]);
|
|
92
|
+
const result = [value[0], value[1]];
|
|
93
|
+
if (!isNumber(value[0]) || value[0] < minValue) result[0] = minValue;
|
|
94
|
+
if (!isNumber(value[1]) || value[1] > maxValue) result[1] = maxValue;
|
|
95
|
+
if (result[0] > maxValue) result[0] = maxValue;
|
|
96
|
+
if (result[1] < minValue) result[1] = minValue;
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
function getNormalizedStackId(publicStackId) {
|
|
100
|
+
return publicStackId == null ? void 0 : String(publicStackId);
|
|
101
|
+
}
|
|
102
|
+
function getCateCoordinateOfLine({ axis, ticks, bandSize, entry, index, dataKey }) {
|
|
103
|
+
if (axis.type === "category") {
|
|
104
|
+
if (!axis.allowDuplicatedCategory && axis.dataKey && !isNullish(entry[axis.dataKey])) {
|
|
105
|
+
const matchedTick = findEntryInArray(ticks, "value", entry[axis.dataKey]);
|
|
106
|
+
if (matchedTick) return matchedTick.coordinate + bandSize / 2;
|
|
107
|
+
}
|
|
108
|
+
return ticks[index] ? ticks[index].coordinate + bandSize / 2 : null;
|
|
109
|
+
}
|
|
110
|
+
const value = getValueByDataKey(entry, !isNullish(dataKey) ? dataKey : axis.dataKey);
|
|
111
|
+
return !isNullish(value) ? axis.scale(value) : null;
|
|
112
|
+
}
|
|
113
|
+
function getChartPointer(event) {
|
|
114
|
+
const target = event.currentTarget;
|
|
115
|
+
const rect = target.getBoundingClientRect();
|
|
116
|
+
const scaleX = rect.width / target.offsetWidth;
|
|
117
|
+
const scaleY = rect.height / target.offsetHeight;
|
|
118
|
+
return {
|
|
119
|
+
chartX: Math.round((event.clientX - rect.left) / scaleX),
|
|
120
|
+
chartY: Math.round((event.clientY - rect.top) / scaleY)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function getTooltipEntry({ tooltipEntrySettings, dataKey, payload, value, name }) {
|
|
124
|
+
return {
|
|
125
|
+
...tooltipEntrySettings,
|
|
126
|
+
dataKey,
|
|
127
|
+
payload,
|
|
128
|
+
value,
|
|
129
|
+
name
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
function calculateTooltipPos(rangeObj, layout) {
|
|
133
|
+
if (layout === "horizontal") return rangeObj.x;
|
|
134
|
+
if (layout === "vertical") return rangeObj.y;
|
|
135
|
+
if (layout === "centric") return rangeObj.angle;
|
|
136
|
+
return rangeObj.radius;
|
|
137
|
+
}
|
|
138
|
+
function inRangeOfSector({ x, y }, viewBox) {
|
|
139
|
+
const { radius, angle } = getAngleOfPoint({
|
|
140
|
+
x,
|
|
141
|
+
y
|
|
142
|
+
}, viewBox);
|
|
143
|
+
const { innerRadius, outerRadius } = viewBox;
|
|
144
|
+
if (radius < innerRadius || radius > outerRadius) return null;
|
|
145
|
+
if (radius === 0) return null;
|
|
146
|
+
const { startAngle, endAngle } = formatAngleOfSector(viewBox);
|
|
147
|
+
let formatAngle = angle;
|
|
148
|
+
let inRange;
|
|
149
|
+
if (startAngle <= endAngle) {
|
|
150
|
+
while (formatAngle > endAngle) formatAngle -= 360;
|
|
151
|
+
while (formatAngle < startAngle) formatAngle += 360;
|
|
152
|
+
inRange = formatAngle >= startAngle && formatAngle <= endAngle;
|
|
153
|
+
} else {
|
|
154
|
+
while (formatAngle > startAngle) formatAngle -= 360;
|
|
155
|
+
while (formatAngle < endAngle) formatAngle += 360;
|
|
156
|
+
inRange = formatAngle >= endAngle && formatAngle <= startAngle;
|
|
157
|
+
}
|
|
158
|
+
if (inRange) return {
|
|
159
|
+
...viewBox,
|
|
160
|
+
radius,
|
|
161
|
+
angle: reverseFormatAngleOfSector(formatAngle, viewBox)
|
|
162
|
+
};
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
function inRange(x, y, layout, polarViewBox, offset) {
|
|
166
|
+
if (layout === "horizontal" || layout === "vertical") return x >= offset.left && x <= offset.left + offset.width && y >= offset.top && y <= offset.top + offset.height ? {
|
|
167
|
+
x,
|
|
168
|
+
y
|
|
169
|
+
} : null;
|
|
170
|
+
if (polarViewBox) return inRangeOfSector({
|
|
171
|
+
x,
|
|
172
|
+
y
|
|
173
|
+
}, polarViewBox);
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
function calculateActiveTickIndex(coordinate, ticks, unsortedTicks, axisType, range) {
|
|
177
|
+
let index = -1;
|
|
178
|
+
const len = ticks?.length ?? 0;
|
|
179
|
+
if (len <= 1) return 0;
|
|
180
|
+
if (axisType === "angleAxis" && range != null && Math.abs(Math.abs(range[1] - range[0]) - 360) <= 1e-6) for (let i = 0; i < len; i++) {
|
|
181
|
+
const before = i > 0 ? unsortedTicks[i - 1].coordinate : unsortedTicks[len - 1].coordinate;
|
|
182
|
+
const cur = unsortedTicks[i].coordinate;
|
|
183
|
+
const after = i >= len - 1 ? unsortedTicks[0].coordinate : unsortedTicks[i + 1].coordinate;
|
|
184
|
+
let sameDirectionCoord;
|
|
185
|
+
if (mathSign(cur - before) !== mathSign(after - cur)) {
|
|
186
|
+
const diffInterval = [];
|
|
187
|
+
if (mathSign(after - cur) === mathSign(range[1] - range[0])) {
|
|
188
|
+
sameDirectionCoord = after;
|
|
189
|
+
const curInRange = cur + range[1] - range[0];
|
|
190
|
+
diffInterval[0] = Math.min(curInRange, (curInRange + before) / 2);
|
|
191
|
+
diffInterval[1] = Math.max(curInRange, (curInRange + before) / 2);
|
|
192
|
+
} else {
|
|
193
|
+
sameDirectionCoord = before;
|
|
194
|
+
const afterInRange = after + range[1] - range[0];
|
|
195
|
+
diffInterval[0] = Math.min(cur, (afterInRange + cur) / 2);
|
|
196
|
+
diffInterval[1] = Math.max(cur, (afterInRange + cur) / 2);
|
|
197
|
+
}
|
|
198
|
+
const sameInterval = [Math.min(cur, (sameDirectionCoord + cur) / 2), Math.max(cur, (sameDirectionCoord + cur) / 2)];
|
|
199
|
+
if (coordinate > sameInterval[0] && coordinate <= sameInterval[1] || coordinate >= diffInterval[0] && coordinate <= diffInterval[1]) {
|
|
200
|
+
index = unsortedTicks[i].index;
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
} else {
|
|
204
|
+
const minValue = Math.min(before, after);
|
|
205
|
+
const maxValue = Math.max(before, after);
|
|
206
|
+
if (coordinate > (minValue + cur) / 2 && coordinate <= (maxValue + cur) / 2) {
|
|
207
|
+
index = unsortedTicks[i].index;
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
else for (let i = 0; i < len; i++) if (i === 0 && coordinate <= (ticks[i].coordinate + ticks[i + 1].coordinate) / 2 || i > 0 && i < len - 1 && coordinate > (ticks[i].coordinate + ticks[i - 1].coordinate) / 2 && coordinate <= (ticks[i].coordinate + ticks[i + 1].coordinate) / 2 || i === len - 1 && coordinate > (ticks[i].coordinate + ticks[i - 1].coordinate) / 2) {
|
|
213
|
+
index = ticks[i].index;
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
return index;
|
|
217
|
+
}
|
|
218
|
+
function getActiveCoordinate(layout, tooltipTicks, activeIndex, rangeObj) {
|
|
219
|
+
const entry = tooltipTicks.find((tick) => tick && tick.index === activeIndex);
|
|
220
|
+
if (entry) {
|
|
221
|
+
if (layout === "horizontal") return {
|
|
222
|
+
x: entry.coordinate,
|
|
223
|
+
y: rangeObj.y
|
|
224
|
+
};
|
|
225
|
+
if (layout === "vertical") return {
|
|
226
|
+
x: rangeObj.x,
|
|
227
|
+
y: entry.coordinate
|
|
228
|
+
};
|
|
229
|
+
if (layout === "centric") {
|
|
230
|
+
const angle = entry.coordinate;
|
|
231
|
+
const { radius } = rangeObj;
|
|
232
|
+
return {
|
|
233
|
+
...rangeObj,
|
|
234
|
+
...polarToCartesian(rangeObj.cx, rangeObj.cy, radius, angle),
|
|
235
|
+
angle,
|
|
236
|
+
radius
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const radius = entry.coordinate;
|
|
240
|
+
const { angle } = rangeObj;
|
|
241
|
+
return {
|
|
242
|
+
...rangeObj,
|
|
243
|
+
...polarToCartesian(rangeObj.cx, rangeObj.cy, radius, angle),
|
|
244
|
+
angle,
|
|
245
|
+
radius
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return {
|
|
249
|
+
x: 0,
|
|
250
|
+
y: 0
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function makeDomainFinite(domain) {
|
|
254
|
+
return [domain[0] === Infinity ? 0 : domain[0], domain[1] === -Infinity ? 0 : domain[1]];
|
|
255
|
+
}
|
|
256
|
+
function getDomainOfSingle(data) {
|
|
257
|
+
const flat = data.flat(2).filter(isNumber);
|
|
258
|
+
return [Math.min(...flat), Math.max(...flat)];
|
|
259
|
+
}
|
|
260
|
+
function getDomainOfStackGroups(stackGroups, startIndex, endIndex) {
|
|
261
|
+
if (stackGroups == null) return;
|
|
262
|
+
return makeDomainFinite(Object.keys(stackGroups).reduce((result, stackId) => {
|
|
263
|
+
const { stackedData } = stackGroups[stackId];
|
|
264
|
+
const domain = stackedData.reduce((res, entry) => {
|
|
265
|
+
const s = getDomainOfSingle(entry.slice(startIndex, endIndex + 1));
|
|
266
|
+
return [Math.min(res[0], s[0]), Math.max(res[1], s[1])];
|
|
267
|
+
}, [Infinity, -Infinity]);
|
|
268
|
+
return [Math.min(domain[0], result[0]), Math.max(domain[1], result[1])];
|
|
269
|
+
}, [Infinity, -Infinity]));
|
|
270
|
+
}
|
|
271
|
+
var EPS = 1e-4;
|
|
272
|
+
function checkDomainOfScale(scale) {
|
|
273
|
+
const domain = scale.domain();
|
|
274
|
+
if (!domain || domain.length <= 2) return;
|
|
275
|
+
const len = domain.length;
|
|
276
|
+
const range = scale.range();
|
|
277
|
+
const minValue = Math.min(range[0], range[1]) - EPS;
|
|
278
|
+
const maxValue = Math.max(range[0], range[1]) + EPS;
|
|
279
|
+
const first = scale(domain[0]);
|
|
280
|
+
const last = scale(domain[len - 1]);
|
|
281
|
+
if (first < minValue || first > maxValue || last < minValue || last > maxValue) scale.domain([domain[0], domain[len - 1]]);
|
|
282
|
+
}
|
|
283
|
+
function getTooltipNameProp(nameFromItem, dataKey) {
|
|
284
|
+
if (nameFromItem) return String(nameFromItem);
|
|
285
|
+
if (typeof dataKey === "string") return dataKey;
|
|
286
|
+
}
|
|
287
|
+
function isClipDot(dot) {
|
|
288
|
+
if (dot && typeof dot === "object" && "clipDot" in dot) return Boolean(dot.clipDot);
|
|
289
|
+
return true;
|
|
290
|
+
}
|
|
291
|
+
var offsetSign = (series) => {
|
|
292
|
+
const n = series.length;
|
|
293
|
+
if (n <= 0) return;
|
|
294
|
+
for (let j = 0, m = series[0].length; j < m; ++j) {
|
|
295
|
+
let positive = 0;
|
|
296
|
+
let negative = 0;
|
|
297
|
+
for (let i = 0; i < n; ++i) {
|
|
298
|
+
const value = isNan(series[i][j][1]) ? series[i][j][0] : series[i][j][1];
|
|
299
|
+
if (value >= 0) {
|
|
300
|
+
series[i][j][0] = positive;
|
|
301
|
+
series[i][j][1] = positive + value;
|
|
302
|
+
positive = series[i][j][1];
|
|
303
|
+
} else {
|
|
304
|
+
series[i][j][0] = negative;
|
|
305
|
+
series[i][j][1] = negative + value;
|
|
306
|
+
negative = series[i][j][1];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* Replaces all negative values with zero when stacking data.
|
|
313
|
+
*
|
|
314
|
+
* If all values in the series are positive then this behaves the same as 'none' stacker.
|
|
315
|
+
*
|
|
316
|
+
* @param {Array} series from d3-shape Stack
|
|
317
|
+
* @return {Array} series with applied offset
|
|
318
|
+
*/
|
|
319
|
+
var offsetPositive = (series) => {
|
|
320
|
+
const n = series.length;
|
|
321
|
+
if (n <= 0) return;
|
|
322
|
+
for (let j = 0, m = series[0].length; j < m; ++j) {
|
|
323
|
+
let positive = 0;
|
|
324
|
+
for (let i = 0; i < n; ++i) {
|
|
325
|
+
const value = isNan(series[i][j][1]) ? series[i][j][0] : series[i][j][1];
|
|
326
|
+
if (value >= 0) {
|
|
327
|
+
series[i][j][0] = positive;
|
|
328
|
+
series[i][j][1] = positive + value;
|
|
329
|
+
positive = series[i][j][1];
|
|
330
|
+
} else {
|
|
331
|
+
series[i][j][0] = 0;
|
|
332
|
+
series[i][j][1] = 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
var STACK_OFFSET_MAP = {
|
|
338
|
+
sign: offsetSign,
|
|
339
|
+
expand: stackOffsetExpand,
|
|
340
|
+
none: stackOffsetNone,
|
|
341
|
+
silhouette: stackOffsetSilhouette,
|
|
342
|
+
wiggle: stackOffsetWiggle,
|
|
343
|
+
positive: offsetPositive
|
|
344
|
+
};
|
|
345
|
+
function getStackedData(data, dataKeys, offsetType) {
|
|
346
|
+
const offsetAccessor = STACK_OFFSET_MAP[offsetType];
|
|
347
|
+
return stack().keys(dataKeys).value((d, key) => +getValueByDataKey(d, key, 0)).order(stackOrderNone).offset(offsetAccessor)(data);
|
|
348
|
+
}
|
|
349
|
+
function getBaseValueOfBar({ numericAxis }) {
|
|
350
|
+
const domain = numericAxis.scale.domain();
|
|
351
|
+
if (numericAxis.type === "number") {
|
|
352
|
+
const minValue = Math.min(domain[0], domain[1]);
|
|
353
|
+
const maxValue = Math.max(domain[0], domain[1]);
|
|
354
|
+
if (minValue <= 0 && maxValue >= 0) return 0;
|
|
355
|
+
if (maxValue < 0) return maxValue;
|
|
356
|
+
return minValue;
|
|
357
|
+
}
|
|
358
|
+
return domain[0];
|
|
359
|
+
}
|
|
360
|
+
function getCateCoordinateOfBar({ axis, ticks, offset, bandSize, entry, index }) {
|
|
361
|
+
if (axis.type === "category") return ticks[index] ? ticks[index].coordinate + offset : null;
|
|
362
|
+
const value = getValueByDataKey(entry, axis.dataKey, axis.scale.domain()[index]);
|
|
363
|
+
return !isNullish(value) ? axis.scale(value) - bandSize / 2 + offset : null;
|
|
364
|
+
}
|
|
365
|
+
//#endregion
|
|
366
|
+
export { MAX_VALUE_REG, MIN_VALUE_REG, calculateActiveTickIndex, calculateTooltipPos, checkDomainOfScale, getActiveCoordinate, getBandSizeOfAxis, getBaseValueOfBar, getCateCoordinateOfBar, getCateCoordinateOfLine, getChartPointer, getDomainOfStackGroups, getNormalizedStackId, getStackedData, getTicksOfAxis, getTooltipEntry, getTooltipNameProp, getValueByDataKey, inRange, isClipDot, truncateByDomain };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region src/utils/const.ts
|
|
2
|
+
/**
|
|
3
|
+
* We use this attribute to identify which element is the one that the user is touching.
|
|
4
|
+
* The index is the position of the element in the data array.
|
|
5
|
+
* This can be either a number (for array-based charts) or a string (for the charts that have a matrix-shaped data).
|
|
6
|
+
*/
|
|
7
|
+
var DATA_ITEM_INDEX_ATTRIBUTE_NAME = "data-recharts-item-index";
|
|
8
|
+
/**
|
|
9
|
+
* We use this attribute to identify which element is the one that the user is touching.
|
|
10
|
+
* DataKey works here as a kind of identifier for the element. It's not a perfect identifier for ~two~ three reasons:
|
|
11
|
+
*
|
|
12
|
+
* 1. There can be two different elements with the same dataKey; we won't know which is it
|
|
13
|
+
* 2. DataKey can be a function, and that serialized will be a `[Function: anonymous]` string
|
|
14
|
+
* which means we will be able to identify that it was a function but can't tell which one.
|
|
15
|
+
* This will lead to some weird bugs. A proper fix would be to either:
|
|
16
|
+
* a) use a unique identifier for each element (passed from props, or generated)
|
|
17
|
+
* b) figure out how to compare the dataKey or graphical item by object reference
|
|
18
|
+
*
|
|
19
|
+
* a) is a fuss because we don't have the unique identifier in props,
|
|
20
|
+
* and b) is possible most of the time except for touchMove events which work differently from mouseEnter/mouseLeave:
|
|
21
|
+
* - while mouseEnter is fired for the element that the mouse is over,
|
|
22
|
+
* touchMove is fired for the element where user has started touching. As the finger moves,
|
|
23
|
+
* we can identify the element that the user is touching by using the elementFromPoint method,
|
|
24
|
+
* but it keeps calling the handler on the element where touchStart was fired.
|
|
25
|
+
*
|
|
26
|
+
* Okay and now I discovered a third reason: the dataKey can be undefined and that's still fine
|
|
27
|
+
* because if dataKey is undefined then graphical elements assume the dataKey of the axes.
|
|
28
|
+
* Which makes it a convenient way of using recharts to render a chart but horrible identifier.
|
|
29
|
+
*/
|
|
30
|
+
var DATA_ITEM_DATAKEY_ATTRIBUTE_NAME = "data-recharts-item-data-key";
|
|
31
|
+
//#endregion
|
|
32
|
+
export { DATA_ITEM_DATAKEY_ATTRIBUTE_NAME, DATA_ITEM_INDEX_ATTRIBUTE_NAME };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { inject, provide } from "vue";
|
|
2
|
+
//#region src/utils/createContext.ts
|
|
3
|
+
/**
|
|
4
|
+
* @param providerComponentName - The name(s) of the component(s) providing the context.
|
|
5
|
+
*
|
|
6
|
+
* There are situations where context can come from multiple components. In such cases, you might need to give an array of component names to provide your context, instead of just a single string.
|
|
7
|
+
*
|
|
8
|
+
* @param contextName The description for injection key symbol.
|
|
9
|
+
*/
|
|
10
|
+
function createContext(contextName) {
|
|
11
|
+
const symbolDescription = contextName;
|
|
12
|
+
const injectionKey = Symbol(symbolDescription);
|
|
13
|
+
/**
|
|
14
|
+
* @param fallback The context value to return if the injection fails.
|
|
15
|
+
*
|
|
16
|
+
* @throws When context injection failed and no fallback is specified.
|
|
17
|
+
* This happens when the component injecting the context is not a child of the root component providing the context.
|
|
18
|
+
*/
|
|
19
|
+
const injectContext = (fallback) => {
|
|
20
|
+
const context = inject(injectionKey, fallback);
|
|
21
|
+
if (context === void 0) throw new Error(`Injection \`${injectionKey.toString()}\` not found. Component must be used within ${`\`${contextName}\``}`);
|
|
22
|
+
return context;
|
|
23
|
+
};
|
|
24
|
+
const provideContext = (contextValue) => {
|
|
25
|
+
provide(injectionKey, contextValue);
|
|
26
|
+
return contextValue;
|
|
27
|
+
};
|
|
28
|
+
return [injectContext, provideContext];
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { createContext };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isNumber } from "./validate.mjs";
|
|
2
|
+
//#region src/utils/data-utils.ts
|
|
3
|
+
var idCounter = 0;
|
|
4
|
+
function uniqueId(prefix) {
|
|
5
|
+
const id = ++idCounter;
|
|
6
|
+
return `${prefix || ""}${id}`;
|
|
7
|
+
}
|
|
8
|
+
function interpolate(start, end, t) {
|
|
9
|
+
if (isNumber(start) && isNumber(end)) return start + t * (end - start);
|
|
10
|
+
return end;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { interpolate, uniqueId };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isNan, isNumber, isPercent } from "./validate.mjs";
|
|
2
|
+
import { get } from "lodash-es";
|
|
3
|
+
//#region src/utils/data.ts
|
|
4
|
+
function mathSign(value) {
|
|
5
|
+
if (value === 0) return 0;
|
|
6
|
+
if (value > 0) return 1;
|
|
7
|
+
return -1;
|
|
8
|
+
}
|
|
9
|
+
function hasDuplicate(ary) {
|
|
10
|
+
if (!Array.isArray(ary)) return false;
|
|
11
|
+
const len = ary.length;
|
|
12
|
+
const cache = {};
|
|
13
|
+
for (let i = 0; i < len; i++) if (!cache[ary[i]]) cache[ary[i]] = true;
|
|
14
|
+
else return true;
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Get percent value of a total value
|
|
19
|
+
* @param {number|string} percent A percent
|
|
20
|
+
* @param {number} totalValue Total value
|
|
21
|
+
* @param {number} defaultValue The value returned when percent is undefined or invalid
|
|
22
|
+
* @param {boolean} validate If set to be true, the result will be validated
|
|
23
|
+
* @return {number} value
|
|
24
|
+
*/
|
|
25
|
+
function getPercentValue(percent, totalValue, defaultValue = 0, validate = false) {
|
|
26
|
+
if (!isNumber(percent) && typeof percent !== "string") return defaultValue;
|
|
27
|
+
let value;
|
|
28
|
+
if (isPercent(percent)) {
|
|
29
|
+
const index = percent.indexOf("%");
|
|
30
|
+
value = totalValue * parseFloat(percent.slice(0, index)) / 100;
|
|
31
|
+
} else value = +percent;
|
|
32
|
+
if (isNan(value)) value = defaultValue;
|
|
33
|
+
if (validate && value > totalValue) value = totalValue;
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function findEntryInArray(ary, specifiedKey, specifiedValue) {
|
|
37
|
+
if (!ary || !ary.length) return null;
|
|
38
|
+
return ary.find((entry) => entry && (typeof specifiedKey === "function" ? specifiedKey(entry) : get(entry, specifiedKey)) === specifiedValue);
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { findEntryInArray, getPercentValue, hasDuplicate, mathSign };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import EventEmitter from "eventemitter3";
|
|
2
|
+
//#region src/utils/events.ts
|
|
3
|
+
var eventCenter = new EventEmitter();
|
|
4
|
+
var TOOLTIP_SYNC_EVENT = "recharts.syncEvent.tooltip";
|
|
5
|
+
var BRUSH_SYNC_EVENT = "recharts.syncEvent.brush";
|
|
6
|
+
//#endregion
|
|
7
|
+
export { BRUSH_SYNC_EVENT, TOOLTIP_SYNC_EVENT, eventCenter };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region src/utils/getLinearRegression.ts
|
|
2
|
+
/**
|
|
3
|
+
* The least square linear regression
|
|
4
|
+
* @param data The array of points
|
|
5
|
+
* @returns The domain of x, and the parameter of linear function y = ax + b
|
|
6
|
+
*/
|
|
7
|
+
function getLinearRegression(data) {
|
|
8
|
+
const len = data.length;
|
|
9
|
+
let xsum = 0;
|
|
10
|
+
let ysum = 0;
|
|
11
|
+
let xysum = 0;
|
|
12
|
+
let xxsum = 0;
|
|
13
|
+
let xmin = Infinity;
|
|
14
|
+
let xmax = -Infinity;
|
|
15
|
+
for (let i = 0; i < len; i++) {
|
|
16
|
+
const xcurrent = data[i]?.cx || 0;
|
|
17
|
+
const ycurrent = data[i]?.cy || 0;
|
|
18
|
+
xsum += xcurrent;
|
|
19
|
+
ysum += ycurrent;
|
|
20
|
+
xysum += xcurrent * ycurrent;
|
|
21
|
+
xxsum += xcurrent * xcurrent;
|
|
22
|
+
xmin = Math.min(xmin, xcurrent);
|
|
23
|
+
xmax = Math.max(xmax, xcurrent);
|
|
24
|
+
}
|
|
25
|
+
const a = len * xxsum !== xsum * xsum ? (len * xysum - xsum * ysum) / (len * xxsum - xsum * xsum) : 0;
|
|
26
|
+
return {
|
|
27
|
+
xmin,
|
|
28
|
+
xmax,
|
|
29
|
+
a,
|
|
30
|
+
b: (ysum - a * xsum) / len
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { getLinearRegression };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region src/utils/grid.ts
|
|
2
|
+
/**
|
|
3
|
+
* Calculate the Coordinates of grid
|
|
4
|
+
* @param {Array} ticks The ticks in axis
|
|
5
|
+
* @param {number} minValue The minimum value of axis
|
|
6
|
+
* @param {number} maxValue The maximum value of axis
|
|
7
|
+
* @param {boolean} syncWithTicks Synchronize grid lines with ticks or not
|
|
8
|
+
* @return {Array} Coordinates
|
|
9
|
+
*/
|
|
10
|
+
function getCoordinatesOfGrid(ticks, minValue, maxValue, syncWithTicks) {
|
|
11
|
+
if (syncWithTicks) return ticks.map((entry) => entry.coordinate);
|
|
12
|
+
let hasMin, hasMax;
|
|
13
|
+
const values = ticks.map((entry) => {
|
|
14
|
+
if (entry.coordinate === minValue) hasMin = true;
|
|
15
|
+
if (entry.coordinate === maxValue) hasMax = true;
|
|
16
|
+
return entry.coordinate;
|
|
17
|
+
});
|
|
18
|
+
if (!hasMin) values.push(minValue);
|
|
19
|
+
if (!hasMax) values.push(maxValue);
|
|
20
|
+
return values;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { getCoordinatesOfGrid };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { isNumber, isWellBehavedNumber } from "./validate.mjs";
|
|
2
|
+
import { MAX_VALUE_REG, MIN_VALUE_REG } from "./chart.mjs";
|
|
3
|
+
//#region src/utils/isDomainSpecifiedByUser.ts
|
|
4
|
+
function isWellFormedNumberDomain(v) {
|
|
5
|
+
if (Array.isArray(v) && v.length === 2) {
|
|
6
|
+
const [min, max] = v;
|
|
7
|
+
if (isWellBehavedNumber(min) && isWellBehavedNumber(max)) return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
function extendDomain(providedDomain, boundaryDomain, allowDataOverflow) {
|
|
12
|
+
if (allowDataOverflow) return providedDomain;
|
|
13
|
+
return [Math.min(providedDomain[0], boundaryDomain[0]), Math.max(providedDomain[1], boundaryDomain[1])];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* So Recharts allows users to provide their own domains,
|
|
17
|
+
* but it also places some expectations on what the domain is.
|
|
18
|
+
* We can improve on the typescript typing, but we also need a runtime test
|
|
19
|
+
to observe that the user-provided domain is well-formed,
|
|
20
|
+
* that is: an array with exactly two numbers.
|
|
21
|
+
*
|
|
22
|
+
* This function does not accept data as an argument.
|
|
23
|
+
* This is to enable a performance optimization - if the domain is there,
|
|
24
|
+
* and we know what it is without traversing all the data,
|
|
25
|
+
* then we don't have to traverse all the data!
|
|
26
|
+
*
|
|
27
|
+
* If the user-provided domain is not well-formed,
|
|
28
|
+
* this function will return undefined - in which case we should traverse the data to calculate the real domain.
|
|
29
|
+
*
|
|
30
|
+
* This function is for parsing the numerical domain only.
|
|
31
|
+
*
|
|
32
|
+
* @param userDomain external prop, user provided, before validation. Can have various shapes: array, function, special magical strings inside too.
|
|
33
|
+
* @param allowDataOverflow boolean, provided by users. If true then the data domain wins
|
|
34
|
+
*
|
|
35
|
+
* @return [min, max] domain if it's well-formed; undefined if the domain is invalid
|
|
36
|
+
*/
|
|
37
|
+
function numericalDomainSpecifiedWithoutRequiringData(userDomain, allowDataOverflow) {
|
|
38
|
+
if (!allowDataOverflow) return;
|
|
39
|
+
if (typeof userDomain === "function") return;
|
|
40
|
+
if (Array.isArray(userDomain) && userDomain.length === 2) {
|
|
41
|
+
const [providedMin, providedMax] = userDomain;
|
|
42
|
+
let finalMin, finalMax;
|
|
43
|
+
if (isWellBehavedNumber(providedMin)) finalMin = providedMin;
|
|
44
|
+
else if (typeof providedMin === "function") return;
|
|
45
|
+
if (isWellBehavedNumber(providedMax)) finalMax = providedMax;
|
|
46
|
+
else if (typeof providedMax === "function") return;
|
|
47
|
+
const candidate = [finalMin, finalMax];
|
|
48
|
+
if (isWellFormedNumberDomain(candidate)) return candidate;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* So Recharts allows users to provide their own domains,
|
|
53
|
+
* but it also places some expectations on what the domain is.
|
|
54
|
+
* We can improve on the typescript typing, but we also need a runtime test
|
|
55
|
+
* to observe that the user-provided domain is well-formed,
|
|
56
|
+
* that is: an array with exactly two numbers.
|
|
57
|
+
* If the user-provided domain is not well-formed,
|
|
58
|
+
* this function will return undefined - in which case we should traverse the data to calculate the real domain.
|
|
59
|
+
*
|
|
60
|
+
* This function is for parsing the numerical domain only.
|
|
61
|
+
*
|
|
62
|
+
* You are probably thinking, why does domain need tick count?
|
|
63
|
+
* Well it adjusts the domain based on where the "nice ticks" land, and nice ticks depend on the tick count.
|
|
64
|
+
*
|
|
65
|
+
* @param userDomain external prop, user provided, before validation. Can have various shapes: array, function, special magical strings inside too.
|
|
66
|
+
* @param dataDomain calculated from data. Can be undefined, as an option for performance optimization
|
|
67
|
+
* @param allowDataOverflow provided by users. If true then the data domain wins
|
|
68
|
+
*
|
|
69
|
+
* @return [min, max] domain if it's well-formed; undefined if the domain is invalid
|
|
70
|
+
*/
|
|
71
|
+
function parseNumericalUserDomain(userDomain, dataDomain, allowDataOverflow) {
|
|
72
|
+
if (!allowDataOverflow && dataDomain == null) return;
|
|
73
|
+
if (typeof userDomain === "function" && dataDomain != null) try {
|
|
74
|
+
const result = userDomain(dataDomain, allowDataOverflow);
|
|
75
|
+
if (isWellFormedNumberDomain(result)) return extendDomain(result, dataDomain, allowDataOverflow);
|
|
76
|
+
} catch {}
|
|
77
|
+
if (Array.isArray(userDomain) && userDomain.length === 2) {
|
|
78
|
+
const [providedMin, providedMax] = userDomain;
|
|
79
|
+
let finalMin, finalMax;
|
|
80
|
+
if (providedMin === "auto") {
|
|
81
|
+
if (dataDomain != null) finalMin = Math.min(...dataDomain);
|
|
82
|
+
} else if (isNumber(providedMin)) finalMin = providedMin;
|
|
83
|
+
else if (typeof providedMin === "function") try {
|
|
84
|
+
if (dataDomain != null) finalMin = providedMin(dataDomain?.[0]);
|
|
85
|
+
} catch {}
|
|
86
|
+
else if (typeof providedMin === "string" && MIN_VALUE_REG.test(providedMin)) {
|
|
87
|
+
const match = MIN_VALUE_REG.exec(providedMin);
|
|
88
|
+
if (match == null || dataDomain == null) finalMin = void 0;
|
|
89
|
+
else {
|
|
90
|
+
const value = +match[1];
|
|
91
|
+
finalMin = dataDomain[0] - value;
|
|
92
|
+
}
|
|
93
|
+
} else finalMin = dataDomain?.[0];
|
|
94
|
+
if (providedMax === "auto") {
|
|
95
|
+
if (dataDomain != null) finalMax = Math.max(...dataDomain);
|
|
96
|
+
} else if (isNumber(providedMax)) finalMax = providedMax;
|
|
97
|
+
else if (typeof providedMax === "function") try {
|
|
98
|
+
if (dataDomain != null) finalMax = providedMax(dataDomain?.[1]);
|
|
99
|
+
} catch {}
|
|
100
|
+
else if (typeof providedMax === "string" && MAX_VALUE_REG.test(providedMax)) {
|
|
101
|
+
const match = MAX_VALUE_REG.exec(providedMax);
|
|
102
|
+
if (match == null || dataDomain == null) finalMax = void 0;
|
|
103
|
+
else {
|
|
104
|
+
const value = +match[1];
|
|
105
|
+
finalMax = dataDomain[1] + value;
|
|
106
|
+
}
|
|
107
|
+
} else finalMax = dataDomain?.[1];
|
|
108
|
+
const candidate = [finalMin, finalMax];
|
|
109
|
+
if (isWellFormedNumberDomain(candidate)) {
|
|
110
|
+
if (dataDomain == null) return candidate;
|
|
111
|
+
return extendDomain(candidate, dataDomain, allowDataOverflow);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { isWellFormedNumberDomain, numericalDomainSpecifiedWithoutRequiringData, parseNumericalUserDomain };
|