@fundar/data-chart-telling 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/README.md +58 -19
- package/dist/configuration/config.svelte.d.ts +1 -1
- package/dist/configuration/config.svelte.js +172 -95
- package/dist/configuration/themes/index.d.ts +5 -1304
- package/dist/index.d.ts +24 -14
- package/dist/index.js +20 -10
- package/dist/layout/base/BasePlotLayout.svelte +129 -51
- package/dist/layout/base/BasePlotLayout.svelte.d.ts +1 -38
- package/dist/layout/coordinates/CoordinatesLayout.svelte +42 -40
- package/dist/layout/coordinates/CoordinatesLayout.svelte.d.ts +0 -2
- package/dist/layout/coordinates/ProjectionZoom.svelte +48 -0
- package/dist/layout/coordinates/ProjectionZoom.svelte.d.ts +10 -0
- package/dist/layout/coordinates/ZoomedProjection.d.ts +11 -0
- package/dist/layout/coordinates/ZoomedProjection.js +24 -0
- package/dist/layout/coordinates/camera.svelte.js +11 -8
- package/dist/layout/coordinates/projections/argentina.js +1 -1
- package/dist/layout/coordinates/projections/fit.d.ts +1 -1
- package/dist/layout/coordinates/projections/fit.js +1 -1
- package/dist/layout/coordinates/zoom.svelte.d.ts +4 -5
- package/dist/layout/coordinates/zoom.svelte.js +4 -5
- package/dist/layout/facet/FacetLayout.svelte +1 -1
- package/dist/layout/facet/config.js +1 -1
- package/dist/layout/figure/Figure.svelte +2 -0
- package/dist/layout/geometry/GeometryLayout.svelte +14 -9
- package/dist/layout/geometry/GeometryLayout.svelte.d.ts +0 -3
- package/dist/layout/geometry/MarkerOffset.svelte +28 -0
- package/dist/layout/geometry/MarkerOffset.svelte.d.ts +13 -0
- package/dist/layout/grid/GridCell.svelte +6 -8
- package/dist/layout/hover/HoverSettings.d.ts +20 -6
- package/dist/layout/hover/HoverSettings.js +29 -4
- package/dist/layout/legend/ContinuousSection.svelte +44 -9
- package/dist/layout/legend/DiscreteBadgeItem.svelte +2 -2
- package/dist/layout/legend/DiscreteSection.svelte +2 -2
- package/dist/layout/legend/DiscreteSymbolIcon.svelte +1 -1
- package/dist/layout/legend/LegendChannels.js +36 -12
- package/dist/layout/legend/LegendLayout.svelte +9 -1
- package/dist/layout/legend/LegendState.svelte.d.ts +9 -0
- package/dist/layout/legend/LegendState.svelte.js +24 -3
- package/dist/layout/legend/SizeSection.svelte +1 -1
- package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -5
- package/dist/layout/margins/PlotMargins.svelte.js +4 -8
- package/dist/layout/plot/Plot.svelte +6 -3
- package/dist/layout/plot/PublicPlotContext.d.ts +5 -4
- package/dist/layout/plot/PublicPlotContext.js +7 -3
- package/dist/layout/plot/Slice.d.ts +5 -1
- package/dist/layout/plot/Slice.js +18 -6
- package/dist/layout/scales/EdgeTicks.d.ts +39 -0
- package/dist/layout/scales/EdgeTicks.js +82 -0
- package/dist/layout/scales/NiceTicks.d.ts +43 -0
- package/dist/layout/scales/NiceTicks.js +76 -0
- package/dist/layout/scales/ScalesLayout.svelte +133 -34
- package/dist/layout/scales/ScalesLayout.svelte.d.ts +10 -0
- package/dist/layout/scales/SveltePlotScale.d.ts +15 -0
- package/dist/layout/scales/SveltePlotScale.js +86 -0
- package/dist/layout/scales/TickLabels.d.ts +32 -0
- package/dist/layout/scales/TickLabels.js +55 -0
- package/dist/layout/styles/StylesLayout.svelte +2 -2
- package/dist/layout/styles/ValueLabels.d.ts +33 -5
- package/dist/layout/styles/ValueLabels.js +83 -23
- package/dist/layout/timeline/Timeline.svelte +5 -2
- package/dist/layout/timeline/Timeline.svelte.d.ts +2 -0
- package/dist/layout/timeline/TimelineLayout.svelte +39 -13
- package/dist/layout/timeline/TimelineLayout.svelte.d.ts +7 -5
- package/dist/layout/timeline/TimelineRule.svelte +1 -0
- package/dist/layout/timeline/TimelineState.svelte.d.ts +13 -5
- package/dist/layout/timeline/TimelineState.svelte.js +42 -8
- package/dist/layout/timeline/TimelineTime.d.ts +18 -0
- package/dist/layout/timeline/TimelineTime.js +117 -0
- package/dist/layout/tooltip/Tooltip.svelte +10 -7
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +6 -4
- package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -2
- package/dist/layout/tooltip/TooltipState.svelte.js +23 -4
- package/dist/markers/MarkerKinds.d.ts +5 -0
- package/dist/markers/MarkerKinds.js +1 -0
- package/dist/markers/area/AreaMarker.svelte +15 -63
- package/dist/markers/arrow/ArrowMarker.svelte +51 -9
- package/dist/markers/bar/BarMarker.svelte +8 -4
- package/dist/markers/bollinger/BollingerMarker.svelte +33 -18
- package/dist/markers/box/BoxMarker.svelte +40 -9
- package/dist/markers/delta/Delta.js +1 -1
- package/dist/markers/delta/DeltaMarker.svelte +9 -7
- package/dist/markers/dot/DotMarker.svelte +24 -27
- package/dist/markers/image/ImageMarker.svelte +17 -12
- package/dist/markers/inset/InsetMarker.svelte +2 -2
- package/dist/markers/line/LineMarker.svelte +1 -0
- package/dist/markers/link/LinkMarker.svelte +174 -29
- package/dist/markers/regression/RegressionMarker.svelte +16 -33
- package/dist/markers/rule/RuleMarker.svelte +9 -3
- package/dist/markers/text/Declutter.d.ts +4 -0
- package/dist/markers/text/Declutter.js +26 -11
- package/dist/markers/text/TextMarker.svelte +91 -48
- package/dist/markers/tick/TickMarker.svelte +27 -25
- package/dist/markers/utils/MarkerChannels.d.ts +24 -0
- package/dist/markers/utils/MarkerChannels.js +42 -7
- package/dist/markers/utils/RowOffset.d.ts +23 -0
- package/dist/markers/utils/RowOffset.js +23 -0
- package/dist/markers/utils/RowOffsetMarks.svelte +30 -0
- package/dist/markers/utils/RowOffsetMarks.svelte.d.ts +33 -0
- package/dist/markers/utils/RowStroke.d.ts +31 -0
- package/dist/markers/utils/RowStroke.js +28 -0
- package/dist/markers/violin/ViolinMarker.svelte +75 -0
- package/dist/markers/violin/ViolinMarker.svelte.d.ts +7 -0
- package/dist/markers/violin/ViolinProfiles.d.ts +29 -0
- package/dist/markers/violin/ViolinProfiles.js +55 -0
- package/dist/markers/waffle/WaffleMarker.svelte +17 -37
- package/dist/phases/Pipeline.d.ts +5 -0
- package/dist/phases/Pipeline.js +8 -2
- package/dist/phases/data/DataPhase.d.ts +5 -11
- package/dist/phases/data/DataPhase.js +14 -11
- package/dist/phases/data/PlotAxes.d.ts +10 -0
- package/dist/phases/data/PlotAxes.js +14 -1
- package/dist/phases/facet/FacetPanels.d.ts +55 -0
- package/dist/phases/facet/FacetPanels.js +96 -0
- package/dist/phases/facet/FacetPhase.d.ts +1 -42
- package/dist/phases/facet/FacetPhase.js +1 -87
- package/dist/phases/hover/HoverPhase.d.ts +6 -43
- package/dist/phases/hover/HoverPhase.js +19 -54
- package/dist/phases/mapping/MappingPhase.d.ts +1 -1
- package/dist/phases/mapping/MappingPhase.js +3 -5
- package/dist/phases/markers/MarkersPhase.js +2 -1
- package/dist/phases/scales/CategoryOrder.d.ts +23 -0
- package/dist/phases/scales/CategoryOrder.js +73 -0
- package/dist/phases/scales/ScalesPhase.d.ts +1 -3
- package/dist/phases/scales/ScalesPhase.js +37 -27
- package/dist/phases/sharedScales/SharedScalesPhase.d.ts +6 -2
- package/dist/phases/sharedScales/SharedScalesPhase.js +14 -8
- package/dist/phases/statistics/Statistics.d.ts +10 -6
- package/dist/phases/statistics/Statistics.js +20 -10
- package/dist/phases/statistics/StatisticsPhase.js +10 -6
- package/dist/phases/statistics/methods/BollingerStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/BollingerStatistic.js +13 -11
- package/dist/phases/statistics/methods/BoxStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/BoxStatistic.js +14 -12
- package/dist/phases/statistics/methods/Density2dStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/Density2dStatistic.js +13 -11
- package/dist/phases/statistics/methods/DensityStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/DensityStatistic.js +11 -9
- package/dist/phases/statistics/methods/DeviationStatistic.d.ts +8 -0
- package/dist/phases/statistics/methods/DeviationStatistic.js +111 -0
- package/dist/phases/statistics/methods/MovingAverageStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/MovingAverageStatistic.js +11 -9
- package/dist/phases/statistics/methods/RegressionStatistic.d.ts +1 -1
- package/dist/phases/statistics/methods/RegressionStatistic.js +16 -14
- package/dist/phases/tooltip/TooltipPhase.d.ts +4 -2
- package/dist/phases/tooltip/TooltipPhase.js +10 -3
- package/dist/phases/transforms/ProcessedPositions.d.ts +30 -0
- package/dist/phases/transforms/ProcessedPositions.js +74 -0
- package/dist/phases/transforms/TransformsPhase.d.ts +5 -42
- package/dist/phases/transforms/TransformsPhase.js +67 -58
- package/dist/phases/transforms/ValueSelection.d.ts +30 -0
- package/dist/phases/transforms/ValueSelection.js +53 -0
- package/dist/plots/{heatmap → correlation/heatmap}/Plot.svelte +5 -2
- package/dist/plots/{heatmap → correlation/heatmap}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{heatmap → correlation/heatmap}/defaults.d.ts +2 -2
- package/dist/plots/{heatmap → correlation/heatmap}/defaults.js +5 -5
- package/dist/plots/{heatmap → correlation/heatmap}/markers.d.ts +4 -4
- package/dist/plots/{heatmap → correlation/heatmap}/markers.js +4 -3
- package/dist/plots/{scatter → correlation/scatter}/Plot.svelte +5 -2
- package/dist/plots/{scatter → correlation/scatter}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{scatter → correlation/scatter}/defaults.d.ts +2 -2
- package/dist/plots/{scatter → correlation/scatter}/defaults.js +6 -5
- package/dist/plots/{scatter → correlation/scatter}/markers.d.ts +4 -4
- package/dist/plots/{scatter → correlation/scatter}/markers.js +5 -4
- package/dist/plots/distribution/box/BoxSummaries.d.ts +19 -0
- package/dist/plots/distribution/box/BoxSummaries.js +101 -0
- package/dist/plots/distribution/box/Plot.svelte +42 -0
- package/dist/plots/distribution/box/Plot.svelte.d.ts +26 -0
- package/dist/plots/distribution/box/defaults.d.ts +12 -0
- package/dist/plots/distribution/box/defaults.js +34 -0
- package/dist/plots/distribution/box/markers.d.ts +12 -0
- package/dist/plots/distribution/box/markers.js +34 -0
- package/dist/plots/distribution/density/Plot.svelte +45 -0
- package/dist/plots/distribution/density/Plot.svelte.d.ts +26 -0
- package/dist/plots/distribution/density/defaults.d.ts +9 -0
- package/dist/plots/distribution/density/defaults.js +29 -0
- package/dist/plots/distribution/density/markers.d.ts +9 -0
- package/dist/plots/distribution/density/markers.js +42 -0
- package/dist/plots/{histogram → distribution/histogram}/Plot.svelte +2 -2
- package/dist/plots/{histogram → distribution/histogram}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{histogram → distribution/histogram}/defaults.d.ts +2 -2
- package/dist/plots/{histogram → distribution/histogram}/defaults.js +4 -4
- package/dist/plots/{histogram → distribution/histogram}/markers.d.ts +3 -3
- package/dist/plots/{histogram → distribution/histogram}/markers.js +7 -7
- package/dist/plots/{pyramid → distribution/pyramid}/Plot.svelte +5 -2
- package/dist/plots/{pyramid → distribution/pyramid}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{pyramid → distribution/pyramid}/defaults.d.ts +2 -2
- package/dist/plots/{pyramid → distribution/pyramid}/defaults.js +7 -6
- package/dist/plots/{pyramid → distribution/pyramid}/markers.d.ts +4 -4
- package/dist/plots/{pyramid → distribution/pyramid}/markers.js +8 -11
- package/dist/plots/distribution/violin/Plot.svelte +45 -0
- package/dist/plots/distribution/violin/Plot.svelte.d.ts +26 -0
- package/dist/plots/distribution/violin/defaults.d.ts +10 -0
- package/dist/plots/distribution/violin/defaults.js +58 -0
- package/dist/plots/distribution/violin/markers.d.ts +10 -0
- package/dist/plots/distribution/violin/markers.js +71 -0
- package/dist/plots/{area → evolution/area}/Plot.svelte +2 -2
- package/dist/plots/{area → evolution/area}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{area → evolution/area}/defaults.d.ts +2 -2
- package/dist/plots/{area → evolution/area}/defaults.js +2 -0
- package/dist/plots/{area → evolution/area}/markers.d.ts +2 -2
- package/dist/plots/{area → evolution/area}/markers.js +2 -3
- package/dist/plots/{line → evolution/line}/Plot.svelte +2 -2
- package/dist/plots/{line → evolution/line}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{line → evolution/line}/defaults.d.ts +2 -2
- package/dist/plots/{line → evolution/line}/defaults.js +2 -0
- package/dist/plots/{line → evolution/line}/markers.d.ts +11 -8
- package/dist/plots/{line → evolution/line}/markers.js +7 -6
- package/dist/plots/evolution/slope/Plot.svelte +42 -0
- package/dist/plots/evolution/slope/Plot.svelte.d.ts +26 -0
- package/dist/plots/evolution/slope/defaults.d.ts +8 -0
- package/dist/plots/evolution/slope/defaults.js +31 -0
- package/dist/plots/evolution/slope/markers.d.ts +16 -0
- package/dist/plots/evolution/slope/markers.js +79 -0
- package/dist/plots/evolution/sparkline/Plot.svelte +45 -0
- package/dist/plots/evolution/sparkline/Plot.svelte.d.ts +26 -0
- package/dist/plots/evolution/sparkline/defaults.d.ts +7 -0
- package/dist/plots/evolution/sparkline/defaults.js +23 -0
- package/dist/plots/evolution/sparkline/markers.d.ts +7 -0
- package/dist/plots/evolution/sparkline/markers.js +56 -0
- package/dist/plots/{geo → map/geo}/Core.svelte +11 -10
- package/dist/plots/{geo → map/geo}/Core.svelte.d.ts +1 -1
- package/dist/plots/map/geo/GeoFeatures.svelte.d.ts +9 -0
- package/dist/plots/map/geo/GeoFeatures.svelte.js +55 -0
- package/dist/plots/map/geo/GeoGeometry.d.ts +27 -0
- package/dist/plots/map/geo/GeoGeometry.js +142 -0
- package/dist/plots/map/geo/GeoSegments.d.ts +16 -0
- package/dist/plots/map/geo/GeoSegments.js +23 -0
- package/dist/plots/{geo → map/geo}/Plot.svelte +10 -10
- package/dist/plots/{geo → map/geo}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{geo → map/geo}/defaults.d.ts +2 -2
- package/dist/plots/{geo → map/geo}/defaults.js +1 -1
- package/dist/plots/{geo → map/geo}/phases/data.d.ts +1 -1
- package/dist/plots/{geo → map/geo}/phases/data.js +7 -6
- package/dist/plots/{geo → map/geo}/phases/hover.d.ts +1 -1
- package/dist/plots/{geo → map/geo}/phases/hover.js +5 -5
- package/dist/plots/{geo → map/geo}/phases/markers.d.ts +1 -1
- package/dist/plots/{geo → map/geo}/phases/markers.js +8 -13
- package/dist/plots/{geo → map/geo}/phases/scales.d.ts +2 -2
- package/dist/plots/{geo → map/geo}/phases/scales.js +28 -12
- package/dist/plots/{geo → map/geo}/phases/tooltip.d.ts +1 -1
- package/dist/plots/map/geo/phases/tooltip.js +5 -0
- package/dist/plots/{geo → map/geo}/slices.d.ts +2 -2
- package/dist/plots/{geo → map/geo}/slices.js +7 -4
- package/dist/plots/{bar → ranking/bar}/Plot.svelte +2 -2
- package/dist/plots/{bar → ranking/bar}/Plot.svelte.d.ts +2 -2
- package/dist/plots/ranking/bar/defaults.d.ts +16 -0
- package/dist/plots/{bar → ranking/bar}/defaults.js +17 -15
- package/dist/plots/{bar → ranking/bar}/markers.d.ts +8 -8
- package/dist/plots/{bar → ranking/bar}/markers.js +11 -19
- package/dist/plots/ranking/bullet/Plot.svelte +42 -0
- package/dist/plots/ranking/bullet/Plot.svelte.d.ts +26 -0
- package/dist/plots/ranking/bullet/defaults.d.ts +8 -0
- package/dist/plots/ranking/bullet/defaults.js +24 -0
- package/dist/plots/ranking/bullet/markers.d.ts +10 -0
- package/dist/plots/ranking/bullet/markers.js +90 -0
- package/dist/plots/ranking/cleveland/ClevelandConnector.d.ts +48 -0
- package/dist/plots/ranking/cleveland/ClevelandConnector.js +140 -0
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +33 -0
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +375 -0
- package/dist/plots/ranking/cleveland/ClevelandRanges.d.ts +31 -0
- package/dist/plots/ranking/cleveland/ClevelandRanges.js +116 -0
- package/dist/plots/ranking/cleveland/Plot.svelte +45 -0
- package/dist/plots/ranking/cleveland/Plot.svelte.d.ts +26 -0
- package/dist/plots/ranking/cleveland/defaults.d.ts +13 -0
- package/dist/plots/ranking/cleveland/defaults.js +66 -0
- package/dist/plots/ranking/dumbbell/Plot.svelte +45 -0
- package/dist/plots/ranking/dumbbell/Plot.svelte.d.ts +26 -0
- package/dist/plots/ranking/dumbbell/defaults.d.ts +9 -0
- package/dist/plots/ranking/dumbbell/defaults.js +19 -0
- package/dist/plots/ranking/forest/Plot.svelte +42 -0
- package/dist/plots/ranking/forest/Plot.svelte.d.ts +26 -0
- package/dist/plots/ranking/forest/defaults.d.ts +11 -0
- package/dist/plots/ranking/forest/defaults.js +20 -0
- package/dist/plots/ranking/lollipop/Plot.svelte +45 -0
- package/dist/plots/ranking/lollipop/Plot.svelte.d.ts +26 -0
- package/dist/plots/ranking/lollipop/defaults.d.ts +9 -0
- package/dist/plots/ranking/lollipop/defaults.js +18 -0
- package/dist/plots/utils/RowNumbers.d.ts +16 -0
- package/dist/plots/utils/RowNumbers.js +24 -0
- package/dist/plots/utils/gaps.js +1 -1
- package/dist/plots/utils/segments.js +1 -1
- package/dist/types/configuration/styling.d.ts +287 -132
- package/dist/types/layout/composer.d.ts +5 -2
- package/dist/types/layout/coordinates.d.ts +5 -4
- package/dist/types/layout/legend.d.ts +21 -5
- package/dist/types/layout/plot.d.ts +44 -1
- package/dist/types/layout/scales.d.ts +51 -3
- package/dist/types/layout/statistics/deviation.d.ts +40 -0
- package/dist/types/layout/statistics/index.d.ts +7 -2
- package/dist/types/layout/styles/base.d.ts +18 -0
- package/dist/types/layout/styles/bullet.d.ts +25 -0
- package/dist/types/layout/styles/connector.d.ts +98 -0
- package/dist/types/layout/styles/curve.d.ts +11 -0
- package/dist/types/layout/styles/frame.d.ts +17 -0
- package/dist/types/layout/styles/gaps.d.ts +12 -0
- package/dist/types/layout/styles/geo.d.ts +55 -0
- package/dist/types/layout/styles/index.d.ts +8 -0
- package/dist/types/layout/styles/index.js +8 -0
- package/dist/types/layout/styles/values.d.ts +47 -0
- package/dist/types/layout/timeline.d.ts +19 -7
- package/dist/types/layout/tooltip.d.ts +6 -2
- package/dist/types/markers/axis/area.d.ts +2 -2
- package/dist/types/markers/axis/arrow.d.ts +3 -0
- package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
- package/dist/types/markers/axis/bar.d.ts +1 -1
- package/dist/types/markers/axis/box.d.ts +5 -0
- package/dist/types/markers/axis/difference.d.ts +2 -2
- package/dist/types/markers/axis/image.d.ts +3 -2
- package/dist/types/markers/axis/line.d.ts +2 -0
- package/dist/types/markers/axis/rule.d.ts +9 -0
- package/dist/types/markers/axis/trail.d.ts +2 -3
- package/dist/types/markers/axis/violin.d.ts +25 -0
- package/dist/types/markers/basic/dot.d.ts +3 -2
- package/dist/types/markers/basic/text.d.ts +13 -3
- package/dist/types/markers/channels/commonMarkerConfig.d.ts +7 -3
- package/dist/types/markers/channels/commonMarkerConfigWithRowOffset.d.ts +13 -0
- package/dist/types/markers/common.d.ts +1 -1
- package/dist/types/markers/common.js +1 -0
- package/dist/types/markers/geo/link.d.ts +5 -1
- package/dist/types/phases/hover/phase.d.ts +6 -0
- package/dist/types/phases/index.d.ts +1 -1
- package/dist/types/phases/scales/phase.d.ts +5 -1
- package/dist/types/phases/state.d.ts +20 -4
- package/dist/types/phases/statistics/phase.d.ts +3 -1
- package/dist/types/phases/statistics/source.d.ts +3 -1
- package/dist/types/phases/transforms/phase.d.ts +32 -0
- package/dist/types/plots/{heatmap → correlation/heatmap}/props.d.ts +6 -6
- package/dist/types/plots/{heatmap → correlation/heatmap}/state.d.ts +4 -4
- package/dist/types/plots/{scatter → correlation/scatter}/props.d.ts +6 -6
- package/dist/types/plots/{scatter → correlation/scatter}/state.d.ts +2 -2
- package/dist/types/plots/distribution/box/props.d.ts +10 -0
- package/dist/types/plots/distribution/box/state.d.ts +23 -0
- package/dist/types/plots/distribution/density/props.d.ts +23 -0
- package/dist/types/plots/distribution/density/state.d.ts +6 -0
- package/dist/types/plots/distribution/density/state.js +1 -0
- package/dist/types/plots/{histogram → distribution/histogram}/props.d.ts +7 -7
- package/dist/types/plots/distribution/histogram/props.js +1 -0
- package/dist/types/plots/{histogram → distribution/histogram}/state.d.ts +2 -2
- package/dist/types/plots/distribution/histogram/state.js +1 -0
- package/dist/types/plots/{pyramid → distribution/pyramid}/props.d.ts +6 -6
- package/dist/types/plots/distribution/pyramid/props.js +1 -0
- package/dist/types/plots/{pyramid → distribution/pyramid}/state.d.ts +3 -3
- package/dist/types/plots/distribution/pyramid/state.js +1 -0
- package/dist/types/plots/distribution/violin/props.d.ts +23 -0
- package/dist/types/plots/distribution/violin/props.js +1 -0
- package/dist/types/plots/distribution/violin/state.d.ts +6 -0
- package/dist/types/plots/distribution/violin/state.js +1 -0
- package/dist/types/plots/{area → evolution/area}/props.d.ts +6 -6
- package/dist/types/plots/evolution/area/props.js +1 -0
- package/dist/types/plots/{area → evolution/area}/state.d.ts +2 -2
- package/dist/types/plots/evolution/area/state.js +1 -0
- package/dist/types/plots/evolution/line/props.d.ts +10 -0
- package/dist/types/plots/evolution/line/props.js +1 -0
- package/dist/types/plots/{line → evolution/line}/state.d.ts +3 -3
- package/dist/types/plots/evolution/line/state.js +1 -0
- package/dist/types/plots/evolution/slope/props.d.ts +5 -0
- package/dist/types/plots/evolution/slope/props.js +1 -0
- package/dist/types/plots/evolution/slope/state.d.ts +5 -0
- package/dist/types/plots/evolution/slope/state.js +1 -0
- package/dist/types/plots/evolution/sparkline/props.d.ts +5 -0
- package/dist/types/plots/evolution/sparkline/props.js +1 -0
- package/dist/types/plots/evolution/sparkline/state.d.ts +5 -0
- package/dist/types/plots/evolution/sparkline/state.js +1 -0
- package/dist/types/plots/{geo → map/geo}/props.d.ts +8 -8
- package/dist/types/plots/map/geo/props.js +1 -0
- package/dist/types/plots/{geo → map/geo}/state.d.ts +18 -11
- package/dist/types/plots/map/geo/state.js +1 -0
- package/dist/types/plots/props.d.ts +3 -1
- package/dist/types/plots/{bar → ranking/bar}/props.d.ts +6 -6
- package/dist/types/plots/ranking/bar/props.js +1 -0
- package/dist/types/plots/{bar → ranking/bar}/state.d.ts +2 -2
- package/dist/types/plots/ranking/bar/state.js +1 -0
- package/dist/types/plots/ranking/bullet/props.d.ts +22 -0
- package/dist/types/plots/ranking/bullet/props.js +1 -0
- package/dist/types/plots/ranking/bullet/state.d.ts +5 -0
- package/dist/types/plots/ranking/bullet/state.js +1 -0
- package/dist/types/plots/ranking/cleveland/props.d.ts +10 -0
- package/dist/types/plots/ranking/cleveland/props.js +1 -0
- package/dist/types/plots/ranking/cleveland/state.d.ts +49 -0
- package/dist/types/plots/ranking/cleveland/state.js +1 -0
- package/dist/types/plots/ranking/dumbbell/props.d.ts +10 -0
- package/dist/types/plots/ranking/dumbbell/props.js +1 -0
- package/dist/types/plots/ranking/dumbbell/state.d.ts +5 -0
- package/dist/types/plots/ranking/dumbbell/state.js +1 -0
- package/dist/types/plots/ranking/forest/props.d.ts +23 -0
- package/dist/types/plots/ranking/forest/props.js +1 -0
- package/dist/types/plots/ranking/forest/state.d.ts +5 -0
- package/dist/types/plots/ranking/forest/state.js +1 -0
- package/dist/types/plots/ranking/lollipop/props.d.ts +10 -0
- package/dist/types/plots/ranking/lollipop/props.js +1 -0
- package/dist/types/plots/ranking/lollipop/state.d.ts +5 -0
- package/dist/types/plots/ranking/lollipop/state.js +1 -0
- package/dist/types/plots/segments/common.d.ts +4 -1
- package/dist/utils/OpacityScale.d.ts +14 -0
- package/dist/utils/OpacityScale.js +43 -0
- package/dist/utils/{symbol.d.ts → SymbolPath.d.ts} +0 -12
- package/dist/utils/{symbol.js → SymbolPath.js} +0 -24
- package/dist/utils/SymbolScale.d.ts +18 -0
- package/dist/utils/SymbolScale.js +29 -0
- package/dist/utils/color/ColorRamp.d.ts +27 -0
- package/dist/utils/color/ColorRamp.js +120 -0
- package/dist/utils/color/CssColor.d.ts +19 -0
- package/dist/utils/color/CssColor.js +114 -0
- package/dist/utils/color/Palette.d.ts +21 -0
- package/dist/utils/color/Palette.js +52 -0
- package/dist/utils/color/index.d.ts +11 -3
- package/dist/utils/color/index.js +14 -3
- package/dist/utils/grouping.js +1 -1
- package/docs/architecture.md +1 -1
- package/docs/chrome.md +39 -8
- package/docs/composer.md +19 -3
- package/docs/concepts.md +1 -1
- package/docs/development.md +14 -5
- package/docs/facets.md +62 -8
- package/docs/getting-started.md +8 -9
- package/docs/legend.md +73 -24
- package/docs/markers.md +45 -32
- package/docs/plots/correlation/heatmap.md +26 -0
- package/docs/plots/correlation/scatter.md +35 -0
- package/docs/plots/distribution/box.md +28 -0
- package/docs/plots/distribution/density.md +26 -0
- package/docs/plots/distribution/histogram.md +33 -0
- package/docs/plots/distribution/pyramid.md +31 -0
- package/docs/plots/distribution/violin.md +35 -0
- package/docs/plots/evolution/area.md +32 -0
- package/docs/plots/evolution/line.md +93 -0
- package/docs/plots/evolution/slope.md +39 -0
- package/docs/plots/evolution/sparkline.md +34 -0
- package/docs/plots/ranking/bar.md +59 -0
- package/docs/plots/ranking/bullet.md +37 -0
- package/docs/plots/ranking/cleveland.md +54 -0
- package/docs/plots/ranking/dumbbell.md +39 -0
- package/docs/plots/ranking/forest.md +40 -0
- package/docs/plots/ranking/lollipop.md +39 -0
- package/docs/plots.md +22 -154
- package/docs/scales.md +50 -27
- package/docs/state.md +1 -1
- package/docs/styles-and-segments.md +96 -39
- package/docs/theming.md +33 -19
- package/docs/timeline.md +62 -28
- package/docs/tooltip-and-hover.md +72 -24
- package/docs/transforms-and-statistics.md +56 -25
- package/examples/BarValues.svelte +2 -2
- package/examples/Box.svelte +7 -0
- package/examples/Bullet.svelte +17 -0
- package/examples/Chrome.svelte +17 -0
- package/examples/ChromeOrder.svelte +18 -0
- package/examples/Cleveland.svelte +15 -0
- package/examples/Composer.svelte +23 -0
- package/examples/CustomTooltip.svelte +21 -14
- package/examples/Density.svelte +7 -0
- package/examples/Dumbbell.svelte +16 -0
- package/examples/Facets.svelte +3 -3
- package/examples/FacetsCarousel.svelte +14 -0
- package/examples/FacetsRowsCols.svelte +23 -0
- package/examples/FirstPlot.svelte +7 -0
- package/examples/Forest.svelte +17 -0
- package/examples/Gaps.svelte +21 -0
- package/examples/GroupedBars.svelte +15 -0
- package/examples/Heatmap.svelte +7 -0
- package/examples/HeatmapSegments.svelte +26 -0
- package/examples/Histogram.svelte +14 -0
- package/examples/HorizontalBars.svelte +15 -0
- package/examples/LegendSections.svelte +27 -0
- package/examples/LegendToggle.svelte +3 -3
- package/examples/LineByRegion.svelte +18 -0
- package/examples/LineDates.svelte +15 -0
- package/examples/LineStep.svelte +16 -0
- package/examples/LineStepSegment.svelte +18 -0
- package/examples/Lollipop.svelte +17 -0
- package/examples/Markers.svelte +27 -0
- package/examples/MovingAverage.svelte +15 -0
- package/examples/Pyramid.svelte +14 -0
- package/examples/Regression.svelte +14 -0
- package/examples/ResponsiveLine.svelte +7 -7
- package/examples/Scales.svelte +26 -0
- package/examples/Scatter.svelte +16 -0
- package/examples/SegmentHighlight.svelte +22 -0
- package/examples/Segments.svelte +11 -3
- package/examples/SegmentsBySeries.svelte +25 -0
- package/examples/Slope.svelte +17 -0
- package/examples/Sparkline.svelte +14 -0
- package/examples/StackedArea.svelte +16 -0
- package/examples/StackedBars.svelte +15 -0
- package/examples/TimelinePlayer.svelte +8 -7
- package/examples/TimelineRule.svelte +19 -0
- package/examples/Tooltip.svelte +3 -3
- package/examples/ValueLabels.svelte +21 -0
- package/examples/Violin.svelte +14 -0
- package/examples/datasets/argentina-chile-trends.ts +34 -0
- package/examples/datasets/commodity-prices.ts +48 -0
- package/examples/datasets/countries-over-time.ts +368 -0
- package/examples/datasets/daily-temperature.ts +121 -0
- package/examples/datasets/earthquakes.ts +977 -0
- package/examples/datasets/flight-routes.ts +29 -0
- package/examples/datasets/height-density.ts +37 -0
- package/examples/datasets/heights.ts +370 -0
- package/examples/datasets/index.ts +24 -0
- package/examples/datasets/inflation-by-region.ts +44 -0
- package/examples/datasets/inflation-ranges.ts +34 -0
- package/examples/datasets/iris-flower.ts +207 -0
- package/examples/datasets/life-expectancy.ts +95 -0
- package/examples/datasets/napoleons-march.ts +182 -0
- package/examples/datasets/penguins.ts +54 -0
- package/examples/datasets/population-by-age-with-gaps.ts +23 -0
- package/examples/datasets/population-by-age.ts +890 -0
- package/examples/datasets/province-population.ts +521 -0
- package/examples/datasets/stock-prices.ts +63 -0
- package/examples/datasets/weather-stations-over-time.ts +31 -0
- package/examples/datasets/weather-stations.ts +22 -0
- package/examples/datasets/wind-vectors.ts +30 -0
- package/examples/datasets/world-temperature.ts +400 -0
- package/llms-full.txt +51 -12
- package/llms.txt +60 -4
- package/package.json +12 -2
- package/dist/layout/scales/buildScale.d.ts +0 -8
- package/dist/layout/scales/buildScale.js +0 -67
- package/dist/layout/scales/niceDomain.d.ts +0 -23
- package/dist/layout/scales/niceDomain.js +0 -59
- package/dist/plots/bar/defaults.d.ts +0 -9
- package/dist/plots/geo/features.svelte.d.ts +0 -5
- package/dist/plots/geo/features.svelte.js +0 -44
- package/dist/plots/geo/phases/tooltip.js +0 -5
- package/dist/plots/utils/geoAccessors.d.ts +0 -72
- package/dist/plots/utils/geoAccessors.js +0 -220
- package/dist/plots/utils/geoSegments.d.ts +0 -29
- package/dist/plots/utils/geoSegments.js +0 -37
- package/dist/types/layout/styles.d.ts +0 -122
- package/dist/types/markers/axis/curveName.d.ts +0 -2
- package/dist/types/plots/line/props.d.ts +0 -10
- package/dist/utils/color/contrast.d.ts +0 -9
- package/dist/utils/color/contrast.js +0 -40
- package/dist/utils/color/cssColor.d.ts +0 -4
- package/dist/utils/color/cssColor.js +0 -77
- package/dist/utils/color/ramp.d.ts +0 -17
- package/dist/utils/color/ramp.js +0 -110
- package/dist/utils/opacity.d.ts +0 -9
- package/dist/utils/opacity.js +0 -38
- package/examples/data.ts +0 -12
- /package/dist/types/layout/{styles.js → statistics/deviation.js} +0 -0
- /package/dist/types/{markers/axis/curveName.js → layout/styles/base.js} +0 -0
- /package/dist/types/{plots/area/props.js → layout/styles/bullet.js} +0 -0
- /package/dist/types/{plots/area/state.js → layout/styles/connector.js} +0 -0
- /package/dist/types/{plots/bar/props.js → layout/styles/curve.js} +0 -0
- /package/dist/types/{plots/bar/state.js → layout/styles/frame.js} +0 -0
- /package/dist/types/{plots/geo/props.js → layout/styles/gaps.js} +0 -0
- /package/dist/types/{plots/geo/state.js → layout/styles/geo.js} +0 -0
- /package/dist/types/{plots/heatmap/props.js → layout/styles/values.js} +0 -0
- /package/dist/types/{plots/heatmap/state.js → markers/axis/violin.js} +0 -0
- /package/dist/types/{plots/histogram/props.js → markers/channels/commonMarkerConfigWithRowOffset.js} +0 -0
- /package/dist/types/plots/{line → correlation/heatmap}/props.js +0 -0
- /package/dist/types/plots/{histogram → correlation/heatmap}/state.js +0 -0
- /package/dist/types/plots/{pyramid → correlation/scatter}/props.js +0 -0
- /package/dist/types/plots/{line → correlation/scatter}/state.js +0 -0
- /package/dist/types/plots/{scatter → distribution/box}/props.js +0 -0
- /package/dist/types/plots/{pyramid → distribution/box}/state.js +0 -0
- /package/dist/types/plots/{scatter/state.js → distribution/density/props.js} +0 -0
- /package/dist/{plots/utils → utils}/accessors.d.ts +0 -0
- /package/dist/{plots/utils → utils}/accessors.js +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { Accessor } from '../../types/plots/data/common';
|
|
2
1
|
import type { AxisPlotState, AxisPlotCtx, DataStageOptions, PhaseStage } from '../../types/phases';
|
|
3
2
|
type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
4
3
|
/**
|
|
5
4
|
* The "data" phase every axis-based plot shares: its series (from `series`,
|
|
6
|
-
* or flat rows split by
|
|
7
|
-
* channel is and which way the plot runs
|
|
8
|
-
* color, the series a legend omits dropped,
|
|
9
|
-
* visual segments, and - for a discrete
|
|
5
|
+
* or flat rows split by `seriesGrouping`: its `grouping`, or a categorical
|
|
6
|
+
* `color`), what each position channel is and which way the plot runs
|
|
7
|
+
* ({@link PlotAxes}), each series' color, the series a legend omits dropped,
|
|
8
|
+
* each series cut into its styled visual segments, and - for a discrete
|
|
9
|
+
* mark - the values its gaps fill in.
|
|
10
10
|
* Colors and axes come from every series, before any is omitted or split by
|
|
11
11
|
* facet panel, so they stay put and every panel agrees.
|
|
12
12
|
*/
|
|
@@ -15,11 +15,5 @@ export declare class DataPhase<TState extends AnyAxisState, TCtx extends AxisPlo
|
|
|
15
15
|
readonly phase: "data";
|
|
16
16
|
constructor(options?: DataStageOptions<TState, TCtx>);
|
|
17
17
|
run: (state: TState, ctx: TCtx) => TState;
|
|
18
|
-
/**
|
|
19
|
-
* The key a plot's rows split into series by: its `grouping`, or its `color`
|
|
20
|
-
* when that names categories. A numeric `color` is a continuous value (a
|
|
21
|
-
* heatmap's cells), so it colors rows without grouping them.
|
|
22
|
-
*/
|
|
23
|
-
static buildGrouping(state: Pick<AnyAxisState, 'grouping' | 'color' | 'data'>): Accessor<any, unknown> | undefined;
|
|
24
18
|
}
|
|
25
19
|
export {};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { buildSeries } from '../../utils/grouping';
|
|
2
|
-
import {
|
|
3
|
-
import { resolveAccessor } from '../../
|
|
2
|
+
import { ColorRamp } from '../../utils/color';
|
|
3
|
+
import { resolveAccessor } from '../../utils/accessors';
|
|
4
4
|
import { buildGroupedSeries, buildScopedMarkerGroups } from '../../plots/utils/segments';
|
|
5
5
|
import { buildGapFillMaps, isGapValue } from '../../plots/utils/gaps';
|
|
6
|
-
import {
|
|
6
|
+
import { FacetPanels } from '../facet/FacetPanels';
|
|
7
7
|
import { PlotAxes } from './PlotAxes';
|
|
8
8
|
/**
|
|
9
9
|
* The "data" phase every axis-based plot shares: its series (from `series`,
|
|
10
|
-
* or flat rows split by
|
|
11
|
-
* channel is and which way the plot runs
|
|
12
|
-
* color, the series a legend omits dropped,
|
|
13
|
-
* visual segments, and - for a discrete
|
|
10
|
+
* or flat rows split by `seriesGrouping`: its `grouping`, or a categorical
|
|
11
|
+
* `color`), what each position channel is and which way the plot runs
|
|
12
|
+
* ({@link PlotAxes}), each series' color, the series a legend omits dropped,
|
|
13
|
+
* each series cut into its styled visual segments, and - for a discrete
|
|
14
|
+
* mark - the values its gaps fill in.
|
|
14
15
|
* Colors and axes come from every series, before any is omitted or split by
|
|
15
16
|
* facet panel, so they stay put and every panel agrees.
|
|
16
17
|
*/
|
|
@@ -24,7 +25,8 @@ export class DataPhase {
|
|
|
24
25
|
const options = this.#options;
|
|
25
26
|
const { series, data, segments, scales } = state;
|
|
26
27
|
const { connect = true, color: segmentColor } = options.segments ?? {};
|
|
27
|
-
const
|
|
28
|
+
const seriesGrouping = DataPhase.#buildGrouping(state);
|
|
29
|
+
const built = series ?? buildSeries(data ?? [], state.x, state.y, seriesGrouping);
|
|
28
30
|
const fullSeries = options.orderSeries ? options.orderSeries(built, state) : built;
|
|
29
31
|
const axes = PlotAxes.build({
|
|
30
32
|
series: fullSeries,
|
|
@@ -32,9 +34,9 @@ export class DataPhase {
|
|
|
32
34
|
given: { x: state.x !== undefined, y: state.y !== undefined },
|
|
33
35
|
discrete: options.discreteAxes
|
|
34
36
|
});
|
|
35
|
-
const colorForSeries =
|
|
37
|
+
const colorForSeries = ColorRamp.resolve(scales.color, (options.colorOrder ? options.colorOrder(fullSeries) : fullSeries).map((s) => s.name), ctx.cfg.palette);
|
|
36
38
|
const panelSeries = state.panels && state.panelOf && !series
|
|
37
|
-
?
|
|
39
|
+
? FacetPanels.splitSeries(fullSeries, state.panels, state.panelOf)
|
|
38
40
|
: fullSeries;
|
|
39
41
|
const resolvedSeries = ctx.interaction?.legend?.withoutOmitted(panelSeries) ?? panelSeries;
|
|
40
42
|
const groupedSeries = buildGroupedSeries(resolvedSeries, segments, connect);
|
|
@@ -52,6 +54,7 @@ export class DataPhase {
|
|
|
52
54
|
...state,
|
|
53
55
|
axes,
|
|
54
56
|
resolvedSeries,
|
|
57
|
+
seriesGrouping,
|
|
55
58
|
allSeriesNames: fullSeries.map((s) => s.name),
|
|
56
59
|
groupedSeries,
|
|
57
60
|
flat: resolvedSeries.flatMap((s) => s.data),
|
|
@@ -66,7 +69,7 @@ export class DataPhase {
|
|
|
66
69
|
* when that names categories. A numeric `color` is a continuous value (a
|
|
67
70
|
* heatmap's cells), so it colors rows without grouping them.
|
|
68
71
|
*/
|
|
69
|
-
static buildGrouping(state
|
|
72
|
+
static #buildGrouping(state
|
|
70
73
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
71
74
|
) {
|
|
72
75
|
if (state.grouping !== undefined)
|
|
@@ -58,6 +58,16 @@ export declare class PlotAxes {
|
|
|
58
58
|
static categoryOf(state: {
|
|
59
59
|
axes?: PlotAxes;
|
|
60
60
|
}): AxisChannelName;
|
|
61
|
+
/**
|
|
62
|
+
* Where marks that rise from a baseline start along the value axis: zero,
|
|
63
|
+
* or the nearest end of a pinned domain that leaves zero out.
|
|
64
|
+
*/
|
|
65
|
+
static baselineOf(state: {
|
|
66
|
+
axes?: PlotAxes;
|
|
67
|
+
scales: Partial<Record<AxisChannelName, {
|
|
68
|
+
domain?: readonly unknown[];
|
|
69
|
+
}>>;
|
|
70
|
+
}): number;
|
|
61
71
|
/** The other position axis. */
|
|
62
72
|
static other(axis: AxisChannelName): AxisChannelName;
|
|
63
73
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { resolveAccessor } from '../../
|
|
1
|
+
import { resolveAccessor } from '../../utils/accessors';
|
|
2
2
|
import { isGapValue } from '../../plots/utils/gaps';
|
|
3
3
|
import { DISCRETE_SCALE_TYPES, TEMPORAL_SCALE_TYPES } from '../../types/layout/scales';
|
|
4
4
|
const AXES = ['x', 'y'];
|
|
@@ -47,6 +47,19 @@ export class PlotAxes {
|
|
|
47
47
|
static categoryOf(state) {
|
|
48
48
|
return state.axes?.category ?? 'x';
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* Where marks that rise from a baseline start along the value axis: zero,
|
|
52
|
+
* or the nearest end of a pinned domain that leaves zero out.
|
|
53
|
+
*/
|
|
54
|
+
static baselineOf(state) {
|
|
55
|
+
const domain = state.scales[PlotAxes.valueOf(state)]?.domain;
|
|
56
|
+
const lo = Number(domain?.[0]);
|
|
57
|
+
const hi = Number(domain?.[(domain?.length ?? 1) - 1]);
|
|
58
|
+
if (!domain || domain.length < 2 || Number.isNaN(lo) || Number.isNaN(hi))
|
|
59
|
+
return 0;
|
|
60
|
+
const [min, max] = [Math.min(lo, hi), Math.max(lo, hi)];
|
|
61
|
+
return min > 0 ? min : max < 0 ? max : 0;
|
|
62
|
+
}
|
|
50
63
|
/** The other position axis. */
|
|
51
64
|
static other(axis) {
|
|
52
65
|
return axis === 'x' ? 'y' : 'x';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Series } from '../../types/plots/data/common';
|
|
2
|
+
import type { FacetPanel, FacetStageState } from '../../types/phases';
|
|
3
|
+
/** The state fields narrowing to some panels filters. */
|
|
4
|
+
type NarrowableState = FacetStageState & {
|
|
5
|
+
resolvedSeries?: Series<Record<string, unknown>>[];
|
|
6
|
+
flat?: unknown[];
|
|
7
|
+
scopedGroups?: {
|
|
8
|
+
panel?: string;
|
|
9
|
+
}[];
|
|
10
|
+
groupedSeries?: {
|
|
11
|
+
series: {
|
|
12
|
+
panel?: string;
|
|
13
|
+
};
|
|
14
|
+
}[];
|
|
15
|
+
processedData?: {
|
|
16
|
+
data: Record<string | symbol, unknown>[];
|
|
17
|
+
};
|
|
18
|
+
processedGroups?: {
|
|
19
|
+
series: {
|
|
20
|
+
panel?: string;
|
|
21
|
+
};
|
|
22
|
+
}[];
|
|
23
|
+
labelled?: Record<string | symbol, unknown>[];
|
|
24
|
+
};
|
|
25
|
+
/** The field a processed row carries its facet panel under. */
|
|
26
|
+
export declare const PANEL_KEY = "__panel";
|
|
27
|
+
/**
|
|
28
|
+
* What the "facet" phase's panels do to the rest of a plot's state: each
|
|
29
|
+
* series split into one per panel, a state narrowed to some panels, and one
|
|
30
|
+
* panel's part of a run over every panel.
|
|
31
|
+
*/
|
|
32
|
+
export declare class FacetPanels {
|
|
33
|
+
/** The id of a series' part in one facet panel. */
|
|
34
|
+
static buildSeriesId(panel: string, name: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Each series split into one per facet panel, panel by panel: the same
|
|
37
|
+
* `name` (and so the same color and legend entry), its own `id` and `panel`,
|
|
38
|
+
* and only that panel's rows. A series with no rows in a panel has no part there.
|
|
39
|
+
*/
|
|
40
|
+
static splitSeries<S extends Series<Record<string, unknown>>>(series: S[], panels: FacetPanel[], panelOf: NonNullable<FacetStageState['panelOf']>): S[];
|
|
41
|
+
/** A state narrowed to one panel's series, rows and processed rows. */
|
|
42
|
+
static narrowToPanel<TState extends NarrowableState>(state: TState, panel: string): TState;
|
|
43
|
+
/** A state narrowed to some panels' series, rows and processed rows. */
|
|
44
|
+
static narrowToPanels<TState extends NarrowableState>(state: TState, panels: readonly string[]): TState;
|
|
45
|
+
/**
|
|
46
|
+
* One facet panel's part of a run of the data phases over every panel: its
|
|
47
|
+
* series, rows, processed rows and markers, without the facet itself, ready
|
|
48
|
+
* for the phases each panel runs on its own.
|
|
49
|
+
*/
|
|
50
|
+
static buildPanelState<TState extends FacetStageState & {
|
|
51
|
+
resolvedSeries?: Series<Record<string, unknown>>[];
|
|
52
|
+
markers?: object[];
|
|
53
|
+
}>(state: TState, panel: string): Omit<TState, 'facet' | 'panels' | 'panelOf'>;
|
|
54
|
+
}
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** The field a processed row carries its facet panel under. */
|
|
2
|
+
export const PANEL_KEY = '__panel';
|
|
3
|
+
/**
|
|
4
|
+
* What the "facet" phase's panels do to the rest of a plot's state: each
|
|
5
|
+
* series split into one per panel, a state narrowed to some panels, and one
|
|
6
|
+
* panel's part of a run over every panel.
|
|
7
|
+
*/
|
|
8
|
+
export class FacetPanels {
|
|
9
|
+
/** The id of a series' part in one facet panel. */
|
|
10
|
+
static buildSeriesId(panel, name) {
|
|
11
|
+
return `${panel}\u0000${name}`;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Each series split into one per facet panel, panel by panel: the same
|
|
15
|
+
* `name` (and so the same color and legend entry), its own `id` and `panel`,
|
|
16
|
+
* and only that panel's rows. A series with no rows in a panel has no part there.
|
|
17
|
+
*/
|
|
18
|
+
static splitSeries(series, panels, panelOf) {
|
|
19
|
+
const rowsByPanel = series.map((s) => {
|
|
20
|
+
const groups = new Map();
|
|
21
|
+
for (const row of s.data) {
|
|
22
|
+
const key = panelOf(row);
|
|
23
|
+
if (key === undefined)
|
|
24
|
+
continue;
|
|
25
|
+
const bucket = groups.get(key);
|
|
26
|
+
if (bucket)
|
|
27
|
+
bucket.push(row);
|
|
28
|
+
else
|
|
29
|
+
groups.set(key, [row]);
|
|
30
|
+
}
|
|
31
|
+
return groups;
|
|
32
|
+
});
|
|
33
|
+
return panels.flatMap((panel) => series.flatMap((s, i) => {
|
|
34
|
+
const rows = rowsByPanel[i].get(panel.key);
|
|
35
|
+
if (!rows?.length)
|
|
36
|
+
return [];
|
|
37
|
+
return [
|
|
38
|
+
{
|
|
39
|
+
...s,
|
|
40
|
+
id: FacetPanels.buildSeriesId(panel.key, s.name),
|
|
41
|
+
panel: panel.key,
|
|
42
|
+
data: rows
|
|
43
|
+
}
|
|
44
|
+
];
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
/** A state narrowed to one panel's series, rows and processed rows. */
|
|
48
|
+
static narrowToPanel(state, panel) {
|
|
49
|
+
return FacetPanels.narrowToPanels(state, [panel]);
|
|
50
|
+
}
|
|
51
|
+
/** A state narrowed to some panels' series, rows and processed rows. */
|
|
52
|
+
static narrowToPanels(state, panels) {
|
|
53
|
+
const keep = new Set(panels);
|
|
54
|
+
const has = (panel) => keep.has(panel);
|
|
55
|
+
const resolvedSeries = state.resolvedSeries?.filter((s) => has(s.panel));
|
|
56
|
+
const { panelOf } = state;
|
|
57
|
+
return {
|
|
58
|
+
...state,
|
|
59
|
+
resolvedSeries,
|
|
60
|
+
flat: panelOf
|
|
61
|
+
? state.flat?.filter((row) => has(panelOf(row)))
|
|
62
|
+
: resolvedSeries?.flatMap((s) => s.data),
|
|
63
|
+
scopedGroups: state.scopedGroups?.filter((g) => has(g.panel)),
|
|
64
|
+
groupedSeries: state.groupedSeries?.filter((g) => has(g.series.panel)),
|
|
65
|
+
processedGroups: state.processedGroups?.filter((g) => has(g.series.panel)),
|
|
66
|
+
labelled: state.labelled?.filter((row) => has(row[PANEL_KEY])),
|
|
67
|
+
processedData: state.processedData && {
|
|
68
|
+
...state.processedData,
|
|
69
|
+
data: state.processedData.data.filter((row) => has(row[PANEL_KEY]))
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One facet panel's part of a run of the data phases over every panel: its
|
|
75
|
+
* series, rows, processed rows and markers, without the facet itself, ready
|
|
76
|
+
* for the phases each panel runs on its own.
|
|
77
|
+
*/
|
|
78
|
+
static buildPanelState(state, panel) {
|
|
79
|
+
const narrowed = FacetPanels.narrowToPanel(state, panel);
|
|
80
|
+
const markers = state.markers?.flatMap((marker) => {
|
|
81
|
+
const own = marker;
|
|
82
|
+
if (own[PANEL_KEY] === undefined)
|
|
83
|
+
return [marker];
|
|
84
|
+
if (own[PANEL_KEY] !== panel)
|
|
85
|
+
return [];
|
|
86
|
+
const untagged = { ...own };
|
|
87
|
+
delete untagged[PANEL_KEY];
|
|
88
|
+
return [untagged];
|
|
89
|
+
});
|
|
90
|
+
const out = { ...narrowed, markers };
|
|
91
|
+
delete out.facet;
|
|
92
|
+
delete out.panels;
|
|
93
|
+
delete out.panelOf;
|
|
94
|
+
return out;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { FacetPanel, FacetStageState, PhaseStage } from '../../types/phases';
|
|
3
|
-
/** The state fields narrowing to some panels filters. */
|
|
4
|
-
type NarrowableState = FacetStageState & {
|
|
5
|
-
resolvedSeries?: Series<Record<string, unknown>>[];
|
|
6
|
-
flat?: unknown[];
|
|
7
|
-
scopedGroups?: {
|
|
8
|
-
panel?: string;
|
|
9
|
-
}[];
|
|
10
|
-
groupedSeries?: {
|
|
11
|
-
series: {
|
|
12
|
-
panel?: string;
|
|
13
|
-
};
|
|
14
|
-
}[];
|
|
15
|
-
processedData?: {
|
|
16
|
-
data: Record<string | symbol, unknown>[];
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
/** The field a processed row carries its facet panel under. */
|
|
20
|
-
export declare const PANEL_KEY = "__panel";
|
|
1
|
+
import type { FacetStageState, PhaseStage } from '../../types/phases';
|
|
21
2
|
/**
|
|
22
3
|
* The "facet" phase: the panels the plot's `facet` lays its rows out in, and
|
|
23
4
|
* which panel each row belongs to. It runs first, so the "data" phase builds
|
|
@@ -27,26 +8,4 @@ export declare const PANEL_KEY = "__panel";
|
|
|
27
8
|
export declare class FacetPhase<TState extends FacetStageState> implements PhaseStage<TState> {
|
|
28
9
|
readonly phase: "facet";
|
|
29
10
|
run: (state: TState) => TState;
|
|
30
|
-
/** The id of a series' part in one facet panel. */
|
|
31
|
-
static buildPanelSeriesId(panel: string, name: string): string;
|
|
32
|
-
/**
|
|
33
|
-
* Each series split into one per facet panel, panel by panel: the same
|
|
34
|
-
* `name` (and so the same color and legend entry), its own `id` and `panel`,
|
|
35
|
-
* and only that panel's rows. A series with no rows in a panel has no part there.
|
|
36
|
-
*/
|
|
37
|
-
static splitSeriesByPanel<S extends Series<Record<string, unknown>>>(series: S[], panels: FacetPanel[], panelOf: NonNullable<FacetStageState['panelOf']>): S[];
|
|
38
|
-
/** A state narrowed to one panel's series, rows and processed rows. */
|
|
39
|
-
static narrowToPanel<TState extends NarrowableState>(state: TState, panel: string): TState;
|
|
40
|
-
/** A state narrowed to some panels' series, rows and processed rows. */
|
|
41
|
-
static narrowToPanels<TState extends NarrowableState>(state: TState, panels: readonly string[]): TState;
|
|
42
|
-
/**
|
|
43
|
-
* One facet panel's part of a run of the data phases over every panel: its
|
|
44
|
-
* series, rows, processed rows and markers, without the facet itself, ready
|
|
45
|
-
* for the phases each panel runs on its own.
|
|
46
|
-
*/
|
|
47
|
-
static buildPanelState<TState extends FacetStageState & {
|
|
48
|
-
resolvedSeries?: Series<Record<string, unknown>>[];
|
|
49
|
-
markers?: object[];
|
|
50
|
-
}>(state: TState, panel: string): Omit<TState, 'facet' | 'panels' | 'panelOf'>;
|
|
51
11
|
}
|
|
52
|
-
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { buildFacetKeyOf, buildFacetPanels } from '../../layout/facet/config';
|
|
2
|
-
|
|
3
|
-
export const PANEL_KEY = '__panel';
|
|
2
|
+
import { PANEL_KEY } from './FacetPanels';
|
|
4
3
|
/**
|
|
5
4
|
* The "facet" phase: the panels the plot's `facet` lays its rows out in, and
|
|
6
5
|
* which panel each row belongs to. It runs first, so the "data" phase builds
|
|
@@ -26,89 +25,4 @@ export class FacetPhase {
|
|
|
26
25
|
};
|
|
27
26
|
return { ...state, panels, panelOf };
|
|
28
27
|
};
|
|
29
|
-
/** The id of a series' part in one facet panel. */
|
|
30
|
-
static buildPanelSeriesId(panel, name) {
|
|
31
|
-
return `${panel}\u0000${name}`;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Each series split into one per facet panel, panel by panel: the same
|
|
35
|
-
* `name` (and so the same color and legend entry), its own `id` and `panel`,
|
|
36
|
-
* and only that panel's rows. A series with no rows in a panel has no part there.
|
|
37
|
-
*/
|
|
38
|
-
static splitSeriesByPanel(series, panels, panelOf) {
|
|
39
|
-
const rowsByPanel = series.map((s) => {
|
|
40
|
-
const groups = new Map();
|
|
41
|
-
for (const row of s.data) {
|
|
42
|
-
const key = panelOf(row);
|
|
43
|
-
if (key === undefined)
|
|
44
|
-
continue;
|
|
45
|
-
const bucket = groups.get(key);
|
|
46
|
-
if (bucket)
|
|
47
|
-
bucket.push(row);
|
|
48
|
-
else
|
|
49
|
-
groups.set(key, [row]);
|
|
50
|
-
}
|
|
51
|
-
return groups;
|
|
52
|
-
});
|
|
53
|
-
return panels.flatMap((panel) => series.flatMap((s, i) => {
|
|
54
|
-
const rows = rowsByPanel[i].get(panel.key);
|
|
55
|
-
if (!rows?.length)
|
|
56
|
-
return [];
|
|
57
|
-
return [
|
|
58
|
-
{
|
|
59
|
-
...s,
|
|
60
|
-
id: FacetPhase.buildPanelSeriesId(panel.key, s.name),
|
|
61
|
-
panel: panel.key,
|
|
62
|
-
data: rows
|
|
63
|
-
}
|
|
64
|
-
];
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
/** A state narrowed to one panel's series, rows and processed rows. */
|
|
68
|
-
static narrowToPanel(state, panel) {
|
|
69
|
-
return FacetPhase.narrowToPanels(state, [panel]);
|
|
70
|
-
}
|
|
71
|
-
/** A state narrowed to some panels' series, rows and processed rows. */
|
|
72
|
-
static narrowToPanels(state, panels) {
|
|
73
|
-
const keep = new Set(panels);
|
|
74
|
-
const has = (panel) => keep.has(panel);
|
|
75
|
-
const resolvedSeries = state.resolvedSeries?.filter((s) => has(s.panel));
|
|
76
|
-
const { panelOf } = state;
|
|
77
|
-
return {
|
|
78
|
-
...state,
|
|
79
|
-
resolvedSeries,
|
|
80
|
-
flat: panelOf
|
|
81
|
-
? state.flat?.filter((row) => has(panelOf(row)))
|
|
82
|
-
: resolvedSeries?.flatMap((s) => s.data),
|
|
83
|
-
scopedGroups: state.scopedGroups?.filter((g) => has(g.panel)),
|
|
84
|
-
groupedSeries: state.groupedSeries?.filter((g) => has(g.series.panel)),
|
|
85
|
-
processedData: state.processedData && {
|
|
86
|
-
...state.processedData,
|
|
87
|
-
data: state.processedData.data.filter((row) => has(row[PANEL_KEY]))
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* One facet panel's part of a run of the data phases over every panel: its
|
|
93
|
-
* series, rows, processed rows and markers, without the facet itself, ready
|
|
94
|
-
* for the phases each panel runs on its own.
|
|
95
|
-
*/
|
|
96
|
-
static buildPanelState(state, panel) {
|
|
97
|
-
const narrowed = FacetPhase.narrowToPanel(state, panel);
|
|
98
|
-
const markers = state.markers?.flatMap((marker) => {
|
|
99
|
-
const own = marker;
|
|
100
|
-
if (own[PANEL_KEY] === undefined)
|
|
101
|
-
return [marker];
|
|
102
|
-
if (own[PANEL_KEY] !== panel)
|
|
103
|
-
return [];
|
|
104
|
-
const untagged = { ...own };
|
|
105
|
-
delete untagged[PANEL_KEY];
|
|
106
|
-
return [untagged];
|
|
107
|
-
});
|
|
108
|
-
const out = { ...narrowed, markers };
|
|
109
|
-
delete out.facet;
|
|
110
|
-
delete out.panels;
|
|
111
|
-
delete out.panelOf;
|
|
112
|
-
return out;
|
|
113
|
-
}
|
|
114
28
|
}
|
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import type { HoverConfig, PointMatchingStrategy, TooltipConfig } from '../../types/plots/props';
|
|
4
|
-
import type { LegendState } from '../../layout/legend/LegendState.svelte';
|
|
1
|
+
import type { HoverDisplayPoint, HoverPoint } from '../../types/layout/hover';
|
|
2
|
+
import { LegendState } from '../../layout/legend/LegendState.svelte';
|
|
5
3
|
import type { AxisPlotCtx, AxisPlotState, HoverPosition, HoverStageOptions, PhaseStage, ProcessedData } from '../../types/phases';
|
|
6
4
|
type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
7
5
|
/**
|
|
8
6
|
* The "hover" phase every axis-based plot shares: what the pointer can match
|
|
9
|
-
* (`hover
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* Every plot gets the same candidates: each processed row of a series the
|
|
15
|
-
* legend shows, at its position, in its series' color - except a gap row (one
|
|
16
|
-
* with no value, or filled in) and a row whose color falls outside the
|
|
17
|
-
* legend's narrowed range.
|
|
7
|
+
* (`hover`), the rows it hovers over (`hoverRows`) and where each sits
|
|
8
|
+
* (`hoverPosition`). Candidates are the processed rows (or the kind's own
|
|
9
|
+
* hover `rows`) of the series the legend shows, except gap rows and rows
|
|
10
|
+
* outside the legend's narrowed range.
|
|
18
11
|
*/
|
|
19
12
|
export declare class HoverPhase<TState extends AnyAxisState, TCtx extends AxisPlotCtx> implements PhaseStage<TState, TCtx> {
|
|
20
13
|
#private;
|
|
21
14
|
readonly phase: "hover";
|
|
22
15
|
constructor(options?: HoverStageOptions<TState, TCtx>);
|
|
23
16
|
run: (state: TState, ctx: TCtx) => TState;
|
|
24
|
-
/**
|
|
25
|
-
* The hover strategy a plot's axes ask for: along the axis that isn't
|
|
26
|
-
* measured (a bar's categories, a line's `x`), or one exact cell at a time
|
|
27
|
-
* when both axes hold categories.
|
|
28
|
-
*/
|
|
29
|
-
static strategyOf(state: {
|
|
30
|
-
axes?: PlotAxes;
|
|
31
|
-
}): HoverStrategy;
|
|
32
|
-
/**
|
|
33
|
-
* A plot's `hover` config for `BasePlotLayout`: active whenever there's a
|
|
34
|
-
* tooltip or a hover marker, with the strategy and sync those two resolve to
|
|
35
|
-
* (the plot kind's own `defaultStrategy` when neither sets one). The tooltip
|
|
36
|
-
* reads as `format` unless it sets its own.
|
|
37
|
-
*/
|
|
38
|
-
static buildHoverConfig<TRow extends Record<string, unknown>>(args: {
|
|
39
|
-
tooltip: TooltipConfig<TRow> | undefined;
|
|
40
|
-
format: (row: TRow) => string;
|
|
41
|
-
markers: {
|
|
42
|
-
type: string;
|
|
43
|
-
}[];
|
|
44
|
-
points: HoverPoint<TRow>[];
|
|
45
|
-
label: (row: TRow) => string;
|
|
46
|
-
defaultStrategy: HoverStrategy;
|
|
47
|
-
pointMatching?: PointMatchingStrategy;
|
|
48
|
-
}): HoverConfig<TRow>;
|
|
49
17
|
/**
|
|
50
18
|
* Hover candidates for a plot's own processed rows: each visible row at its
|
|
51
19
|
* position (a stacked row's top, a bin's centre), in its series' color. A
|
|
@@ -64,10 +32,5 @@ export declare class HoverPhase<TState extends AnyAxisState, TCtx extends AxisPl
|
|
|
64
32
|
/** Where a row sits, as is. Defaults to its processed position, with `y` as a number. */
|
|
65
33
|
position?: HoverPosition;
|
|
66
34
|
}): HoverPoint<TRow>[];
|
|
67
|
-
/** Whether a value sits within the legend's narrowed range; one with no value is never dimmed. */
|
|
68
|
-
static inRange(value: number | null | undefined, range: {
|
|
69
|
-
min: number;
|
|
70
|
-
max: number;
|
|
71
|
-
}): boolean;
|
|
72
35
|
}
|
|
73
36
|
export {};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProcessedPositions } from '../transforms/ProcessedPositions';
|
|
2
|
+
import { GAP_VALUE, SERIES_KEY } from '../transforms/TransformsPhase';
|
|
2
3
|
import { HoverSettings } from '../../layout/hover/HoverSettings';
|
|
3
4
|
import { PlotAxes } from '../data/PlotAxes';
|
|
4
5
|
import { isGapValue } from '../../plots/utils/gaps';
|
|
6
|
+
import { LegendState } from '../../layout/legend/LegendState.svelte';
|
|
5
7
|
/**
|
|
6
8
|
* The "hover" phase every axis-based plot shares: what the pointer can match
|
|
7
|
-
* (`hover
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* Every plot gets the same candidates: each processed row of a series the
|
|
13
|
-
* legend shows, at its position, in its series' color - except a gap row (one
|
|
14
|
-
* with no value, or filled in) and a row whose color falls outside the
|
|
15
|
-
* legend's narrowed range.
|
|
9
|
+
* (`hover`), the rows it hovers over (`hoverRows`) and where each sits
|
|
10
|
+
* (`hoverPosition`). Candidates are the processed rows (or the kind's own
|
|
11
|
+
* hover `rows`) of the series the legend shows, except gap rows and rows
|
|
12
|
+
* outside the legend's narrowed range.
|
|
16
13
|
*/
|
|
17
14
|
export class HoverPhase {
|
|
18
15
|
phase = 'hover';
|
|
@@ -24,7 +21,7 @@ export class HoverPhase {
|
|
|
24
21
|
const options = this.#options;
|
|
25
22
|
const valueAxis = PlotAxes.valueOf(state);
|
|
26
23
|
const raw = options.position?.(state) ??
|
|
27
|
-
|
|
24
|
+
ProcessedPositions.of(state.processedData, valueAxis);
|
|
28
25
|
// A processed position reads as raw; the hover controller and the plot's
|
|
29
26
|
// scales want its value as a number, unless that axis lays out categories.
|
|
30
27
|
const position = options.position || state.axes?.isDiscrete(valueAxis)
|
|
@@ -32,8 +29,11 @@ export class HoverPhase {
|
|
|
32
29
|
: { ...raw, [valueAxis]: (row) => Number(raw[valueAxis](row)) };
|
|
33
30
|
const label = options.label?.(state) ??
|
|
34
31
|
((row) => String(state.channels[valueAxis].accessor(row)));
|
|
32
|
+
const processed = options.rows
|
|
33
|
+
? { ...state.processedData, data: options.rows(state) }
|
|
34
|
+
: state.processedData;
|
|
35
35
|
const points = HoverPhase.buildProcessedHoverPoints({
|
|
36
|
-
processed
|
|
36
|
+
processed,
|
|
37
37
|
colorFor: state.colorForSeries,
|
|
38
38
|
legendInteraction: ctx.interaction?.legend,
|
|
39
39
|
label: label,
|
|
@@ -42,13 +42,14 @@ export class HoverPhase {
|
|
|
42
42
|
row: options.row?.(state),
|
|
43
43
|
decorate: options.decorate?.(state, ctx)
|
|
44
44
|
});
|
|
45
|
-
const hover =
|
|
45
|
+
const hover = HoverSettings.buildConfig({
|
|
46
46
|
tooltip: state.tooltip,
|
|
47
|
-
format: state.tooltipFormat,
|
|
47
|
+
format: options.format?.(state) ?? state.tooltipFormat,
|
|
48
|
+
sort: options.sort?.(state) ?? state.tooltipSort,
|
|
48
49
|
markers: state.authorMarkers ?? [],
|
|
49
50
|
points: points,
|
|
50
51
|
label: label,
|
|
51
|
-
defaultStrategy: options.strategy ??
|
|
52
|
+
defaultStrategy: options.strategy ?? HoverSettings.strategyOf(state.axes),
|
|
52
53
|
pointMatching: options.pointMatching
|
|
53
54
|
});
|
|
54
55
|
const hitAreas = options.hitAreas?.(state, hover, ctx) ?? [];
|
|
@@ -56,42 +57,10 @@ export class HoverPhase {
|
|
|
56
57
|
...state,
|
|
57
58
|
hover,
|
|
58
59
|
hoverPosition: position,
|
|
59
|
-
hoverRows:
|
|
60
|
+
hoverRows: processed.data,
|
|
60
61
|
...(hitAreas.length > 0 ? { markers: [...(state.markers ?? []), ...hitAreas] } : {})
|
|
61
62
|
};
|
|
62
63
|
};
|
|
63
|
-
/**
|
|
64
|
-
* The hover strategy a plot's axes ask for: along the axis that isn't
|
|
65
|
-
* measured (a bar's categories, a line's `x`), or one exact cell at a time
|
|
66
|
-
* when both axes hold categories.
|
|
67
|
-
*/
|
|
68
|
-
static strategyOf(state) {
|
|
69
|
-
const { axes } = state;
|
|
70
|
-
if (!axes)
|
|
71
|
-
return 'x';
|
|
72
|
-
if (axes.isDiscrete('x') && axes.isDiscrete('y'))
|
|
73
|
-
return 'punctual';
|
|
74
|
-
return PlotAxes.other(PlotAxes.valueOf(state));
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* A plot's `hover` config for `BasePlotLayout`: active whenever there's a
|
|
78
|
-
* tooltip or a hover marker, with the strategy and sync those two resolve to
|
|
79
|
-
* (the plot kind's own `defaultStrategy` when neither sets one). The tooltip
|
|
80
|
-
* reads as `format` unless it sets its own.
|
|
81
|
-
*/
|
|
82
|
-
static buildHoverConfig(args) {
|
|
83
|
-
const { tooltip, format, markers, points, label, defaultStrategy, pointMatching } = args;
|
|
84
|
-
const settings = new HoverSettings(tooltip, markers, defaultStrategy);
|
|
85
|
-
return {
|
|
86
|
-
active: settings.active,
|
|
87
|
-
points,
|
|
88
|
-
label,
|
|
89
|
-
strategy: settings.strategy,
|
|
90
|
-
sync: settings.sync,
|
|
91
|
-
tooltip: tooltip && { ...tooltip, format: tooltip.format ?? format },
|
|
92
|
-
...(pointMatching ? { pointMatching } : {})
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
64
|
/**
|
|
96
65
|
* Hover candidates for a plot's own processed rows: each visible row at its
|
|
97
66
|
* position (a stacked row's top, a bin's centre), in its series' color. A
|
|
@@ -99,7 +68,7 @@ export class HoverPhase {
|
|
|
99
68
|
*/
|
|
100
69
|
static buildProcessedHoverPoints(args) {
|
|
101
70
|
const { processed, colorFor, legendInteraction, label, include, row: rowOf, decorate } = args;
|
|
102
|
-
const processedPosition =
|
|
71
|
+
const processedPosition = ProcessedPositions.of(processed);
|
|
103
72
|
const position = args.position ?? {
|
|
104
73
|
x: processedPosition.x,
|
|
105
74
|
y: (row) => Number(processedPosition.y(row))
|
|
@@ -134,11 +103,7 @@ export class HoverPhase {
|
|
|
134
103
|
return (row) => {
|
|
135
104
|
if (isGapValue(position[valueAxis](row)) || row[GAP_VALUE] !== undefined)
|
|
136
105
|
return false;
|
|
137
|
-
return !range || !color ||
|
|
106
|
+
return !range || !color || LegendState.inRange(Number(color(row)), range);
|
|
138
107
|
};
|
|
139
108
|
}
|
|
140
|
-
/** Whether a value sits within the legend's narrowed range; one with no value is never dimmed. */
|
|
141
|
-
static inRange(value, range) {
|
|
142
|
-
return value == null || (value >= range.min && value <= range.max);
|
|
143
|
-
}
|
|
144
109
|
}
|
|
@@ -4,7 +4,7 @@ type AnyAxisState = AxisPlotState<any, any, any, any>;
|
|
|
4
4
|
* The "mapping" phase every axis-based plot shares: every channel resolved to
|
|
5
5
|
* a row accessor. `x`/`y` (and `color`) read the first series' own, falling
|
|
6
6
|
* back to the plot's props; `grouping` is the key the "data" phase split rows
|
|
7
|
-
* by (
|
|
7
|
+
* by (its `seriesGrouping`); any other channel resolves only when
|
|
8
8
|
* its prop is set, and a size channel given a number stays that literal size.
|
|
9
9
|
* An unset `x`/`y` reads each row itself, with no `source`.
|
|
10
10
|
*/
|