@fundar/data-chart-telling 0.0.64 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/LICENSE +21 -0
- package/README.md +81 -561
- package/dist/configuration/config.svelte.d.ts +5 -5
- package/dist/configuration/config.svelte.js +130 -46
- package/dist/configuration/fonts.d.ts +6 -0
- package/dist/configuration/fonts.js +6 -0
- package/dist/configuration/themes/compact.d.ts +2 -2
- package/dist/configuration/themes/compact.js +1 -1
- package/dist/configuration/themes/dark.d.ts +2 -2
- package/dist/configuration/themes/dark.js +5 -4
- package/dist/configuration/themes/default.d.ts +8 -3
- package/dist/configuration/themes/default.js +8 -2
- package/dist/configuration/themes/editorial.d.ts +2 -2
- package/dist/configuration/themes/editorial.js +2 -2
- package/dist/configuration/themes/index.d.ts +421 -80
- package/dist/configuration/themes/index.js +6 -5
- package/dist/index.d.ts +34 -48
- package/dist/index.js +19 -35
- package/dist/layout/base/BasePlotLayout.svelte +312 -0
- package/dist/layout/base/BasePlotLayout.svelte.d.ts +111 -0
- package/dist/layout/composer/PlotComposer.svelte +94 -0
- package/dist/layout/composer/PlotComposer.svelte.d.ts +13 -0
- package/dist/layout/coordinates/CameraFit.svelte +4 -4
- package/dist/layout/coordinates/CoordinatesLayout.svelte +11 -3
- package/dist/layout/coordinates/CoordinatesLayout.svelte.d.ts +6 -2
- package/dist/layout/coordinates/camera.svelte.d.ts +1 -1
- package/dist/layout/coordinates/camera.svelte.js +6 -6
- package/dist/layout/coordinates/projections/argentina.js +3 -3
- package/dist/layout/coordinates/projections/fit.js +1 -1
- package/dist/layout/coordinates/resolveCameraTarget.d.ts +1 -1
- package/dist/layout/coordinates/resolveProjection.d.ts +1 -1
- package/dist/layout/coordinates/resolveProjection.js +2 -2
- package/dist/layout/coordinates/rotate.svelte.d.ts +3 -3
- package/dist/layout/coordinates/rotate.svelte.js +8 -8
- package/dist/layout/coordinates/zoom.svelte.d.ts +1 -1
- package/dist/layout/facet/FacetIndicator.svelte +23 -23
- package/dist/layout/facet/FacetLayout.svelte +435 -398
- package/dist/layout/facet/FacetLayout.svelte.d.ts +9 -3
- package/dist/layout/facet/axes.d.ts +16 -0
- package/dist/layout/facet/axes.js +25 -0
- package/dist/layout/facet/config.d.ts +32 -0
- package/dist/layout/facet/config.js +82 -0
- package/dist/layout/figure/Figure.svelte +177 -0
- package/dist/layout/figure/Figure.svelte.d.ts +14 -0
- package/dist/layout/figure/FigureChrome.svelte +341 -0
- package/dist/layout/figure/FigureChrome.svelte.d.ts +21 -0
- package/dist/layout/geometry/FrameClip.svelte +45 -0
- package/dist/layout/geometry/FrameClip.svelte.d.ts +8 -0
- package/dist/layout/geometry/FrameClipping.d.ts +24 -0
- package/dist/layout/geometry/FrameClipping.js +40 -0
- package/dist/layout/geometry/GeometryLayout.svelte +287 -224
- package/dist/layout/geometry/GeometryLayout.svelte.d.ts +10 -10
- package/dist/layout/grid/Grid.svelte +194 -0
- package/dist/layout/grid/Grid.svelte.d.ts +26 -0
- package/dist/layout/grid/GridAlignment.svelte.d.ts +31 -0
- package/dist/layout/grid/GridAlignment.svelte.js +56 -0
- package/dist/layout/grid/GridCell.svelte +141 -0
- package/dist/layout/grid/GridCell.svelte.d.ts +17 -0
- package/dist/layout/grid/GridCellsRegistry.svelte.d.ts +52 -0
- package/dist/layout/grid/GridCellsRegistry.svelte.js +70 -0
- package/dist/layout/grid/GridPlan.d.ts +49 -0
- package/dist/layout/grid/GridPlan.js +167 -0
- package/dist/layout/grid/Tags.d.ts +8 -0
- package/dist/layout/grid/Tags.js +39 -0
- package/dist/layout/hover/HoverScope.svelte +11 -0
- package/dist/layout/hover/HoverScope.svelte.d.ts +8 -0
- package/dist/layout/hover/HoverSettings.d.ts +20 -0
- package/dist/layout/hover/HoverSettings.js +27 -0
- package/dist/layout/hover/HoverState.svelte.d.ts +47 -0
- package/dist/layout/hover/HoverState.svelte.js +99 -0
- package/dist/layout/hover/PlotHover.svelte.d.ts +63 -0
- package/dist/layout/hover/PlotHover.svelte.js +133 -0
- package/dist/layout/interaction/PlotInteraction.svelte.d.ts +38 -0
- package/dist/layout/interaction/PlotInteraction.svelte.js +56 -0
- package/dist/layout/legend/AxisNumberFormat.d.ts +12 -0
- package/dist/layout/legend/AxisNumberFormat.js +25 -0
- package/dist/layout/legend/ContinuousSection.svelte +363 -351
- package/dist/layout/legend/DisabledStyle.d.ts +19 -0
- package/dist/layout/legend/DisabledStyle.js +57 -0
- package/dist/layout/legend/DiscreteBadgeItem.svelte +6 -3
- package/dist/layout/legend/DiscreteSection.svelte +32 -32
- package/dist/layout/legend/DiscreteSwatchItem.svelte +4 -1
- package/dist/layout/legend/DiscreteSymbolIcon.svelte +14 -9
- package/dist/layout/legend/LegendChannels.d.ts +21 -0
- package/dist/layout/legend/LegendChannels.js +221 -0
- package/dist/layout/legend/LegendLayout.svelte +49 -43
- package/dist/layout/legend/LegendState.svelte.d.ts +79 -0
- package/dist/layout/legend/LegendState.svelte.js +329 -0
- package/dist/layout/legend/LegendText.d.ts +12 -0
- package/dist/layout/legend/LegendText.js +22 -0
- package/dist/layout/legend/SizeSection.svelte +84 -0
- package/dist/layout/legend/SizeSection.svelte.d.ts +7 -0
- package/dist/layout/legend/SymbolSection.svelte +31 -0
- package/dist/layout/legend/SymbolSection.svelte.d.ts +8 -0
- package/dist/layout/margins/Box.d.ts +84 -0
- package/dist/layout/margins/Box.js +138 -0
- package/dist/layout/margins/Margins.d.ts +37 -0
- package/dist/layout/margins/Margins.js +71 -0
- package/dist/layout/margins/PlotMargins.svelte.d.ts +101 -0
- package/dist/layout/margins/PlotMargins.svelte.js +219 -0
- package/dist/layout/plot/Core.svelte +61 -0
- package/dist/layout/plot/Core.svelte.d.ts +41 -0
- package/dist/layout/plot/PanelRun.svelte +28 -0
- package/dist/{charts/heatmap/Chart.svelte.d.ts → layout/plot/PanelRun.svelte.d.ts} +11 -7
- package/dist/layout/plot/Plot.svelte +284 -0
- package/dist/layout/plot/Plot.svelte.d.ts +49 -0
- package/dist/layout/plot/PlotContext.d.ts +41 -0
- package/dist/layout/plot/PlotContext.js +46 -0
- package/dist/layout/plot/PublicPlotContext.d.ts +130 -0
- package/dist/layout/plot/PublicPlotContext.js +236 -0
- package/dist/layout/plot/Slice.d.ts +44 -0
- package/dist/layout/plot/Slice.js +98 -0
- package/dist/layout/plot/usePlot.d.ts +9 -0
- package/dist/layout/plot/usePlot.js +13 -0
- package/dist/layout/scales/ScalesLayout.svelte +241 -206
- package/dist/layout/scales/ScalesLayout.svelte.d.ts +2 -1
- package/dist/layout/scales/buildScale.d.ts +5 -22
- package/dist/layout/scales/buildScale.js +11 -34
- package/dist/layout/scales/niceDomain.d.ts +3 -3
- package/dist/layout/scales/niceDomain.js +4 -4
- package/dist/layout/styles/StylesLayout.svelte +65 -65
- package/dist/layout/styles/TileLayer.svelte +78 -76
- package/dist/layout/styles/TileLayer.svelte.d.ts +1 -1
- package/dist/layout/styles/ValueLabels.d.ts +97 -0
- package/dist/layout/styles/ValueLabels.js +237 -0
- package/dist/layout/timeline/Timeline.svelte +80 -74
- package/dist/layout/timeline/TimelineFrame.svelte +86 -0
- package/dist/layout/timeline/TimelineFrame.svelte.d.ts +16 -0
- package/dist/layout/timeline/TimelineLayout.svelte +114 -169
- package/dist/layout/timeline/TimelineLayout.svelte.d.ts +2 -0
- package/dist/layout/timeline/TimelinePlayer.svelte +195 -0
- package/dist/layout/timeline/TimelinePlayer.svelte.d.ts +7 -0
- package/dist/layout/timeline/TimelineRule.svelte +50 -0
- package/dist/layout/timeline/TimelineRule.svelte.d.ts +7 -0
- package/dist/layout/timeline/TimelineState.svelte.d.ts +82 -0
- package/dist/layout/timeline/TimelineState.svelte.js +226 -0
- package/dist/layout/timeline/TimelineSteps.d.ts +24 -0
- package/dist/layout/timeline/TimelineSteps.js +48 -0
- package/dist/layout/tooltip/Tooltip.svelte +82 -85
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +43 -24
- package/dist/layout/tooltip/TooltipState.svelte.d.ts +61 -0
- package/dist/layout/tooltip/TooltipState.svelte.js +107 -0
- package/dist/markers/MarkerKinds.d.ts +173 -0
- package/dist/markers/MarkerKinds.js +51 -0
- package/dist/markers/area/AreaMarker.svelte +110 -0
- package/dist/markers/area/AreaMarker.svelte.d.ts +7 -0
- package/dist/markers/arrow/ArrowMarker.svelte +28 -0
- package/dist/markers/arrow/ArrowMarker.svelte.d.ts +7 -0
- package/dist/markers/{BarMarker.svelte → bar/BarMarker.svelte} +54 -52
- package/dist/markers/{BarMarker.svelte.d.ts → bar/BarMarker.svelte.d.ts} +1 -1
- package/dist/markers/bollinger/BollingerMarker.svelte +44 -0
- package/dist/markers/bollinger/BollingerMarker.svelte.d.ts +7 -0
- package/dist/markers/box/BoxMarker.svelte +143 -0
- package/dist/markers/box/BoxMarker.svelte.d.ts +7 -0
- package/dist/markers/brush/BrushMarker.svelte +32 -0
- package/dist/markers/brush/BrushMarker.svelte.d.ts +7 -0
- package/dist/markers/cell/CellMarker.svelte +27 -0
- package/dist/markers/{CellMarker.svelte.d.ts → cell/CellMarker.svelte.d.ts} +1 -1
- package/dist/markers/contour/ContourClipMarker.svelte +83 -0
- package/dist/markers/{ContourClipMarker.svelte.d.ts → contour/ContourClipMarker.svelte.d.ts} +1 -1
- package/dist/markers/contour/ContourMarker.svelte +28 -0
- package/dist/markers/{ContourMarker.svelte.d.ts → contour/ContourMarker.svelte.d.ts} +1 -1
- package/dist/markers/delaunay/DelaunayLinkMarker.svelte +26 -0
- package/dist/markers/delaunay/DelaunayLinkMarker.svelte.d.ts +7 -0
- package/dist/markers/delaunay/DelaunayMeshMarker.svelte +26 -0
- package/dist/markers/delaunay/DelaunayMeshMarker.svelte.d.ts +7 -0
- package/dist/markers/delta/Delta.d.ts +21 -0
- package/dist/markers/delta/Delta.js +60 -0
- package/dist/markers/delta/DeltaMarker.svelte +94 -0
- package/dist/markers/{DeltaMarker.svelte.d.ts → delta/DeltaMarker.svelte.d.ts} +2 -2
- package/dist/markers/density/DensityMarker.svelte +63 -0
- package/dist/markers/density/DensityMarker.svelte.d.ts +7 -0
- package/dist/markers/difference/DifferenceMarker.svelte +30 -0
- package/dist/markers/difference/DifferenceMarker.svelte.d.ts +7 -0
- package/dist/markers/dot/DotMarker.svelte +102 -0
- package/dist/markers/{DotMarker.svelte.d.ts → dot/DotMarker.svelte.d.ts} +5 -17
- package/dist/markers/geo/GeoFeaturesMarker.svelte +39 -0
- package/dist/markers/{GeoFeaturesMarker.svelte.d.ts → geo/GeoFeaturesMarker.svelte.d.ts} +1 -1
- package/dist/markers/geo/GeoHoverMarker.svelte +28 -0
- package/dist/markers/{GeoHoverMarker.svelte.d.ts → geo/GeoHoverMarker.svelte.d.ts} +2 -2
- package/dist/markers/geo/GraticuleMarker.svelte +18 -0
- package/dist/markers/{GraticuleMarker.svelte.d.ts → geo/GraticuleMarker.svelte.d.ts} +1 -1
- package/dist/markers/geo/SphereMarker.svelte +15 -0
- package/dist/markers/{SphereMarker.svelte.d.ts → geo/SphereMarker.svelte.d.ts} +1 -1
- package/dist/markers/hover/HoverMarker.svelte +252 -0
- package/dist/markers/{HoverMarker.svelte.d.ts → hover/HoverMarker.svelte.d.ts} +10 -10
- package/dist/markers/hull/HullMarker.svelte +25 -0
- package/dist/markers/hull/HullMarker.svelte.d.ts +7 -0
- package/dist/markers/image/ImageMarker.svelte +22 -0
- package/dist/markers/image/ImageMarker.svelte.d.ts +7 -0
- package/dist/markers/inset/InsetMarker.svelte +184 -150
- package/dist/markers/inset/InsetMarker.svelte.d.ts +4 -4
- package/dist/markers/inset/insetLayout.d.ts +1 -1
- package/dist/markers/inset/insetLayout.js +6 -2
- package/dist/markers/inset/insetProjection.d.ts +1 -1
- package/dist/markers/inset/insetProjection.js +3 -3
- package/dist/markers/line/LineMarker.svelte +30 -0
- package/dist/markers/{LineMarker.svelte.d.ts → line/LineMarker.svelte.d.ts} +1 -1
- package/dist/markers/link/LinkMarker.svelte +47 -0
- package/dist/markers/{LinkMarker.svelte.d.ts → link/LinkMarker.svelte.d.ts} +1 -1
- package/dist/markers/raster/RasterMarker.svelte +31 -0
- package/dist/markers/raster/RasterMarker.svelte.d.ts +7 -0
- package/dist/markers/rect/RectMarker.svelte +62 -0
- package/dist/markers/rect/RectMarker.svelte.d.ts +7 -0
- package/dist/markers/regression/RegressionMarker.svelte +60 -0
- package/dist/markers/regression/RegressionMarker.svelte.d.ts +7 -0
- package/dist/markers/rule/RuleMarker.svelte +47 -0
- package/dist/markers/{RuleMarker.svelte.d.ts → rule/RuleMarker.svelte.d.ts} +2 -5
- package/dist/markers/text/Declutter.d.ts +35 -0
- package/dist/markers/text/Declutter.js +157 -0
- package/dist/markers/text/TextMarker.svelte +244 -0
- package/dist/markers/{TextMarker.svelte.d.ts → text/TextMarker.svelte.d.ts} +5 -9
- package/dist/markers/tick/TickMarker.svelte +44 -0
- package/dist/markers/tick/TickMarker.svelte.d.ts +7 -0
- package/dist/markers/trail/TrailMarker.svelte +27 -0
- package/dist/markers/trail/TrailMarker.svelte.d.ts +7 -0
- package/dist/markers/utils/BandNudge.d.ts +22 -0
- package/dist/markers/utils/BandNudge.js +23 -0
- package/dist/markers/utils/MarkerChannels.d.ts +49 -0
- package/dist/markers/utils/MarkerChannels.js +97 -0
- package/dist/markers/vector/VectorMarker.svelte +29 -0
- package/dist/markers/{VectorMarker.svelte.d.ts → vector/VectorMarker.svelte.d.ts} +1 -1
- package/dist/markers/voronoi/VoronoiMarker.svelte +26 -0
- package/dist/markers/voronoi/VoronoiMarker.svelte.d.ts +7 -0
- package/dist/markers/voronoi/VoronoiMeshMarker.svelte +26 -0
- package/dist/markers/voronoi/VoronoiMeshMarker.svelte.d.ts +7 -0
- package/dist/markers/waffle/WaffleMarker.svelte +56 -0
- package/dist/markers/waffle/WaffleMarker.svelte.d.ts +7 -0
- package/dist/phases/Pipeline.d.ts +108 -0
- package/dist/phases/Pipeline.js +226 -0
- package/dist/phases/data/DataPhase.d.ts +25 -0
- package/dist/phases/data/DataPhase.js +82 -0
- package/dist/phases/data/PlotAxes.d.ts +75 -0
- package/dist/phases/data/PlotAxes.js +151 -0
- package/dist/phases/facet/FacetPhase.d.ts +52 -0
- package/dist/phases/facet/FacetPhase.js +114 -0
- package/dist/phases/hover/HoverPhase.d.ts +73 -0
- package/dist/phases/hover/HoverPhase.js +144 -0
- package/dist/phases/mapping/MappingPhase.d.ts +17 -0
- package/dist/phases/mapping/MappingPhase.js +42 -0
- package/dist/phases/markers/MarkersPhase.d.ts +14 -0
- package/dist/phases/markers/MarkersPhase.js +27 -0
- package/dist/phases/scales/MarkerAxisValues.d.ts +12 -0
- package/dist/phases/scales/MarkerAxisValues.js +34 -0
- package/dist/phases/scales/ScalesPhase.d.ts +31 -0
- package/dist/phases/scales/ScalesPhase.js +157 -0
- package/dist/phases/sharedScales/SharedScalesPhase.d.ts +55 -0
- package/dist/phases/sharedScales/SharedScalesPhase.js +168 -0
- package/dist/phases/statistics/AuthorMarkers.d.ts +43 -0
- package/dist/phases/statistics/AuthorMarkers.js +69 -0
- package/dist/phases/statistics/MarkerGrouping.d.ts +48 -0
- package/dist/phases/statistics/MarkerGrouping.js +113 -0
- package/dist/phases/statistics/Statistics.d.ts +53 -0
- package/dist/phases/statistics/Statistics.js +156 -0
- package/dist/phases/statistics/StatisticsPhase.d.ts +18 -0
- package/dist/phases/statistics/StatisticsPhase.js +68 -0
- package/dist/phases/statistics/methods/BollingerStatistic.d.ts +9 -0
- package/dist/phases/statistics/methods/BollingerStatistic.js +18 -0
- package/dist/phases/statistics/methods/BoxStatistic.d.ts +9 -0
- package/dist/phases/statistics/methods/BoxStatistic.js +18 -0
- package/dist/phases/statistics/methods/Density2dStatistic.d.ts +9 -0
- package/dist/phases/statistics/methods/Density2dStatistic.js +18 -0
- package/dist/phases/statistics/methods/DensityStatistic.d.ts +12 -0
- package/dist/phases/statistics/methods/DensityStatistic.js +29 -0
- package/dist/phases/statistics/methods/MovingAverageStatistic.d.ts +12 -0
- package/dist/phases/statistics/methods/MovingAverageStatistic.js +30 -0
- package/dist/phases/statistics/methods/RegressionStatistic.d.ts +9 -0
- package/dist/phases/statistics/methods/RegressionStatistic.js +21 -0
- package/dist/phases/styles/StylesPhase.d.ts +13 -0
- package/dist/phases/styles/StylesPhase.js +17 -0
- package/dist/phases/tooltip/TooltipPhase.d.ts +12 -0
- package/dist/phases/tooltip/TooltipPhase.js +10 -0
- package/dist/phases/transforms/Transforms.d.ts +42 -0
- package/dist/phases/transforms/Transforms.js +130 -0
- package/dist/phases/transforms/TransformsPhase.d.ts +64 -0
- package/dist/phases/transforms/TransformsPhase.js +242 -0
- package/dist/phases/transforms/methods/AnchorBar.d.ts +13 -0
- package/dist/phases/transforms/methods/AnchorBar.js +21 -0
- package/dist/phases/transforms/methods/BinTransform.d.ts +7 -0
- package/dist/phases/transforms/methods/BinTransform.js +48 -0
- package/dist/phases/transforms/methods/DensityTransform.d.ts +6 -0
- package/dist/phases/transforms/methods/DensityTransform.js +13 -0
- package/dist/phases/transforms/methods/GroupTransform.d.ts +8 -0
- package/dist/phases/transforms/methods/GroupTransform.js +39 -0
- package/dist/phases/transforms/methods/NormalizeTransform.d.ts +10 -0
- package/dist/phases/transforms/methods/NormalizeTransform.js +30 -0
- package/dist/phases/transforms/methods/OrderTransform.d.ts +16 -0
- package/dist/phases/transforms/methods/OrderTransform.js +43 -0
- package/dist/phases/transforms/methods/PerGroup.d.ts +11 -0
- package/dist/phases/transforms/methods/PerGroup.js +39 -0
- package/dist/phases/transforms/methods/PositionTransform.d.ts +15 -0
- package/dist/phases/transforms/methods/PositionTransform.js +74 -0
- package/dist/phases/transforms/methods/StackTransform.d.ts +8 -0
- package/dist/phases/transforms/methods/StackTransform.js +29 -0
- package/dist/phases/transforms/methods/WindowTransform.d.ts +8 -0
- package/dist/phases/transforms/methods/WindowTransform.js +23 -0
- package/dist/plots/area/Plot.svelte +42 -0
- package/dist/plots/{heatmap/ValueLabels.svelte.d.ts → area/Plot.svelte.d.ts} +8 -16
- package/dist/plots/area/defaults.d.ts +4 -0
- package/dist/plots/area/defaults.js +21 -0
- package/dist/plots/area/markers.d.ts +14 -0
- package/dist/plots/area/markers.js +40 -0
- package/dist/plots/bar/Plot.svelte +33 -438
- package/dist/plots/bar/Plot.svelte.d.ts +5 -8
- package/dist/plots/bar/defaults.d.ts +9 -0
- package/dist/plots/bar/defaults.js +92 -0
- package/dist/plots/bar/markers.d.ts +45 -0
- package/dist/plots/bar/markers.js +232 -0
- package/dist/plots/geo/Core.svelte +151 -0
- package/dist/plots/geo/Core.svelte.d.ts +25 -0
- package/dist/plots/geo/Plot.svelte +103 -324
- package/dist/plots/geo/Plot.svelte.d.ts +5 -9
- package/dist/plots/geo/defaults.d.ts +4 -0
- package/dist/plots/geo/defaults.js +16 -0
- package/dist/plots/geo/features.svelte.d.ts +5 -0
- package/dist/plots/geo/features.svelte.js +44 -0
- package/dist/plots/geo/phases/data.d.ts +6 -0
- package/dist/plots/geo/phases/data.js +26 -0
- package/dist/plots/geo/phases/hover.d.ts +9 -0
- package/dist/plots/geo/phases/hover.js +45 -0
- package/dist/plots/geo/phases/markers.d.ts +9 -0
- package/dist/plots/geo/phases/markers.js +76 -0
- package/dist/plots/geo/phases/scales.d.ts +10 -0
- package/dist/plots/geo/phases/scales.js +85 -0
- package/dist/plots/geo/phases/tooltip.d.ts +3 -0
- package/dist/plots/geo/phases/tooltip.js +5 -0
- package/dist/plots/geo/slices.d.ts +18 -0
- package/dist/plots/geo/slices.js +56 -0
- package/dist/plots/heatmap/Plot.svelte +55 -249
- package/dist/plots/heatmap/Plot.svelte.d.ts +5 -8
- package/dist/plots/heatmap/defaults.d.ts +11 -0
- package/dist/plots/heatmap/defaults.js +91 -0
- package/dist/plots/heatmap/markers.d.ts +17 -0
- package/dist/plots/heatmap/markers.js +141 -0
- package/dist/plots/histogram/Plot.svelte +45 -0
- package/dist/plots/histogram/Plot.svelte.d.ts +26 -0
- package/dist/plots/histogram/defaults.d.ts +9 -0
- package/dist/plots/histogram/defaults.js +87 -0
- package/dist/plots/histogram/markers.d.ts +18 -0
- package/dist/plots/histogram/markers.js +89 -0
- package/dist/plots/line/Plot.svelte +37 -268
- package/dist/plots/line/Plot.svelte.d.ts +3 -7
- package/dist/plots/line/defaults.d.ts +4 -0
- package/dist/plots/line/defaults.js +29 -0
- package/dist/plots/line/markers.d.ts +49 -0
- package/dist/plots/line/markers.js +200 -0
- package/dist/plots/pyramid/Plot.svelte +34 -362
- package/dist/plots/pyramid/Plot.svelte.d.ts +5 -8
- package/dist/plots/pyramid/defaults.d.ts +13 -0
- package/dist/plots/pyramid/defaults.js +86 -0
- package/dist/plots/pyramid/markers.d.ts +21 -0
- package/dist/plots/pyramid/markers.js +159 -0
- package/dist/plots/scatter/Plot.svelte +34 -288
- package/dist/plots/scatter/Plot.svelte.d.ts +5 -8
- package/dist/plots/scatter/defaults.d.ts +4 -0
- package/dist/plots/scatter/defaults.js +79 -0
- package/dist/plots/scatter/markers.d.ts +19 -0
- package/dist/plots/scatter/markers.js +128 -0
- package/dist/plots/utils/ChannelName.d.ts +9 -0
- package/dist/plots/utils/ChannelName.js +14 -0
- package/dist/plots/utils/accessors.d.ts +1 -1
- package/dist/plots/utils/accessors.js +4 -2
- package/dist/plots/utils/gaps.d.ts +14 -19
- package/dist/plots/utils/gaps.js +38 -18
- package/dist/plots/utils/geoAccessors.d.ts +8 -8
- package/dist/plots/utils/geoAccessors.js +16 -12
- package/dist/plots/utils/geoSegments.d.ts +24 -9
- package/dist/plots/utils/geoSegments.js +31 -11
- package/dist/plots/utils/segments.d.ts +5 -16
- package/dist/plots/utils/segments.js +40 -52
- package/dist/plots/utils/tiles.d.ts +9 -9
- package/dist/plots/utils/tiles.js +35 -25
- package/dist/plots/utils/topojson.d.ts +1 -1
- package/dist/plots/utils/topojson.js +3 -3
- package/dist/stores/device.js +2 -4
- package/dist/types/configuration/styling.d.ts +152 -27
- package/dist/types/layout/box.d.ts +24 -0
- package/dist/types/layout/composer.d.ts +36 -0
- package/dist/types/layout/coordinates.d.ts +14 -14
- package/dist/types/layout/facet.d.ts +44 -22
- package/dist/types/layout/figure.d.ts +7 -0
- package/dist/types/layout/geometry.d.ts +6 -2
- package/dist/types/layout/grid.d.ts +66 -0
- package/dist/types/layout/hover.d.ts +48 -0
- package/dist/types/layout/legend.d.ts +256 -55
- package/dist/types/layout/mapping.d.ts +68 -0
- package/dist/types/layout/plot.d.ts +41 -0
- package/dist/types/layout/scales.d.ts +92 -24
- package/dist/types/layout/scales.js +19 -1
- package/dist/types/layout/statistics/bollinger.d.ts +18 -0
- package/dist/types/layout/statistics/box.d.ts +8 -0
- package/dist/types/layout/statistics/box.js +1 -0
- package/dist/types/layout/statistics/density.d.ts +27 -0
- package/dist/types/layout/statistics/density.js +1 -0
- package/dist/types/layout/statistics/index.d.ts +46 -0
- package/dist/types/layout/statistics/index.js +1 -0
- package/dist/types/layout/statistics/movingAverage.d.ts +12 -0
- package/dist/types/layout/statistics/movingAverage.js +1 -0
- package/dist/types/layout/statistics/regression.d.ts +20 -0
- package/dist/types/layout/statistics/regression.js +1 -0
- package/dist/types/layout/styles.d.ts +24 -35
- package/dist/types/layout/timeline.d.ts +51 -4
- package/dist/types/layout/tooltip.d.ts +7 -85
- package/dist/types/markers/all.d.ts +3 -4
- package/dist/types/markers/axis/area.d.ts +12 -0
- package/dist/types/markers/axis/area.js +1 -0
- package/dist/types/markers/axis/arrow.d.ts +15 -0
- package/dist/types/markers/axis/arrow.js +1 -0
- package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +29 -0
- package/dist/types/markers/axis/axisBasedMarkersConfig.js +1 -0
- package/dist/types/markers/axis/bar.d.ts +18 -0
- package/dist/types/markers/axis/bar.js +1 -0
- package/dist/types/markers/axis/bollinger.d.ts +6 -0
- package/dist/types/markers/axis/bollinger.js +1 -0
- package/dist/types/markers/axis/box.d.ts +14 -0
- package/dist/types/markers/axis/box.js +1 -0
- package/dist/types/markers/axis/brush.d.ts +28 -0
- package/dist/types/markers/axis/brush.js +1 -0
- package/dist/types/markers/axis/cell.d.ts +9 -0
- package/dist/types/markers/axis/cell.js +1 -0
- package/dist/types/markers/axis/component.d.ts +9 -0
- package/dist/types/markers/axis/component.js +1 -0
- package/dist/types/markers/axis/curveName.d.ts +2 -0
- package/dist/types/markers/axis/curveName.js +1 -0
- package/dist/types/markers/axis/delaunayLink.d.ts +7 -0
- package/dist/types/markers/axis/delaunayLink.js +1 -0
- package/dist/types/markers/axis/delaunayMesh.d.ts +7 -0
- package/dist/types/markers/axis/delaunayMesh.js +1 -0
- package/dist/types/markers/axis/delta.d.ts +27 -0
- package/dist/types/markers/axis/delta.js +1 -0
- package/dist/types/markers/axis/density.d.ts +12 -0
- package/dist/types/markers/axis/density.js +1 -0
- package/dist/types/markers/axis/difference.d.ts +12 -0
- package/dist/types/markers/axis/difference.js +1 -0
- package/dist/types/markers/axis/hover.d.ts +21 -0
- package/dist/types/markers/axis/hover.js +1 -0
- package/dist/types/markers/axis/hull.d.ts +7 -0
- package/dist/types/markers/axis/hull.js +1 -0
- package/dist/types/markers/axis/image.d.ts +12 -0
- package/dist/types/markers/axis/image.js +1 -0
- package/dist/types/markers/axis/line.d.ts +7 -0
- package/dist/types/markers/axis/line.js +1 -0
- package/dist/types/markers/axis/raster.d.ts +18 -0
- package/dist/types/markers/axis/raster.js +1 -0
- package/dist/types/markers/axis/rect.d.ts +15 -0
- package/dist/types/markers/axis/rect.js +1 -0
- package/dist/types/markers/axis/regression.d.ts +6 -0
- package/dist/types/markers/axis/regression.js +1 -0
- package/dist/types/markers/axis/rule.d.ts +15 -0
- package/dist/types/markers/axis/rule.js +1 -0
- package/dist/types/markers/axis/tick.d.ts +8 -0
- package/dist/types/markers/axis/tick.js +1 -0
- package/dist/types/markers/axis/trail.d.ts +14 -0
- package/dist/types/markers/axis/trail.js +1 -0
- package/dist/types/markers/axis/voronoi.d.ts +7 -0
- package/dist/types/markers/axis/voronoi.js +1 -0
- package/dist/types/markers/axis/voronoiMesh.d.ts +7 -0
- package/dist/types/markers/axis/voronoiMesh.js +1 -0
- package/dist/types/markers/axis/waffle.d.ts +13 -0
- package/dist/types/markers/axis/waffle.js +1 -0
- package/dist/types/markers/basic/basicMarkersConfig.d.ts +4 -0
- package/dist/types/markers/basic/basicMarkersConfig.js +1 -0
- package/dist/types/markers/basic/dot.d.ts +9 -0
- package/dist/types/markers/basic/dot.js +1 -0
- package/dist/types/markers/basic/text.d.ts +60 -0
- package/dist/types/markers/basic/text.js +1 -0
- package/dist/types/markers/basic.d.ts +4 -0
- package/dist/types/markers/basic.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfig.d.ts +26 -0
- package/dist/types/markers/channels/commonMarkerConfig.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +6 -0
- package/dist/types/markers/channels/commonMarkerConfigWithArea.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithColor.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithColor.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithInterval.d.ts +9 -0
- package/dist/types/markers/channels/commonMarkerConfigWithInterval.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithRadius.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithRadius.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithSymbol.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithSymbol.js +1 -0
- package/dist/types/markers/channels/commonMarkerConfigWithWeight.d.ts +5 -0
- package/dist/types/markers/channels/commonMarkerConfigWithWeight.js +1 -0
- package/dist/types/markers/common.d.ts +30 -103
- package/dist/types/markers/common.js +29 -1
- package/dist/types/markers/geo/contour.d.ts +27 -0
- package/dist/types/markers/geo/contour.js +1 -0
- package/dist/types/markers/geo/features.d.ts +12 -0
- package/dist/types/markers/geo/features.js +1 -0
- package/dist/types/markers/geo/geoComponent.d.ts +7 -0
- package/dist/types/markers/geo/geoComponent.js +1 -0
- package/dist/types/markers/geo/geoHover.d.ts +6 -0
- package/dist/types/markers/geo/geoHover.js +1 -0
- package/dist/types/markers/geo/geoMarkersConfig.d.ts +11 -0
- package/dist/types/markers/geo/geoMarkersConfig.js +1 -0
- package/dist/types/markers/geo/graticule.d.ts +11 -0
- package/dist/types/markers/geo/graticule.js +1 -0
- package/dist/types/markers/geo/inset.d.ts +50 -0
- package/dist/types/markers/geo/inset.js +1 -0
- package/dist/types/markers/geo/link.d.ts +13 -0
- package/dist/types/markers/geo/link.js +1 -0
- package/dist/types/markers/geo/sphere.d.ts +11 -0
- package/dist/types/markers/geo/sphere.js +1 -0
- package/dist/types/markers/geo/vector.d.ts +17 -0
- package/dist/types/markers/geo/vector.js +1 -0
- package/dist/types/markers/geo.d.ts +10 -212
- package/dist/types/markers/geo.js +10 -1
- package/dist/types/markers/traits.d.ts +22 -0
- package/dist/types/markers/traits.js +1 -0
- package/dist/types/misc/easing.js +1 -0
- package/dist/types/misc/viewport.js +1 -0
- package/dist/types/phases/data/axes.d.ts +18 -0
- package/dist/types/phases/data/axes.js +1 -0
- package/dist/types/phases/data/phase.d.ts +26 -0
- package/dist/types/phases/data/phase.js +2 -0
- package/dist/types/phases/facet/phase.d.ts +18 -0
- package/dist/types/phases/facet/phase.js +1 -0
- package/dist/types/phases/hover/phase.d.ts +34 -0
- package/dist/types/phases/hover/phase.js +1 -0
- package/dist/types/phases/index.d.ts +14 -0
- package/dist/types/phases/index.js +1 -0
- package/dist/types/phases/kind.d.ts +59 -0
- package/dist/types/phases/kind.js +1 -0
- package/dist/types/phases/mapping/phase.d.ts +5 -0
- package/dist/types/phases/mapping/phase.js +1 -0
- package/dist/types/phases/markers/phase.d.ts +13 -0
- package/dist/types/phases/markers/phase.js +1 -0
- package/dist/types/phases/pipeline.d.ts +10 -0
- package/dist/types/phases/pipeline.js +1 -0
- package/dist/types/phases/scales/phase.d.ts +26 -0
- package/dist/types/phases/scales/phase.js +1 -0
- package/dist/types/phases/sharedScales/phase.d.ts +12 -0
- package/dist/types/phases/sharedScales/phase.js +1 -0
- package/dist/types/phases/stage.d.ts +12 -0
- package/dist/types/phases/stage.js +1 -0
- package/dist/types/phases/state.d.ts +73 -0
- package/dist/types/phases/state.js +1 -0
- package/dist/types/phases/statistics/phase.d.ts +41 -0
- package/dist/types/phases/statistics/phase.js +1 -0
- package/dist/types/phases/statistics/source.d.ts +20 -0
- package/dist/types/phases/statistics/source.js +7 -0
- package/dist/types/phases/styles/phase.d.ts +24 -0
- package/dist/types/phases/styles/phase.js +1 -0
- package/dist/types/phases/transforms/adapter.d.ts +27 -0
- package/dist/types/phases/transforms/adapter.js +1 -0
- package/dist/types/phases/transforms/phase.d.ts +40 -0
- package/dist/types/phases/transforms/phase.js +1 -0
- package/dist/types/plots/area/props.d.ts +10 -0
- package/dist/types/plots/area/props.js +1 -0
- package/dist/types/plots/area/state.d.ts +6 -0
- package/dist/types/plots/area/state.js +1 -0
- package/dist/types/plots/bar/props.d.ts +10 -0
- package/dist/types/plots/bar/props.js +1 -0
- package/dist/types/plots/bar/state.d.ts +6 -0
- package/dist/types/plots/bar/state.js +1 -0
- package/dist/types/plots/camera.d.ts +7 -17
- package/dist/types/plots/constants.d.ts +16 -8
- package/dist/types/plots/data/common.d.ts +25 -17
- package/dist/types/plots/data/geo.d.ts +26 -12
- package/dist/types/plots/gaps.d.ts +19 -38
- package/dist/types/plots/geo/props.d.ts +23 -0
- package/dist/types/plots/geo/props.js +1 -0
- package/dist/types/plots/geo/state.d.ts +82 -0
- package/dist/types/plots/geo/state.js +1 -0
- package/dist/types/plots/heatmap/props.d.ts +10 -0
- package/dist/types/plots/heatmap/props.js +1 -0
- package/dist/types/plots/heatmap/state.d.ts +28 -0
- package/dist/types/plots/heatmap/state.js +1 -0
- package/dist/types/plots/histogram/props.d.ts +18 -0
- package/dist/types/plots/histogram/props.js +1 -0
- package/dist/types/plots/histogram/state.d.ts +6 -0
- package/dist/types/plots/histogram/state.js +1 -0
- package/dist/types/plots/line/props.d.ts +10 -0
- package/dist/types/plots/line/props.js +1 -0
- package/dist/types/plots/line/state.d.ts +9 -0
- package/dist/types/plots/line/state.js +1 -0
- package/dist/types/plots/props.d.ts +143 -35
- package/dist/types/plots/pyramid/props.d.ts +10 -0
- package/dist/types/plots/pyramid/props.js +1 -0
- package/dist/types/plots/pyramid/state.d.ts +16 -0
- package/dist/types/plots/pyramid/state.js +1 -0
- package/dist/types/plots/scatter/props.d.ts +10 -0
- package/dist/types/plots/scatter/props.js +1 -0
- package/dist/types/plots/scatter/state.d.ts +6 -0
- package/dist/types/plots/scatter/state.js +1 -0
- package/dist/types/plots/segments/common.d.ts +1 -1
- package/dist/types/plots/segments/config.d.ts +12 -6
- package/dist/types/plots/styling.d.ts +5 -5
- package/dist/types/transforms/bin.d.ts +84 -0
- package/dist/types/transforms/bin.js +28 -0
- package/dist/types/transforms/bollinger.d.ts +21 -0
- package/dist/types/transforms/bollinger.js +1 -0
- package/dist/types/transforms/common.d.ts +29 -0
- package/dist/types/transforms/common.js +16 -0
- package/dist/types/transforms/density.d.ts +45 -0
- package/dist/types/transforms/density.js +10 -0
- package/dist/types/transforms/filter.d.ts +12 -0
- package/dist/types/transforms/filter.js +14 -0
- package/dist/types/transforms/group.d.ts +70 -0
- package/dist/types/transforms/group.js +8 -0
- package/dist/types/transforms/index.d.ts +36 -0
- package/dist/types/transforms/index.js +1 -0
- package/dist/types/transforms/interval.d.ts +21 -0
- package/dist/types/transforms/interval.js +14 -0
- package/dist/types/transforms/jitter.d.ts +34 -0
- package/dist/types/transforms/jitter.js +1 -0
- package/dist/types/transforms/map.d.ts +24 -0
- package/dist/types/transforms/map.js +1 -0
- package/dist/types/transforms/normalize.d.ts +36 -0
- package/dist/types/transforms/normalize.js +1 -0
- package/dist/types/transforms/select.d.ts +15 -0
- package/dist/types/transforms/select.js +1 -0
- package/dist/types/transforms/shift.d.ts +20 -0
- package/dist/types/transforms/shift.js +1 -0
- package/dist/types/transforms/sort.d.ts +31 -0
- package/dist/types/transforms/sort.js +14 -0
- package/dist/types/transforms/stack.d.ts +64 -0
- package/dist/types/transforms/stack.js +12 -0
- package/dist/types/transforms/window.d.ts +29 -0
- package/dist/types/transforms/window.js +1 -0
- package/dist/utils/ContinuousDomain.d.ts +12 -0
- package/dist/utils/ContinuousDomain.js +19 -0
- package/dist/utils/Interpolation.d.ts +26 -0
- package/dist/utils/Interpolation.js +65 -0
- package/dist/utils/{color.d.ts → color/contrast.d.ts} +0 -5
- package/dist/utils/color/contrast.js +40 -0
- package/dist/utils/color/cssColor.d.ts +4 -0
- package/dist/utils/color/cssColor.js +77 -0
- package/dist/utils/color/index.d.ts +3 -0
- package/dist/utils/color/index.js +3 -0
- package/dist/utils/color/ramp.d.ts +17 -0
- package/dist/utils/color/ramp.js +110 -0
- package/dist/utils/grouping.d.ts +9 -5
- package/dist/utils/grouping.js +19 -10
- package/dist/utils/merge.d.ts +7 -0
- package/dist/utils/merge.js +17 -0
- package/dist/utils/opacity.d.ts +9 -0
- package/dist/utils/opacity.js +38 -0
- package/dist/utils/symbol.d.ts +31 -0
- package/dist/utils/symbol.js +92 -0
- package/docs/architecture.md +137 -0
- package/docs/chrome.md +68 -0
- package/docs/composer.md +53 -0
- package/docs/concepts.md +99 -0
- package/docs/development.md +94 -0
- package/docs/facets.md +69 -0
- package/docs/geo.md +151 -0
- package/docs/getting-started.md +79 -0
- package/docs/legend.md +106 -0
- package/docs/markers.md +106 -0
- package/docs/plots.md +158 -0
- package/docs/scales.md +78 -0
- package/docs/state.md +71 -0
- package/docs/styles-and-segments.md +215 -0
- package/docs/theming.md +215 -0
- package/docs/timeline.md +94 -0
- package/docs/tooltip-and-hover.md +80 -0
- package/docs/transforms-and-statistics.md +88 -0
- package/examples/BarValues.svelte +14 -0
- package/examples/CustomTooltip.svelte +37 -0
- package/examples/Facets.svelte +15 -0
- package/examples/LegendReader.svelte +8 -0
- package/examples/LegendToggle.svelte +25 -0
- package/examples/ResponsiveLine.svelte +37 -0
- package/examples/Segments.svelte +17 -0
- package/examples/TimelinePlayer.svelte +20 -0
- package/examples/Tooltip.svelte +19 -0
- package/examples/TooltipCard.svelte +86 -0
- package/examples/data.ts +12 -0
- package/llms-full.txt +114 -0
- package/llms.txt +49 -0
- package/package.json +41 -5
- package/dist/charts/BaseChart.svelte +0 -149
- package/dist/charts/BaseChart.svelte.d.ts +0 -47
- package/dist/charts/bar/Chart.svelte +0 -110
- package/dist/charts/bar/Chart.svelte.d.ts +0 -26
- package/dist/charts/container/ChartContainer.svelte +0 -137
- package/dist/charts/container/ChartContainer.svelte.d.ts +0 -16
- package/dist/charts/heatmap/Chart.svelte +0 -114
- package/dist/charts/line/Chart.svelte +0 -112
- package/dist/charts/line/Chart.svelte.d.ts +0 -26
- package/dist/charts/pyramid/Chart.svelte +0 -134
- package/dist/charts/pyramid/Chart.svelte.d.ts +0 -30
- package/dist/charts/scatter/Chart.svelte +0 -95
- package/dist/charts/scatter/Chart.svelte.d.ts +0 -28
- package/dist/layout/coordinates/margins.d.ts +0 -16
- package/dist/layout/coordinates/margins.js +0 -11
- package/dist/layout/legend/interaction.svelte.d.ts +0 -15
- package/dist/layout/legend/interaction.svelte.js +0 -32
- package/dist/layout/plot/BasePlotLayout.svelte +0 -332
- package/dist/layout/plot/BasePlotLayout.svelte.d.ts +0 -122
- package/dist/layout/plot/margins.d.ts +0 -18
- package/dist/layout/plot/margins.js +0 -15
- package/dist/layout/plot/measureText.d.ts +0 -4
- package/dist/layout/plot/measureText.js +0 -19
- package/dist/layout/tooltip/TooltipLayout.svelte +0 -51
- package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +0 -45
- package/dist/layout/tooltip/controller.svelte.d.ts +0 -61
- package/dist/layout/tooltip/controller.svelte.js +0 -173
- package/dist/layout/tooltip/hover.svelte.d.ts +0 -7
- package/dist/layout/tooltip/hover.svelte.js +0 -28
- package/dist/layout/tooltip/resolveTooltipPlacement.d.ts +0 -24
- package/dist/layout/tooltip/resolveTooltipPlacement.js +0 -49
- package/dist/layout/tooltip/utils.d.ts +0 -49
- package/dist/layout/tooltip/utils.js +0 -82
- package/dist/markers/CellMarker.svelte +0 -21
- package/dist/markers/ContourClipMarker.svelte +0 -77
- package/dist/markers/ContourMarker.svelte +0 -28
- package/dist/markers/DeltaMarker.svelte +0 -109
- package/dist/markers/DotMarker.svelte +0 -70
- package/dist/markers/GeoFeaturesMarker.svelte +0 -19
- package/dist/markers/GeoHoverMarker.svelte +0 -25
- package/dist/markers/GraticuleMarker.svelte +0 -18
- package/dist/markers/HoverMarker.svelte +0 -212
- package/dist/markers/LineMarker.svelte +0 -19
- package/dist/markers/LinkMarker.svelte +0 -42
- package/dist/markers/PeakMarker.svelte +0 -80
- package/dist/markers/PeakMarker.svelte.d.ts +0 -13
- package/dist/markers/RuleMarker.svelte +0 -24
- package/dist/markers/SphereMarker.svelte +0 -15
- package/dist/markers/TextMarker.svelte +0 -62
- package/dist/markers/VectorMarker.svelte +0 -20
- package/dist/plots/bar/ValueLabels.svelte +0 -149
- package/dist/plots/bar/ValueLabels.svelte.d.ts +0 -58
- package/dist/plots/bar/buildBarMarkers.d.ts +0 -27
- package/dist/plots/bar/buildBarMarkers.js +0 -151
- package/dist/plots/bar/hoverPoints.d.ts +0 -15
- package/dist/plots/bar/hoverPoints.js +0 -37
- package/dist/plots/bar/layout.svelte.d.ts +0 -42
- package/dist/plots/bar/layout.svelte.js +0 -182
- package/dist/plots/geo/buildGeoMarkers.d.ts +0 -33
- package/dist/plots/geo/buildGeoMarkers.js +0 -47
- package/dist/plots/heatmap/ValueLabels.svelte +0 -56
- package/dist/plots/heatmap/buildCellMarkers.d.ts +0 -21
- package/dist/plots/heatmap/buildCellMarkers.js +0 -25
- package/dist/plots/line/ValueLabels.svelte +0 -269
- package/dist/plots/line/ValueLabels.svelte.d.ts +0 -52
- package/dist/plots/line/buildGapMarkers.d.ts +0 -28
- package/dist/plots/line/buildGapMarkers.js +0 -74
- package/dist/plots/line/buildLineMarkers.d.ts +0 -16
- package/dist/plots/line/buildLineMarkers.js +0 -56
- package/dist/plots/line/valueLabelMargin.d.ts +0 -19
- package/dist/plots/line/valueLabelMargin.js +0 -65
- package/dist/plots/pyramid/ValueLabels.svelte +0 -139
- package/dist/plots/pyramid/ValueLabels.svelte.d.ts +0 -56
- package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +0 -26
- package/dist/plots/pyramid/buildPyramidBarMarkers.js +0 -72
- package/dist/plots/scatter/ValueLabels.svelte +0 -163
- package/dist/plots/scatter/ValueLabels.svelte.d.ts +0 -52
- package/dist/plots/scatter/buildScatterMarkers.d.ts +0 -12
- package/dist/plots/scatter/buildScatterMarkers.js +0 -36
- package/dist/plots/scatter/resolveRadiusPaddedDomain.d.ts +0 -10
- package/dist/plots/scatter/resolveRadiusPaddedDomain.js +0 -23
- package/dist/plots/utils/categoricalAxisMargin.d.ts +0 -14
- package/dist/plots/utils/categoricalAxisMargin.js +0 -20
- package/dist/plots/utils/declutter.d.ts +0 -120
- package/dist/plots/utils/declutter.js +0 -240
- package/dist/plots/utils/labelOverflow.svelte.d.ts +0 -107
- package/dist/plots/utils/labelOverflow.svelte.js +0 -257
- package/dist/plots/utils/legendDisabled.d.ts +0 -27
- package/dist/plots/utils/legendDisabled.js +0 -68
- package/dist/plots/utils/valueLabelMargin.d.ts +0 -67
- package/dist/plots/utils/valueLabelMargin.js +0 -60
- package/dist/types/charts/common.d.ts +0 -22
- package/dist/types/charts/props.d.ts +0 -50
- package/dist/types/markers/base.d.ts +0 -45
- package/dist/types/markers/line.d.ts +0 -34
- package/dist/types/markers/props.d.ts +0 -11
- package/dist/types/plots/data/scatter.d.ts +0 -13
- package/dist/utils/color.js +0 -141
- package/dist/utils/delta.d.ts +0 -12
- package/dist/utils/delta.js +0 -69
- package/dist/utils/edgeAwareAnchor.d.ts +0 -34
- package/dist/utils/edgeAwareAnchor.js +0 -60
- package/dist/utils/interpolate.d.ts +0 -31
- package/dist/utils/interpolate.js +0 -71
- /package/dist/types/{charts/common.js → layout/box.js} +0 -0
- /package/dist/types/{charts/interpolate.js → layout/composer.js} +0 -0
- /package/dist/types/{charts/props.js → layout/figure.js} +0 -0
- /package/dist/types/{markers/base.js → layout/grid.js} +0 -0
- /package/dist/types/{markers/line.js → layout/hover.js} +0 -0
- /package/dist/types/{markers/props.js → layout/mapping.js} +0 -0
- /package/dist/types/{plots/data/scatter.js → layout/plot.js} +0 -0
- /package/dist/types/{viewport.js → layout/statistics/bollinger.js} +0 -0
- /package/dist/types/{charts/interpolate.d.ts → misc/easing.d.ts} +0 -0
- /package/dist/types/{viewport.d.ts → misc/viewport.d.ts} +0 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Rect } from 'svelteplot';
|
|
3
|
+
import { MarkerChannels } from '../utils/MarkerChannels';
|
|
4
|
+
import { getConfiguration } from '../../configuration/config.svelte';
|
|
5
|
+
import type { RectMarkerConfig } from '../../types/markers/common';
|
|
6
|
+
|
|
7
|
+
/** Renders one `'rect'` marker as a `<Rect>` call - an arbitrary rectangle, unlike `BarMarker`'s category-band-anchored bar. */
|
|
8
|
+
let { marker }: { marker: RectMarkerConfig } = $props();
|
|
9
|
+
|
|
10
|
+
const cfg = $derived(getConfiguration());
|
|
11
|
+
const data = $derived(marker.data ?? []);
|
|
12
|
+
const channelFill = $derived(MarkerChannels.buildFill(data, marker.color, marker.scales, cfg));
|
|
13
|
+
const opacityBuckets = $derived(
|
|
14
|
+
MarkerChannels.buildOpacityBuckets(data, marker.opacity, marker.scales, cfg)
|
|
15
|
+
);
|
|
16
|
+
</script>
|
|
17
|
+
|
|
18
|
+
{#if opacityBuckets}
|
|
19
|
+
{#each opacityBuckets as bucket (bucket.value)}
|
|
20
|
+
<Rect
|
|
21
|
+
data={bucket.data}
|
|
22
|
+
x={marker.x}
|
|
23
|
+
y={marker.y}
|
|
24
|
+
x1={marker.x1}
|
|
25
|
+
x2={marker.x2}
|
|
26
|
+
y1={marker.y1}
|
|
27
|
+
y2={marker.y2}
|
|
28
|
+
interval={marker.interval}
|
|
29
|
+
insetLeft={marker.insetLeft}
|
|
30
|
+
insetRight={marker.insetRight}
|
|
31
|
+
insetTop={marker.insetTop}
|
|
32
|
+
insetBottom={marker.insetBottom}
|
|
33
|
+
fill={channelFill ?? marker.styles?.fill}
|
|
34
|
+
fillOpacity={bucket.value}
|
|
35
|
+
stroke={marker.styles?.stroke}
|
|
36
|
+
strokeWidth={marker.styles?.strokeWidth}
|
|
37
|
+
strokeOpacity={marker.styles?.strokeOpacity}
|
|
38
|
+
strokeDasharray={marker.styles?.strokeDasharray}
|
|
39
|
+
/>
|
|
40
|
+
{/each}
|
|
41
|
+
{:else}
|
|
42
|
+
<Rect
|
|
43
|
+
{data}
|
|
44
|
+
x={marker.x}
|
|
45
|
+
y={marker.y}
|
|
46
|
+
x1={marker.x1}
|
|
47
|
+
x2={marker.x2}
|
|
48
|
+
y1={marker.y1}
|
|
49
|
+
y2={marker.y2}
|
|
50
|
+
interval={marker.interval}
|
|
51
|
+
insetLeft={marker.insetLeft}
|
|
52
|
+
insetRight={marker.insetRight}
|
|
53
|
+
insetTop={marker.insetTop}
|
|
54
|
+
insetBottom={marker.insetBottom}
|
|
55
|
+
fill={channelFill ?? marker.styles?.fill}
|
|
56
|
+
fillOpacity={marker.styles?.fillOpacity ?? 1}
|
|
57
|
+
stroke={marker.styles?.stroke}
|
|
58
|
+
strokeWidth={marker.styles?.strokeWidth}
|
|
59
|
+
strokeOpacity={marker.styles?.strokeOpacity}
|
|
60
|
+
strokeDasharray={marker.styles?.strokeDasharray}
|
|
61
|
+
/>
|
|
62
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RectMarkerConfig } from '../../types/markers/common';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
marker: RectMarkerConfig;
|
|
4
|
+
};
|
|
5
|
+
declare const RectMarker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type RectMarker = ReturnType<typeof RectMarker>;
|
|
7
|
+
export default RectMarker;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RegressionX, RegressionY } from 'svelteplot';
|
|
3
|
+
import { usePlot } from '../../layout/plot/usePlot';
|
|
4
|
+
import type { RegressionMarkerConfig } from '../../types/markers/common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Renders one `'regression'` marker - a fitted curve (svelteplot's
|
|
8
|
+
* `RegressionX`/`RegressionY`), with a confidence band shown by default
|
|
9
|
+
* (svelteplot's own default `confidence` is `0.99`; set `confidence:
|
|
10
|
+
* false` to omit it). `RegressionX` or `RegressionY` is picked from the way
|
|
11
|
+
* the plot runs (`usePlot().axes`).
|
|
12
|
+
*
|
|
13
|
+
* Confirmed empirically: the band always renders in the same color as
|
|
14
|
+
* `stroke`, at a fixed low opacity - its own `fill` prop takes no
|
|
15
|
+
* author-supplied value (any literal or per-row function alike renders
|
|
16
|
+
* identically); passing it at all is only what turns the band on, so
|
|
17
|
+
* it's set here as a fixed placeholder gated on `confidence` being
|
|
18
|
+
* active, never exposed as its own style option.
|
|
19
|
+
*/
|
|
20
|
+
let { marker }: { marker: RegressionMarkerConfig } = $props();
|
|
21
|
+
|
|
22
|
+
const plot = usePlot();
|
|
23
|
+
const isHorizontal = $derived(plot.axes?.isHorizontal ?? false);
|
|
24
|
+
|
|
25
|
+
const data = $derived(marker.data ?? []);
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{#if isHorizontal}
|
|
29
|
+
<RegressionX
|
|
30
|
+
{data}
|
|
31
|
+
x={marker.x}
|
|
32
|
+
y={marker.y}
|
|
33
|
+
type={marker.regressionType}
|
|
34
|
+
order={marker.order}
|
|
35
|
+
base={marker.base}
|
|
36
|
+
span={marker.span}
|
|
37
|
+
confidence={marker.confidence}
|
|
38
|
+
stroke={marker.styles?.stroke ?? 'currentColor'}
|
|
39
|
+
strokeWidth={marker.styles?.strokeWidth}
|
|
40
|
+
strokeOpacity={marker.styles?.strokeOpacity}
|
|
41
|
+
strokeDasharray={marker.styles?.strokeDasharray}
|
|
42
|
+
fill={marker.confidence !== false ? 'currentColor' : undefined}
|
|
43
|
+
/>
|
|
44
|
+
{:else}
|
|
45
|
+
<RegressionY
|
|
46
|
+
{data}
|
|
47
|
+
x={marker.x}
|
|
48
|
+
y={marker.y}
|
|
49
|
+
type={marker.regressionType}
|
|
50
|
+
order={marker.order}
|
|
51
|
+
base={marker.base}
|
|
52
|
+
span={marker.span}
|
|
53
|
+
confidence={marker.confidence}
|
|
54
|
+
stroke={marker.styles?.stroke ?? 'currentColor'}
|
|
55
|
+
strokeWidth={marker.styles?.strokeWidth}
|
|
56
|
+
strokeOpacity={marker.styles?.strokeOpacity}
|
|
57
|
+
strokeDasharray={marker.styles?.strokeDasharray}
|
|
58
|
+
fill={marker.confidence !== false ? 'currentColor' : undefined}
|
|
59
|
+
/>
|
|
60
|
+
{/if}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RegressionMarkerConfig } from '../../types/markers/common';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
marker: RegressionMarkerConfig;
|
|
4
|
+
};
|
|
5
|
+
declare const RegressionMarker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type RegressionMarker = ReturnType<typeof RegressionMarker>;
|
|
7
|
+
export default RegressionMarker;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { RuleX, RuleY } from 'svelteplot';
|
|
3
|
+
import type { AxisValue } from '../../types/layout/mapping';
|
|
4
|
+
import type { RuleMarkerConfig } from '../../types/markers/common';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A single vertical (`axis: 'x'`) or horizontal (`axis: 'y'`) reference
|
|
8
|
+
* line - or, with `data`, one line per row. Shared by author-configured
|
|
9
|
+
* `'rule'` markers and `HoverMarker`'s crosshair (which always calls it
|
|
10
|
+
* with a literal `value` and no `data`). Falls back to `'currentColor'`/`1`
|
|
11
|
+
* when the caller supplies no style. See `RuleMarkerConfig`'s own doc
|
|
12
|
+
* comment for `value`/`x1`/`x2`/`y1`/`y2`/inset semantics - forwarded here
|
|
13
|
+
* straight through to svelteplot's own `RuleX`/`RuleY`.
|
|
14
|
+
*/
|
|
15
|
+
const { marker }: { marker: RuleMarkerConfig } = $props();
|
|
16
|
+
|
|
17
|
+
const axis = $derived(marker.axis);
|
|
18
|
+
const data = $derived(marker.data);
|
|
19
|
+
const value = $derived(marker.value);
|
|
20
|
+
const styles = $derived(marker.styles);
|
|
21
|
+
|
|
22
|
+
const RuleMark = $derived(axis === 'x' ? RuleX : RuleY);
|
|
23
|
+
const rows = $derived(data ?? [{ v: value }]);
|
|
24
|
+
/**
|
|
25
|
+
* With `data`, `value` is forwarded raw (a field key resolves per row via
|
|
26
|
+
* svelteplot's own `resolve()`, same as every other mark, and lets its
|
|
27
|
+
* axis-title auto-inference see the field name - a pre-resolved closure
|
|
28
|
+
* would defeat both). Without `data`, `value` is a literal against the
|
|
29
|
+
* single synthetic `{v: value}` row.
|
|
30
|
+
*/
|
|
31
|
+
const position = $derived(data ? value : (d: { v: AxisValue }) => d.v);
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
<RuleMark
|
|
35
|
+
data={rows}
|
|
36
|
+
{...axis === 'x'
|
|
37
|
+
? { x: position, y1: marker.y1, y2: marker.y2 }
|
|
38
|
+
: { y: position, x1: marker.x1, x2: marker.x2 }}
|
|
39
|
+
inset={marker.inset}
|
|
40
|
+
{...axis === 'x'
|
|
41
|
+
? { insetTop: marker.insetTop, insetBottom: marker.insetBottom }
|
|
42
|
+
: { insetLeft: marker.insetLeft, insetRight: marker.insetRight }}
|
|
43
|
+
stroke={styles?.stroke ?? 'currentColor'}
|
|
44
|
+
strokeWidth={styles?.strokeWidth ?? 1}
|
|
45
|
+
strokeOpacity={styles?.strokeOpacity ?? 1}
|
|
46
|
+
strokeDasharray={styles?.strokeDasharray}
|
|
47
|
+
/>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { StrokeStyle } from '../types/plots/styling';
|
|
1
|
+
import type { RuleMarkerConfig } from '../../types/markers/common';
|
|
3
2
|
type $$ComponentProps = {
|
|
4
|
-
|
|
5
|
-
value: AxisValue;
|
|
6
|
-
style?: StrokeStyle;
|
|
3
|
+
marker: RuleMarkerConfig;
|
|
7
4
|
};
|
|
8
5
|
declare const RuleMarker: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
6
|
type RuleMarker = ReturnType<typeof RuleMarker>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { LabelLane } from '../../types/markers/basic/text';
|
|
2
|
+
/**
|
|
3
|
+
* Lays out point labels that would overlap: spreads their pixel `y` apart,
|
|
4
|
+
* gives each moved label its own lane for its leader line, and lines every
|
|
5
|
+
* label up on one shared column once any of them clusters.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Declutter {
|
|
8
|
+
#private;
|
|
9
|
+
/**
|
|
10
|
+
* Lays out labels keyed by each item's `key`; fewer than two need none. A
|
|
11
|
+
* leftward fan with no room before the content box's left edge (the Y
|
|
12
|
+
* axis's tick labels sit there) flips right instead.
|
|
13
|
+
*/
|
|
14
|
+
static buildLanes<K>(args: {
|
|
15
|
+
items: {
|
|
16
|
+
key: K;
|
|
17
|
+
px?: number;
|
|
18
|
+
py: number;
|
|
19
|
+
}[];
|
|
20
|
+
/** The labels' own horizontal offset (px); its sign is the side they fan toward. */
|
|
21
|
+
dx: number;
|
|
22
|
+
fontSize: number;
|
|
23
|
+
geometry: {
|
|
24
|
+
elbowGap: number;
|
|
25
|
+
laneStep: number;
|
|
26
|
+
labelGap: number;
|
|
27
|
+
};
|
|
28
|
+
/** The content box's left/top/bottom edges (px). */
|
|
29
|
+
bounds: {
|
|
30
|
+
left: number;
|
|
31
|
+
top: number;
|
|
32
|
+
bottom: number;
|
|
33
|
+
};
|
|
34
|
+
}): Map<K, LabelLane>;
|
|
35
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
const clamp = (value, lo, hi) => Math.min(Math.max(value, lo), hi);
|
|
2
|
+
/**
|
|
3
|
+
* Lays out point labels that would overlap: spreads their pixel `y` apart,
|
|
4
|
+
* gives each moved label its own lane for its leader line, and lines every
|
|
5
|
+
* label up on one shared column once any of them clusters.
|
|
6
|
+
*/
|
|
7
|
+
export class Declutter {
|
|
8
|
+
/**
|
|
9
|
+
* Lays out labels keyed by each item's `key`; fewer than two need none. A
|
|
10
|
+
* leftward fan with no room before the content box's left edge (the Y
|
|
11
|
+
* axis's tick labels sit there) flips right instead.
|
|
12
|
+
*/
|
|
13
|
+
static buildLanes(args) {
|
|
14
|
+
const { items, dx, fontSize, geometry, bounds } = args;
|
|
15
|
+
const lanes = new Map();
|
|
16
|
+
if (items.length < 2)
|
|
17
|
+
return lanes;
|
|
18
|
+
const sorted = [...items].sort((a, b) => a.py - b.py);
|
|
19
|
+
const originals = sorted.map((item) => item.py);
|
|
20
|
+
const minGap = Math.max(16, fontSize * 1.4);
|
|
21
|
+
const { finals, connected } = Declutter.#spread(originals, minGap, [bounds.top, bounds.bottom]);
|
|
22
|
+
const ranks = Declutter.#assignLanes(originals, finals, connected);
|
|
23
|
+
const aligned = ranks.some((r) => r.runSize > 1);
|
|
24
|
+
const lanesUsed = aligned ? Math.max(...ranks.map((r) => r.runSize)) : 1;
|
|
25
|
+
const reach = geometry.elbowGap + (lanesUsed - 1) * geometry.laneStep + geometry.labelGap;
|
|
26
|
+
let dir = Math.sign(dx) || 1;
|
|
27
|
+
if (aligned && dir === -1) {
|
|
28
|
+
// Unknown room (no x position yet) counts as none: flipping right is never wrong.
|
|
29
|
+
const rooms = sorted.flatMap((item) => (item.px == null ? [] : [item.px - bounds.left]));
|
|
30
|
+
if ((rooms.length > 0 ? Math.min(...rooms) : -Infinity) < reach)
|
|
31
|
+
dir = 1;
|
|
32
|
+
}
|
|
33
|
+
sorted.forEach((item, i) => {
|
|
34
|
+
lanes.set(item.key, {
|
|
35
|
+
extraDy: finals[i] - originals[i],
|
|
36
|
+
aligned,
|
|
37
|
+
reach,
|
|
38
|
+
laneReach: geometry.elbowGap + ranks[i].rank * geometry.laneStep,
|
|
39
|
+
dir
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
return lanes;
|
|
43
|
+
}
|
|
44
|
+
/** The runs of `connected` pairs over `connected.length + 1` positions. */
|
|
45
|
+
static #runs(connected) {
|
|
46
|
+
const runs = [];
|
|
47
|
+
for (let i = 0; i <= connected.length;) {
|
|
48
|
+
let j = i;
|
|
49
|
+
while (j < connected.length && connected[j])
|
|
50
|
+
j++;
|
|
51
|
+
runs.push([i, j]);
|
|
52
|
+
i = j + 1;
|
|
53
|
+
}
|
|
54
|
+
return runs;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Spreads sorted `positions` so no two end up closer than `minGap`, keeping
|
|
58
|
+
* the block centered on the originals: a pass pushing items down and one
|
|
59
|
+
* pulling them up, each valid alone, averaged per item (chaining them would
|
|
60
|
+
* be a no-op). `connected[i]` is whether either pass had to push `i` and
|
|
61
|
+
* `i + 1` apart. Each run is then kept inside `bounds`.
|
|
62
|
+
*/
|
|
63
|
+
static #spread(positions, minGap, bounds) {
|
|
64
|
+
const n = positions.length;
|
|
65
|
+
const connected = new Array(n - 1).fill(false);
|
|
66
|
+
const down = [...positions];
|
|
67
|
+
for (let i = 1; i < n; i++) {
|
|
68
|
+
if (down[i - 1] + minGap > down[i]) {
|
|
69
|
+
down[i] = down[i - 1] + minGap;
|
|
70
|
+
connected[i - 1] = true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const up = [...positions];
|
|
74
|
+
for (let i = n - 2; i >= 0; i--) {
|
|
75
|
+
if (up[i + 1] - minGap < up[i]) {
|
|
76
|
+
up[i] = up[i + 1] - minGap;
|
|
77
|
+
connected[i] = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const weights = Declutter.#biasWeights(down, up, connected, bounds);
|
|
81
|
+
const averaged = positions.map((_, i) => down[i] * weights[i] + up[i] * (1 - weights[i]));
|
|
82
|
+
return { finals: Declutter.#fit(averaged, connected, bounds), connected };
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Per-item weight of the down pass (the up pass gets the rest). A run near
|
|
86
|
+
* an edge leans on the pass that grows away from it, so it expands the way
|
|
87
|
+
* there is room instead of reaching for room it lacks; `0.5` with equal room
|
|
88
|
+
* on both sides. Every member of a run shares one weight.
|
|
89
|
+
*/
|
|
90
|
+
static #biasWeights(down, up, connected, [lo, hi]) {
|
|
91
|
+
const weights = down.map(() => 0.5);
|
|
92
|
+
for (const [i, j] of Declutter.#runs(connected)) {
|
|
93
|
+
if (j === i)
|
|
94
|
+
continue;
|
|
95
|
+
const center = ((down[i] + up[i]) / 2 + (down[j] + up[j]) / 2) / 2;
|
|
96
|
+
const roomAbove = Math.max(0, center - lo);
|
|
97
|
+
const roomBelow = Math.max(0, hi - center);
|
|
98
|
+
const total = roomAbove + roomBelow;
|
|
99
|
+
weights.fill(total > 0 ? roomBelow / total : 0.5, i, j + 1);
|
|
100
|
+
}
|
|
101
|
+
return weights;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Shifts each run inside `[lo, hi]`, shrinking it uniformly around its
|
|
105
|
+
* center only if it is wider than the room. A lone position is clamped.
|
|
106
|
+
*/
|
|
107
|
+
static #fit(positions, connected, [lo, hi]) {
|
|
108
|
+
const out = [...positions];
|
|
109
|
+
for (const [i, j] of Declutter.#runs(connected)) {
|
|
110
|
+
if (j === i) {
|
|
111
|
+
out[i] = clamp(out[i], lo, hi);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const [min, max] = [out[i], out[j]];
|
|
115
|
+
if (min >= lo && max <= hi)
|
|
116
|
+
continue;
|
|
117
|
+
const span = max - min;
|
|
118
|
+
const scale = span > 0 ? Math.min(1, (hi - lo) / span) : 1;
|
|
119
|
+
const center = (min + max) / 2;
|
|
120
|
+
const newCenter = clamp(center, lo + (span * scale) / 2, hi - (span * scale) / 2);
|
|
121
|
+
for (let k = i; k <= j; k++)
|
|
122
|
+
out[k] = newCenter + (out[k] - center) * scale;
|
|
123
|
+
}
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Gives every member of a run its own lane (`rank` 0 bends nearest the
|
|
128
|
+
* point), so no two leader lines touch or cross. Each leader is an elbow:
|
|
129
|
+
* a stub out from the point to its lane, a vertical run to the label's
|
|
130
|
+
* height, then a run in to the shared column. A pair is ordered by which
|
|
131
|
+
* member can sit in the nearer lane without crossing the other's elbow;
|
|
132
|
+
* when the geometry doesn't decide, the member that traveled furthest
|
|
133
|
+
* takes the nearer lane.
|
|
134
|
+
*/
|
|
135
|
+
static #assignLanes(originals, finals, connected) {
|
|
136
|
+
const out = originals.map(() => ({ rank: 0, runSize: 1 }));
|
|
137
|
+
const within = (v, k) => v >= Math.min(originals[k], finals[k]) && v <= Math.max(originals[k], finals[k]);
|
|
138
|
+
const distance = (k) => Math.abs(finals[k] - originals[k]);
|
|
139
|
+
/** Whether `i` in the nearer lane than `j` provably crosses nothing. */
|
|
140
|
+
const saferNearer = (i, j) => !within(originals[j], i) && !within(finals[i], j);
|
|
141
|
+
for (const [start, end] of Declutter.#runs(connected)) {
|
|
142
|
+
const runSize = end - start + 1;
|
|
143
|
+
if (runSize < 2)
|
|
144
|
+
continue;
|
|
145
|
+
const order = Array.from({ length: runSize }, (_, k) => start + k).sort((a, b) => {
|
|
146
|
+
const aNearer = saferNearer(a, b);
|
|
147
|
+
if (aNearer !== saferNearer(b, a))
|
|
148
|
+
return aNearer ? -1 : 1;
|
|
149
|
+
return distance(b) - distance(a);
|
|
150
|
+
});
|
|
151
|
+
order.forEach((k, rank) => {
|
|
152
|
+
out[k] = { rank, runSize };
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return out;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
<script lang="ts" generics="TData = Record<string, unknown>">
|
|
2
|
+
import { Text } from 'svelteplot';
|
|
3
|
+
import { usePlot } from '../../layout/plot/usePlot';
|
|
4
|
+
import { getConfiguration } from '../../configuration/config.svelte';
|
|
5
|
+
import { BandNudge } from '../utils/BandNudge';
|
|
6
|
+
import { Declutter } from './Declutter';
|
|
7
|
+
import { PlotMargins } from '../../layout/margins/PlotMargins.svelte';
|
|
8
|
+
import { Box } from '../../layout/margins/Box';
|
|
9
|
+
import type { TextMarkerConfig } from '../../types/markers/common';
|
|
10
|
+
import type { TextAnchor } from '../../types/plots/constants';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Renders one `'text'` marker. `x`/`y` also accept a literal number or Date.
|
|
14
|
+
* A marker that declutters, flips at the edges or listens to the pointer
|
|
15
|
+
* draws one label per row, inside the plot's content box. With
|
|
16
|
+
* `fitMargins`, the plot's margins grow until the labels fit.
|
|
17
|
+
*/
|
|
18
|
+
const { marker }: { marker: TextMarkerConfig } = $props();
|
|
19
|
+
|
|
20
|
+
// A text's anchors as the side of its point it sits on, and back.
|
|
21
|
+
const TEXT_SIDES = { start: 'after', middle: 'middle', end: 'before' } as const;
|
|
22
|
+
const TEXT_ANCHORS = { after: 'start', middle: 'middle', before: 'end' } as const;
|
|
23
|
+
const LINE_SIDES = { top: 'after', middle: 'middle', bottom: 'before' } as const;
|
|
24
|
+
const LINE_ANCHORS = { after: 'top', middle: 'middle', before: 'bottom' } as const;
|
|
25
|
+
|
|
26
|
+
const cfg = $derived(getConfiguration());
|
|
27
|
+
const plot = usePlot().svelteplot;
|
|
28
|
+
const plotMargins = PlotMargins.current();
|
|
29
|
+
const bounds = $derived(plotMargins?.contentBox);
|
|
30
|
+
|
|
31
|
+
const data = $derived((marker.data ?? []) as TData[]);
|
|
32
|
+
const x = $derived(marker.x);
|
|
33
|
+
const y = $derived(marker.y);
|
|
34
|
+
const text = $derived(marker.text ?? '');
|
|
35
|
+
const styles = $derived(marker.styles);
|
|
36
|
+
|
|
37
|
+
const displayData = $derived(data.length > 0 ? data : [{} as TData]);
|
|
38
|
+
// Per-row accessors give literal values; an empty one takes the flat default.
|
|
39
|
+
const flatFill = $derived(styles?.fill ?? 'currentColor');
|
|
40
|
+
const fill = $derived.by(() => {
|
|
41
|
+
const own = marker.fill;
|
|
42
|
+
if (typeof own !== 'function') return own ?? flatFill;
|
|
43
|
+
return { value: (d: TData) => own(d) ?? flatFill, scale: null };
|
|
44
|
+
});
|
|
45
|
+
const fillOpacity = $derived.by(() => {
|
|
46
|
+
const own = marker.fillOpacity;
|
|
47
|
+
return typeof own === 'function' ? { value: (d: TData) => own(d) ?? 1, scale: null } : own;
|
|
48
|
+
});
|
|
49
|
+
const fontSize = $derived(styles?.fontSize ?? 12);
|
|
50
|
+
const fontWeight = $derived(styles?.fontWeight ?? 'normal');
|
|
51
|
+
const fontStyleProp = $derived(styles?.fontStyle ?? 'normal');
|
|
52
|
+
// An unresolved `'outside'` falls back to `'start'`.
|
|
53
|
+
const textAnchor = $derived<Exclude<TextAnchor, 'outside'>>(
|
|
54
|
+
styles?.textAnchor === 'outside' ? 'start' : (styles?.textAnchor ?? 'middle')
|
|
55
|
+
);
|
|
56
|
+
const lineAnchor = $derived(styles?.lineAnchor ?? 'middle');
|
|
57
|
+
// A label in a slice of its band sits off the band's middle, at its drawn width.
|
|
58
|
+
const nudge = $derived(BandNudge.of(plot.scales, marker.bandSlice));
|
|
59
|
+
const dx = $derived((styles?.dx ?? 0) + nudge.dx);
|
|
60
|
+
const dy = $derived((styles?.dy ?? 0) + nudge.dy);
|
|
61
|
+
|
|
62
|
+
const declutter = $derived.by(() => {
|
|
63
|
+
if (!marker.declutter) return undefined;
|
|
64
|
+
const own = marker.declutter === true ? {} : marker.declutter;
|
|
65
|
+
const defaults = cfg.text.declutter;
|
|
66
|
+
return {
|
|
67
|
+
elbowGap: own.elbowGap ?? defaults.elbowGap,
|
|
68
|
+
laneStep: own.laneStep ?? defaults.laneStep,
|
|
69
|
+
labelGap: own.labelGap ?? defaults.labelGap,
|
|
70
|
+
connector: { ...defaults.connector, ...own.connector }
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
const perRow = $derived(
|
|
74
|
+
!!declutter || !!marker.edgeAware || !!marker.onPointerEnter || !!marker.onPointerLeave
|
|
75
|
+
);
|
|
76
|
+
const dir = $derived(Math.sign(dx) || 1);
|
|
77
|
+
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
79
|
+
function channel(value: unknown): (d: any) => unknown {
|
|
80
|
+
if (typeof value === 'function') return value as (d: unknown) => unknown;
|
|
81
|
+
// A field key: a name, or the symbol a transform keyed its output channel by.
|
|
82
|
+
if (typeof value === 'string' || typeof value === 'symbol') return (d) => d?.[value];
|
|
83
|
+
return () => value;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function textOf(d: TData): string {
|
|
87
|
+
return typeof text === 'function' ? text(d) : text;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function opacityOf(d: TData): number | undefined {
|
|
91
|
+
const value = marker.fillOpacity;
|
|
92
|
+
return typeof value === 'function' ? value(d) : value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Each row's pixel position, once both scales resolve. */
|
|
96
|
+
const points = $derived.by(() => {
|
|
97
|
+
const xScale = plot.scales.x?.fn;
|
|
98
|
+
const yScale = plot.scales.y?.fn;
|
|
99
|
+
if ((!declutter && !marker.edgeAware) || !xScale || !yScale) return undefined;
|
|
100
|
+
const xOf = channel(x ?? 0);
|
|
101
|
+
const yOf = channel(y ?? 0);
|
|
102
|
+
return displayData.map((d) => ({
|
|
103
|
+
px: Number(xScale(xOf(d) as never)),
|
|
104
|
+
py: Number(yScale(yOf(d) as never))
|
|
105
|
+
}));
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const lanes = $derived(
|
|
109
|
+
declutter && points && bounds
|
|
110
|
+
? Declutter.buildLanes({
|
|
111
|
+
items: points.map((p, key) => ({ key, ...p })),
|
|
112
|
+
dx,
|
|
113
|
+
fontSize,
|
|
114
|
+
geometry: declutter,
|
|
115
|
+
bounds
|
|
116
|
+
})
|
|
117
|
+
: undefined
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
/** Each row's anchor and offset, flipped where its text would cross the content box's edge. */
|
|
121
|
+
const placements = $derived.by(() => {
|
|
122
|
+
if (!marker.edgeAware || !points) return undefined;
|
|
123
|
+
const within = bounds ?? Box.size(plot.plotWidth, plot.plotHeight);
|
|
124
|
+
const anchor = { x: TEXT_SIDES[textAnchor], y: LINE_SIDES[lineAnchor] };
|
|
125
|
+
const gap = { x: Math.abs(dx), y: Math.abs(dy) };
|
|
126
|
+
return displayData.map((d, i) => {
|
|
127
|
+
const point = { x: points[i].px, y: points[i].py };
|
|
128
|
+
const flip = Box.ofText(textOf(d), fontSize, cfg).flipNear(point, anchor, within, gap);
|
|
129
|
+
return {
|
|
130
|
+
dx: flip.dx,
|
|
131
|
+
dy: flip.dy,
|
|
132
|
+
textAnchor: TEXT_ANCHORS[flip.anchor.x],
|
|
133
|
+
lineAnchor: LINE_ANCHORS[flip.anchor.y]
|
|
134
|
+
};
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const flipAnchor = (anchor: typeof textAnchor) =>
|
|
139
|
+
anchor === 'start' ? 'end' : anchor === 'end' ? 'start' : anchor;
|
|
140
|
+
|
|
141
|
+
let groupEl: SVGGElement | undefined = $state();
|
|
142
|
+
|
|
143
|
+
// The plot measures what it draws: how far it reaches out, and with `fitMargins` its margins grow to fit it.
|
|
144
|
+
const measured = $derived(!!plotMargins && (!!marker.onOverflow || !!marker.fitMargins));
|
|
145
|
+
plotMargins?.watch(() => (measured ? groupEl : undefined), {
|
|
146
|
+
grow: () => !!marker.fitMargins,
|
|
147
|
+
onOverflow: (overflow) => marker.onOverflow?.(overflow),
|
|
148
|
+
// The box isn't tracked reactively: a new layout measures again.
|
|
149
|
+
deps: () => [marker, points]
|
|
150
|
+
});
|
|
151
|
+
</script>
|
|
152
|
+
|
|
153
|
+
{#snippet label(
|
|
154
|
+
rows: TData[],
|
|
155
|
+
rowDx: number,
|
|
156
|
+
rowDy: number,
|
|
157
|
+
rowAnchor: typeof textAnchor,
|
|
158
|
+
rowLineAnchor: typeof lineAnchor
|
|
159
|
+
)}
|
|
160
|
+
<Text
|
|
161
|
+
data={rows}
|
|
162
|
+
x={x ?? 0}
|
|
163
|
+
y={y ?? 0}
|
|
164
|
+
text={text ?? ''}
|
|
165
|
+
dx={rowDx}
|
|
166
|
+
dy={rowDy}
|
|
167
|
+
fill={fill as never}
|
|
168
|
+
fillOpacity={fillOpacity as never}
|
|
169
|
+
{fontSize}
|
|
170
|
+
{fontWeight}
|
|
171
|
+
textAnchor={rowAnchor}
|
|
172
|
+
lineAnchor={rowLineAnchor}
|
|
173
|
+
fontStyle={fontStyleProp}
|
|
174
|
+
lineHeight={styles?.lineHeight}
|
|
175
|
+
rotate={styles?.rotate}
|
|
176
|
+
stroke={styles?.stroke}
|
|
177
|
+
strokeWidth={styles?.strokeWidth}
|
|
178
|
+
paintOrder={styles?.paintOrder}
|
|
179
|
+
class={styles?.class}
|
|
180
|
+
textClass={styles?.textClass}
|
|
181
|
+
/>
|
|
182
|
+
{/snippet}
|
|
183
|
+
|
|
184
|
+
{#snippet labels()}
|
|
185
|
+
{#if !perRow}
|
|
186
|
+
{@render label(displayData, dx, dy, textAnchor, lineAnchor)}
|
|
187
|
+
{:else if (!declutter && !marker.edgeAware) || points}
|
|
188
|
+
<!-- A decluttered or edge-aware label waits for both scales. -->
|
|
189
|
+
{#each displayData as d, i (i)}
|
|
190
|
+
{@const lane = lanes?.get(i)}
|
|
191
|
+
{@const placement = placements?.[i]}
|
|
192
|
+
{@const extraDy = lane?.extraDy ?? 0}
|
|
193
|
+
{@const laneDir = lane?.aligned ? lane.dir : dir}
|
|
194
|
+
{@const labelDx = lane?.aligned ? laneDir * lane.reach : dx}
|
|
195
|
+
{#if declutter && points && (lane?.aligned || extraDy !== 0)}
|
|
196
|
+
{@const { px, py } = points[i]}
|
|
197
|
+
{@const laneX = lane?.aligned ? px + laneDir * lane.laneReach : px + labelDx}
|
|
198
|
+
{@const connector = declutter.connector}
|
|
199
|
+
<path
|
|
200
|
+
d={`M ${px} ${py} H ${laneX} V ${py + extraDy} H ${px + labelDx}`}
|
|
201
|
+
fill="none"
|
|
202
|
+
stroke={connector.stroke}
|
|
203
|
+
stroke-width={connector.strokeWidth}
|
|
204
|
+
stroke-opacity={connector.strokeOpacity ?? opacityOf(d) ?? 1}
|
|
205
|
+
stroke-dasharray={connector.strokeDasharray}
|
|
206
|
+
stroke-linecap={connector.strokeLinecap ?? 'square'}
|
|
207
|
+
stroke-linejoin={connector.strokeLinejoin ?? 'miter'}
|
|
208
|
+
/>
|
|
209
|
+
{/if}
|
|
210
|
+
<!-- svelteplot's Text never wires pointer handlers to its DOM node; a wrapping <g> catches them. -->
|
|
211
|
+
<g
|
|
212
|
+
role="presentation"
|
|
213
|
+
onpointerenter={marker.onPointerEnter && (() => marker.onPointerEnter?.(d))}
|
|
214
|
+
onpointerleave={marker.onPointerLeave && (() => marker.onPointerLeave?.(d))}
|
|
215
|
+
>
|
|
216
|
+
{#if placement}
|
|
217
|
+
{@render label(
|
|
218
|
+
[d],
|
|
219
|
+
placement.dx,
|
|
220
|
+
placement.dy + extraDy,
|
|
221
|
+
placement.textAnchor,
|
|
222
|
+
placement.lineAnchor
|
|
223
|
+
)}
|
|
224
|
+
{:else}
|
|
225
|
+
{@render label(
|
|
226
|
+
[d],
|
|
227
|
+
labelDx,
|
|
228
|
+
dy + extraDy,
|
|
229
|
+
lane?.aligned && laneDir !== dir ? flipAnchor(textAnchor) : textAnchor,
|
|
230
|
+
lineAnchor
|
|
231
|
+
)}
|
|
232
|
+
{/if}
|
|
233
|
+
</g>
|
|
234
|
+
{/each}
|
|
235
|
+
{/if}
|
|
236
|
+
{/snippet}
|
|
237
|
+
|
|
238
|
+
{#if text}
|
|
239
|
+
{#if measured}
|
|
240
|
+
<g bind:this={groupEl}>{@render labels()}</g>
|
|
241
|
+
{:else}
|
|
242
|
+
{@render labels()}
|
|
243
|
+
{/if}
|
|
244
|
+
{/if}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { TextMarkerConfig } from '../../types/markers/common';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
marker: TextMarkerConfig;
|
|
4
|
+
};
|
|
4
5
|
declare function $$render<TData = Record<string, unknown>>(): {
|
|
5
|
-
props:
|
|
6
|
-
x?: AxisValue | ((d: TData) => AxisValue);
|
|
7
|
-
y?: AxisValue | ((d: TData) => AxisValue);
|
|
8
|
-
text?: string | ((d: TData) => string);
|
|
9
|
-
style?: FontStyle;
|
|
10
|
-
};
|
|
6
|
+
props: $$ComponentProps;
|
|
11
7
|
exports: {};
|
|
12
8
|
bindings: "";
|
|
13
9
|
slots: {};
|