vccs 0.5.0 → 1.0.0-beta.1
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 +25 -0
- package/README.md +133 -112
- package/dist/animation/ActiveDot.d.ts +14 -0
- package/dist/animation/MovingLabels.d.ts +57 -0
- package/dist/animation/SweepClip.d.ts +56 -0
- package/dist/animation/gridTransition.d.ts +38 -0
- package/dist/animation/motion.d.ts +78 -0
- package/dist/animation/ridingLabels.d.ts +29 -0
- package/dist/animation/useAnimationCallbacks.d.ts +5 -0
- package/dist/animation/useKeyedTransition.d.ts +86 -0
- package/dist/animation/usePointTransition.d.ts +40 -0
- package/dist/animation/useReducedMotion.d.ts +2 -0
- package/dist/animation/useTickMotion.d.ts +22 -0
- package/dist/cartesian/ActivePoints.d.ts +71 -0
- package/dist/cartesian/GraphicalItemClipPath.d.ts +27 -2
- package/dist/cartesian/area/Area.d.ts +229 -14
- package/dist/cartesian/area/RenderArea.d.ts +1 -16
- package/dist/cartesian/area/hooks/useArea.d.ts +13 -18
- package/dist/cartesian/area/type.d.ts +32 -81
- package/dist/cartesian/axis/AxisProps.d.ts +101 -0
- package/dist/cartesian/axis/XAxis.d.ts +144 -83
- package/dist/cartesian/axis/YAxis.d.ts +152 -94
- package/dist/cartesian/bar/Bar.d.ts +229 -2
- package/dist/cartesian/bar/components/BarBackground.d.ts +1 -1
- package/dist/cartesian/bar/hooks/useBar.d.ts +31 -15
- package/dist/cartesian/bar/type.d.ts +46 -77
- package/dist/cartesian/brush/Brush.d.ts +150 -2
- package/dist/cartesian/brush/components/BrushText.d.ts +7 -7
- package/dist/cartesian/brush/components/Panorama.d.ts +7 -5
- package/dist/cartesian/brush/components/Slide.d.ts +4 -4
- package/dist/cartesian/brush/components/TravellerLayer.d.ts +21 -13
- package/dist/cartesian/brush/hooks/useBrushHandlers.d.ts +3 -4
- package/dist/cartesian/brush/hooks/useBrushState.d.ts +16 -16
- package/dist/cartesian/brush/type.d.ts +14 -33
- package/dist/cartesian/brush/utils.d.ts +5 -6
- package/dist/cartesian/cartesian-axis/CartesianAxis.d.ts +37 -63
- package/dist/cartesian/cartesian-grid/Background.d.ts +1 -1
- package/dist/cartesian/cartesian-grid/CartesianGrid.d.ts +68 -16
- package/dist/cartesian/cartesian-grid/HorizontalGridLines.d.ts +18 -11
- package/dist/cartesian/cartesian-grid/HorizontalStripes.d.ts +6 -5
- package/dist/cartesian/cartesian-grid/VerticalGridLines.d.ts +17 -10
- package/dist/cartesian/cartesian-grid/VerticalStripes.d.ts +6 -5
- package/dist/cartesian/cartesian-grid/const.d.ts +2 -6
- package/dist/cartesian/cartesian-grid/type.d.ts +21 -30
- package/dist/cartesian/cartesian-grid/utils.d.ts +3 -1
- package/dist/cartesian/cartesianPositionToCSSTranslate.d.ts +15 -0
- package/dist/cartesian/error-bar/ErrorBar.d.ts +11 -30
- package/dist/cartesian/error-bar/ErrorBarContext.d.ts +12 -15
- package/dist/cartesian/funnel/Funnel.d.ts +161 -2
- package/dist/cartesian/funnel/type.d.ts +20 -57
- package/dist/cartesian/getCartesianPosition.d.ts +43 -0
- package/dist/cartesian/line/Line.d.ts +177 -77
- package/dist/cartesian/line/StaticLine.d.ts +0 -15
- package/dist/cartesian/line/hooks/useLine.d.ts +14 -15
- package/dist/cartesian/line/type.d.ts +52 -104
- package/dist/cartesian/reference-area/ReferenceArea.d.ts +42 -90
- package/dist/cartesian/reference-dot/ReferenceDot.d.ts +21 -63
- package/dist/cartesian/reference-line/ReferenceLine.d.ts +35 -67
- package/dist/cartesian/scatter/Scatter.d.ts +72 -53
- package/dist/cartesian/scatter/hooks/useScatter.d.ts +6 -5
- package/dist/cartesian/scatter/type.d.ts +89 -0
- package/dist/cartesian/useNeedsClip.d.ts +3 -2
- package/dist/cartesian/utils/get-ticks.d.ts +5 -6
- package/dist/cartesian/z-axis/ZAxis.d.ts +20 -21
- package/dist/chart/AreaChart.d.ts +231 -1
- package/dist/chart/BarChart.d.ts +231 -1
- package/dist/chart/BarList.d.ts +172 -0
- package/dist/chart/CalendarHeatmap.d.ts +308 -0
- package/dist/chart/CellGridLayer.d.ts +136 -0
- package/dist/chart/ChartShell.d.ts +85 -0
- package/dist/chart/ChartWrapper.d.ts +167 -0
- package/dist/chart/ChartsWrapper.d.ts +75 -87
- package/dist/chart/CohortChart.d.ts +254 -0
- package/dist/chart/ComposedChart.d.ts +231 -1
- package/dist/chart/FunnelChart.d.ts +201 -1
- package/dist/chart/Heatmap.d.ts +687 -0
- package/dist/chart/JourneySankey.d.ts +261 -0
- package/dist/chart/LineChart.d.ts +231 -1
- package/dist/chart/PieChart.d.ts +243 -1
- package/dist/chart/RadarChart.d.ts +243 -1
- package/dist/chart/RadialBarChart.d.ts +273 -1
- package/dist/chart/Sankey.d.ts +85 -157
- package/dist/chart/ScatterChart.d.ts +231 -1
- package/dist/chart/Sparkline.d.ts +257 -0
- package/dist/chart/SunburstChart.d.ts +101 -132
- package/dist/chart/Tracker.d.ts +211 -0
- package/dist/chart/Treemap.d.ts +101 -147
- package/dist/chart/cellGridProps.d.ts +40 -0
- package/dist/chart/cellGridUtils.d.ts +53 -0
- package/dist/chart/chartProps.d.ts +402 -0
- package/dist/chart/chartRoot.d.ts +144 -0
- package/dist/chart/const.d.ts +0 -2
- package/dist/chart/directChartTypes.d.ts +13 -0
- package/dist/chart/journeyTypes.d.ts +99 -0
- package/dist/chart/journeyUtils.d.ts +102 -0
- package/dist/chart/sankeyUtils.d.ts +2 -2
- package/dist/chart/shell.d.ts +14 -0
- package/dist/chart/sunburstUtils.d.ts +7 -3
- package/dist/chart/treemapUtils.d.ts +8 -6
- package/dist/componentNames.d.ts +2 -0
- package/dist/components/Cell.d.ts +1 -1
- package/dist/components/Customized.d.ts +12 -7
- package/dist/components/Text.d.ts +31 -31
- package/dist/components/label/Label.d.ts +14 -26
- package/dist/components/label/LabelList.d.ts +24 -14
- package/dist/components/label/LabelListView.d.ts +23 -0
- package/dist/components/label/LabelView.d.ts +79 -0
- package/dist/components/label/types.d.ts +70 -15
- package/dist/components/label/utils.d.ts +24 -12
- package/dist/components/legend/Legend.d.ts +109 -4
- package/dist/components/legend/LegendSymbol.d.ts +2 -3
- package/dist/components/legend/hooks/useLegend.d.ts +9 -8
- package/dist/components/legend/hooks/useLegendContent.d.ts +7 -14
- package/dist/components/legend/type.d.ts +33 -25
- package/dist/components/legend/utils.d.ts +12 -3
- package/dist/components/tooltip/Cursor.d.ts +19 -0
- package/dist/components/tooltip/DefaultTooltipContent.d.ts +35 -0
- package/dist/components/{Tooltip.d.ts → tooltip/Tooltip.d.ts} +71 -99
- package/dist/components/tooltip/TooltipBoundingBox.d.ts +40 -0
- package/dist/components/tooltip/types.d.ts +59 -0
- package/dist/components/types.d.ts +6 -6
- package/dist/components/utils.d.ts +3 -3
- package/dist/container/ClipPath.d.ts +1 -1
- package/dist/container/Layer.d.ts +1 -1
- package/dist/container/ResponsiveContainer.d.ts +10 -13
- package/dist/container/Surface.d.ts +9 -1
- package/dist/container/useSizeContext.d.ts +4 -10
- package/dist/context/cartesianLabelListContext.d.ts +6 -2
- package/dist/context/polarLabelViewBoxContext.d.ts +1 -1
- package/dist/core/area.d.ts +32 -0
- package/dist/core/axis/data.d.ts +28 -0
- package/dist/core/axis/domain.d.ts +11 -0
- package/dist/core/axis/key.d.ts +7 -0
- package/dist/core/axis/polar.d.ts +11 -0
- package/dist/core/axis/polarSettings.d.ts +5 -0
- package/dist/core/axis/position.d.ts +76 -0
- package/dist/core/axis/range.d.ts +8 -0
- package/dist/core/axis/references.d.ts +6 -0
- package/dist/core/axis/scale.d.ts +21 -0
- package/dist/core/axis/settings.d.ts +4 -0
- package/dist/core/axis/stacks.d.ts +14 -0
- package/dist/core/axis/ticks.d.ts +19 -0
- package/dist/core/axis/userDomain.d.ts +48 -0
- package/dist/core/bar.d.ts +22 -0
- package/dist/core/barSizing.d.ts +43 -0
- package/dist/core/color.d.ts +21 -0
- package/dist/core/coordinates.d.ts +34 -0
- package/dist/core/data.d.ts +2 -0
- package/dist/core/errorBar.d.ts +15 -0
- package/dist/core/funnel.d.ts +17 -0
- package/dist/core/interaction.d.ts +18 -0
- package/dist/core/layout.d.ts +43 -0
- package/dist/core/line.d.ts +14 -0
- package/dist/{state/selectors/pieSelectors.d.ts → core/pie.d.ts} +14 -16
- package/dist/core/polygon.d.ts +5 -0
- package/dist/core/radar.d.ts +20 -0
- package/dist/core/radialBar.d.ts +36 -0
- package/dist/core/rectangle.d.ts +10 -0
- package/dist/core/scatter.d.ts +18 -0
- package/dist/core/tooltip.d.ts +16 -0
- package/dist/es/animation/ActiveDot.mjs +39 -0
- package/dist/es/animation/MovingLabels.mjs +61 -0
- package/dist/es/animation/SweepClip.mjs +40 -0
- package/dist/es/animation/gridTransition.mjs +112 -0
- package/dist/es/animation/motion.mjs +100 -0
- package/dist/es/animation/ridingLabels.mjs +70 -0
- package/dist/es/animation/useAnimationCallbacks.mjs +23 -0
- package/dist/es/animation/useKeyedTransition.mjs +355 -0
- package/dist/es/animation/usePointTransition.mjs +119 -0
- package/dist/es/animation/useReducedMotion.mjs +12 -0
- package/dist/es/animation/useTickMotion.mjs +62 -0
- package/dist/es/cartesian/ActivePoints.mjs +65 -0
- package/dist/es/cartesian/GraphicalItemClipPath.mjs +50 -9
- package/dist/es/cartesian/area/Area.mjs +72 -35
- package/dist/es/cartesian/area/RenderArea.mjs +112 -105
- package/dist/es/cartesian/area/hooks/useArea.mjs +44 -42
- package/dist/es/cartesian/area/type.mjs +14 -46
- package/dist/es/cartesian/axis/AxisProps.mjs +94 -0
- package/dist/es/cartesian/axis/XAxis.mjs +37 -153
- package/dist/es/cartesian/axis/YAxis.mjs +63 -161
- package/dist/es/cartesian/bar/Bar.mjs +122 -53
- package/dist/es/cartesian/bar/components/BarBackground.mjs +1 -1
- package/dist/es/cartesian/bar/components/BarRectangles.mjs +188 -126
- package/dist/es/cartesian/bar/hooks/useBar.mjs +67 -31
- package/dist/es/cartesian/bar/type.mjs +4 -22
- package/dist/es/cartesian/brush/Brush.mjs +294 -0
- package/dist/es/cartesian/brush/components/Background.mjs +25 -0
- package/dist/es/cartesian/brush/components/BrushText.mjs +55 -0
- package/dist/es/cartesian/brush/components/Panorama.mjs +54 -0
- package/dist/es/cartesian/brush/components/Slide.mjs +40 -0
- package/dist/es/cartesian/brush/components/Traveller.mjs +46 -0
- package/dist/es/cartesian/brush/components/TravellerLayer.mjs +68 -0
- package/dist/es/cartesian/brush/hooks/useBrushHandlers.mjs +158 -0
- package/dist/es/cartesian/brush/hooks/useBrushState.mjs +67 -0
- package/dist/es/cartesian/brush/type.mjs +54 -0
- package/dist/es/cartesian/brush/utils.mjs +30 -0
- package/dist/es/cartesian/cartesian-axis/CartesianAxis.mjs +27 -20
- package/dist/es/cartesian/cartesian-grid/CartesianGrid.mjs +157 -72
- package/dist/es/cartesian/cartesian-grid/HorizontalGridLines.mjs +5 -1
- package/dist/es/cartesian/cartesian-grid/VerticalGridLines.mjs +5 -1
- package/dist/es/cartesian/cartesian-grid/const.mjs +3 -320
- package/dist/es/cartesian/cartesian-grid/utils.mjs +1 -1
- package/dist/es/cartesian/cartesianPositionToCSSTranslate.mjs +28 -0
- package/dist/es/cartesian/error-bar/ErrorBar.mjs +65 -102
- package/dist/es/cartesian/error-bar/ErrorBarContext.mjs +21 -5
- package/dist/es/cartesian/funnel/Funnel.mjs +247 -127
- package/dist/es/cartesian/funnel/type.mjs +8 -14
- package/dist/es/cartesian/getCartesianPosition.mjs +176 -0
- package/dist/es/cartesian/line/Line.mjs +72 -25
- package/dist/es/cartesian/line/StaticLine.mjs +129 -166
- package/dist/es/cartesian/line/hooks/useLine.mjs +38 -35
- package/dist/es/cartesian/line/type.mjs +5 -43
- package/dist/es/cartesian/reference-area/ReferenceArea.mjs +108 -88
- package/dist/es/cartesian/reference-dot/ReferenceDot.mjs +87 -67
- package/dist/es/cartesian/reference-line/ReferenceLine.mjs +99 -74
- package/dist/es/cartesian/scatter/Scatter.mjs +188 -190
- package/dist/es/cartesian/scatter/hooks/useScatter.mjs +25 -6
- package/dist/es/cartesian/scatter/type.mjs +79 -0
- package/dist/es/cartesian/useNeedsClip.mjs +6 -14
- package/dist/es/cartesian/utils/get-ticks.mjs +6 -6
- package/dist/es/cartesian/z-axis/ZAxis.mjs +7 -11
- package/dist/es/chart/AreaChart.mjs +12 -4
- package/dist/es/chart/BarChart.mjs +12 -4
- package/dist/es/chart/BarList.mjs +265 -0
- package/dist/es/chart/CalendarHeatmap.mjs +299 -0
- package/dist/es/chart/CellGridLayer.mjs +380 -0
- package/dist/es/chart/ChartShell.mjs +139 -0
- package/dist/es/chart/ChartWrapper.mjs +215 -0
- package/dist/es/chart/ChartsWrapper.mjs +21 -180
- package/dist/es/chart/CohortChart.mjs +169 -0
- package/dist/es/chart/ComposedChart.mjs +14 -4
- package/dist/es/chart/FunnelChart.mjs +11 -5
- package/dist/es/chart/Heatmap.mjs +319 -0
- package/dist/es/chart/JourneySankey.mjs +682 -0
- package/dist/es/chart/LineChart.mjs +13 -4
- package/dist/es/chart/PieChart.mjs +13 -9
- package/dist/es/chart/RadarChart.mjs +13 -9
- package/dist/es/chart/RadialBarChart.mjs +18 -10
- package/dist/es/chart/Sankey.mjs +355 -244
- package/dist/es/chart/ScatterChart.mjs +12 -4
- package/dist/es/chart/Sparkline.mjs +458 -0
- package/dist/es/chart/SunburstChart.mjs +215 -158
- package/dist/es/chart/Tracker.mjs +175 -0
- package/dist/es/chart/Treemap.mjs +357 -300
- package/dist/es/chart/cellGridProps.mjs +42 -0
- package/dist/es/chart/cellGridUtils.mjs +80 -0
- package/dist/es/chart/chartProps.mjs +88 -0
- package/dist/es/chart/chartRoot.mjs +153 -0
- package/dist/es/chart/journeyTypes.mjs +90 -0
- package/dist/es/chart/journeyUtils.mjs +223 -0
- package/dist/es/chart/sankeyUtils.mjs +52 -1
- package/dist/es/chart/shell.mjs +30 -0
- package/dist/es/chart/sunburstUtils.mjs +14 -9
- package/dist/es/chart/treemapUtils.mjs +10 -8
- package/dist/es/componentNames.mjs +84 -0
- package/dist/es/components/Cell.mjs +3 -2
- package/dist/es/components/Customized.mjs +14 -9
- package/dist/es/components/Text.vue_vue_type_script_setup_true_lang.mjs +16 -10
- package/dist/es/components/label/Label.mjs +12 -30
- package/dist/es/components/label/LabelList.mjs +13 -48
- package/dist/es/components/label/LabelListView.mjs +73 -0
- package/dist/es/components/label/LabelView.mjs +45 -0
- package/dist/es/components/label/types.mjs +10 -5
- package/dist/es/components/label/utils.mjs +39 -19
- package/dist/es/components/legend/Legend.mjs +104 -37
- package/dist/es/components/legend/LegendSymbol.mjs +2 -2
- package/dist/es/components/legend/hooks/useLegend.mjs +66 -46
- package/dist/es/components/legend/hooks/useLegendContent.mjs +1 -13
- package/dist/es/components/legend/type.mjs +20 -10
- package/dist/es/components/legend/utils.mjs +20 -5
- package/dist/es/components/tooltip/Cursor.mjs +118 -0
- package/dist/es/components/tooltip/DefaultTooltipContent.mjs +107 -0
- package/dist/es/components/tooltip/Tooltip.mjs +229 -0
- package/dist/es/components/tooltip/TooltipBoundingBox.mjs +187 -0
- package/dist/es/components/utils.mjs +26 -27
- package/dist/es/container/ClipPath.mjs +2 -2
- package/dist/es/container/Layer.mjs +2 -2
- package/dist/es/container/ResponsiveContainer.vue_vue_type_script_setup_true_lang.mjs +20 -115
- package/dist/es/container/Surface.mjs +46 -7
- package/dist/es/container/useSizeContext.mjs +12 -3
- package/dist/es/context/cartesianLabelListContext.mjs +11 -2
- package/dist/es/{cartesian/area/utils.mjs → core/area.mjs} +5 -4
- package/dist/es/core/axis/data.mjs +75 -0
- package/dist/es/core/axis/domain.mjs +63 -0
- package/dist/es/core/axis/key.mjs +13 -0
- package/dist/es/core/axis/polar.mjs +16 -0
- package/dist/es/core/axis/polarSettings.mjs +100 -0
- package/dist/es/core/axis/position.mjs +51 -0
- package/dist/es/core/axis/range.mjs +46 -0
- package/dist/es/core/axis/references.mjs +26 -0
- package/dist/es/core/axis/scale.mjs +148 -0
- package/dist/es/core/axis/settings.mjs +76 -0
- package/dist/es/core/axis/stacks.mjs +97 -0
- package/dist/es/core/axis/ticks.mjs +82 -0
- package/dist/es/{utils/isDomainSpecifiedByUser.mjs → core/axis/userDomain.mjs} +5 -4
- package/dist/es/{cartesian/bar/utils.mjs → core/bar.mjs} +19 -16
- package/dist/es/core/barSizing.mjs +108 -0
- package/dist/es/core/color.mjs +23 -0
- package/dist/es/core/coordinates.mjs +57 -0
- package/dist/es/core/data.mjs +20 -0
- package/dist/es/core/errorBar.mjs +56 -0
- package/dist/es/{cartesian/funnel/utils.mjs → core/funnel.mjs} +31 -11
- package/dist/es/core/interaction.mjs +152 -0
- package/dist/es/core/layout.mjs +91 -0
- package/dist/es/{cartesian/line/utils.mjs → core/line.mjs} +7 -6
- package/dist/es/{state/selectors/pieSelectors.mjs → core/pie.mjs} +37 -65
- package/dist/es/core/polygon.mjs +7 -0
- package/dist/es/core/radar.mjs +58 -0
- package/dist/es/core/radialBar.mjs +92 -0
- package/dist/es/core/rectangle.mjs +25 -0
- package/dist/es/core/scatter.mjs +86 -0
- package/dist/es/core/tooltip.mjs +96 -0
- package/dist/es/events/componentEvents.mjs +58 -0
- package/dist/es/events/delegateItemEvents.mjs +24 -0
- package/dist/es/events/itemEvents.mjs +34 -0
- package/dist/es/events/sync.mjs +141 -0
- package/dist/es/events/useChartCallbacks.mjs +24 -0
- package/dist/es/events/useChartInteractions.mjs +143 -0
- package/dist/es/events/useItemInteractions.mjs +58 -0
- package/dist/es/events/useItemKeyboard.mjs +45 -0
- package/dist/es/events/usePointEvents.mjs +55 -0
- package/dist/es/hooks/deferredView.mjs +19 -0
- package/dist/es/hooks/publicHooks.mjs +36 -35
- package/dist/es/hooks/useActiveTooltipDataPoints.mjs +10 -0
- package/dist/es/hooks/useChartId.mjs +8 -0
- package/dist/es/hooks/useLayerTeleport.mjs +10 -0
- package/dist/es/hooks/useResponsiveSize.mjs +84 -0
- package/dist/es/hooks/useRoundedSize.mjs +28 -0
- package/dist/es/hooks/useSeriesProps.mjs +32 -0
- package/dist/es/hooks/useSetupGraphicalItem.mjs +74 -44
- package/dist/es/hooks/useTrackedData.mjs +17 -0
- package/dist/es/index.mjs +37 -23
- package/dist/es/model/animation.mjs +11 -0
- package/dist/es/model/axis.mjs +85 -0
- package/dist/es/model/axisLayout.mjs +27 -0
- package/dist/es/model/axisScale.mjs +52 -0
- package/dist/es/model/brush.mjs +27 -0
- package/dist/es/model/chart.mjs +122 -0
- package/dist/es/model/dataRange.mjs +54 -0
- package/dist/es/model/defaults.mjs +28 -0
- package/dist/es/model/layout.mjs +33 -0
- package/dist/es/model/legend.mjs +30 -0
- package/dist/es/model/options.mjs +8 -0
- package/dist/es/model/polar.mjs +29 -0
- package/dist/es/model/polarAxis.mjs +48 -0
- package/dist/es/model/presentation.mjs +13 -0
- package/dist/es/model/registries.mjs +38 -0
- package/dist/es/model/registry.mjs +20 -0
- package/dist/es/model/runtime.mjs +156 -0
- package/dist/es/model/tooltip.mjs +385 -0
- package/dist/es/nuxt.mjs +28 -0
- package/dist/es/polar/pie/Pie.mjs +260 -112
- package/dist/es/polar/pie/type.mjs +19 -8
- package/dist/es/polar/radar/PolarAngleAxis.mjs +117 -99
- package/dist/es/polar/radar/PolarGrid.mjs +73 -50
- package/dist/es/polar/radar/PolarRadiusAxis.mjs +124 -100
- package/dist/es/polar/radar/Radar.mjs +272 -219
- package/dist/es/polar/radial-bar/RadialBar.mjs +248 -130
- package/dist/es/polar/radial-bar/type.mjs +6 -7
- package/dist/es/resolver.mjs +19 -0
- package/dist/es/shape/Cross.mjs +2 -1
- package/dist/es/shape/Curve.mjs +7 -5
- package/dist/es/shape/Dot.mjs +9 -5
- package/dist/es/shape/Polygon.mjs +4 -7
- package/dist/es/shape/Rectangle.mjs +17 -10
- package/dist/es/shape/Sector.mjs +8 -5
- package/dist/es/shape/Symbols.mjs +13 -8
- package/dist/es/shape/Trapezoid.mjs +3 -1
- package/dist/es/typed.mjs +9 -0
- package/dist/es/types/base.mjs +6 -0
- package/dist/es/utils/ReduceCSSCalc.mjs +2 -2
- package/dist/es/utils/VueUtils.mjs +89 -3
- package/dist/es/utils/attributes.mjs +18 -0
- package/dist/es/utils/attrs.mjs +38 -26
- package/dist/es/utils/cartesian.mjs +1 -21
- package/dist/es/utils/cell.mjs +13 -1
- package/dist/es/utils/chart.mjs +3 -361
- package/dist/es/utils/const.mjs +2 -25
- package/dist/es/utils/createCategoricalInverse.mjs +2 -2
- package/dist/es/utils/data-utils.mjs +2 -6
- package/dist/es/utils/data.mjs +1 -1
- package/dist/es/utils/env.mjs +10 -0
- package/dist/es/utils/events.mjs +29 -2
- package/dist/es/utils/labelColor.mjs +16 -0
- package/dist/es/utils/log.mjs +23 -5
- package/dist/es/utils/pointer.mjs +13 -0
- package/dist/es/utils/polar.mjs +7 -2
- package/dist/es/utils/scale/getNiceTickValues.mjs +8 -8
- package/dist/es/utils/scale/utils/arithmetic.mjs +0 -15
- package/dist/es/utils/scale/utils/utils.mjs +9 -44
- package/dist/es/utils/style.mjs +1 -1
- package/dist/es/utils/svg.mjs +320 -0
- package/dist/es/utils/theme.mjs +50 -0
- package/dist/es/utils/tick.mjs +4 -3
- package/dist/es/utils/validate.mjs +21 -3
- package/dist/events/componentEvents.d.ts +60 -0
- package/dist/events/delegateItemEvents.d.ts +12 -0
- package/dist/events/itemEvents.d.ts +100 -0
- package/dist/events/sync.d.ts +6 -0
- package/dist/events/useChartCallbacks.d.ts +2 -0
- package/dist/events/useChartInteractions.d.ts +8 -0
- package/dist/events/useItemInteractions.d.ts +7 -0
- package/dist/events/useItemKeyboard.d.ts +24 -0
- package/dist/events/usePointEvents.d.ts +23 -0
- package/dist/hooks/deferredView.d.ts +12 -0
- package/dist/hooks/publicHooks.d.ts +27 -29
- package/dist/hooks/useActiveTooltipDataPoints.d.ts +2 -0
- package/dist/hooks/useChartId.d.ts +2 -0
- package/dist/hooks/useLayerTeleport.d.ts +5 -0
- package/dist/hooks/useResponsiveSize.d.ts +37 -0
- package/dist/hooks/useRoundedSize.d.ts +19 -0
- package/dist/hooks/useSeriesProps.d.ts +7 -0
- package/dist/hooks/useSetupGraphicalItem.d.ts +35 -4
- package/dist/hooks/useTrackedData.d.ts +3 -0
- package/dist/index.d.ts +130 -9
- package/dist/model/animation.d.ts +7 -0
- package/dist/model/axis.d.ts +29 -0
- package/dist/model/axisLayout.d.ts +85 -0
- package/dist/model/axisScale.d.ts +41 -0
- package/dist/model/brush.d.ts +17 -0
- package/dist/model/chart.d.ts +44 -0
- package/dist/model/dataRange.d.ts +19 -0
- package/dist/model/defaults.d.ts +7 -0
- package/dist/model/layout.d.ts +38 -0
- package/dist/model/legend.d.ts +28 -0
- package/dist/model/options.d.ts +30 -0
- package/dist/model/polar.d.ts +24 -0
- package/dist/model/polarAxis.d.ts +39 -0
- package/dist/model/presentation.d.ts +19 -0
- package/dist/model/registries.d.ts +27 -0
- package/dist/model/registry.d.ts +7 -0
- package/dist/model/runtime.d.ts +76 -0
- package/dist/model/tooltip.d.ts +451 -0
- package/dist/nuxt.d.ts +7 -0
- package/dist/polar/pie/Pie.d.ts +252 -2
- package/dist/polar/pie/type.d.ts +37 -25
- package/dist/polar/radar/PolarAngleAxis.d.ts +36 -39
- package/dist/polar/radar/PolarGrid.d.ts +10 -8
- package/dist/polar/radar/PolarRadiusAxis.d.ts +30 -28
- package/dist/polar/radar/Radar.d.ts +82 -53
- package/dist/polar/radial-bar/RadialBar.d.ts +251 -2
- package/dist/polar/radial-bar/type.d.ts +26 -26
- package/dist/publicProps.d.ts +96 -0
- package/dist/resolver.d.ts +9 -0
- package/dist/shape/Cross.d.ts +2 -1
- package/dist/shape/Curve.d.ts +8 -19
- package/dist/shape/Dot.d.ts +10 -6
- package/dist/shape/Polygon.d.ts +2 -1
- package/dist/shape/Rectangle.d.ts +9 -8
- package/dist/shape/Sector.d.ts +7 -6
- package/dist/shape/Symbols.d.ts +3 -3
- package/dist/shape/Trapezoid.d.ts +5 -5
- package/dist/typed.d.ts +92 -0
- package/dist/types/area.d.ts +5 -6
- package/dist/types/axis.d.ts +9 -36
- package/dist/types/axisSettings.d.ts +20 -0
- package/dist/types/bar.d.ts +17 -7
- package/dist/types/base.d.ts +46 -0
- package/dist/types/categorical.d.ts +5 -7
- package/dist/types/chartData.d.ts +21 -0
- package/dist/types/chartLayout.d.ts +7 -0
- package/dist/{state/rootPropsSlice.d.ts → types/chartOptions.d.ts} +4 -5
- package/dist/types/common.d.ts +16 -55
- package/dist/types/event.d.ts +2 -15
- package/dist/types/funnel.d.ts +23 -0
- package/dist/types/graphical.d.ts +77 -0
- package/dist/types/index.d.ts +4 -4
- package/dist/types/legend.d.ts +17 -0
- package/dist/types/line.d.ts +6 -0
- package/dist/types/polarOptions.d.ts +8 -0
- package/dist/types/radar.d.ts +4 -4
- package/dist/types/radialBar.d.ts +15 -0
- package/dist/types/reference.d.ts +22 -0
- package/dist/types/scale.d.ts +13 -2
- package/dist/{shape/types.d.ts → types/shape.d.ts} +6 -4
- package/dist/types/tick.d.ts +18 -7
- package/dist/types/tooltip.d.ts +181 -14
- package/dist/types/typed.d.ts +16 -0
- package/dist/{cartesian/type.d.ts → types/viewBox.d.ts} +8 -2
- package/dist/utils/ReduceCSSCalc.d.ts +0 -1
- package/dist/utils/VueUtils.d.ts +6 -9
- package/dist/utils/attributes.d.ts +56 -0
- package/dist/utils/attrs.d.ts +4 -45
- package/dist/utils/cartesian.d.ts +2 -16
- package/dist/utils/cell.d.ts +7 -2
- package/dist/utils/chart.d.ts +2 -99
- package/dist/utils/const.d.ts +1 -24
- package/dist/utils/createCategoricalInverse.d.ts +2 -6
- package/dist/utils/data-utils.d.ts +0 -1
- package/dist/utils/data.d.ts +1 -2
- package/dist/utils/env.d.ts +5 -0
- package/dist/utils/events.d.ts +14 -7
- package/dist/utils/grid.d.ts +1 -28
- package/dist/utils/index.d.ts +4 -5
- package/dist/utils/isDomainSpecifiedByUser.d.ts +1 -47
- package/dist/utils/labelColor.d.ts +2 -0
- package/dist/utils/log.d.ts +2 -1
- package/dist/utils/pointer.d.ts +2 -0
- package/dist/utils/polar.d.ts +2 -4
- package/dist/utils/scale/getNiceTickValues.d.ts +2 -61
- package/dist/utils/scale/utils/arithmetic.d.ts +3 -31
- package/dist/utils/scale/utils/utils.d.ts +2 -9
- package/dist/utils/scale.d.ts +1 -1
- package/dist/utils/style.d.ts +2 -1
- package/dist/utils/svg.d.ts +4 -0
- package/dist/utils/theme.d.ts +4 -0
- package/dist/utils/tick.d.ts +3 -3
- package/dist/utils/tooltip/translate.d.ts +9 -25
- package/dist/utils/validate.d.ts +12 -4
- package/package.json +46 -29
- package/dist/animation/Animate.d.ts +0 -72
- package/dist/cartesian/area/ActivePoints.d.ts +0 -77
- package/dist/cartesian/area/ClipRect.d.ts +0 -1
- package/dist/cartesian/area/__stories__/config.d.ts +0 -31
- package/dist/cartesian/area/index.d.ts +0 -2
- package/dist/cartesian/area/utils.d.ts +0 -19
- package/dist/cartesian/axis/index.d.ts +0 -2
- package/dist/cartesian/axis/type.d.ts +0 -57
- package/dist/cartesian/bar/index.d.ts +0 -1
- package/dist/cartesian/bar/utils.d.ts +0 -31
- package/dist/cartesian/brush/hooks/useBrushSetting.d.ts +0 -6
- package/dist/cartesian/brush/index.d.ts +0 -2
- package/dist/cartesian/cartesian-axis/const.d.ts +0 -24
- package/dist/cartesian/cartesian-axis/index.d.ts +0 -1
- package/dist/cartesian/cartesian-axis/use-axis-line.d.ts +0 -7
- package/dist/cartesian/cartesian-grid/index.d.ts +0 -1
- package/dist/cartesian/error-bar/index.d.ts +0 -2
- package/dist/cartesian/funnel/index.d.ts +0 -2
- package/dist/cartesian/funnel/utils.d.ts +0 -12
- package/dist/cartesian/index.d.ts +0 -13
- package/dist/cartesian/line/ActivePoints.d.ts +0 -77
- package/dist/cartesian/line/index.d.ts +0 -3
- package/dist/cartesian/line/utils.d.ts +0 -13
- package/dist/cartesian/reference-area/index.d.ts +0 -1
- package/dist/cartesian/reference-dot/index.d.ts +0 -2
- package/dist/cartesian/reference-line/index.d.ts +0 -1
- package/dist/cartesian/scatter/index.d.ts +0 -1
- package/dist/cartesian/z-axis/index.d.ts +0 -1
- package/dist/chart/LegendPortalContext.d.ts +0 -3
- package/dist/chart/Surface.d.ts +0 -41
- package/dist/chart/TooltipPortalContext.d.ts +0 -2
- package/dist/chart/generateCategoricalChart.d.ts +0 -123
- package/dist/chart/index.d.ts +0 -12
- package/dist/chart/provideClipPathId.d.ts +0 -12
- package/dist/components/DefaultLegendContent.d.ts +0 -18
- package/dist/components/index.d.ts +0 -6
- package/dist/components/label/index.d.ts +0 -2
- package/dist/components/legend/index.d.ts +0 -2
- package/dist/container/RootSurface.d.ts +0 -17
- package/dist/container/index.d.ts +0 -1
- package/dist/context/ChartDataContextProvider.d.ts +0 -17
- package/dist/context/PanoramaContextProvider.d.ts +0 -22
- package/dist/context/accessibilityContext.d.ts +0 -1
- package/dist/context/chartLayoutContext.d.ts +0 -8
- package/dist/context/cursorLayerContext.d.ts +0 -2
- package/dist/context/graphicalLayerContext.d.ts +0 -2
- package/dist/context/labelLayerContext.d.ts +0 -2
- package/dist/context/useTooltipAxis.d.ts +0 -2
- package/dist/es/animation/Animate.mjs +0 -89
- package/dist/es/cartesian/area/ActivePoints.mjs +0 -78
- package/dist/es/cartesian/area/ClipRect.mjs +0 -125
- package/dist/es/cartesian/line/ActivePoints.mjs +0 -79
- package/dist/es/chart/LegendPortalContext.mjs +0 -5
- package/dist/es/chart/Surface.mjs +0 -5
- package/dist/es/chart/Surface.vue_vue_type_script_setup_true_lang.mjs +0 -78
- package/dist/es/chart/TooltipPortalContext.mjs +0 -5
- package/dist/es/chart/generateCategoricalChart.mjs +0 -205
- package/dist/es/chart/provideClipPathId.mjs +0 -15
- package/dist/es/components/Tooltip.mjs +0 -479
- package/dist/es/context/ChartDataContextProvider.mjs +0 -27
- package/dist/es/context/PanoramaContextProvider.mjs +0 -24
- package/dist/es/context/accessibilityContext.mjs +0 -5
- package/dist/es/context/chartLayoutContext.mjs +0 -49
- package/dist/es/context/cursorLayerContext.mjs +0 -5
- package/dist/es/context/graphicalLayerContext.mjs +0 -5
- package/dist/es/context/labelLayerContext.mjs +0 -5
- package/dist/es/context/useTooltipAxis.mjs +0 -17
- package/dist/es/events/useChartSynchronisation.mjs +0 -113
- package/dist/es/hooks/useIsAnimating.mjs +0 -28
- package/dist/es/state/ReportChartProps.mjs +0 -62
- package/dist/es/state/ReportMainChartProps.mjs +0 -46
- package/dist/es/state/ReportPolarOptions.mjs +0 -56
- package/dist/es/state/SetGraphicalItem.mjs +0 -49
- package/dist/es/state/SetLegendPayload.mjs +0 -20
- package/dist/es/state/SetTooltipEntrySettings.mjs +0 -19
- package/dist/es/state/brushSlice.mjs +0 -26
- package/dist/es/state/cartesianAxisSlice.mjs +0 -50
- package/dist/es/state/chartDataSlice.mjs +0 -33
- package/dist/es/state/externalEventsMiddleware.mjs +0 -30
- package/dist/es/state/graphicalItemsSlice.mjs +0 -47
- package/dist/es/state/hooks.mjs +0 -26
- package/dist/es/state/keyboardEventsMiddleware.mjs +0 -63
- package/dist/es/state/layoutSlice.mjs +0 -39
- package/dist/es/state/legendSlice.mjs +0 -40
- package/dist/es/state/mouseEventsMiddleware.mjs +0 -41
- package/dist/es/state/optionsSlice.mjs +0 -25
- package/dist/es/state/polarAxisSlice.mjs +0 -28
- package/dist/es/state/polarOptionsSlice.mjs +0 -13
- package/dist/es/state/reduxDevtoolsJsonStringifyReplacer.mjs +0 -8
- package/dist/es/state/referenceElementsSlice.mjs +0 -36
- package/dist/es/state/rootPropsSlice.mjs +0 -32
- package/dist/es/state/selectors/areaSelectors.mjs +0 -77
- package/dist/es/state/selectors/axisSelectors.mjs +0 -908
- package/dist/es/state/selectors/barSelectors.mjs +0 -241
- package/dist/es/state/selectors/brushSelectors.mjs +0 -18
- package/dist/es/state/selectors/combiners/combineActiveLabel.mjs +0 -9
- package/dist/es/state/selectors/combiners/combineActiveTooltipIndex.mjs +0 -43
- package/dist/es/state/selectors/combiners/combineAxisRangeWithReverse.mjs +0 -8
- package/dist/es/state/selectors/combiners/combineCoordinateForDefaultIndex.mjs +0 -21
- package/dist/es/state/selectors/combiners/combineTooltipInteractionState.mjs +0 -37
- package/dist/es/state/selectors/combiners/combineTooltipPayloadConfigurations.mjs +0 -13
- package/dist/es/state/selectors/common.mjs +0 -4
- package/dist/es/state/selectors/containerSelectors.mjs +0 -7
- package/dist/es/state/selectors/dataSelectors.mjs +0 -35
- package/dist/es/state/selectors/funnelSelectors.mjs +0 -38
- package/dist/es/state/selectors/legendSelectors.mjs +0 -10
- package/dist/es/state/selectors/lineSelectors.mjs +0 -64
- package/dist/es/state/selectors/pickAxisId.mjs +0 -4
- package/dist/es/state/selectors/pickAxisType.mjs +0 -4
- package/dist/es/state/selectors/polarAxisSelectors.mjs +0 -167
- package/dist/es/state/selectors/polarGridSelectors.mjs +0 -19
- package/dist/es/state/selectors/polarScaleSelectors.mjs +0 -55
- package/dist/es/state/selectors/polarSelectors.mjs +0 -81
- package/dist/es/state/selectors/radarSelectors.mjs +0 -133
- package/dist/es/state/selectors/radialBarSelectors.mjs +0 -259
- package/dist/es/state/selectors/rootPropsSelectors.mjs +0 -14
- package/dist/es/state/selectors/scatterSelectors.mjs +0 -134
- package/dist/es/state/selectors/selectActivePropsFromChartPointer.mjs +0 -20
- package/dist/es/state/selectors/selectAllAxes.mjs +0 -10
- package/dist/es/state/selectors/selectChartOffset.mjs +0 -72
- package/dist/es/state/selectors/selectChartOffsetInternal.mjs +0 -66
- package/dist/es/state/selectors/selectTooltipEventType.mjs +0 -22
- package/dist/es/state/selectors/selectTooltipPayloadSearcher.mjs +0 -6
- package/dist/es/state/selectors/selectTooltipSettings.mjs +0 -4
- package/dist/es/state/selectors/selectTooltipState.mjs +0 -4
- package/dist/es/state/selectors/selectors.mjs +0 -104
- package/dist/es/state/selectors/tooltipSelectors.mjs +0 -269
- package/dist/es/state/selectors/touchSelectors.mjs +0 -19
- package/dist/es/state/store.mjs +0 -55
- package/dist/es/state/tooltipSlice.mjs +0 -102
- package/dist/es/state/touchEventsMiddleware.mjs +0 -44
- package/dist/es/state/utils/useReportScale.mjs +0 -19
- package/dist/es/synchronisation/syncSelectors.mjs +0 -6
- package/dist/es/synchronisation/useChartSynchronisation.mjs +0 -38
- package/dist/es/utils/Global.mjs +0 -18
- package/dist/es/utils/createContext.mjs +0 -31
- package/dist/es/utils/legend.mjs +0 -19
- package/dist/es/utils/props.mjs +0 -20
- package/dist/es/utils/resolveDefaultProps.mjs +0 -26
- package/dist/events/useChartSynchronisation.d.ts +0 -8
- package/dist/hooks/useIsAnimating.d.ts +0 -14
- package/dist/polar/index.d.ts +0 -3
- package/dist/polar/pie/index.d.ts +0 -2
- package/dist/polar/radar/index.d.ts +0 -4
- package/dist/polar/radial-bar/index.d.ts +0 -2
- package/dist/shape/index.d.ts +0 -10
- package/dist/state/ReportBar.d.ts +0 -1
- package/dist/state/ReportChartProps.d.ts +0 -88
- package/dist/state/ReportMainChartProps.d.ts +0 -37
- package/dist/state/ReportPolarOptions.d.ts +0 -59
- package/dist/state/SetGraphicalItem.d.ts +0 -9
- package/dist/state/SetLegendPayload.d.ts +0 -3
- package/dist/state/SetTooltipEntrySettings.d.ts +0 -8
- package/dist/state/brushSlice.d.ts +0 -18
- package/dist/state/cartesianAxisSlice.d.ts +0 -96
- package/dist/state/chartDataSlice.d.ts +0 -44
- package/dist/state/externalEventsMiddleware.d.ts +0 -17
- package/dist/state/graphicalItemsSlice.d.ts +0 -108
- package/dist/state/hooks.d.ts +0 -54
- package/dist/state/keyboardEventsMiddleware.d.ts +0 -3
- package/dist/state/layoutSlice.d.ts +0 -15
- package/dist/state/legendSlice.d.ts +0 -26
- package/dist/state/mouseEventsMiddleware.d.ts +0 -5
- package/dist/state/optionsSlice.d.ts +0 -27
- package/dist/state/polarAxisSlice.d.ts +0 -10
- package/dist/state/polarOptionsSlice.d.ts +0 -10
- package/dist/state/reduxDevtoolsJsonStringifyReplacer.d.ts +0 -1
- package/dist/state/referenceElementsSlice.d.ts +0 -40
- package/dist/state/selectors/areaSelectors.d.ts +0 -24
- package/dist/state/selectors/axisSelectors.d.ts +0 -1833
- package/dist/state/selectors/barSelectors.d.ts +0 -944
- package/dist/state/selectors/brushSelectors.d.ts +0 -10
- package/dist/state/selectors/combiners/combineActiveLabel.d.ts +0 -3
- package/dist/state/selectors/combiners/combineActiveTooltipIndex.d.ts +0 -5
- package/dist/state/selectors/combiners/combineAxisRangeWithReverse.d.ts +0 -3
- package/dist/state/selectors/combiners/combineCoordinateForDefaultIndex.d.ts +0 -3
- package/dist/state/selectors/combiners/combineTooltipInteractionState.d.ts +0 -3
- package/dist/state/selectors/combiners/combineTooltipPayloadConfigurations.d.ts +0 -3
- package/dist/state/selectors/common.d.ts +0 -2
- package/dist/state/selectors/containerSelectors.d.ts +0 -6
- package/dist/state/selectors/dataSelectors.d.ts +0 -23
- package/dist/state/selectors/funnelSelectors.d.ts +0 -69
- package/dist/state/selectors/legendSelectors.d.ts +0 -7
- package/dist/state/selectors/lineSelectors.d.ts +0 -123
- package/dist/state/selectors/pickAxisId.d.ts +0 -3
- package/dist/state/selectors/pickAxisType.d.ts +0 -2
- package/dist/state/selectors/polarAxisSelectors.d.ts +0 -49
- package/dist/state/selectors/polarGridSelectors.d.ts +0 -118
- package/dist/state/selectors/polarScaleSelectors.d.ts +0 -9
- package/dist/state/selectors/polarSelectors.d.ts +0 -70
- package/dist/state/selectors/radarSelectors.d.ts +0 -76
- package/dist/state/selectors/radialBarSelectors.d.ts +0 -61
- package/dist/state/selectors/rootPropsSelectors.d.ts +0 -11
- package/dist/state/selectors/scatterSelectors.d.ts +0 -21
- package/dist/state/selectors/selectActivePropsFromChartPointer.d.ts +0 -382
- package/dist/state/selectors/selectAllAxes.d.ts +0 -4
- package/dist/state/selectors/selectChartOffset.d.ts +0 -116
- package/dist/state/selectors/selectChartOffsetInternal.d.ts +0 -9
- package/dist/state/selectors/selectTooltipEventType.d.ts +0 -8
- package/dist/state/selectors/selectTooltipPayloadSearcher.d.ts +0 -3
- package/dist/state/selectors/selectTooltipSettings.d.ts +0 -3
- package/dist/state/selectors/selectTooltipState.d.ts +0 -3
- package/dist/state/selectors/selectors.d.ts +0 -184
- package/dist/state/selectors/tooltipSelectors.d.ts +0 -581
- package/dist/state/selectors/touchSelectors.d.ts +0 -4
- package/dist/state/store.d.ts +0 -74
- package/dist/state/tooltipSlice.d.ts +0 -204
- package/dist/state/touchEventsMiddleware.d.ts +0 -2
- package/dist/state/utils/useReportScale.d.ts +0 -1
- package/dist/synchronisation/syncSelectors.d.ts +0 -3
- package/dist/synchronisation/useChartSynchronisation.d.ts +0 -11
- package/dist/types/offset.d.ts +0 -8
- package/dist/utils/Global.d.ts +0 -9
- package/dist/utils/context.d.ts +0 -8
- package/dist/utils/createContext.d.ts +0 -8
- package/dist/utils/legend.d.ts +0 -3
- package/dist/utils/props.d.ts +0 -15
- package/dist/utils/resolveDefaultProps.d.ts +0 -52
|
@@ -12,9 +12,11 @@ var LabelListVueProps = {
|
|
|
12
12
|
clockWise: { type: Boolean },
|
|
13
13
|
dataKey: { type: [String, Function] },
|
|
14
14
|
textBreakAll: { type: Boolean },
|
|
15
|
-
position: { type: String },
|
|
15
|
+
position: { type: [String, Object] },
|
|
16
16
|
offset: { type: Number },
|
|
17
|
-
angle: { type: Number }
|
|
17
|
+
angle: { type: Number },
|
|
18
|
+
/** Writes the label text. Receives the raw value, which can be `null` or an object in messy data. */
|
|
19
|
+
formatter: { type: Function }
|
|
18
20
|
};
|
|
19
21
|
var LabelVueProps = {
|
|
20
22
|
id: { type: String },
|
|
@@ -23,7 +25,6 @@ var LabelVueProps = {
|
|
|
23
25
|
default: ""
|
|
24
26
|
},
|
|
25
27
|
viewBox: { type: Object },
|
|
26
|
-
parentViewBox: { type: Object },
|
|
27
28
|
value: { type: [Number, String] },
|
|
28
29
|
formatter: { type: Function },
|
|
29
30
|
offset: {
|
|
@@ -32,8 +33,12 @@ var LabelVueProps = {
|
|
|
32
33
|
},
|
|
33
34
|
position: { type: [String, Object] },
|
|
34
35
|
textBreakAll: { type: Boolean },
|
|
35
|
-
angle: { type: Number }
|
|
36
|
+
angle: { type: Number }
|
|
37
|
+
};
|
|
38
|
+
var LabelViewVueProps = {
|
|
39
|
+
...LabelVueProps,
|
|
40
|
+
parentViewBox: { type: Object },
|
|
36
41
|
index: { type: Number }
|
|
37
42
|
};
|
|
38
43
|
//#endregion
|
|
39
|
-
export { LabelListVueProps, LabelVueProps };
|
|
44
|
+
export { LabelListVueProps, LabelViewVueProps, LabelVueProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isNumber, isPercent } from "../../utils/validate.mjs";
|
|
2
|
-
import { uniqueId } from "../../utils/data-utils.mjs";
|
|
3
2
|
import { getPercentValue, mathSign } from "../../utils/data.mjs";
|
|
3
|
+
import { polarToCartesian } from "../../utils/polar.mjs";
|
|
4
4
|
import { createVNode, mergeProps } from "vue";
|
|
5
5
|
//#region src/components/label/utils.tsx
|
|
6
6
|
function parseViewBox(props) {
|
|
@@ -37,20 +37,36 @@ function parseViewBox(props) {
|
|
|
37
37
|
};
|
|
38
38
|
if (props.viewBox) return props.viewBox;
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
40
|
+
/** A label's box with every field set: missing sizes and angles are 0. */
|
|
41
|
+
/**
|
|
42
|
+
* Fills the fields a caller's `viewBox` leaves out, once, so position math never reads
|
|
43
|
+
* `undefined` and renders NaN. A box with a numeric `cx` is polar.
|
|
44
|
+
*/
|
|
45
|
+
function normalizeViewBox(viewBox) {
|
|
46
|
+
if ("cx" in viewBox && isNumber(viewBox.cx)) return {
|
|
47
|
+
cx: viewBox.cx,
|
|
48
|
+
cy: viewBox.cy ?? 0,
|
|
49
|
+
innerRadius: viewBox.innerRadius ?? 0,
|
|
50
|
+
outerRadius: viewBox.outerRadius ?? 0,
|
|
51
|
+
startAngle: viewBox.startAngle ?? 0,
|
|
52
|
+
endAngle: viewBox.endAngle ?? 0,
|
|
53
|
+
clockWise: viewBox.clockWise ?? false
|
|
54
|
+
};
|
|
55
|
+
const box = viewBox;
|
|
45
56
|
return {
|
|
46
|
-
x:
|
|
47
|
-
y:
|
|
57
|
+
x: box.x ?? 0,
|
|
58
|
+
y: box.y ?? 0,
|
|
59
|
+
width: box.width ?? 0,
|
|
60
|
+
height: box.height ?? 0
|
|
48
61
|
};
|
|
49
62
|
}
|
|
63
|
+
function isPolar(viewBox) {
|
|
64
|
+
return "cx" in viewBox;
|
|
65
|
+
}
|
|
50
66
|
function getDeltaAngle(startAngle, endAngle) {
|
|
51
67
|
return mathSign(endAngle - startAngle) * Math.min(Math.abs(endAngle - startAngle), 360);
|
|
52
68
|
}
|
|
53
|
-
function renderRadialLabel(labelProps, position, label, attrs, viewBox) {
|
|
69
|
+
function renderRadialLabel(labelProps, position, label, attrs, viewBox, generatedId) {
|
|
54
70
|
const { offset = 5, class: className, id: labelId } = labelProps;
|
|
55
71
|
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle, clockWise } = viewBox;
|
|
56
72
|
const radius = (innerRadius + outerRadius) / 2;
|
|
@@ -77,8 +93,8 @@ function renderRadialLabel(labelProps, position, label, attrs, viewBox) {
|
|
|
77
93
|
const startPoint = polarToCartesian(cx, cy, radius, labelAngle);
|
|
78
94
|
const endPoint = polarToCartesian(cx, cy, radius, labelAngle + (direction ? 1 : -1) * 359);
|
|
79
95
|
const path = `M${startPoint.x},${startPoint.y} A${radius},${radius},0,1,${direction ? 0 : 1},${endPoint.x},${endPoint.y}`;
|
|
80
|
-
const id = labelId
|
|
81
|
-
return createVNode("text", mergeProps(attrs, {
|
|
96
|
+
const id = labelId ?? generatedId;
|
|
97
|
+
return createVNode("text", mergeProps({ "data-slot": "label" }, attrs, {
|
|
82
98
|
"dominant-baseline": "central",
|
|
83
99
|
"class": ["v-charts-radial-bar-label", className]
|
|
84
100
|
}), [createVNode("defs", null, [createVNode("path", {
|
|
@@ -87,8 +103,8 @@ function renderRadialLabel(labelProps, position, label, attrs, viewBox) {
|
|
|
87
103
|
}, null)]), createVNode("textPath", { "xlink:href": `#${id}` }, [label])]);
|
|
88
104
|
}
|
|
89
105
|
function getAttrsOfPolarLabel(props, viewBox) {
|
|
90
|
-
const { offset, position } = props;
|
|
91
|
-
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle } = viewBox
|
|
106
|
+
const { offset = 5, position } = props;
|
|
107
|
+
const { cx, cy, innerRadius, outerRadius, startAngle, endAngle } = viewBox;
|
|
92
108
|
const midAngle = (startAngle + endAngle) / 2;
|
|
93
109
|
if (position === "outside") {
|
|
94
110
|
const { x, y } = polarToCartesian(cx, cy, outerRadius + offset, midAngle);
|
|
@@ -117,7 +133,8 @@ function getAttrsOfPolarLabel(props, viewBox) {
|
|
|
117
133
|
textAnchor: "middle",
|
|
118
134
|
verticalAnchor: "end"
|
|
119
135
|
};
|
|
120
|
-
const
|
|
136
|
+
const r = (innerRadius + outerRadius) / 2;
|
|
137
|
+
const { x, y } = polarToCartesian(cx, cy, r, midAngle);
|
|
121
138
|
return {
|
|
122
139
|
x,
|
|
123
140
|
y,
|
|
@@ -126,7 +143,9 @@ function getAttrsOfPolarLabel(props, viewBox) {
|
|
|
126
143
|
};
|
|
127
144
|
}
|
|
128
145
|
function getAttrsOfCartesianLabel(props, viewBox) {
|
|
129
|
-
const {
|
|
146
|
+
const { offset = 5, position } = props;
|
|
147
|
+
const parent = props.parentViewBox && normalizeViewBox(props.parentViewBox);
|
|
148
|
+
const parentViewBox = parent && !isPolar(parent) ? parent : void 0;
|
|
130
149
|
const { x, y, width, height } = viewBox;
|
|
131
150
|
const verticalSign = height >= 0 ? 1 : -1;
|
|
132
151
|
const verticalOffset = verticalSign * offset;
|
|
@@ -246,9 +265,10 @@ function getAttrsOfCartesianLabel(props, viewBox) {
|
|
|
246
265
|
verticalAnchor: verticalEnd,
|
|
247
266
|
...sizeAttrs
|
|
248
267
|
};
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
268
|
+
const at = typeof position === "object" ? position : void 0;
|
|
269
|
+
if (at?.x != null && at.y != null && (isNumber(at.x) || isPercent(at.x)) && (isNumber(at.y) || isPercent(at.y))) return {
|
|
270
|
+
x: x + getPercentValue(at.x, width),
|
|
271
|
+
y: y + getPercentValue(at.y, height),
|
|
252
272
|
textAnchor: "end",
|
|
253
273
|
verticalAnchor: "end",
|
|
254
274
|
...sizeAttrs
|
|
@@ -262,4 +282,4 @@ function getAttrsOfCartesianLabel(props, viewBox) {
|
|
|
262
282
|
};
|
|
263
283
|
}
|
|
264
284
|
//#endregion
|
|
265
|
-
export { getAttrsOfCartesianLabel, getAttrsOfPolarLabel, isPolar, parseViewBox, renderRadialLabel };
|
|
285
|
+
export { getAttrsOfCartesianLabel, getAttrsOfPolarLabel, isPolar, normalizeViewBox, parseViewBox, renderRadialLabel };
|
|
@@ -1,52 +1,83 @@
|
|
|
1
|
+
import { useChart } from "../../model/chart.mjs";
|
|
2
|
+
import { useLayerTeleport } from "../../hooks/useLayerTeleport.mjs";
|
|
3
|
+
import { useDeferredView } from "../../hooks/deferredView.mjs";
|
|
1
4
|
import Surface from "../../container/Surface.mjs";
|
|
2
5
|
import { LegendVueProps } from "./type.mjs";
|
|
6
|
+
import { isOutsidePosition } from "../../cartesian/getCartesianPosition.mjs";
|
|
7
|
+
import { getLayoutForPosition } from "./utils.mjs";
|
|
3
8
|
import { useLegend } from "./hooks/useLegend.mjs";
|
|
4
9
|
import { useLegendContent } from "./hooks/useLegendContent.mjs";
|
|
5
10
|
import { LegendSymbol } from "./LegendSymbol.mjs";
|
|
6
|
-
import {
|
|
11
|
+
import { computed, createVNode, defineComponent, h, shallowRef, watch } from "vue";
|
|
7
12
|
//#region src/components/legend/Legend.tsx
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
var legendItemEvent = (_entry, _index, _event) => true;
|
|
14
|
+
var legendEmits = {
|
|
15
|
+
"update:hidden": (_hidden) => true,
|
|
16
|
+
"click": legendItemEvent,
|
|
17
|
+
"mouseenter": legendItemEvent,
|
|
18
|
+
"mouseleave": legendItemEvent,
|
|
19
|
+
"bbox-update": (_box) => true
|
|
20
|
+
};
|
|
21
|
+
var LegendView = /* @__PURE__ */ defineComponent({
|
|
22
|
+
name: "LegendView",
|
|
23
|
+
emits: legendEmits,
|
|
24
|
+
inheritAttrs: false,
|
|
25
|
+
props: {
|
|
26
|
+
item: {
|
|
27
|
+
type: Object,
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
svgAttrs: {
|
|
31
|
+
type: Object,
|
|
32
|
+
required: true
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
setup(view, { slots, emit }) {
|
|
36
|
+
const teleport = useLayerTeleport();
|
|
37
|
+
const props = view.item;
|
|
38
|
+
view.svgAttrs;
|
|
39
|
+
const { legendRef, processedPayload, outerStyle, legendPortal, resolvedLayout, positionViewBox, boundingBox } = useLegend(props);
|
|
40
|
+
const { getItemStyle, getSvgStyle, formatValue } = useLegendContent(props);
|
|
41
|
+
watch(boundingBox, (box) => emit("bbox-update", box), { immediate: true });
|
|
42
|
+
const activateItem = (entry, index, event) => {
|
|
43
|
+
if (props.hidden !== void 0 && entry.dataKey !== void 0) {
|
|
44
|
+
const key = String(entry.dataKey);
|
|
45
|
+
emit("update:hidden", props.hidden.includes(key) ? props.hidden.filter((item) => item !== key) : [...props.hidden, key]);
|
|
46
|
+
}
|
|
47
|
+
emit("click", entry, index, event);
|
|
48
|
+
};
|
|
21
49
|
const renderDefaultContent = () => {
|
|
22
50
|
if (!processedPayload.value || processedPayload.value.length === 0) return null;
|
|
23
|
-
const {
|
|
24
|
-
const
|
|
25
|
-
padding: 0,
|
|
26
|
-
margin: 0,
|
|
27
|
-
textAlign: layout === "horizontal" ? align : "left"
|
|
28
|
-
};
|
|
51
|
+
const { align = "center", iconSize = 14 } = props;
|
|
52
|
+
const layout = resolvedLayout.value;
|
|
29
53
|
return createVNode("ul", {
|
|
30
54
|
"class": "v-charts-default-legend",
|
|
31
|
-
"style":
|
|
55
|
+
"style": {
|
|
56
|
+
padding: "0px",
|
|
57
|
+
margin: "0px",
|
|
58
|
+
textAlign: layout === "horizontal" ? align : "left"
|
|
59
|
+
}
|
|
32
60
|
}, [processedPayload.value.map((entry, index) => {
|
|
33
61
|
if (entry.type === "none") return null;
|
|
34
62
|
return createVNode("li", {
|
|
35
63
|
"key": `legend-item-${index}`,
|
|
36
64
|
"class": "v-charts-legend-item",
|
|
37
65
|
"style": getItemStyle(layout),
|
|
38
|
-
"
|
|
39
|
-
"
|
|
66
|
+
"onMouseenter": (event) => emit("mouseenter", entry, index, event),
|
|
67
|
+
"onMouseleave": (event) => emit("mouseleave", entry, index, event)
|
|
68
|
+
}, [createVNode("button", {
|
|
69
|
+
"type": "button",
|
|
40
70
|
"aria-label": `Toggle ${formatValue(entry)} series`,
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
71
|
+
"aria-pressed": !entry.inactive,
|
|
72
|
+
"style": {
|
|
73
|
+
padding: 0,
|
|
74
|
+
border: 0,
|
|
75
|
+
background: "none",
|
|
76
|
+
font: "inherit",
|
|
77
|
+
color: "var(--v-charts-text, #666)",
|
|
78
|
+
cursor: "pointer"
|
|
47
79
|
},
|
|
48
|
-
"
|
|
49
|
-
"onMouseleave": () => handleMouseLeave(entry, index)
|
|
80
|
+
"onClick": (event) => activateItem(entry, index, event)
|
|
50
81
|
}, [createVNode(Surface, {
|
|
51
82
|
"width": iconSize,
|
|
52
83
|
"height": iconSize,
|
|
@@ -60,34 +91,70 @@ var Legend_default = /* @__PURE__ */ defineComponent({
|
|
|
60
91
|
"aria-label": `${formatValue(entry)} legend icon`
|
|
61
92
|
}, { default: () => [createVNode(LegendSymbol, {
|
|
62
93
|
"type": props.iconType ?? entry.type,
|
|
63
|
-
"color": entry.inactive ? "#a3a3a3" : entry.color,
|
|
94
|
+
"color": entry.inactive ? "var(--v-charts-inactive, #a3a3a3)" : entry.color,
|
|
64
95
|
"size": iconSize,
|
|
65
96
|
"data": entry
|
|
66
97
|
}, null)] }), createVNode("span", {
|
|
67
98
|
"class": "v-charts-legend-item-text",
|
|
68
|
-
"style": { color:
|
|
69
|
-
}, [formatValue(entry)])]);
|
|
99
|
+
"style": { color: "var(--v-charts-text, #666)" }
|
|
100
|
+
}, [formatValue(entry)])])]);
|
|
70
101
|
})]);
|
|
71
102
|
};
|
|
72
103
|
const renderContent = () => {
|
|
73
104
|
if (!processedPayload.value || processedPayload.value.length === 0) return null;
|
|
74
105
|
const contentProps = {
|
|
75
106
|
...props,
|
|
107
|
+
layout: resolvedLayout.value,
|
|
76
108
|
payload: processedPayload.value
|
|
77
109
|
};
|
|
78
110
|
if (slots.content) return slots.content(contentProps);
|
|
79
111
|
return renderDefaultContent();
|
|
80
112
|
};
|
|
81
113
|
return () => {
|
|
82
|
-
if (
|
|
114
|
+
if (props.position != null && positionViewBox.value == null) return null;
|
|
83
115
|
const legendElement = createVNode("div", {
|
|
116
|
+
"data-slot": "legend",
|
|
84
117
|
"class": "v-charts-legend-wrapper",
|
|
85
118
|
"style": outerStyle.value,
|
|
86
119
|
"ref": legendRef
|
|
87
120
|
}, [renderContent()]);
|
|
88
|
-
return createVNode("foreignObject", null, [
|
|
121
|
+
return createVNode("foreignObject", null, [teleport(legendElement, legendPortal)]);
|
|
89
122
|
};
|
|
90
123
|
}
|
|
91
124
|
});
|
|
125
|
+
var Legend = /* @__PURE__ */ defineComponent({
|
|
126
|
+
name: "Legend",
|
|
127
|
+
inheritAttrs: false,
|
|
128
|
+
emits: legendEmits,
|
|
129
|
+
slots: Object,
|
|
130
|
+
props: LegendVueProps,
|
|
131
|
+
setup(props, { attrs, slots, emit }) {
|
|
132
|
+
const measuredSize = shallowRef();
|
|
133
|
+
useChart().legend.register(computed(() => ({
|
|
134
|
+
hidden: props.hidden,
|
|
135
|
+
size: props.to == null && (props.position == null || isOutsidePosition(props.position)) ? measuredSize.value : void 0,
|
|
136
|
+
settings: {
|
|
137
|
+
layout: props.layout && props.layout !== "auto" ? props.layout : getLayoutForPosition(props.position),
|
|
138
|
+
align: props.align,
|
|
139
|
+
verticalAlign: props.verticalAlign,
|
|
140
|
+
position: props.position,
|
|
141
|
+
offset: props.offset
|
|
142
|
+
}
|
|
143
|
+
})));
|
|
144
|
+
const View = useDeferredView(LegendView);
|
|
145
|
+
return () => h(View, {
|
|
146
|
+
"item": props,
|
|
147
|
+
"svgAttrs": attrs,
|
|
148
|
+
"onUpdate:hidden": (hidden) => emit("update:hidden", hidden),
|
|
149
|
+
"onClick": (entry, index, event) => emit("click", entry, index, event),
|
|
150
|
+
"onMouseenter": (entry, index, event) => emit("mouseenter", entry, index, event),
|
|
151
|
+
"onMouseleave": (entry, index, event) => emit("mouseleave", entry, index, event),
|
|
152
|
+
"onBbox-update": (box) => {
|
|
153
|
+
measuredSize.value = box ?? void 0;
|
|
154
|
+
emit("bbox-update", box);
|
|
155
|
+
}
|
|
156
|
+
}, slots);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
92
159
|
//#endregion
|
|
93
|
-
export {
|
|
160
|
+
export { Legend as default };
|
|
@@ -15,7 +15,7 @@ var LegendSymbol = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
return () => {
|
|
16
16
|
const { type, color, data } = props;
|
|
17
17
|
if (type === "none") return null;
|
|
18
|
-
const halfSize =
|
|
18
|
+
const halfSize = 16;
|
|
19
19
|
const thirdSize = 32 / 3;
|
|
20
20
|
const sixthSize = 32 / 6;
|
|
21
21
|
switch (type) {
|
|
@@ -43,7 +43,7 @@ var LegendSymbol = /* @__PURE__ */ defineComponent({
|
|
|
43
43
|
case "rect": return createVNode("path", {
|
|
44
44
|
"stroke": "none",
|
|
45
45
|
"fill": color,
|
|
46
|
-
"d": `M0
|
|
46
|
+
"d": `M0,4h32v24h-32z`,
|
|
47
47
|
"class": "v-charts-legend-icon"
|
|
48
48
|
}, null);
|
|
49
49
|
default: return createVNode(Symbols, {
|
|
@@ -1,29 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useLegendPortal } from "../../../chart/LegendPortalContext.mjs";
|
|
1
|
+
import { useChartPresentation } from "../../../model/presentation.mjs";
|
|
2
|
+
import { useChart } from "../../../model/chart.mjs";
|
|
3
|
+
import { useCanMeasureText, useChartLayer } from "../../../model/runtime.mjs";
|
|
4
|
+
import { toPx } from "../../../utils/style.mjs";
|
|
6
5
|
import { getUniqPayload } from "../../../utils/payload/getUniqPayload.mjs";
|
|
7
|
-
import {
|
|
6
|
+
import { getCartesianPosition, isOutsidePosition } from "../../../cartesian/getCartesianPosition.mjs";
|
|
7
|
+
import { cartesianPositionToCSSTranslate } from "../../../cartesian/cartesianPositionToCSSTranslate.mjs";
|
|
8
|
+
import { defaultUniqBy, getDefaultPosition, getLayoutForPosition, getOutsidePositionOffset, getWidthOrHeight } from "../utils.mjs";
|
|
8
9
|
import { computed, ref } from "vue";
|
|
9
10
|
import { sortBy } from "es-toolkit/compat";
|
|
10
11
|
import { useElementBounding } from "@vueuse/core";
|
|
11
12
|
//#region src/components/legend/hooks/useLegend.ts
|
|
12
13
|
function useLegend(props) {
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
const
|
|
14
|
+
const chart = useChart();
|
|
15
|
+
const canMeasureText = useCanMeasureText();
|
|
16
|
+
const contextPayload = chart.legend.payload;
|
|
17
|
+
const legendPortalFromContext = useChartLayer("portal");
|
|
18
|
+
const margin = useChartPresentation().margin;
|
|
19
|
+
const chartWidth = useChartPresentation().width;
|
|
20
|
+
const chartHeight = useChartPresentation().height;
|
|
21
|
+
const viewBox = useChartPresentation().viewBox;
|
|
22
|
+
const legendArea = chart.legendArea;
|
|
19
23
|
const legendRef = ref();
|
|
20
|
-
const
|
|
24
|
+
const measuredLegendRef = computed(() => canMeasureText.value ? legendRef.value : void 0);
|
|
25
|
+
const { width: boundingWidth, height: boundingHeight } = useElementBounding(measuredLegendRef);
|
|
26
|
+
const resolvedLayout = computed(() => props.layout && props.layout !== "auto" ? props.layout : getLayoutForPosition(props.position));
|
|
21
27
|
const maxWidth = computed(() => chartWidth.value - (margin.value.left || 0) - (margin.value.right || 0));
|
|
22
|
-
const widthOrHeight = computed(() => getWidthOrHeight(
|
|
28
|
+
const widthOrHeight = computed(() => getWidthOrHeight(resolvedLayout.value, props.height, props.width, maxWidth.value));
|
|
23
29
|
const boundingBox = computed(() => ({
|
|
24
|
-
width: boundingWidth.value,
|
|
25
|
-
height: boundingHeight.value
|
|
30
|
+
width: canMeasureText.value ? boundingWidth.value : 0,
|
|
31
|
+
height: canMeasureText.value ? boundingHeight.value : 0
|
|
26
32
|
}));
|
|
33
|
+
const positionViewBox = computed(() => {
|
|
34
|
+
if (props.position == null) return null;
|
|
35
|
+
return isOutsidePosition(props.position) ? legendArea.value : viewBox.value;
|
|
36
|
+
});
|
|
27
37
|
const processedPayload = computed(() => {
|
|
28
38
|
if (!contextPayload.value || contextPayload.value.length === 0) return [];
|
|
29
39
|
let finalPayload = getUniqPayload(contextPayload.value, props.payloadUniqBy, defaultUniqBy);
|
|
@@ -33,44 +43,54 @@ function useLegend(props) {
|
|
|
33
43
|
}
|
|
34
44
|
return Array.from(finalPayload);
|
|
35
45
|
});
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
position:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
const
|
|
46
|
+
const positionStyle = computed(() => {
|
|
47
|
+
if (props.position == null || positionViewBox.value == null) return;
|
|
48
|
+
const positionResult = getCartesianPosition({
|
|
49
|
+
viewBox: positionViewBox.value,
|
|
50
|
+
position: props.position,
|
|
51
|
+
offset: props.offset ?? 0
|
|
52
|
+
});
|
|
53
|
+
const outsidePositionOffset = getOutsidePositionOffset(props.position, props.offset ?? 0, boundingBox.value);
|
|
54
|
+
const positionMaxWidth = resolvedLayout.value === "vertical" ? (positionViewBox.value.width ?? 0) / 2 : positionViewBox.value.width ?? 0;
|
|
55
|
+
const positionMaxHeight = resolvedLayout.value === "horizontal" ? (positionViewBox.value.height ?? 0) / 2 : positionViewBox.value.height ?? 0;
|
|
45
56
|
return {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
width: "max-content",
|
|
58
|
+
height: "max-content",
|
|
59
|
+
maxWidth: `${positionMaxWidth}px`,
|
|
60
|
+
maxHeight: `${positionMaxHeight}px`,
|
|
61
|
+
overflowY: "auto",
|
|
62
|
+
top: `${positionResult.y + (outsidePositionOffset.top ?? 0)}px`,
|
|
63
|
+
left: `${positionResult.x + (outsidePositionOffset.left ?? 0)}px`,
|
|
64
|
+
transform: cartesianPositionToCSSTranslate(positionResult.horizontalAnchor, positionResult.verticalAnchor)
|
|
49
65
|
};
|
|
50
66
|
});
|
|
51
|
-
const legendPortal = computed(() => props.portal ?? legendPortalFromContext?.value);
|
|
52
|
-
const syncSettings = () => {
|
|
53
|
-
dispatch(setLegendSettings({
|
|
54
|
-
layout: props.layout,
|
|
55
|
-
align: props.align,
|
|
56
|
-
verticalAlign: props.verticalAlign
|
|
57
|
-
}));
|
|
58
|
-
};
|
|
59
|
-
const syncSize = () => {
|
|
60
|
-
dispatch(setLegendSize({
|
|
61
|
-
width: boundingBox.value.width,
|
|
62
|
-
height: boundingBox.value.height
|
|
63
|
-
}));
|
|
64
|
-
};
|
|
65
67
|
return {
|
|
66
68
|
legendRef,
|
|
67
69
|
boundingBox,
|
|
68
70
|
widthOrHeight,
|
|
69
71
|
processedPayload,
|
|
70
|
-
outerStyle
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
outerStyle: computed(() => {
|
|
73
|
+
const userStyle = props.wrapperStyle ? { ...props.wrapperStyle } : {};
|
|
74
|
+
if (props.to) return userStyle;
|
|
75
|
+
const baseStyle = {
|
|
76
|
+
position: "absolute",
|
|
77
|
+
width: toPx(widthOrHeight.value?.width || props.width || "auto"),
|
|
78
|
+
height: toPx(widthOrHeight.value?.height || props.height || "auto")
|
|
79
|
+
};
|
|
80
|
+
const calculatedPositionStyle = positionStyle.value ?? getDefaultPosition(userStyle, {
|
|
81
|
+
layout: resolvedLayout.value,
|
|
82
|
+
align: props.align,
|
|
83
|
+
verticalAlign: props.verticalAlign
|
|
84
|
+
}, margin.value, chartWidth.value, chartHeight.value, boundingBox.value);
|
|
85
|
+
return {
|
|
86
|
+
...baseStyle,
|
|
87
|
+
...calculatedPositionStyle,
|
|
88
|
+
...userStyle
|
|
89
|
+
};
|
|
90
|
+
}),
|
|
91
|
+
legendPortal: computed(() => props.to ?? legendPortalFromContext?.value),
|
|
92
|
+
resolvedLayout,
|
|
93
|
+
positionViewBox
|
|
74
94
|
};
|
|
75
95
|
}
|
|
76
96
|
//#endregion
|
|
@@ -43,25 +43,13 @@ function useLegendContent(props) {
|
|
|
43
43
|
const formatValue = (entry) => {
|
|
44
44
|
return props.formatter ? props.formatter(entry.value, entry) : entry.value;
|
|
45
45
|
};
|
|
46
|
-
const handleClick = (entry, index) => {
|
|
47
|
-
props.onClick?.(entry, index);
|
|
48
|
-
};
|
|
49
|
-
const handleMouseEnter = (entry, index) => {
|
|
50
|
-
props.onMouseEnter?.(entry, index);
|
|
51
|
-
};
|
|
52
|
-
const handleMouseLeave = (entry, index) => {
|
|
53
|
-
props.onMouseLeave?.(entry, index);
|
|
54
|
-
};
|
|
55
46
|
return {
|
|
56
47
|
getWrapperStyle,
|
|
57
48
|
getContentStyle,
|
|
58
49
|
getItemStyle,
|
|
59
50
|
getViewBox,
|
|
60
51
|
getSvgStyle,
|
|
61
|
-
formatValue
|
|
62
|
-
handleClick,
|
|
63
|
-
handleMouseEnter,
|
|
64
|
-
handleMouseLeave
|
|
52
|
+
formatValue
|
|
65
53
|
};
|
|
66
54
|
}
|
|
67
55
|
//#endregion
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region src/components/legend/type.ts
|
|
2
2
|
var LegendVueProps = {
|
|
3
|
+
hidden: Array,
|
|
3
4
|
layout: {
|
|
4
5
|
type: String,
|
|
5
|
-
default: "
|
|
6
|
+
default: "auto"
|
|
6
7
|
},
|
|
7
8
|
align: {
|
|
8
9
|
type: String,
|
|
@@ -12,6 +13,21 @@ var LegendVueProps = {
|
|
|
12
13
|
type: String,
|
|
13
14
|
default: "bottom"
|
|
14
15
|
},
|
|
16
|
+
/**
|
|
17
|
+
* The position of the legend relative to the chart.
|
|
18
|
+
* If this is defined, it overrides `align` and `verticalAlign`.
|
|
19
|
+
*/
|
|
20
|
+
position: {
|
|
21
|
+
type: [String, Object],
|
|
22
|
+
default: void 0
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* The offset to the specified `position`. Direction of the offset depends on the position.
|
|
26
|
+
*/
|
|
27
|
+
offset: {
|
|
28
|
+
type: Number,
|
|
29
|
+
default: 0
|
|
30
|
+
},
|
|
15
31
|
width: Number,
|
|
16
32
|
height: Number,
|
|
17
33
|
iconSize: {
|
|
@@ -23,19 +39,13 @@ var LegendVueProps = {
|
|
|
23
39
|
contentStyle: Object,
|
|
24
40
|
itemStyle: Object,
|
|
25
41
|
formatter: Function,
|
|
26
|
-
onClick: Function,
|
|
27
|
-
onMouseEnter: Function,
|
|
28
|
-
onMouseLeave: Function,
|
|
29
|
-
margin: Object,
|
|
30
|
-
chartWidth: Number,
|
|
31
|
-
chartHeight: Number,
|
|
32
42
|
payloadUniqBy: [Boolean, Function],
|
|
43
|
+
/** Sort entries. By default they keep the order of the data (Pie) or of the series. */
|
|
33
44
|
itemSorter: {
|
|
34
45
|
type: [String, Function],
|
|
35
|
-
default:
|
|
46
|
+
default: void 0
|
|
36
47
|
},
|
|
37
|
-
|
|
38
|
-
onBBoxUpdate: Function
|
|
48
|
+
to: [String, Object]
|
|
39
49
|
};
|
|
40
50
|
//#endregion
|
|
41
51
|
export { LegendVueProps };
|
|
@@ -1,13 +1,28 @@
|
|
|
1
1
|
import { isNumber } from "../../utils/validate.mjs";
|
|
2
2
|
//#region src/components/legend/utils.ts
|
|
3
|
+
function getLayoutForPosition(position) {
|
|
4
|
+
if (position === "left" || position === "right" || position === "insideLeft" || position === "insideRight") return "vertical";
|
|
5
|
+
return "horizontal";
|
|
6
|
+
}
|
|
7
|
+
function getOutsidePositionOffset(position, offset, box) {
|
|
8
|
+
if (position === "top") return { top: box.height + offset };
|
|
9
|
+
if (position === "bottom") return { top: -box.height - offset };
|
|
10
|
+
if (position === "left") return { left: box.width + offset };
|
|
11
|
+
if (position === "right") return { left: -box.width - offset };
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
3
14
|
function getDefaultPosition(style, props, margin, chartWidth, chartHeight, box) {
|
|
4
15
|
const { layout, align, verticalAlign } = props;
|
|
5
16
|
let hPos = {};
|
|
6
17
|
let vPos = {};
|
|
7
|
-
if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null))
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
if (!style || (style.left === void 0 || style.left === null) && (style.right === void 0 || style.right === null)) {
|
|
19
|
+
if (align === "center" && layout === "vertical") hPos = { left: `${((chartWidth || 0) - box.width) / 2}px` };
|
|
20
|
+
else hPos = align === "right" ? { right: `${margin?.right || 0}px` } : { left: `${margin?.left || 0}px` };
|
|
21
|
+
}
|
|
22
|
+
if (!style || (style.top === void 0 || style.top === null) && (style.bottom === void 0 || style.bottom === null)) {
|
|
23
|
+
if (verticalAlign === "middle") vPos = { top: `${((chartHeight || 0) - box.height) / 2}px` };
|
|
24
|
+
else vPos = verticalAlign === "bottom" ? { bottom: `${margin?.bottom || 0}px` } : { top: `${margin?.top || 0}px` };
|
|
25
|
+
}
|
|
11
26
|
return {
|
|
12
27
|
...hPos,
|
|
13
28
|
...vPos
|
|
@@ -22,4 +37,4 @@ function defaultUniqBy(entry) {
|
|
|
22
37
|
return entry.value;
|
|
23
38
|
}
|
|
24
39
|
//#endregion
|
|
25
|
-
export { defaultUniqBy, getDefaultPosition, getWidthOrHeight };
|
|
40
|
+
export { defaultUniqBy, getDefaultPosition, getLayoutForPosition, getOutsidePositionOffset, getWidthOrHeight };
|