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,111 @@
|
|
|
1
|
+
import { isNullish, isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { mathSign } from "../../utils/data.mjs";
|
|
3
|
+
import { getBaseValueOfBar, getCateCoordinateOfBar, getValueByDataKey, truncateByDomain } from "../../utils/chart.mjs";
|
|
4
|
+
import { toRaw } from "vue";
|
|
5
|
+
import { isNaN } from "es-toolkit/compat";
|
|
6
|
+
import { invariant } from "es-toolkit";
|
|
7
|
+
//#region src/cartesian/bar/utils.ts
|
|
8
|
+
/**
|
|
9
|
+
* Safely gets minPointSize from the minPointSize prop if it is a function
|
|
10
|
+
* @param minPointSize minPointSize as passed to the Bar component
|
|
11
|
+
* @param defaultValue default minPointSize
|
|
12
|
+
* @returns minPointSize
|
|
13
|
+
*/
|
|
14
|
+
function minPointSizeCallback(minPointSize, defaultValue = 0) {
|
|
15
|
+
return (value, index) => {
|
|
16
|
+
if (isNumber(minPointSize)) return minPointSize;
|
|
17
|
+
const isValueNumberOrNil = isNumber(value) || isNullish(value);
|
|
18
|
+
if (isValueNumberOrNil) return minPointSize(value, index);
|
|
19
|
+
invariant(isValueNumberOrNil, `minPointSize callback function received a value with type of ${typeof value}. Currently only numbers or null/undefined are supported.`);
|
|
20
|
+
return defaultValue;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
var defaultMinPointSize = 0;
|
|
24
|
+
function computeBarRectangles({ layout, barSettings: { dataKey, minPointSize: minPointSizeProp }, pos, bandSize, xAxis, yAxis, xAxisTicks, yAxisTicks, stackedData, displayedData, offset }) {
|
|
25
|
+
const parentViewBox = {
|
|
26
|
+
x: offset.left,
|
|
27
|
+
y: offset.top,
|
|
28
|
+
width: offset.width,
|
|
29
|
+
height: offset.height
|
|
30
|
+
};
|
|
31
|
+
const numericAxis = layout === "horizontal" ? yAxis : xAxis;
|
|
32
|
+
const stackedDomain = stackedData ? numericAxis.scale.domain() : null;
|
|
33
|
+
const baseValue = getBaseValueOfBar({ numericAxis });
|
|
34
|
+
const stackedBarStart = numericAxis.scale(baseValue);
|
|
35
|
+
return displayedData.map((rawEntry, index) => {
|
|
36
|
+
const entry = toRaw(rawEntry);
|
|
37
|
+
let value, x, y, width, height, background;
|
|
38
|
+
if (stackedData) value = truncateByDomain(stackedData[index], stackedDomain);
|
|
39
|
+
else {
|
|
40
|
+
value = getValueByDataKey(entry, dataKey);
|
|
41
|
+
if (!Array.isArray(value)) value = [baseValue, value];
|
|
42
|
+
}
|
|
43
|
+
const minPointSize = minPointSizeCallback(minPointSizeProp, defaultMinPointSize)(value[1], index);
|
|
44
|
+
if (layout === "horizontal") {
|
|
45
|
+
const [baseValueScale, currentValueScale] = [yAxis.scale(value[0]), yAxis.scale(value[1])];
|
|
46
|
+
x = getCateCoordinateOfBar({
|
|
47
|
+
axis: xAxis,
|
|
48
|
+
ticks: xAxisTicks,
|
|
49
|
+
bandSize,
|
|
50
|
+
offset: pos.offset,
|
|
51
|
+
entry,
|
|
52
|
+
index
|
|
53
|
+
});
|
|
54
|
+
y = currentValueScale ?? baseValueScale ?? void 0;
|
|
55
|
+
width = pos.size;
|
|
56
|
+
const computedHeight = baseValueScale - currentValueScale;
|
|
57
|
+
height = isNaN(computedHeight) ? 0 : computedHeight;
|
|
58
|
+
background = {
|
|
59
|
+
x,
|
|
60
|
+
y: offset.top,
|
|
61
|
+
width,
|
|
62
|
+
height: offset.height
|
|
63
|
+
};
|
|
64
|
+
if (Math.abs(minPointSize) > 0 && Math.abs(height) < Math.abs(minPointSize)) {
|
|
65
|
+
const delta = mathSign(height || minPointSize) * (Math.abs(minPointSize) - Math.abs(height));
|
|
66
|
+
y -= delta;
|
|
67
|
+
height += delta;
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
const [baseValueScale, currentValueScale] = [xAxis.scale(value[0]), xAxis.scale(value[1])];
|
|
71
|
+
x = baseValueScale;
|
|
72
|
+
y = getCateCoordinateOfBar({
|
|
73
|
+
axis: yAxis,
|
|
74
|
+
ticks: yAxisTicks,
|
|
75
|
+
bandSize,
|
|
76
|
+
offset: pos.offset,
|
|
77
|
+
entry,
|
|
78
|
+
index
|
|
79
|
+
});
|
|
80
|
+
width = currentValueScale - baseValueScale;
|
|
81
|
+
height = pos.size;
|
|
82
|
+
background = {
|
|
83
|
+
x: offset.left,
|
|
84
|
+
y,
|
|
85
|
+
width: offset.width,
|
|
86
|
+
height
|
|
87
|
+
};
|
|
88
|
+
if (Math.abs(minPointSize) > 0 && Math.abs(width) < Math.abs(minPointSize)) {
|
|
89
|
+
const delta = mathSign(width || minPointSize) * (Math.abs(minPointSize) - Math.abs(width));
|
|
90
|
+
width += delta;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return {
|
|
94
|
+
x,
|
|
95
|
+
y,
|
|
96
|
+
width,
|
|
97
|
+
height,
|
|
98
|
+
stackedBarStart: stackedBarStart ?? 0,
|
|
99
|
+
value: stackedData ? value : value[1],
|
|
100
|
+
payload: entry,
|
|
101
|
+
background,
|
|
102
|
+
tooltipPosition: {
|
|
103
|
+
x: x + width / 2,
|
|
104
|
+
y: y + height / 2
|
|
105
|
+
},
|
|
106
|
+
parentViewBox
|
|
107
|
+
};
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
//#endregion
|
|
111
|
+
export { computeBarRectangles };
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { filterProps } from "../../utils/VueUtils.mjs";
|
|
3
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
4
|
+
import Text_default from "../../components/Text.mjs";
|
|
5
|
+
import { Label } from "../../components/label/Label.mjs";
|
|
6
|
+
import { getTicks } from "../utils/get-ticks.mjs";
|
|
7
|
+
import { createVNode, defineComponent, mergeProps, reactive } from "vue";
|
|
8
|
+
import { get } from "es-toolkit/compat";
|
|
9
|
+
//#region src/cartesian/cartesian-axis/CartesianAxis.tsx
|
|
10
|
+
/**
|
|
11
|
+
* @fileOverview Cartesian Axis
|
|
12
|
+
*/
|
|
13
|
+
/** The orientation of the axis in correspondence to the chart */
|
|
14
|
+
/** A unit to be appended to a value */
|
|
15
|
+
/** The formatter function of tick */
|
|
16
|
+
var CartesianAxis = /* @__PURE__ */ defineComponent({
|
|
17
|
+
name: "CartesianAxis",
|
|
18
|
+
props: {
|
|
19
|
+
x: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: 0
|
|
22
|
+
},
|
|
23
|
+
y: {
|
|
24
|
+
type: Number,
|
|
25
|
+
default: 0
|
|
26
|
+
},
|
|
27
|
+
width: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0
|
|
30
|
+
},
|
|
31
|
+
height: {
|
|
32
|
+
type: Number,
|
|
33
|
+
default: 0
|
|
34
|
+
},
|
|
35
|
+
unit: [String, Number],
|
|
36
|
+
orientation: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "bottom"
|
|
39
|
+
},
|
|
40
|
+
viewBox: {
|
|
41
|
+
type: Object,
|
|
42
|
+
default: () => ({
|
|
43
|
+
x: 0,
|
|
44
|
+
y: 0,
|
|
45
|
+
width: 0,
|
|
46
|
+
height: 0
|
|
47
|
+
})
|
|
48
|
+
},
|
|
49
|
+
tick: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
default: true
|
|
52
|
+
},
|
|
53
|
+
axisLine: {
|
|
54
|
+
type: [Boolean, Object],
|
|
55
|
+
default: () => true
|
|
56
|
+
},
|
|
57
|
+
tickLine: {
|
|
58
|
+
type: [Boolean, Object],
|
|
59
|
+
default: () => true
|
|
60
|
+
},
|
|
61
|
+
mirror: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: false
|
|
64
|
+
},
|
|
65
|
+
tickMargin: {
|
|
66
|
+
type: Number,
|
|
67
|
+
default: 2
|
|
68
|
+
},
|
|
69
|
+
hide: Boolean,
|
|
70
|
+
label: null,
|
|
71
|
+
minTickGap: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: 5
|
|
74
|
+
},
|
|
75
|
+
ticks: {
|
|
76
|
+
type: Array,
|
|
77
|
+
default: () => []
|
|
78
|
+
},
|
|
79
|
+
tickSize: {
|
|
80
|
+
type: Number,
|
|
81
|
+
default: 6
|
|
82
|
+
},
|
|
83
|
+
tickFormatter: Function,
|
|
84
|
+
interval: {
|
|
85
|
+
type: [String, Number],
|
|
86
|
+
default: "preserveEnd"
|
|
87
|
+
},
|
|
88
|
+
angle: Number,
|
|
89
|
+
scale: { type: [Function] },
|
|
90
|
+
stroke: {
|
|
91
|
+
type: String,
|
|
92
|
+
default: "#666"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
inheritAttrs: false,
|
|
96
|
+
setup(props, { attrs, slots }) {
|
|
97
|
+
const state = reactive({
|
|
98
|
+
fontSize: "",
|
|
99
|
+
letterSpacing: ""
|
|
100
|
+
});
|
|
101
|
+
const getTickLineCoord = (data) => {
|
|
102
|
+
const { x, y, width, height, orientation, tickSize, mirror, tickMargin } = props;
|
|
103
|
+
let x1, x2, y1, y2, tx, ty;
|
|
104
|
+
const sign = mirror ? -1 : 1;
|
|
105
|
+
const finalTickSize = data.tickSize || tickSize;
|
|
106
|
+
const tickCoord = isNumber(data.tickCoord) ? data.tickCoord : data.coordinate;
|
|
107
|
+
switch (orientation) {
|
|
108
|
+
case "top":
|
|
109
|
+
x1 = x2 = data.coordinate;
|
|
110
|
+
y2 = y + +!mirror * height;
|
|
111
|
+
y1 = y2 - sign * finalTickSize;
|
|
112
|
+
ty = y1 - sign * tickMargin;
|
|
113
|
+
tx = tickCoord;
|
|
114
|
+
break;
|
|
115
|
+
case "left":
|
|
116
|
+
y1 = y2 = data.coordinate;
|
|
117
|
+
x2 = x + +!mirror * width;
|
|
118
|
+
x1 = x2 - sign * finalTickSize;
|
|
119
|
+
tx = x1 - sign * tickMargin;
|
|
120
|
+
ty = tickCoord;
|
|
121
|
+
break;
|
|
122
|
+
case "right":
|
|
123
|
+
y1 = y2 = data.coordinate;
|
|
124
|
+
x2 = x + +mirror * width;
|
|
125
|
+
x1 = x2 + sign * finalTickSize;
|
|
126
|
+
tx = x1 + sign * tickMargin;
|
|
127
|
+
ty = tickCoord;
|
|
128
|
+
break;
|
|
129
|
+
default:
|
|
130
|
+
x1 = x2 = data.coordinate;
|
|
131
|
+
y2 = y + +mirror * height;
|
|
132
|
+
y1 = y2 + sign * finalTickSize;
|
|
133
|
+
ty = y1 + sign * tickMargin;
|
|
134
|
+
tx = tickCoord;
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
line: {
|
|
139
|
+
x1,
|
|
140
|
+
y1,
|
|
141
|
+
x2,
|
|
142
|
+
y2
|
|
143
|
+
},
|
|
144
|
+
tick: {
|
|
145
|
+
x: tx,
|
|
146
|
+
y: ty
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
const getTickTextAnchor = () => {
|
|
151
|
+
const { orientation, mirror } = props;
|
|
152
|
+
let textAnchor;
|
|
153
|
+
switch (orientation) {
|
|
154
|
+
case "left":
|
|
155
|
+
textAnchor = mirror ? "start" : "end";
|
|
156
|
+
break;
|
|
157
|
+
case "right":
|
|
158
|
+
textAnchor = mirror ? "end" : "start";
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
textAnchor = "middle";
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
return textAnchor;
|
|
165
|
+
};
|
|
166
|
+
const getTickVerticalAnchor = () => {
|
|
167
|
+
const { orientation, mirror } = props;
|
|
168
|
+
switch (orientation) {
|
|
169
|
+
case "left":
|
|
170
|
+
case "right": return "middle";
|
|
171
|
+
case "top": return mirror ? "start" : "end";
|
|
172
|
+
default: return mirror ? "end" : "start";
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
const renderAxisLine = () => {
|
|
176
|
+
const { x, y, width, height, orientation, mirror, axisLine } = props;
|
|
177
|
+
let lineProps = {
|
|
178
|
+
...filterProps(props, false),
|
|
179
|
+
...filterProps(axisLine, false),
|
|
180
|
+
fill: "none",
|
|
181
|
+
x1: 0,
|
|
182
|
+
y1: 0,
|
|
183
|
+
x2: 0,
|
|
184
|
+
y2: 0
|
|
185
|
+
};
|
|
186
|
+
if (orientation === "top" || orientation === "bottom") {
|
|
187
|
+
const needHeight = +(orientation === "top" && !mirror || orientation === "bottom" && mirror);
|
|
188
|
+
lineProps = {
|
|
189
|
+
...lineProps,
|
|
190
|
+
x1: x,
|
|
191
|
+
y1: y + needHeight * height,
|
|
192
|
+
x2: x + width,
|
|
193
|
+
y2: y + needHeight * height
|
|
194
|
+
};
|
|
195
|
+
} else {
|
|
196
|
+
const needWidth = +(orientation === "left" && !mirror || orientation === "right" && mirror);
|
|
197
|
+
lineProps = {
|
|
198
|
+
...lineProps,
|
|
199
|
+
x1: x + needWidth * width,
|
|
200
|
+
y1: y,
|
|
201
|
+
x2: x + needWidth * width,
|
|
202
|
+
y2: y + height
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return createVNode("line", mergeProps(lineProps, { "class": ["v-charts-cartesian-axis-line", get(axisLine, "class")] }), null);
|
|
206
|
+
};
|
|
207
|
+
function renderTickItem(props, value) {
|
|
208
|
+
const className = ["v-charts-cartesian-axis-tick-value", props.class];
|
|
209
|
+
return createVNode(Text_default, mergeProps(props, {
|
|
210
|
+
"class": className,
|
|
211
|
+
"value": value
|
|
212
|
+
}), null);
|
|
213
|
+
}
|
|
214
|
+
const renderTicks = (props, fontSize, letterSpacing) => {
|
|
215
|
+
const { tickLine, stroke, tick, tickFormatter, unit } = props;
|
|
216
|
+
const finalTicks = getTicks(props, fontSize, letterSpacing);
|
|
217
|
+
const textAnchor = getTickTextAnchor();
|
|
218
|
+
const verticalAnchor = getTickVerticalAnchor();
|
|
219
|
+
const axisProps = filterProps(props, false);
|
|
220
|
+
const customTickProps = filterProps(tick, false);
|
|
221
|
+
const tickLineProps = {
|
|
222
|
+
...axisProps,
|
|
223
|
+
fill: "none",
|
|
224
|
+
...filterProps(tickLine, false)
|
|
225
|
+
};
|
|
226
|
+
const items = finalTicks.map((entry, i) => {
|
|
227
|
+
const { line: lineCoord, tick: tickCoord } = getTickLineCoord(entry);
|
|
228
|
+
const tickProps = {
|
|
229
|
+
textAnchor,
|
|
230
|
+
verticalAnchor,
|
|
231
|
+
...axisProps,
|
|
232
|
+
stroke: "none",
|
|
233
|
+
fill: stroke,
|
|
234
|
+
...customTickProps,
|
|
235
|
+
...tickCoord,
|
|
236
|
+
index: i,
|
|
237
|
+
payload: entry,
|
|
238
|
+
visibleTicksCount: finalTicks.length,
|
|
239
|
+
tickFormatter
|
|
240
|
+
};
|
|
241
|
+
return createVNode(Layer, {
|
|
242
|
+
"class": "v-charts-cartesian-axis-tick",
|
|
243
|
+
"key": `tick-${entry.value}-${entry.coordinate}-${entry.tickCoord}`
|
|
244
|
+
}, { default: () => [tickLine && createVNode("line", mergeProps(tickLineProps, lineCoord, { "class": ["v-charts-cartesian-axis-tick-line", get(tickLine, "class")] }), null), tick && (slots.tick ? slots.tick({
|
|
245
|
+
...tickProps,
|
|
246
|
+
value: entry.value
|
|
247
|
+
}) : renderTickItem(tickProps, `${typeof tickFormatter === "function" ? tickFormatter(entry.value, i) : entry.value}${unit || ""}`))] });
|
|
248
|
+
});
|
|
249
|
+
return items.length > 0 ? createVNode("g", { "class": "v-charts-cartesian-axis-ticks" }, [items]) : null;
|
|
250
|
+
};
|
|
251
|
+
const renderLabel = () => {
|
|
252
|
+
const { label, x, y, width, height } = props;
|
|
253
|
+
if (!label) return null;
|
|
254
|
+
const axisViewBox = {
|
|
255
|
+
x,
|
|
256
|
+
y,
|
|
257
|
+
width,
|
|
258
|
+
height
|
|
259
|
+
};
|
|
260
|
+
if (typeof label === "string" || typeof label === "number") return createVNode(Label, {
|
|
261
|
+
"value": label,
|
|
262
|
+
"viewBox": axisViewBox
|
|
263
|
+
}, null);
|
|
264
|
+
if (typeof label === "object") return createVNode(Label, mergeProps(label, { "viewBox": axisViewBox }), null);
|
|
265
|
+
return null;
|
|
266
|
+
};
|
|
267
|
+
return () => {
|
|
268
|
+
const { axisLine, width, height, hide } = props;
|
|
269
|
+
if (hide) return null;
|
|
270
|
+
if (width != null && width <= 0 || height != null && height <= 0) return null;
|
|
271
|
+
return createVNode(Layer, {
|
|
272
|
+
"class": ["v-charts-cartesian-axis", attrs.class],
|
|
273
|
+
"ref": (ref) => {
|
|
274
|
+
const elm = ref?.$el;
|
|
275
|
+
if (elm) {
|
|
276
|
+
const tick = elm?.getElementsByClassName("v-charts-cartesian-axis-tick-value")[0];
|
|
277
|
+
if (tick) {
|
|
278
|
+
const calculatedFontSize = window.getComputedStyle(tick).fontSize;
|
|
279
|
+
const calculatedLetterSpacing = window.getComputedStyle(tick).letterSpacing;
|
|
280
|
+
if (calculatedFontSize !== state.fontSize || calculatedLetterSpacing !== state.letterSpacing) {
|
|
281
|
+
state.fontSize = window.getComputedStyle(tick).fontSize;
|
|
282
|
+
state.letterSpacing = window.getComputedStyle(tick).letterSpacing;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}, { default: () => [
|
|
288
|
+
axisLine && renderAxisLine(),
|
|
289
|
+
renderTicks(props, state.fontSize, state.letterSpacing),
|
|
290
|
+
renderLabel()
|
|
291
|
+
] });
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
//#endregion
|
|
296
|
+
export { CartesianAxis };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { createVNode, defineComponent } from "vue";
|
|
2
|
+
//#region src/cartesian/cartesian-grid/Background.tsx
|
|
3
|
+
var Background = /* @__PURE__ */ defineComponent({
|
|
4
|
+
name: "Background",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
fill: String,
|
|
8
|
+
fillOpacity: Number,
|
|
9
|
+
x: Number,
|
|
10
|
+
y: Number,
|
|
11
|
+
width: Number,
|
|
12
|
+
height: Number,
|
|
13
|
+
ry: Number
|
|
14
|
+
},
|
|
15
|
+
setup(props) {
|
|
16
|
+
return () => {
|
|
17
|
+
if (!props.fill || props.fill === "none") return null;
|
|
18
|
+
return createVNode("rect", {
|
|
19
|
+
"x": props.x,
|
|
20
|
+
"y": props.y,
|
|
21
|
+
"ry": props.ry,
|
|
22
|
+
"width": props.width,
|
|
23
|
+
"height": props.height,
|
|
24
|
+
"stroke": "none",
|
|
25
|
+
"fill": props.fill,
|
|
26
|
+
"fill-opacity": props.fillOpacity,
|
|
27
|
+
"class": "v-charts-cartesian-grid-bg"
|
|
28
|
+
}, null);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
//#endregion
|
|
33
|
+
export { Background as default };
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { isNumber } from "../../utils/validate.mjs";
|
|
2
|
+
import { warn } from "../../utils/log.mjs";
|
|
3
|
+
import { useIsPanorama } from "../../context/PanoramaContextProvider.mjs";
|
|
4
|
+
import { getTicksOfAxis } from "../../utils/chart.mjs";
|
|
5
|
+
import { selectAxisPropsNeededForCartesianGridTicksGenerator } from "../../state/selectors/axisSelectors.mjs";
|
|
6
|
+
import { useAppSelector } from "../../state/hooks.mjs";
|
|
7
|
+
import { useChartHeight, useChartWidth, useOffset } from "../../context/chartLayoutContext.mjs";
|
|
8
|
+
import { CartesianAxisDefaultProps } from "./const.mjs";
|
|
9
|
+
import { getTicks } from "../utils/get-ticks.mjs";
|
|
10
|
+
import { CartesianAxis } from "../cartesian-axis/CartesianAxis.mjs";
|
|
11
|
+
import { resolveDefaultProps } from "../../utils/resolveDefaultProps.mjs";
|
|
12
|
+
import { getCoordinatesOfGrid } from "../../utils/grid.mjs";
|
|
13
|
+
import Background from "./Background.mjs";
|
|
14
|
+
import HorizontalStripes from "./HorizontalStripes.mjs";
|
|
15
|
+
import VerticalStripes from "./VerticalStripes.mjs";
|
|
16
|
+
import HorizontalGridLines from "./HorizontalGridLines.mjs";
|
|
17
|
+
import VerticalGridLines from "./VerticalGridLines.mjs";
|
|
18
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
19
|
+
//#region src/cartesian/cartesian-grid/CartesianGrid.tsx
|
|
20
|
+
var defaultHorizontalCoordinatesGenerator = ({ yAxis, width, height, offset }, syncWithTicks) => getCoordinatesOfGrid(getTicks({
|
|
21
|
+
...CartesianAxisDefaultProps,
|
|
22
|
+
...yAxis,
|
|
23
|
+
ticks: getTicksOfAxis(yAxis, true),
|
|
24
|
+
viewBox: {
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
width,
|
|
28
|
+
height
|
|
29
|
+
}
|
|
30
|
+
}), offset.top, offset.top + offset.height, syncWithTicks);
|
|
31
|
+
var defaultVerticalCoordinatesGenerator = ({ xAxis, width, height, offset }, syncWithTicks) => {
|
|
32
|
+
return getCoordinatesOfGrid(getTicks({
|
|
33
|
+
...CartesianAxis.defaultProps,
|
|
34
|
+
...xAxis,
|
|
35
|
+
ticks: getTicksOfAxis(xAxis, true),
|
|
36
|
+
viewBox: {
|
|
37
|
+
x: 0,
|
|
38
|
+
y: 0,
|
|
39
|
+
width,
|
|
40
|
+
height
|
|
41
|
+
}
|
|
42
|
+
}), offset.left, offset.left + offset.width, syncWithTicks);
|
|
43
|
+
};
|
|
44
|
+
var defaultProps = {
|
|
45
|
+
horizontal: true,
|
|
46
|
+
vertical: true,
|
|
47
|
+
horizontalPoints: [],
|
|
48
|
+
verticalPoints: [],
|
|
49
|
+
stroke: "#ccc",
|
|
50
|
+
fill: "none",
|
|
51
|
+
verticalFill: [],
|
|
52
|
+
horizontalFill: [],
|
|
53
|
+
xAxisId: 0,
|
|
54
|
+
yAxisId: 0
|
|
55
|
+
};
|
|
56
|
+
var CartesianGrid = /* @__PURE__ */ defineComponent({
|
|
57
|
+
name: "CartesianGrid",
|
|
58
|
+
inheritAttrs: false,
|
|
59
|
+
props: {
|
|
60
|
+
xAxisId: {
|
|
61
|
+
type: [String, Number],
|
|
62
|
+
default: 0
|
|
63
|
+
},
|
|
64
|
+
yAxisId: {
|
|
65
|
+
type: [String, Number],
|
|
66
|
+
default: 0
|
|
67
|
+
},
|
|
68
|
+
x: Number,
|
|
69
|
+
y: Number,
|
|
70
|
+
width: Number,
|
|
71
|
+
height: Number,
|
|
72
|
+
syncWithTicks: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
default: void 0
|
|
75
|
+
},
|
|
76
|
+
horizontal: {
|
|
77
|
+
type: [Boolean, Object],
|
|
78
|
+
default: true
|
|
79
|
+
},
|
|
80
|
+
vertical: {
|
|
81
|
+
type: [Boolean, Object],
|
|
82
|
+
default: true
|
|
83
|
+
},
|
|
84
|
+
horizontalPoints: Array,
|
|
85
|
+
verticalPoints: Array,
|
|
86
|
+
horizontalValues: Array,
|
|
87
|
+
verticalValues: Array,
|
|
88
|
+
fill: String,
|
|
89
|
+
fillOpacity: Number,
|
|
90
|
+
ry: Number,
|
|
91
|
+
verticalCoordinatesGenerator: Function,
|
|
92
|
+
horizontalCoordinatesGenerator: Function
|
|
93
|
+
},
|
|
94
|
+
setup(props, { attrs, slots }) {
|
|
95
|
+
const chartWidth = useChartWidth();
|
|
96
|
+
const chartHeight = useChartHeight();
|
|
97
|
+
const offset = useOffset();
|
|
98
|
+
const isPanorama = useIsPanorama();
|
|
99
|
+
const xAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "xAxis", props.xAxisId, isPanorama));
|
|
100
|
+
const yAxis = useAppSelector((state) => selectAxisPropsNeededForCartesianGridTicksGenerator(state, "yAxis", props.yAxisId, isPanorama));
|
|
101
|
+
return () => {
|
|
102
|
+
const propsIncludingDefaults = {
|
|
103
|
+
...resolveDefaultProps({
|
|
104
|
+
...props,
|
|
105
|
+
...attrs
|
|
106
|
+
}, defaultProps),
|
|
107
|
+
x: isNumber(props.x) ? props.x : offset.value.left,
|
|
108
|
+
y: isNumber(props.y) ? props.y : offset.value.top,
|
|
109
|
+
width: isNumber(props.width) ? props.width : offset.value.width,
|
|
110
|
+
height: isNumber(props.height) ? props.height : offset.value.height
|
|
111
|
+
};
|
|
112
|
+
const { x, y, width, height, syncWithTicks, horizontalValues, verticalValues } = propsIncludingDefaults;
|
|
113
|
+
const verticalCoordinatesGenerator = propsIncludingDefaults.verticalCoordinatesGenerator || defaultVerticalCoordinatesGenerator;
|
|
114
|
+
const horizontalCoordinatesGenerator = propsIncludingDefaults.horizontalCoordinatesGenerator || defaultHorizontalCoordinatesGenerator;
|
|
115
|
+
let { horizontalPoints, verticalPoints } = propsIncludingDefaults;
|
|
116
|
+
if ((!horizontalPoints || !horizontalPoints.length) && typeof horizontalCoordinatesGenerator === "function") {
|
|
117
|
+
const isHorizontalValues = horizontalValues && horizontalValues.length;
|
|
118
|
+
const generatorResult = horizontalCoordinatesGenerator({
|
|
119
|
+
yAxis: yAxis.value ? {
|
|
120
|
+
...yAxis.value,
|
|
121
|
+
ticks: isHorizontalValues ? horizontalValues : yAxis.value?.ticks
|
|
122
|
+
} : void 0,
|
|
123
|
+
width: chartWidth.value,
|
|
124
|
+
height: chartHeight.value,
|
|
125
|
+
offset: offset.value
|
|
126
|
+
}, isHorizontalValues ? true : syncWithTicks);
|
|
127
|
+
warn(Array.isArray(generatorResult), `horizontalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
|
|
128
|
+
if (Array.isArray(generatorResult)) horizontalPoints = generatorResult;
|
|
129
|
+
}
|
|
130
|
+
if ((!verticalPoints || !verticalPoints.length) && typeof verticalCoordinatesGenerator === "function") {
|
|
131
|
+
const isVerticalValues = verticalValues && verticalValues.length;
|
|
132
|
+
const generatorResult = verticalCoordinatesGenerator({
|
|
133
|
+
xAxis: xAxis.value ? {
|
|
134
|
+
...xAxis.value,
|
|
135
|
+
ticks: isVerticalValues ? verticalValues : xAxis.value?.ticks
|
|
136
|
+
} : void 0,
|
|
137
|
+
width: chartWidth.value,
|
|
138
|
+
height: chartHeight.value,
|
|
139
|
+
offset: offset.value
|
|
140
|
+
}, isVerticalValues ? true : syncWithTicks);
|
|
141
|
+
warn(Array.isArray(generatorResult), `verticalCoordinatesGenerator should return Array but instead it returned [${typeof generatorResult}]`);
|
|
142
|
+
if (Array.isArray(generatorResult)) verticalPoints = generatorResult;
|
|
143
|
+
}
|
|
144
|
+
if (!isNumber(width) || width <= 0 || !isNumber(height) || height <= 0 || !isNumber(x) || x !== +x || !isNumber(y) || y !== +y) return null;
|
|
145
|
+
return createVNode("g", { "class": "v-charts-cartesian-grid" }, [
|
|
146
|
+
createVNode(Background, {
|
|
147
|
+
"fill": propsIncludingDefaults.fill,
|
|
148
|
+
"fillOpacity": propsIncludingDefaults.fillOpacity,
|
|
149
|
+
"x": propsIncludingDefaults.x,
|
|
150
|
+
"y": propsIncludingDefaults.y,
|
|
151
|
+
"width": propsIncludingDefaults.width,
|
|
152
|
+
"height": propsIncludingDefaults.height,
|
|
153
|
+
"ry": propsIncludingDefaults.ry
|
|
154
|
+
}, null),
|
|
155
|
+
createVNode(HorizontalStripes, mergeProps(propsIncludingDefaults, { "horizontalPoints": horizontalPoints }), null),
|
|
156
|
+
createVNode(VerticalStripes, mergeProps(propsIncludingDefaults, { "verticalPoints": verticalPoints }), null),
|
|
157
|
+
createVNode(HorizontalGridLines, mergeProps(propsIncludingDefaults, {
|
|
158
|
+
"offset": offset.value,
|
|
159
|
+
"horizontalPoints": horizontalPoints,
|
|
160
|
+
"xAxis": xAxis.value,
|
|
161
|
+
"yAxis": yAxis.value
|
|
162
|
+
}), { default: () => [slots.horizontal ? { horizontal: slots.horizontal } : void 0] }),
|
|
163
|
+
createVNode(VerticalGridLines, mergeProps(propsIncludingDefaults, {
|
|
164
|
+
"offset": offset,
|
|
165
|
+
"verticalPoints": verticalPoints,
|
|
166
|
+
"xAxis": xAxis,
|
|
167
|
+
"yAxis": yAxis
|
|
168
|
+
}), { default: () => [slots.vertical ? { vertical: slots.vertical } : void 0] })
|
|
169
|
+
]);
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
//#endregion
|
|
174
|
+
export { CartesianGrid };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { renderLineItem } from "./utils.mjs";
|
|
2
|
+
import { createVNode, defineComponent } from "vue";
|
|
3
|
+
//#region src/cartesian/cartesian-grid/HorizontalGridLines.tsx
|
|
4
|
+
var HorizontalGridLines = /* @__PURE__ */ defineComponent({
|
|
5
|
+
name: "HorizontalGridLines",
|
|
6
|
+
inheritAttrs: false,
|
|
7
|
+
props: {
|
|
8
|
+
x: Number,
|
|
9
|
+
width: Number,
|
|
10
|
+
horizontal: [Boolean, Object],
|
|
11
|
+
horizontalPoints: Array,
|
|
12
|
+
xAxisId: {
|
|
13
|
+
type: [String, Number],
|
|
14
|
+
default: 0
|
|
15
|
+
},
|
|
16
|
+
yAxisId: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: 0
|
|
19
|
+
},
|
|
20
|
+
offset: Object,
|
|
21
|
+
xAxis: Object,
|
|
22
|
+
yAxis: Object
|
|
23
|
+
},
|
|
24
|
+
setup(props, { attrs, slots }) {
|
|
25
|
+
return () => {
|
|
26
|
+
const { x, width, horizontal = true, horizontalPoints } = props;
|
|
27
|
+
if (!horizontal || !horizontalPoints || !horizontalPoints.length) return null;
|
|
28
|
+
const { xAxisId, yAxisId, ...otherLineItemProps } = {
|
|
29
|
+
...props,
|
|
30
|
+
...attrs
|
|
31
|
+
};
|
|
32
|
+
const items = horizontalPoints.map((entry, i) => {
|
|
33
|
+
const lineItemProps = {
|
|
34
|
+
...otherLineItemProps,
|
|
35
|
+
...attrs,
|
|
36
|
+
x1: x,
|
|
37
|
+
y1: entry,
|
|
38
|
+
x2: x + width,
|
|
39
|
+
y2: entry,
|
|
40
|
+
key: `line-${i}`,
|
|
41
|
+
index: i
|
|
42
|
+
};
|
|
43
|
+
return renderLineItem(slots.horizontal, horizontal, lineItemProps);
|
|
44
|
+
});
|
|
45
|
+
return createVNode("g", { "class": "v-charts-cartesian-grid-horizontal" }, [items]);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
//#endregion
|
|
50
|
+
export { HorizontalGridLines as default };
|