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,217 @@
|
|
|
1
|
+
import { interpolate } from "../../utils/data-utils.mjs";
|
|
2
|
+
import { Curve } from "../../shape/Curve.mjs";
|
|
3
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
4
|
+
import { Dot } from "../../shape/Dot.mjs";
|
|
5
|
+
import { LabelList } from "../../components/label/LabelList.mjs";
|
|
6
|
+
import { useLineContext } from "./hooks/useLine.mjs";
|
|
7
|
+
import { Fragment, createVNode, defineComponent, mergeProps, onBeforeUnmount, ref, watch } from "vue";
|
|
8
|
+
import { animate } from "motion-v";
|
|
9
|
+
//#region src/cartesian/line/StaticLine.tsx
|
|
10
|
+
var Dots = /* @__PURE__ */ defineComponent({
|
|
11
|
+
name: "LineDots",
|
|
12
|
+
props: { points: {
|
|
13
|
+
type: Array,
|
|
14
|
+
default: () => []
|
|
15
|
+
} },
|
|
16
|
+
setup(_props) {
|
|
17
|
+
const { clipPathId, clipDot, props, attrs, needClip, dotSlot } = useLineContext();
|
|
18
|
+
return () => {
|
|
19
|
+
const { points } = _props;
|
|
20
|
+
if (!shouldRenderDots(points, props.dot)) return null;
|
|
21
|
+
const dotObjProps = typeof props.dot === "object" && props.dot !== null ? props.dot : {};
|
|
22
|
+
const dotsProps = {
|
|
23
|
+
"fill": "#fff",
|
|
24
|
+
"stroke": props.stroke,
|
|
25
|
+
"stroke-width": props.strokeWidth,
|
|
26
|
+
...dotObjProps
|
|
27
|
+
};
|
|
28
|
+
return createVNode(Layer, {
|
|
29
|
+
"class": "v-charts-line-dots",
|
|
30
|
+
"clip-path": needClip.value ? `url(#clipPath-${clipDot ? "" : "dots-"}${clipPathId.value})` : void 0
|
|
31
|
+
}, { default: () => [points?.map((point, index) => {
|
|
32
|
+
const pointAsLine = point;
|
|
33
|
+
if (dotSlot) return dotSlot({
|
|
34
|
+
...dotsProps,
|
|
35
|
+
...attrs,
|
|
36
|
+
cx: point.x,
|
|
37
|
+
cy: point.y,
|
|
38
|
+
index,
|
|
39
|
+
value: pointAsLine.value,
|
|
40
|
+
payload: pointAsLine.payload
|
|
41
|
+
});
|
|
42
|
+
return createVNode(Dot, mergeProps({ "r": 3 }, dotsProps, attrs, {
|
|
43
|
+
"cx": point.x,
|
|
44
|
+
"cy": point.y,
|
|
45
|
+
"class": "v-charts-line-dot",
|
|
46
|
+
"clipDot": clipDot
|
|
47
|
+
}), null);
|
|
48
|
+
})] });
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var StaticLine = /* @__PURE__ */ defineComponent({
|
|
53
|
+
name: "StaticLine",
|
|
54
|
+
setup() {
|
|
55
|
+
const { points, clipPathId, layout, attrs, lineData, props, isAnimating, needClip, shapeSlot, labelSlot } = useLineContext();
|
|
56
|
+
const currentPoints = ref([]);
|
|
57
|
+
const strokeDashRatio = ref(1);
|
|
58
|
+
let isFirstRender = true;
|
|
59
|
+
let prevPoints = [];
|
|
60
|
+
let animationTarget = [];
|
|
61
|
+
let currentAnimation = null;
|
|
62
|
+
let revealAnimationRunning = false;
|
|
63
|
+
function stopCurrentAnimation() {
|
|
64
|
+
if (currentAnimation) {
|
|
65
|
+
currentAnimation.stop();
|
|
66
|
+
currentAnimation = null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
onBeforeUnmount(() => {
|
|
70
|
+
stopCurrentAnimation();
|
|
71
|
+
});
|
|
72
|
+
watch(points, (newPoints) => {
|
|
73
|
+
if (newPoints && animationTarget.length === newPoints.length && newPoints.every((p, i) => p.x === animationTarget[i].x && p.y === animationTarget[i].y)) return;
|
|
74
|
+
if (newPoints && newPoints.length > 0) {
|
|
75
|
+
if (!props.isAnimationActive) {
|
|
76
|
+
isFirstRender = false;
|
|
77
|
+
stopCurrentAnimation();
|
|
78
|
+
revealAnimationRunning = false;
|
|
79
|
+
isAnimating.value = false;
|
|
80
|
+
currentPoints.value = newPoints;
|
|
81
|
+
prevPoints = newPoints;
|
|
82
|
+
animationTarget = newPoints;
|
|
83
|
+
strokeDashRatio.value = 0;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
if (isFirstRender) {
|
|
87
|
+
isFirstRender = false;
|
|
88
|
+
revealAnimationRunning = true;
|
|
89
|
+
isAnimating.value = true;
|
|
90
|
+
currentPoints.value = newPoints;
|
|
91
|
+
animationTarget = newPoints;
|
|
92
|
+
strokeDashRatio.value = 1;
|
|
93
|
+
stopCurrentAnimation();
|
|
94
|
+
currentAnimation = animate(1, 0, {
|
|
95
|
+
...props.transition,
|
|
96
|
+
onUpdate(v) {
|
|
97
|
+
if (!revealAnimationRunning) return;
|
|
98
|
+
strokeDashRatio.value = v;
|
|
99
|
+
},
|
|
100
|
+
onPlay() {
|
|
101
|
+
props.onAnimationStart?.();
|
|
102
|
+
},
|
|
103
|
+
onComplete() {
|
|
104
|
+
strokeDashRatio.value = 0;
|
|
105
|
+
isAnimating.value = false;
|
|
106
|
+
revealAnimationRunning = false;
|
|
107
|
+
currentAnimation = null;
|
|
108
|
+
prevPoints = currentPoints.value;
|
|
109
|
+
animationTarget = prevPoints;
|
|
110
|
+
props.onAnimationEnd?.();
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
} else if (revealAnimationRunning) {
|
|
114
|
+
currentPoints.value = newPoints;
|
|
115
|
+
animationTarget = newPoints;
|
|
116
|
+
} else {
|
|
117
|
+
isAnimating.value = true;
|
|
118
|
+
strokeDashRatio.value = 0;
|
|
119
|
+
if (currentPoints.value.length) prevPoints = currentPoints.value;
|
|
120
|
+
animationTarget = newPoints;
|
|
121
|
+
stopCurrentAnimation();
|
|
122
|
+
currentAnimation = animate(0, 1, {
|
|
123
|
+
...props.transition,
|
|
124
|
+
onUpdate(t) {
|
|
125
|
+
if (prevPoints.length) {
|
|
126
|
+
const prevPointsDiffFactor = prevPoints.length / newPoints.length;
|
|
127
|
+
currentPoints.value = t === 1 ? newPoints : newPoints.map((entry, index) => {
|
|
128
|
+
const prevPointIndex = Math.floor(index * prevPointsDiffFactor);
|
|
129
|
+
if (prevPoints[prevPointIndex]) {
|
|
130
|
+
const prev = prevPoints[prevPointIndex];
|
|
131
|
+
return {
|
|
132
|
+
...entry,
|
|
133
|
+
x: interpolate(prev.x, entry.x, t),
|
|
134
|
+
y: interpolate(prev.y, entry.y, t)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return entry;
|
|
138
|
+
});
|
|
139
|
+
} else currentPoints.value = newPoints;
|
|
140
|
+
},
|
|
141
|
+
onPlay() {
|
|
142
|
+
props.onAnimationStart?.();
|
|
143
|
+
},
|
|
144
|
+
onComplete() {
|
|
145
|
+
isAnimating.value = false;
|
|
146
|
+
prevPoints = newPoints;
|
|
147
|
+
animationTarget = newPoints;
|
|
148
|
+
currentAnimation = null;
|
|
149
|
+
props.onAnimationEnd?.();
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
} else {
|
|
154
|
+
stopCurrentAnimation();
|
|
155
|
+
revealAnimationRunning = false;
|
|
156
|
+
isAnimating.value = false;
|
|
157
|
+
currentPoints.value = newPoints || [];
|
|
158
|
+
prevPoints = currentPoints.value;
|
|
159
|
+
animationTarget = prevPoints;
|
|
160
|
+
strokeDashRatio.value = 0;
|
|
161
|
+
}
|
|
162
|
+
}, { immediate: true });
|
|
163
|
+
return () => {
|
|
164
|
+
const curveAttrs = {
|
|
165
|
+
...attrs,
|
|
166
|
+
"fill": "none",
|
|
167
|
+
"stroke": props.stroke,
|
|
168
|
+
"stroke-width": props.strokeWidth
|
|
169
|
+
};
|
|
170
|
+
const dashRatio = strokeDashRatio.value;
|
|
171
|
+
const showLabels = !isAnimating.value && (props.label || labelSlot);
|
|
172
|
+
const labelProps = typeof props.label === "object" ? props.label : {};
|
|
173
|
+
let curveContent = null;
|
|
174
|
+
if (currentPoints.value && currentPoints.value.length > 1) if (shapeSlot) curveContent = shapeSlot({
|
|
175
|
+
...curveAttrs,
|
|
176
|
+
points: currentPoints.value,
|
|
177
|
+
connectNulls: props.connectNulls,
|
|
178
|
+
type: props.type,
|
|
179
|
+
layout: layout.value,
|
|
180
|
+
class: "v-charts-line-curve"
|
|
181
|
+
});
|
|
182
|
+
else curveContent = createVNode(Curve, mergeProps(curveAttrs, !(attrs["stroke-dasharray"] != null) && dashRatio > 0 ? {
|
|
183
|
+
"pathLength": 1,
|
|
184
|
+
"stroke-dasharray": 1,
|
|
185
|
+
"stroke-dashoffset": dashRatio
|
|
186
|
+
} : {}, {
|
|
187
|
+
"points": currentPoints.value,
|
|
188
|
+
"connectNulls": props.connectNulls,
|
|
189
|
+
"type": props.type,
|
|
190
|
+
"layout": layout.value,
|
|
191
|
+
"class": "v-charts-line-curve"
|
|
192
|
+
}), null);
|
|
193
|
+
const hasCustomDashArray = attrs["stroke-dasharray"] != null;
|
|
194
|
+
const needClipAnim = (shapeSlot || hasCustomDashArray) && dashRatio > 0 && curveContent;
|
|
195
|
+
return createVNode(Fragment, null, [
|
|
196
|
+
curveContent && createVNode(Layer, { "clip-path": needClip.value ? `url(#clipPath-${clipPathId.value})` : void 0 }, { default: () => [needClipAnim ? createVNode("g", null, [createVNode("defs", null, [createVNode("clipPath", { "id": `line-anim-${clipPathId.value}` }, [createVNode("rect", {
|
|
197
|
+
"x": "0",
|
|
198
|
+
"y": "0",
|
|
199
|
+
"width": `${(1 - dashRatio) * 100}%`,
|
|
200
|
+
"height": "100%"
|
|
201
|
+
}, null)])]), createVNode("g", { "clip-path": `url(#line-anim-${clipPathId.value})` }, [curveContent])]) : curveContent] }),
|
|
202
|
+
createVNode(Dots, { "points": currentPoints.value }, null),
|
|
203
|
+
showLabels && createVNode(LabelList, mergeProps(labelProps, {
|
|
204
|
+
"data": lineData.value ?? [],
|
|
205
|
+
"dataKey": props.dataKey
|
|
206
|
+
}), labelSlot ? { label: labelSlot } : void 0)
|
|
207
|
+
]);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
function shouldRenderDots(points, dot) {
|
|
212
|
+
if (points == null || !points.length) return false;
|
|
213
|
+
if (dot) return true;
|
|
214
|
+
return points.length === 1;
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
export { StaticLine };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { uniqueId } from "../../../utils/data-utils.mjs";
|
|
2
|
+
import { useIsPanorama } from "../../../context/PanoramaContextProvider.mjs";
|
|
3
|
+
import { isClipDot } from "../../../utils/chart.mjs";
|
|
4
|
+
import { useAppSelector } from "../../../state/hooks.mjs";
|
|
5
|
+
import { useChartLayout } from "../../../context/chartLayoutContext.mjs";
|
|
6
|
+
import { useChartName } from "../../../state/selectors/selectors.mjs";
|
|
7
|
+
import { useIsAnimating } from "../../../hooks/useIsAnimating.mjs";
|
|
8
|
+
import { filterProps } from "../../../utils/VueUtils.mjs";
|
|
9
|
+
import { useNeedsClip } from "../../useNeedsClip.mjs";
|
|
10
|
+
import { selectLinePoints } from "../../../state/selectors/lineSelectors.mjs";
|
|
11
|
+
import { computed, inject, provide } from "vue";
|
|
12
|
+
//#region src/cartesian/line/hooks/useLine.ts
|
|
13
|
+
var LineContextKey = Symbol("LineContext");
|
|
14
|
+
function provideLineContext(context) {
|
|
15
|
+
provide(LineContextKey, context);
|
|
16
|
+
}
|
|
17
|
+
function useLineContext() {
|
|
18
|
+
const context = inject(LineContextKey);
|
|
19
|
+
if (!context) throw new Error("useLineContext must be used within Line component");
|
|
20
|
+
return context;
|
|
21
|
+
}
|
|
22
|
+
function useLine(props, attrs = {}, shapeSlot, dotSlot, labelSlot) {
|
|
23
|
+
const layout = useChartLayout();
|
|
24
|
+
const chartName = useChartName();
|
|
25
|
+
const localId = uniqueId("v-charts-line-");
|
|
26
|
+
const clipPathId = computed(() => props.id || localId);
|
|
27
|
+
const isPanorama = useIsPanorama();
|
|
28
|
+
const isAnimating = useIsAnimating(() => props.isAnimationActive);
|
|
29
|
+
const { needClip } = useNeedsClip(props.xAxisId, props.yAxisId);
|
|
30
|
+
const shouldRender = computed(() => (layout.value === "horizontal" || layout.value === "vertical") && (chartName.value === "LineChart" || chartName.value === "ComposedChart") && !props.hide);
|
|
31
|
+
const lineSettings = computed(() => ({
|
|
32
|
+
data: props.data,
|
|
33
|
+
dataKey: props.dataKey
|
|
34
|
+
}));
|
|
35
|
+
const lineData = useAppSelector((state) => selectLinePoints(state, props.xAxisId, props.yAxisId, isPanorama, lineSettings.value));
|
|
36
|
+
const dot = props.dot;
|
|
37
|
+
const clipDot = isClipDot(dot);
|
|
38
|
+
const { r = 3, strokeWidth = 2 } = filterProps(dot, false) ?? {
|
|
39
|
+
r: 3,
|
|
40
|
+
strokeWidth: 2
|
|
41
|
+
};
|
|
42
|
+
const dotSize = r * 2 + strokeWidth;
|
|
43
|
+
const lineContext = {
|
|
44
|
+
clipPathId,
|
|
45
|
+
layout,
|
|
46
|
+
points: computed(() => lineData.value),
|
|
47
|
+
props,
|
|
48
|
+
attrs,
|
|
49
|
+
lineData,
|
|
50
|
+
isAnimating,
|
|
51
|
+
needClip,
|
|
52
|
+
dot,
|
|
53
|
+
clipDot,
|
|
54
|
+
dotSize,
|
|
55
|
+
shapeSlot,
|
|
56
|
+
dotSlot,
|
|
57
|
+
labelSlot
|
|
58
|
+
};
|
|
59
|
+
provideLineContext(lineContext);
|
|
60
|
+
return {
|
|
61
|
+
shouldRender,
|
|
62
|
+
needClip,
|
|
63
|
+
lineData,
|
|
64
|
+
points: lineContext.points,
|
|
65
|
+
clipPathId
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { LineContextKey, provideLineContext, useLine, useLineContext };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { CurveVueProps } from "../../shape/Curve.mjs";
|
|
2
|
+
//#region src/cartesian/line/type.ts
|
|
3
|
+
var LineVueProps = {
|
|
4
|
+
...CurveVueProps,
|
|
5
|
+
activeDot: {
|
|
6
|
+
type: [
|
|
7
|
+
Boolean,
|
|
8
|
+
Object,
|
|
9
|
+
Function
|
|
10
|
+
],
|
|
11
|
+
default: true
|
|
12
|
+
},
|
|
13
|
+
animationDuration: { type: Number },
|
|
14
|
+
animationEasing: { type: String },
|
|
15
|
+
animationBegin: {
|
|
16
|
+
type: Number,
|
|
17
|
+
default: 0
|
|
18
|
+
},
|
|
19
|
+
animationId: { type: String },
|
|
20
|
+
isAnimationActive: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: true
|
|
23
|
+
},
|
|
24
|
+
connectNulls: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: false
|
|
27
|
+
},
|
|
28
|
+
data: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: void 0
|
|
31
|
+
},
|
|
32
|
+
dataKey: {
|
|
33
|
+
type: [
|
|
34
|
+
String,
|
|
35
|
+
Number,
|
|
36
|
+
Function
|
|
37
|
+
],
|
|
38
|
+
required: true
|
|
39
|
+
},
|
|
40
|
+
dot: {
|
|
41
|
+
type: [
|
|
42
|
+
Boolean,
|
|
43
|
+
Object,
|
|
44
|
+
Function
|
|
45
|
+
],
|
|
46
|
+
default: true
|
|
47
|
+
},
|
|
48
|
+
hide: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
label: { type: [Boolean, Object] },
|
|
53
|
+
legendType: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "line"
|
|
56
|
+
},
|
|
57
|
+
onAnimationEnd: { type: Function },
|
|
58
|
+
onAnimationStart: { type: Function },
|
|
59
|
+
stroke: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: "#3182bd"
|
|
62
|
+
},
|
|
63
|
+
strokeWidth: {
|
|
64
|
+
type: Number,
|
|
65
|
+
default: 1
|
|
66
|
+
},
|
|
67
|
+
tooltipType: { type: String },
|
|
68
|
+
transition: {
|
|
69
|
+
type: Object,
|
|
70
|
+
default: () => ({
|
|
71
|
+
duration: .8,
|
|
72
|
+
ease: "easeOut"
|
|
73
|
+
})
|
|
74
|
+
},
|
|
75
|
+
type: { type: [String, Function] },
|
|
76
|
+
unit: { type: [String, Number] },
|
|
77
|
+
xAxisId: {
|
|
78
|
+
type: [String, Number],
|
|
79
|
+
default: 0
|
|
80
|
+
},
|
|
81
|
+
yAxisId: {
|
|
82
|
+
type: [String, Number],
|
|
83
|
+
default: 0
|
|
84
|
+
},
|
|
85
|
+
needClip: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: false
|
|
88
|
+
},
|
|
89
|
+
id: { type: String },
|
|
90
|
+
activeIndex: { type: Number },
|
|
91
|
+
activePoint: { type: Object },
|
|
92
|
+
left: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: 0
|
|
95
|
+
},
|
|
96
|
+
top: {
|
|
97
|
+
type: Number,
|
|
98
|
+
default: 0
|
|
99
|
+
},
|
|
100
|
+
width: {
|
|
101
|
+
type: Number,
|
|
102
|
+
default: 0
|
|
103
|
+
},
|
|
104
|
+
height: {
|
|
105
|
+
type: Number,
|
|
106
|
+
default: 0
|
|
107
|
+
},
|
|
108
|
+
name: { type: [String, Number] },
|
|
109
|
+
class: { type: String }
|
|
110
|
+
};
|
|
111
|
+
//#endregion
|
|
112
|
+
export { LineVueProps };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { getCateCoordinateOfLine, getValueByDataKey } from "../../utils/chart.mjs";
|
|
3
|
+
//#region src/cartesian/line/utils.ts
|
|
4
|
+
function computeLinePoints({ layout, xAxis, yAxis, xAxisTicks, yAxisTicks, dataKey, bandSize, displayedData }) {
|
|
5
|
+
return displayedData.map((entry, index) => {
|
|
6
|
+
const value = getValueByDataKey(entry, dataKey);
|
|
7
|
+
if (layout === "horizontal") return {
|
|
8
|
+
x: getCateCoordinateOfLine({
|
|
9
|
+
axis: xAxis,
|
|
10
|
+
ticks: xAxisTicks,
|
|
11
|
+
bandSize,
|
|
12
|
+
entry,
|
|
13
|
+
index
|
|
14
|
+
}),
|
|
15
|
+
y: isNullish(value) ? null : yAxis.scale(value),
|
|
16
|
+
value,
|
|
17
|
+
payload: entry
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
x: isNullish(value) ? null : xAxis.scale(value),
|
|
21
|
+
y: getCateCoordinateOfLine({
|
|
22
|
+
axis: yAxis,
|
|
23
|
+
ticks: yAxisTicks,
|
|
24
|
+
bandSize,
|
|
25
|
+
entry,
|
|
26
|
+
index
|
|
27
|
+
}),
|
|
28
|
+
value,
|
|
29
|
+
payload: entry
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { computeLinePoints };
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { isNumOrStr, isWellBehavedNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
3
|
+
import { selectAxisScale } from "../../state/selectors/axisSelectors.mjs";
|
|
4
|
+
import { useAppDispatch, useAppSelector } from "../../state/hooks.mjs";
|
|
5
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
6
|
+
import { Label } from "../../components/label/Label.mjs";
|
|
7
|
+
import { Rectangle } from "../../shape/Rectangle.mjs";
|
|
8
|
+
import { addArea, removeArea } from "../../state/referenceElementsSlice.mjs";
|
|
9
|
+
import { useClipPathId } from "../../chart/provideClipPathId.mjs";
|
|
10
|
+
import { computed, createVNode, defineComponent, mergeProps, onMounted, onUnmounted, reactive } from "vue";
|
|
11
|
+
//#region src/cartesian/reference-area/ReferenceArea.tsx
|
|
12
|
+
function scaleValue(scale, value, position) {
|
|
13
|
+
const coord = scale(value);
|
|
14
|
+
if (!isWellBehavedNumber(coord)) return void 0;
|
|
15
|
+
const bandwidth = scale.bandwidth?.() ?? 0;
|
|
16
|
+
return position === "start" ? coord : coord + bandwidth;
|
|
17
|
+
}
|
|
18
|
+
function rangeMin(scale) {
|
|
19
|
+
const r = scale.range();
|
|
20
|
+
return Math.min(r[0], r[1]);
|
|
21
|
+
}
|
|
22
|
+
function rangeMax(scale) {
|
|
23
|
+
const r = scale.range();
|
|
24
|
+
return Math.max(r[0], r[1]);
|
|
25
|
+
}
|
|
26
|
+
var ReferenceArea = /* @__PURE__ */ defineComponent({
|
|
27
|
+
name: "ReferenceArea",
|
|
28
|
+
props: {
|
|
29
|
+
x1: {
|
|
30
|
+
type: [Number, String],
|
|
31
|
+
default: void 0
|
|
32
|
+
},
|
|
33
|
+
x2: {
|
|
34
|
+
type: [Number, String],
|
|
35
|
+
default: void 0
|
|
36
|
+
},
|
|
37
|
+
y1: {
|
|
38
|
+
type: [Number, String],
|
|
39
|
+
default: void 0
|
|
40
|
+
},
|
|
41
|
+
y2: {
|
|
42
|
+
type: [Number, String],
|
|
43
|
+
default: void 0
|
|
44
|
+
},
|
|
45
|
+
xAxisId: {
|
|
46
|
+
type: [Number, String],
|
|
47
|
+
default: 0
|
|
48
|
+
},
|
|
49
|
+
yAxisId: {
|
|
50
|
+
type: [Number, String],
|
|
51
|
+
default: 0
|
|
52
|
+
},
|
|
53
|
+
stroke: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "none"
|
|
56
|
+
},
|
|
57
|
+
strokeWidth: {
|
|
58
|
+
type: [Number, String],
|
|
59
|
+
default: 1
|
|
60
|
+
},
|
|
61
|
+
fill: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "#ccc"
|
|
64
|
+
},
|
|
65
|
+
fillOpacity: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: .5
|
|
68
|
+
},
|
|
69
|
+
label: {
|
|
70
|
+
type: [
|
|
71
|
+
String,
|
|
72
|
+
Number,
|
|
73
|
+
Boolean,
|
|
74
|
+
Object
|
|
75
|
+
],
|
|
76
|
+
default: void 0
|
|
77
|
+
},
|
|
78
|
+
ifOverflow: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: "discard"
|
|
81
|
+
},
|
|
82
|
+
className: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: void 0
|
|
85
|
+
},
|
|
86
|
+
radius: {
|
|
87
|
+
type: [Number, Array],
|
|
88
|
+
default: 0
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
inheritAttrs: false,
|
|
92
|
+
setup(props, { attrs }) {
|
|
93
|
+
const dispatch = useAppDispatch();
|
|
94
|
+
const isPanorama = useIsPanorama();
|
|
95
|
+
const clipPathId = useClipPathId();
|
|
96
|
+
const settings = reactive({
|
|
97
|
+
xAxisId: props.xAxisId,
|
|
98
|
+
yAxisId: props.yAxisId,
|
|
99
|
+
ifOverflow: props.ifOverflow,
|
|
100
|
+
x1: props.x1,
|
|
101
|
+
x2: props.x2,
|
|
102
|
+
y1: props.y1,
|
|
103
|
+
y2: props.y2
|
|
104
|
+
});
|
|
105
|
+
onMounted(() => {
|
|
106
|
+
dispatch(addArea(settings));
|
|
107
|
+
});
|
|
108
|
+
onUnmounted(() => {
|
|
109
|
+
dispatch(removeArea(settings));
|
|
110
|
+
});
|
|
111
|
+
const xAxisScale = useAppSelector((state) => selectAxisScale(state, "xAxis", props.xAxisId, isPanorama));
|
|
112
|
+
const yAxisScale = useAppSelector((state) => selectAxisScale(state, "yAxis", props.yAxisId, isPanorama));
|
|
113
|
+
const rect = computed(() => {
|
|
114
|
+
const xScale = xAxisScale.value;
|
|
115
|
+
const yScale = yAxisScale.value;
|
|
116
|
+
if (!xScale || !yScale) return null;
|
|
117
|
+
const hasX1 = isNumOrStr(props.x1);
|
|
118
|
+
const hasX2 = isNumOrStr(props.x2);
|
|
119
|
+
const hasY1 = isNumOrStr(props.y1);
|
|
120
|
+
const hasY2 = isNumOrStr(props.y2);
|
|
121
|
+
if (!hasX1 && !hasX2 && !hasY1 && !hasY2) return null;
|
|
122
|
+
const px1 = hasX1 ? scaleValue(xScale, props.x1, "start") : rangeMin(xScale);
|
|
123
|
+
const px2 = hasX2 ? scaleValue(xScale, props.x2, "end") : rangeMax(xScale);
|
|
124
|
+
const py1 = hasY1 ? scaleValue(yScale, props.y1, "start") : rangeMin(yScale);
|
|
125
|
+
const py2 = hasY2 ? scaleValue(yScale, props.y2, "end") : rangeMax(yScale);
|
|
126
|
+
if (px1 == null || px2 == null || py1 == null || py2 == null) return null;
|
|
127
|
+
return {
|
|
128
|
+
x: Math.min(px1, px2),
|
|
129
|
+
y: Math.min(py1, py2),
|
|
130
|
+
width: Math.abs(px2 - px1),
|
|
131
|
+
height: Math.abs(py2 - py1)
|
|
132
|
+
};
|
|
133
|
+
});
|
|
134
|
+
return () => {
|
|
135
|
+
const r = rect.value;
|
|
136
|
+
if (!r) return null;
|
|
137
|
+
const clipPath = props.ifOverflow === "hidden" ? `url(#${clipPathId})` : void 0;
|
|
138
|
+
const svgAttrs = {
|
|
139
|
+
...attrs,
|
|
140
|
+
"stroke": props.stroke,
|
|
141
|
+
"stroke-width": props.strokeWidth,
|
|
142
|
+
"fill": props.fill,
|
|
143
|
+
"fill-opacity": props.fillOpacity
|
|
144
|
+
};
|
|
145
|
+
const labelValue = props.label;
|
|
146
|
+
const labelProps = typeof labelValue === "object" && labelValue !== null ? labelValue : {};
|
|
147
|
+
return createVNode(Layer, { "class": ["v-charts-reference-area", props.className] }, { default: () => [createVNode(Rectangle, mergeProps(svgAttrs, {
|
|
148
|
+
"clip-path": clipPath,
|
|
149
|
+
"x": r.x,
|
|
150
|
+
"y": r.y,
|
|
151
|
+
"width": r.width,
|
|
152
|
+
"height": r.height,
|
|
153
|
+
"radius": props.radius,
|
|
154
|
+
"class": "v-charts-reference-area-rect"
|
|
155
|
+
}), null), labelValue != null && labelValue !== false && createVNode(Label, mergeProps({
|
|
156
|
+
"viewBox": r,
|
|
157
|
+
"value": typeof labelValue === "string" || typeof labelValue === "number" ? labelValue : void 0
|
|
158
|
+
}, labelProps), null)] });
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
//#endregion
|
|
163
|
+
export { ReferenceArea };
|