vccs 0.6.0 → 1.0.0-beta.2
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 +1 -1
- 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 +1 -3
- 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 +8 -10
- package/dist/components/legend/hooks/useLegendContent.d.ts +7 -14
- package/dist/components/legend/type.d.ts +17 -25
- package/dist/components/legend/utils.d.ts +4 -4
- 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} +72 -100
- 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 -159
- package/dist/es/cartesian/axis/YAxis.mjs +63 -167
- 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/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/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 -176
- 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 +101 -36
- package/dist/es/components/legend/LegendSymbol.mjs +2 -2
- package/dist/es/components/legend/hooks/useLegend.mjs +39 -60
- package/dist/es/components/legend/hooks/useLegendContent.mjs +1 -13
- package/dist/es/components/legend/type.mjs +11 -9
- package/dist/es/components/legend/utils.mjs +8 -4
- 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 -106
- 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 +140 -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 +72 -15
- package/dist/es/hooks/useRoundedSize.mjs +0 -3
- 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 +383 -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 +7 -4
- 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 +33 -18
- package/dist/hooks/useRoundedSize.d.ts +0 -3
- 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 +437 -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} +0 -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 -14
- 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 -184
- 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 -42
- 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/selectLegendArea.mjs +0 -19
- 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 -41
- 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 -29
- 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/selectLegendArea.d.ts +0 -7
- 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
|
@@ -1,11 +1,62 @@
|
|
|
1
|
+
import { warn } from "../utils/log.mjs";
|
|
1
2
|
import { toRaw } from "vue";
|
|
2
3
|
import { sankey, sankeyLinkHorizontal } from "d3-sankey";
|
|
3
4
|
//#region src/chart/sankeyUtils.ts
|
|
5
|
+
function validLinks(data) {
|
|
6
|
+
const isNodeIndex = (index) => typeof index === "number" && Number.isInteger(index) && index >= 0 && index < data.nodes.length;
|
|
7
|
+
const links = data.links.flatMap((link) => {
|
|
8
|
+
const { source, target, value } = link;
|
|
9
|
+
if (!isNodeIndex(source) || !isNodeIndex(target) || !Number.isFinite(value) || value <= 0) return [];
|
|
10
|
+
return [{
|
|
11
|
+
...toRaw(link),
|
|
12
|
+
source,
|
|
13
|
+
target
|
|
14
|
+
}];
|
|
15
|
+
});
|
|
16
|
+
const outgoing = Array.from({ length: data.nodes.length }, () => []);
|
|
17
|
+
links.forEach((link, index) => outgoing[link.source].push(index));
|
|
18
|
+
const state = new Uint8Array(data.nodes.length);
|
|
19
|
+
const backEdges = /* @__PURE__ */ new Set();
|
|
20
|
+
for (let node = 0; node < data.nodes.length; node++) {
|
|
21
|
+
if (state[node]) continue;
|
|
22
|
+
state[node] = 1;
|
|
23
|
+
const stack = [{
|
|
24
|
+
node,
|
|
25
|
+
next: 0
|
|
26
|
+
}];
|
|
27
|
+
while (stack.length) {
|
|
28
|
+
const frame = stack[stack.length - 1];
|
|
29
|
+
const edge = outgoing[frame.node][frame.next++];
|
|
30
|
+
if (edge === void 0) {
|
|
31
|
+
state[frame.node] = 2;
|
|
32
|
+
stack.pop();
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const target = links[edge].target;
|
|
36
|
+
if (state[target] === 1) backEdges.add(edge);
|
|
37
|
+
else if (state[target] === 0) {
|
|
38
|
+
state[target] = 1;
|
|
39
|
+
stack.push({
|
|
40
|
+
node: target,
|
|
41
|
+
next: 0
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const kept = links.filter((_, index) => !backEdges.has(index));
|
|
47
|
+
const dropped = data.links.length - kept.length;
|
|
48
|
+
warn(dropped === 0, "Sankey dropped %s invalid or cyclic links.", dropped);
|
|
49
|
+
return kept;
|
|
50
|
+
}
|
|
4
51
|
function computeSankeyLayout(args) {
|
|
5
52
|
const { data, width, height, nodePadding, nodeWidth, iterations, margin } = args;
|
|
6
53
|
const cloned = {
|
|
7
54
|
nodes: data.nodes.map((n) => ({ ...toRaw(n) })),
|
|
8
|
-
links: data
|
|
55
|
+
links: validLinks(data)
|
|
56
|
+
};
|
|
57
|
+
if (!cloned.links.length) return {
|
|
58
|
+
nodes: [],
|
|
59
|
+
links: []
|
|
9
60
|
};
|
|
10
61
|
const result = sankey().nodeWidth(nodeWidth).nodePadding(nodePadding).extent([[margin.left, margin.top], [Math.max(margin.left + 1, width - margin.right), Math.max(margin.top + 1, height - margin.bottom)]]).iterations(iterations)(cloned);
|
|
11
62
|
const x0Min = margin.left;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defaultChartCapabilities } from "../model/options.mjs";
|
|
2
|
+
import { get } from "es-toolkit/compat";
|
|
3
|
+
//#region src/chart/shell.ts
|
|
4
|
+
/** Hierarchies address tooltip items by path, e.g. `children[0].children[1]` or `links[2]`. */
|
|
5
|
+
var pathPayloadSearcher = (data, payloadKey) => data && payloadKey ? get(data, payloadKey) : void 0;
|
|
6
|
+
/** Chart options shared by every standalone chart: tooltips belong to a single item. */
|
|
7
|
+
function standaloneChartOptions(chartName) {
|
|
8
|
+
return {
|
|
9
|
+
chartName,
|
|
10
|
+
capabilities: defaultChartCapabilities,
|
|
11
|
+
defaultTooltipEventType: "item",
|
|
12
|
+
validateTooltipEventTypes: ["item"],
|
|
13
|
+
tooltipPayloadSearcher: pathPayloadSearcher,
|
|
14
|
+
eventEmitter: void 0
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/** Caller `class` and `style` for the chart box. Attributes are untyped, so they are narrowed here once. */
|
|
18
|
+
function boxAttrs(attrs) {
|
|
19
|
+
return {
|
|
20
|
+
class: attrs.class,
|
|
21
|
+
style: attrs.style
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Caller attributes for the SVG root: `class` and `style` go to the chart box instead. */
|
|
25
|
+
function rootAttrs(attrs) {
|
|
26
|
+
const { class: _class, style: _style, ...rest } = attrs;
|
|
27
|
+
return rest;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { boxAttrs, rootAttrs, standaloneChartOptions };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { toFiniteNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { getValueByDataKey } from "../utils/chart.mjs";
|
|
1
3
|
import { hierarchy, partition } from "d3-hierarchy";
|
|
2
4
|
//#region src/chart/sunburstUtils.ts
|
|
3
5
|
/**
|
|
@@ -26,23 +28,25 @@ function buildTooltipIndex(node) {
|
|
|
26
28
|
return parts.join(".");
|
|
27
29
|
}
|
|
28
30
|
function computeSunburstLayout(options) {
|
|
29
|
-
const { data, cx, cy, innerRadius, outerRadius, startAngle, endAngle, dataKey, ringPadding = 0, padding = 0 } = options;
|
|
31
|
+
const { data, cx, cy, innerRadius, outerRadius, startAngle, endAngle, dataKey, nameKey = "name", ringPadding = 0, padding = 0 } = options;
|
|
30
32
|
if (!data.children || data.children.length === 0) return [];
|
|
31
33
|
const root = hierarchy(data).sum((d) => {
|
|
32
34
|
if (d.children && d.children.length > 0) return 0;
|
|
33
|
-
const val = d
|
|
34
|
-
return
|
|
35
|
+
const val = toFiniteNumber(getValueByDataKey(d, dataKey));
|
|
36
|
+
return val != null && val > 0 ? val : 0;
|
|
35
37
|
});
|
|
36
38
|
recordOriginalIndices(root);
|
|
37
39
|
root.sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
|
38
|
-
partition().size([1, 1])(root);
|
|
40
|
+
const layout = partition().size([1, 1])(root);
|
|
39
41
|
const angleRange = endAngle - startAngle;
|
|
40
42
|
const radiusRange = outerRadius - innerRadius;
|
|
41
43
|
const nodes = [];
|
|
42
|
-
|
|
44
|
+
layout.descendants().forEach((d) => {
|
|
43
45
|
if (d.depth === 0) return;
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
+
const sectorAngle = (d.x1 - d.x0) * angleRange;
|
|
47
|
+
const sectorPadding = Math.min(Math.max(padding, 0), Math.abs(sectorAngle) / 2);
|
|
48
|
+
const nodeStartAngle = startAngle + d.x0 * angleRange + sectorPadding / 2;
|
|
49
|
+
const nodeEndAngle = startAngle + d.x1 * angleRange - sectorPadding / 2;
|
|
46
50
|
const nodeInnerRadius = innerRadius + d.y0 * radiusRange + ringPadding / 2;
|
|
47
51
|
const nodeOuterRadius = innerRadius + d.y1 * radiusRange - ringPadding / 2;
|
|
48
52
|
if (nodeEndAngle <= nodeStartAngle || nodeOuterRadius <= nodeInnerRadius) return;
|
|
@@ -54,11 +58,12 @@ function computeSunburstLayout(options) {
|
|
|
54
58
|
startAngle: nodeStartAngle,
|
|
55
59
|
endAngle: nodeEndAngle,
|
|
56
60
|
depth: d.depth,
|
|
57
|
-
name: d.data
|
|
61
|
+
name: getValueByDataKey(d.data, nameKey, ""),
|
|
58
62
|
value: d.value ?? 0,
|
|
59
63
|
fill: d.data.fill,
|
|
60
64
|
payload: d.data,
|
|
61
|
-
tooltipIndex: buildTooltipIndex(d)
|
|
65
|
+
tooltipIndex: buildTooltipIndex(d),
|
|
66
|
+
path: d.ancestors().reverse().slice(1).map((a) => String(getValueByDataKey(a.data, nameKey, ""))).join("\0")
|
|
62
67
|
});
|
|
63
68
|
});
|
|
64
69
|
return nodes;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { toFiniteNumber } from "../utils/validate.mjs";
|
|
2
|
+
import { getValueByDataKey } from "../utils/chart.mjs";
|
|
1
3
|
import { hierarchy, treemap, treemapSquarify } from "d3-hierarchy";
|
|
2
4
|
//#region src/chart/treemapUtils.ts
|
|
3
5
|
function computeTreemapLayout(options) {
|
|
4
|
-
const { data, width, height, dataKey,
|
|
6
|
+
const { data, width, height, dataKey, tileAspectRatio = 4 / 3, nameKey = "name", colors } = options;
|
|
5
7
|
if (!data || data.length === 0 || width <= 0 || height <= 0) return [];
|
|
6
8
|
const root = hierarchy({ children: data }).sum((d) => {
|
|
7
|
-
if (d.children && d.children.length > 0) return 0;
|
|
8
|
-
const val = d
|
|
9
|
-
return
|
|
9
|
+
if (Array.isArray(d.children) && d.children.length > 0) return 0;
|
|
10
|
+
const val = toFiniteNumber(getValueByDataKey(d, dataKey));
|
|
11
|
+
return val != null && val > 0 ? val : 0;
|
|
10
12
|
}).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
|
|
11
|
-
treemap().size([width, height]).tile(treemapSquarify.ratio(
|
|
12
|
-
return root.leaves().map((leaf) => {
|
|
13
|
+
return treemap().size([width, height]).tile(treemapSquarify.ratio(tileAspectRatio)).round(true)(root).leaves().map((leaf) => {
|
|
13
14
|
const d = leaf.data;
|
|
14
15
|
let ancestor = leaf;
|
|
15
16
|
while (ancestor.depth > 1 && ancestor.parent) ancestor = ancestor.parent;
|
|
@@ -20,11 +21,12 @@ function computeTreemapLayout(options) {
|
|
|
20
21
|
width: leaf.x1 - leaf.x0,
|
|
21
22
|
height: leaf.y1 - leaf.y0,
|
|
22
23
|
depth: leaf.depth,
|
|
23
|
-
name: d
|
|
24
|
+
name: getValueByDataKey(d, nameKey, ""),
|
|
24
25
|
value: leaf.value ?? 0,
|
|
25
26
|
payload: d,
|
|
26
27
|
root: rootIndex,
|
|
27
|
-
|
|
28
|
+
entryIndex: data.indexOf(ancestor.data),
|
|
29
|
+
color: colors ? colors[rootIndex % colors.length] : void 0
|
|
28
30
|
};
|
|
29
31
|
});
|
|
30
32
|
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
//#region src/componentNames.ts
|
|
2
|
+
var componentNames = [
|
|
3
|
+
"Area",
|
|
4
|
+
"AreaChart",
|
|
5
|
+
"Bar",
|
|
6
|
+
"BarChart",
|
|
7
|
+
"BarList",
|
|
8
|
+
"Brush",
|
|
9
|
+
"CalendarHeatmap",
|
|
10
|
+
"CartesianAxis",
|
|
11
|
+
"CartesianGrid",
|
|
12
|
+
"Cell",
|
|
13
|
+
"CohortChart",
|
|
14
|
+
"ComposedChart",
|
|
15
|
+
"Cross",
|
|
16
|
+
"Curve",
|
|
17
|
+
"Customized",
|
|
18
|
+
"Dot",
|
|
19
|
+
"ErrorBar",
|
|
20
|
+
"Funnel",
|
|
21
|
+
"FunnelChart",
|
|
22
|
+
"Heatmap",
|
|
23
|
+
"JourneySankey",
|
|
24
|
+
"Label",
|
|
25
|
+
"LabelList",
|
|
26
|
+
"Legend",
|
|
27
|
+
"Line",
|
|
28
|
+
"LineChart",
|
|
29
|
+
"Pie",
|
|
30
|
+
"PieChart",
|
|
31
|
+
"PolarAngleAxis",
|
|
32
|
+
"PolarGrid",
|
|
33
|
+
"PolarRadiusAxis",
|
|
34
|
+
"Polygon",
|
|
35
|
+
"Radar",
|
|
36
|
+
"RadarChart",
|
|
37
|
+
"RadialBar",
|
|
38
|
+
"RadialBarChart",
|
|
39
|
+
"Rectangle",
|
|
40
|
+
"ReferenceArea",
|
|
41
|
+
"ReferenceDot",
|
|
42
|
+
"ReferenceLine",
|
|
43
|
+
"ResponsiveContainer",
|
|
44
|
+
"Sankey",
|
|
45
|
+
"Scatter",
|
|
46
|
+
"ScatterChart",
|
|
47
|
+
"Sector",
|
|
48
|
+
"Sparkline",
|
|
49
|
+
"SunburstChart",
|
|
50
|
+
"Symbols",
|
|
51
|
+
"Text",
|
|
52
|
+
"Tooltip",
|
|
53
|
+
"Tracker",
|
|
54
|
+
"Trapezoid",
|
|
55
|
+
"Treemap",
|
|
56
|
+
"XAxis",
|
|
57
|
+
"YAxis",
|
|
58
|
+
"ZAxis"
|
|
59
|
+
];
|
|
60
|
+
var composableNames = [
|
|
61
|
+
"useActiveTooltipCoordinate",
|
|
62
|
+
"useActiveTooltipDataPoints",
|
|
63
|
+
"useActiveTooltipLabel",
|
|
64
|
+
"useCartesianScale",
|
|
65
|
+
"useChartHeight",
|
|
66
|
+
"useChartWidth",
|
|
67
|
+
"useIsTooltipActive",
|
|
68
|
+
"useMargin",
|
|
69
|
+
"usePlotArea",
|
|
70
|
+
"useXAxisDomain",
|
|
71
|
+
"useXAxisInverseDataSnapScale",
|
|
72
|
+
"useXAxisInverseScale",
|
|
73
|
+
"useXAxisInverseTickSnapScale",
|
|
74
|
+
"useXAxisScale",
|
|
75
|
+
"useXAxisTicks",
|
|
76
|
+
"useYAxisDomain",
|
|
77
|
+
"useYAxisInverseDataSnapScale",
|
|
78
|
+
"useYAxisInverseScale",
|
|
79
|
+
"useYAxisInverseTickSnapScale",
|
|
80
|
+
"useYAxisScale",
|
|
81
|
+
"useYAxisTicks"
|
|
82
|
+
];
|
|
83
|
+
//#endregion
|
|
84
|
+
export { componentNames, composableNames };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { forwardsSvgAttributes } from "../utils/attributes.mjs";
|
|
1
2
|
import { defineComponent } from "vue";
|
|
2
3
|
//#region src/components/Cell.tsx
|
|
3
4
|
/**
|
|
@@ -12,12 +13,12 @@ import { defineComponent } from "vue";
|
|
|
12
13
|
* </Bar>
|
|
13
14
|
* ```
|
|
14
15
|
*/
|
|
15
|
-
var Cell = /* @__PURE__ */ defineComponent({
|
|
16
|
+
var Cell = /* @__PURE__ */ forwardsSvgAttributes(/* @__PURE__ */ defineComponent({
|
|
16
17
|
name: "Cell",
|
|
17
18
|
inheritAttrs: false,
|
|
18
19
|
setup() {
|
|
19
20
|
return () => null;
|
|
20
21
|
}
|
|
21
|
-
});
|
|
22
|
+
}));
|
|
22
23
|
//#endregion
|
|
23
24
|
export { Cell };
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useChartHeight, useChartWidth } from "../context/chartLayoutContext.mjs";
|
|
1
|
+
import { useChartPresentation } from "../model/presentation.mjs";
|
|
2
|
+
import { warnOnce } from "../utils/log.mjs";
|
|
3
|
+
import { useChart } from "../model/chart.mjs";
|
|
5
4
|
import { computed, defineComponent } from "vue";
|
|
6
5
|
//#region src/components/Customized.tsx
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated Use the chart's default slot with `usePlotArea()` and the other chart composables.
|
|
8
|
+
* Removed in 2.0 (see internals/migrations.md).
|
|
9
|
+
*/
|
|
7
10
|
var Customized = /* @__PURE__ */ defineComponent({
|
|
8
11
|
name: "Customized",
|
|
9
12
|
inheritAttrs: false,
|
|
10
13
|
slots: Object,
|
|
11
14
|
setup(_props, { slots }) {
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
15
|
+
warnOnce("[vccs] Customized is deprecated and will be removed in 2.0. Use the chart's default slot with usePlotArea() and the other chart composables.");
|
|
16
|
+
const chart = useChart();
|
|
17
|
+
const chartWidth = useChartPresentation().width;
|
|
18
|
+
const chartHeight = useChartPresentation().height;
|
|
19
|
+
const offset = chart.offset;
|
|
20
|
+
const cartesianItems = chart.items.cartesian.entries;
|
|
21
|
+
const polarItems = chart.items.polar.entries;
|
|
17
22
|
const formattedGraphicalItems = computed(() => {
|
|
18
23
|
const items = [];
|
|
19
24
|
for (const item of cartesianItems.value) items.push({
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { useCanMeasureText } from "../model/runtime.mjs";
|
|
2
|
+
import { svgAttrs } from "../utils/VueUtils.mjs";
|
|
1
3
|
import { getStringSize } from "../utils/attrs.mjs";
|
|
2
4
|
import { reduceCSSCalc } from "../utils/ReduceCSSCalc.mjs";
|
|
3
|
-
import { Fragment, computed, createElementBlock, defineComponent,
|
|
5
|
+
import { Fragment, computed, createElementBlock, defineComponent, mergeProps, openBlock, renderList, renderSlot, toDisplayString, useAttrs } from "vue";
|
|
4
6
|
//#region src/components/Text.vue?vue&type=script&setup=true&lang.ts
|
|
5
7
|
var _hoisted_1 = [
|
|
6
8
|
"x",
|
|
@@ -10,7 +12,8 @@ var _hoisted_1 = [
|
|
|
10
12
|
"fill"
|
|
11
13
|
];
|
|
12
14
|
var _hoisted_2 = ["x", "dy"];
|
|
13
|
-
var Text_vue_vue_type_script_setup_true_lang_default =
|
|
15
|
+
var Text_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
|
|
16
|
+
inheritAttrs: false,
|
|
14
17
|
__name: "Text",
|
|
15
18
|
props: {
|
|
16
19
|
x: {
|
|
@@ -51,7 +54,7 @@ var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
51
54
|
},
|
|
52
55
|
fill: {
|
|
53
56
|
type: String,
|
|
54
|
-
default: "#808080"
|
|
57
|
+
default: "var(--v-charts-text, #808080)"
|
|
55
58
|
},
|
|
56
59
|
angle: {
|
|
57
60
|
type: Number,
|
|
@@ -80,6 +83,9 @@ var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
80
83
|
},
|
|
81
84
|
setup(__props) {
|
|
82
85
|
const props = __props;
|
|
86
|
+
const attrs = useAttrs();
|
|
87
|
+
const elementAttrs = computed(() => svgAttrs(attrs));
|
|
88
|
+
const canMeasureText = useCanMeasureText();
|
|
83
89
|
const BREAKING_SPACES = /[ \f\n\r\t\v\u2028\u2029]+/;
|
|
84
90
|
function calculateWordWidths(children, breakAll, style) {
|
|
85
91
|
let words = [];
|
|
@@ -87,9 +93,9 @@ var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
87
93
|
return {
|
|
88
94
|
wordsWithComputedWidth: words.map((word) => ({
|
|
89
95
|
word,
|
|
90
|
-
width: getStringSize(word, style).width
|
|
96
|
+
width: getStringSize(word, style, canMeasureText.value).width
|
|
91
97
|
})),
|
|
92
|
-
spaceWidth: breakAll ? 0 : getStringSize("\xA0", style).width
|
|
98
|
+
spaceWidth: breakAll ? 0 : getStringSize("\xA0", style, canMeasureText.value).width
|
|
93
99
|
};
|
|
94
100
|
}
|
|
95
101
|
function calculateWordsByLines(maxLines, value, style, breakAll, initialWordsWithComputedWidth, spaceWidth, lineWidth, scaleToFit) {
|
|
@@ -169,21 +175,21 @@ var Text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineCom
|
|
|
169
175
|
return arr.join(" ");
|
|
170
176
|
});
|
|
171
177
|
return (_ctx, _cache) => {
|
|
172
|
-
return openBlock(), createElementBlock("text", {
|
|
178
|
+
return openBlock(), createElementBlock("text", mergeProps(elementAttrs.value, {
|
|
173
179
|
x: x.value,
|
|
174
180
|
y: y.value,
|
|
175
181
|
transform: transforms.value || void 0,
|
|
176
182
|
"text-anchor": props.textAnchor,
|
|
177
|
-
fill: props.fill && props.fill.includes("url") ? "#808080" : props.fill,
|
|
183
|
+
fill: props.fill && props.fill.includes("url") ? "var(--v-charts-text, #808080)" : props.fill,
|
|
178
184
|
class: "v-charts-text",
|
|
179
|
-
style:
|
|
180
|
-
}, [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(wordsByLines.value, (line, index) => {
|
|
185
|
+
style: props.style
|
|
186
|
+
}), [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(wordsByLines.value, (line, index) => {
|
|
181
187
|
return openBlock(), createElementBlock("tspan", {
|
|
182
188
|
key: index,
|
|
183
189
|
x: x.value,
|
|
184
190
|
dy: index === 0 ? startDy.value : props.lineHeight
|
|
185
191
|
}, toDisplayString(line.words.join(props.breakAll ? "" : " ")), 9, _hoisted_2);
|
|
186
|
-
}), 128))])],
|
|
192
|
+
}), 128))])], 16, _hoisted_1);
|
|
187
193
|
};
|
|
188
194
|
}
|
|
189
195
|
});
|
|
@@ -1,40 +1,22 @@
|
|
|
1
|
-
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
-
import { useViewBox } from "../../context/chartLayoutContext.mjs";
|
|
3
1
|
import { LabelVueProps } from "./types.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
2
|
+
import { LabelView } from "./LabelView.mjs";
|
|
3
|
+
import { forwardsSvgAttributes } from "../../utils/attributes.mjs";
|
|
4
|
+
import { defineComponent, h } from "vue";
|
|
8
5
|
//#region src/components/label/Label.tsx
|
|
9
|
-
var Label = /* @__PURE__ */ defineComponent({
|
|
6
|
+
var Label = /* @__PURE__ */ forwardsSvgAttributes(/* @__PURE__ */ defineComponent({
|
|
10
7
|
name: "Label",
|
|
11
8
|
props: LabelVueProps,
|
|
9
|
+
inheritAttrs: false,
|
|
12
10
|
slots: Object,
|
|
13
|
-
setup(props, {
|
|
14
|
-
const viewBoxFromContext = useViewBox();
|
|
15
|
-
const polarLabelViewBox = usePolarLabelViewBox();
|
|
11
|
+
setup(props, { attrs, slots }) {
|
|
16
12
|
return () => {
|
|
17
|
-
const {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
...props,
|
|
23
|
-
viewBox
|
|
24
|
-
});
|
|
25
|
-
let label = value;
|
|
26
|
-
if (typeof formatter === "function") label = formatter(label);
|
|
27
|
-
if (isPolarLabel && (position === "insideStart" || position === "insideEnd" || position === "end")) return renderRadialLabel(props, position, label, attrs, viewBox);
|
|
28
|
-
const positionAttrs = isPolarLabel ? getAttrsOfPolarLabel(props, viewBox) : getAttrsOfCartesianLabel(props, viewBox);
|
|
29
|
-
const textAnchor = attrs.textAnchor != null && (attrs.textAnchor === "start" || attrs.textAnchor === "middle" || attrs.textAnchor === "end") ? attrs.textAnchor : positionAttrs.textAnchor;
|
|
30
|
-
return createVNode(Text_default, mergeProps({ "class": ["v-charts-label", props.class] }, attrs, positionAttrs, {
|
|
31
|
-
"textAnchor": textAnchor,
|
|
32
|
-
"angle": props.angle,
|
|
33
|
-
"breakAll": textBreakAll,
|
|
34
|
-
"value": label
|
|
35
|
-
}), null);
|
|
13
|
+
const { parentViewBox: _parentViewBox, "parent-view-box": _parentBox, index: _index, ...svgAttrs } = attrs;
|
|
14
|
+
return h(LabelView, {
|
|
15
|
+
...svgAttrs,
|
|
16
|
+
...props
|
|
17
|
+
}, slots);
|
|
36
18
|
};
|
|
37
19
|
}
|
|
38
|
-
});
|
|
20
|
+
}));
|
|
39
21
|
//#endregion
|
|
40
22
|
export { Label };
|
|
@@ -1,55 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { getValueByDataKey } from "../../utils/chart.mjs";
|
|
3
|
-
import { Layer } from "../../container/Layer.mjs";
|
|
1
|
+
import { useDeferredView } from "../../hooks/deferredView.mjs";
|
|
4
2
|
import { LabelListVueProps } from "./types.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useCartesianLabelListData } from "../../context/cartesianLabelListContext.mjs";
|
|
9
|
-
import { Teleport, createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
3
|
+
import { LabelListView } from "./LabelListView.mjs";
|
|
4
|
+
import { forwardsSvgAttributes } from "../../utils/attributes.mjs";
|
|
5
|
+
import { defineComponent, h } from "vue";
|
|
10
6
|
//#region src/components/label/LabelList.tsx
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
var LabelList = /* @__PURE__ */ defineComponent({
|
|
7
|
+
var LabelList = /* @__PURE__ */ forwardsSvgAttributes(/* @__PURE__ */ defineComponent({
|
|
8
|
+
name: "LabelList",
|
|
15
9
|
props: LabelListVueProps,
|
|
10
|
+
slots: Object,
|
|
16
11
|
setup(props, { attrs, slots }) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const data = props.data ?? contextData?.value;
|
|
23
|
-
if (!data || !data.length) return null;
|
|
24
|
-
const content = createVNode(Layer, { "class": "v-charts-label-list" }, _isSlot(_slot = data.map((entry, index) => {
|
|
25
|
-
const value = isNullish(dataKey) ? valueAccessor(entry, index) : getValueByDataKey(entry && entry.payload, dataKey);
|
|
26
|
-
const idProps = isNullish(id) ? void 0 : `${id}-${index}`;
|
|
27
|
-
const viewBox = parseViewBox(isNullish(clockWise) ? entry : {
|
|
28
|
-
...entry,
|
|
29
|
-
clockWise
|
|
30
|
-
});
|
|
31
|
-
if (slots.label) return slots.label({
|
|
32
|
-
...others,
|
|
33
|
-
...attrs,
|
|
34
|
-
...viewBox,
|
|
35
|
-
value,
|
|
36
|
-
index,
|
|
37
|
-
key: `label-${index}`
|
|
38
|
-
});
|
|
39
|
-
const entryFill = entry.fill != null && !("fill" in others) && !("fill" in attrs) ? entry.fill : void 0;
|
|
40
|
-
return createVNode(Label, mergeProps(others, attrs, entryFill != null ? { fill: entryFill } : {}, {
|
|
41
|
-
"id": idProps,
|
|
42
|
-
"parentViewBox": entry.parentViewBox,
|
|
43
|
-
"value": value,
|
|
44
|
-
"viewBox": viewBox,
|
|
45
|
-
"key": `label-${index}`,
|
|
46
|
-
"index": index
|
|
47
|
-
}), null);
|
|
48
|
-
})) ? _slot : { default: () => [_slot] });
|
|
49
|
-
if (labelLayerRef?.value) return createVNode(Teleport, { "to": labelLayerRef.value }, _isSlot(content) ? content : { default: () => [content] });
|
|
50
|
-
return content;
|
|
51
|
-
};
|
|
12
|
+
const View = useDeferredView(LabelListView);
|
|
13
|
+
return () => h(View, {
|
|
14
|
+
item: props,
|
|
15
|
+
svgAttrs: attrs
|
|
16
|
+
}, slots);
|
|
52
17
|
}
|
|
53
|
-
});
|
|
18
|
+
}));
|
|
54
19
|
//#endregion
|
|
55
20
|
export { LabelList };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { useLayerTeleport } from "../../hooks/useLayerTeleport.mjs";
|
|
3
|
+
import { useChartLayer } from "../../model/runtime.mjs";
|
|
4
|
+
import { Layer } from "../../container/Layer.mjs";
|
|
5
|
+
import { getValueByDataKey } from "../../utils/chart.mjs";
|
|
6
|
+
import { parseViewBox } from "./utils.mjs";
|
|
7
|
+
import { LabelView } from "./LabelView.mjs";
|
|
8
|
+
import { useCartesianLabelListData } from "../../context/cartesianLabelListContext.mjs";
|
|
9
|
+
import { createVNode, defineComponent, isVNode, mergeProps } from "vue";
|
|
10
|
+
//#region src/components/label/LabelListView.tsx
|
|
11
|
+
function _isSlot(s) {
|
|
12
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
13
|
+
}
|
|
14
|
+
var LabelListView = /* @__PURE__ */ defineComponent({
|
|
15
|
+
name: "LabelListView",
|
|
16
|
+
inheritAttrs: true,
|
|
17
|
+
props: {
|
|
18
|
+
item: {
|
|
19
|
+
type: Object,
|
|
20
|
+
required: true
|
|
21
|
+
},
|
|
22
|
+
svgAttrs: {
|
|
23
|
+
type: Object,
|
|
24
|
+
required: true
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
setup(view, { slots }) {
|
|
28
|
+
const teleport = useLayerTeleport();
|
|
29
|
+
const labelLayerRef = useChartLayer("label");
|
|
30
|
+
const contextData = useCartesianLabelListData(null);
|
|
31
|
+
return () => {
|
|
32
|
+
let _slot;
|
|
33
|
+
const props = view.item;
|
|
34
|
+
const attrs = view.svgAttrs;
|
|
35
|
+
const { dataKey, valueAccessor, clockWise, id, formatter, ...others } = props;
|
|
36
|
+
const data = props.data ?? contextData?.value;
|
|
37
|
+
if (!data || !data.length) return null;
|
|
38
|
+
const content = createVNode(Layer, { "class": "v-charts-label-list" }, _isSlot(_slot = data.map((entry, index) => {
|
|
39
|
+
const raw = isNullish(dataKey) ? valueAccessor(entry, index) : getValueByDataKey(entry && entry.payload, dataKey);
|
|
40
|
+
const text = typeof raw === "number" || typeof raw === "string" ? raw : void 0;
|
|
41
|
+
const idProps = isNullish(id) ? void 0 : `${id}-${index}`;
|
|
42
|
+
const viewBox = parseViewBox(isNullish(clockWise) ? entry : {
|
|
43
|
+
...entry,
|
|
44
|
+
clockWise
|
|
45
|
+
});
|
|
46
|
+
const entryOpacity = typeof entry.opacity === "number" ? { opacity: entry.opacity } : void 0;
|
|
47
|
+
const contentSlot = slots.content ?? slots.label;
|
|
48
|
+
if (contentSlot) return contentSlot({
|
|
49
|
+
...others,
|
|
50
|
+
formatter,
|
|
51
|
+
...attrs,
|
|
52
|
+
...entryOpacity,
|
|
53
|
+
...viewBox,
|
|
54
|
+
value: formatter ? raw : text,
|
|
55
|
+
index,
|
|
56
|
+
key: `label-${String(entry.key ?? index)}`
|
|
57
|
+
});
|
|
58
|
+
const entryFill = entry.fill != null && !("fill" in others) && !("fill" in attrs) ? entry.fill : void 0;
|
|
59
|
+
return createVNode(LabelView, mergeProps(others, attrs, entryFill != null ? { fill: entryFill } : {}, entryOpacity, {
|
|
60
|
+
"id": idProps,
|
|
61
|
+
"parentViewBox": entry.parentViewBox,
|
|
62
|
+
"value": formatter ? formatter(raw) : text,
|
|
63
|
+
"viewBox": viewBox,
|
|
64
|
+
"key": `label-${String(entry.key ?? index)}`,
|
|
65
|
+
"index": index
|
|
66
|
+
}), null);
|
|
67
|
+
})) ? _slot : { default: () => [_slot] });
|
|
68
|
+
return teleport(content, labelLayerRef);
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
//#endregion
|
|
73
|
+
export { LabelListView };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { isNullish } from "../../utils/validate.mjs";
|
|
2
|
+
import { useChartPresentation } from "../../model/presentation.mjs";
|
|
3
|
+
import { useChartId } from "../../hooks/useChartId.mjs";
|
|
4
|
+
import { LabelViewVueProps } from "./types.mjs";
|
|
5
|
+
import { usePolarLabelViewBox } from "../../context/polarLabelViewBoxContext.mjs";
|
|
6
|
+
import { getAttrsOfCartesianLabel, getAttrsOfPolarLabel, isPolar, normalizeViewBox, renderRadialLabel } from "./utils.mjs";
|
|
7
|
+
import Text_default from "../Text.mjs";
|
|
8
|
+
import { createVNode, defineComponent, mergeProps } from "vue";
|
|
9
|
+
//#region src/components/label/LabelView.tsx
|
|
10
|
+
var LabelView = /* @__PURE__ */ defineComponent({
|
|
11
|
+
name: "LabelView",
|
|
12
|
+
props: LabelViewVueProps,
|
|
13
|
+
slots: Object,
|
|
14
|
+
setup(props, { slots, attrs }) {
|
|
15
|
+
const radialLabelId = useChartId("v-charts-radial-line");
|
|
16
|
+
const viewBoxFromContext = useChartPresentation().viewBox;
|
|
17
|
+
const polarLabelViewBox = usePolarLabelViewBox();
|
|
18
|
+
return () => {
|
|
19
|
+
const { viewBox: viewBoxFromProps, value, position, textBreakAll, formatter } = props;
|
|
20
|
+
const source = viewBoxFromProps || polarLabelViewBox.value || viewBoxFromContext.value;
|
|
21
|
+
if (!source || isNullish(value) && !slots.content) return null;
|
|
22
|
+
const viewBox = normalizeViewBox(source);
|
|
23
|
+
if (slots.content) return slots.content({
|
|
24
|
+
...props,
|
|
25
|
+
viewBox
|
|
26
|
+
});
|
|
27
|
+
let label = value;
|
|
28
|
+
if (typeof formatter === "function") label = formatter(label);
|
|
29
|
+
if (isPolar(viewBox) && (position === "insideStart" || position === "insideEnd" || position === "end")) return renderRadialLabel(props, position, label, attrs, viewBox, radialLabelId);
|
|
30
|
+
const positionAttrs = isPolar(viewBox) ? getAttrsOfPolarLabel(props, viewBox) : getAttrsOfCartesianLabel(props, viewBox);
|
|
31
|
+
const textAnchor = attrs.textAnchor != null && (attrs.textAnchor === "start" || attrs.textAnchor === "middle" || attrs.textAnchor === "end") ? attrs.textAnchor : positionAttrs.textAnchor;
|
|
32
|
+
return createVNode(Text_default, mergeProps({
|
|
33
|
+
"data-slot": "label",
|
|
34
|
+
"class": ["v-charts-label", props.class]
|
|
35
|
+
}, attrs, positionAttrs, {
|
|
36
|
+
"textAnchor": textAnchor,
|
|
37
|
+
"angle": props.angle,
|
|
38
|
+
"breakAll": textBreakAll,
|
|
39
|
+
"value": label
|
|
40
|
+
}), null);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
export { LabelView };
|