@fundar/data-chart-telling 1.1.0 → 1.3.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 +45 -0
- package/README.md +8 -7
- package/dist/configuration/config.svelte.d.ts +1 -1
- package/dist/configuration/config.svelte.js +177 -100
- package/dist/configuration/themes/index.d.ts +5 -1428
- package/dist/index.d.ts +23 -14
- package/dist/index.js +20 -11
- package/dist/layout/base/BasePlotLayout.svelte +115 -50
- 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/facet/scope.d.ts +40 -0
- package/dist/layout/facet/scope.js +104 -0
- 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/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 +39 -15
- package/dist/layout/legend/LegendChannels.js +36 -12
- package/dist/layout/legend/LegendLayout.svelte +9 -1
- package/dist/layout/legend/LegendState.svelte.d.ts +4 -0
- package/dist/layout/legend/LegendState.svelte.js +23 -8
- 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 +35 -8
- package/dist/layout/plot/Plot.svelte +22 -2
- package/dist/layout/plot/Slice.d.ts +5 -1
- package/dist/layout/plot/Slice.js +14 -4
- package/dist/layout/scales/NiceTicks.d.ts +3 -0
- package/dist/layout/scales/NiceTicks.js +4 -0
- package/dist/layout/scales/ScalesLayout.svelte +93 -7
- package/dist/layout/scales/ScalesLayout.svelte.d.ts +5 -0
- package/dist/layout/scales/SveltePlotScale.d.ts +2 -2
- package/dist/layout/scales/SveltePlotScale.js +13 -6
- 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 +80 -21
- package/dist/layout/timeline/TimelineLayout.svelte +1 -1
- package/dist/layout/tooltip/Tooltip.svelte +4 -4
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +4 -4
- package/dist/layout/tooltip/TooltipState.svelte.js +1 -1
- 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.d.ts +6 -1
- package/dist/markers/delta/Delta.js +16 -1
- package/dist/markers/delta/DeltaMarker.svelte +9 -87
- package/dist/markers/delta/DeltaPoint.svelte +97 -0
- package/dist/markers/delta/DeltaPoint.svelte.d.ts +29 -0
- 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 +14 -5
- 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 +5 -0
- package/dist/phases/data/DataPhase.js +3 -3
- package/dist/phases/data/PlotAxes.d.ts +10 -0
- package/dist/phases/data/PlotAxes.js +14 -1
- package/dist/phases/facet/FacetPanels.d.ts +1 -0
- package/dist/phases/facet/FacetPanels.js +1 -0
- package/dist/phases/facet/FacetPhase.d.ts +2 -1
- package/dist/phases/facet/FacetPhase.js +19 -4
- package/dist/phases/mapping/MappingPhase.js +1 -1
- 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.js +21 -7
- package/dist/phases/sharedScales/SharedScalesPhase.d.ts +3 -2
- package/dist/phases/sharedScales/SharedScalesPhase.js +5 -2
- package/dist/phases/statistics/Statistics.d.ts +10 -6
- package/dist/phases/statistics/Statistics.js +20 -10
- package/dist/phases/statistics/StatisticsPhase.js +16 -3
- 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/transforms/ProcessedPositions.js +1 -1
- package/dist/phases/transforms/TransformsPhase.js +49 -3
- 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 +3 -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 +4 -4
- package/dist/plots/{scatter → correlation/scatter}/markers.d.ts +4 -4
- package/dist/plots/{scatter → correlation/scatter}/markers.js +3 -3
- package/dist/plots/{box → distribution/box}/BoxSummaries.d.ts +2 -2
- package/dist/plots/{box → distribution/box}/BoxSummaries.js +6 -6
- package/dist/plots/{box → distribution/box}/Plot.svelte +2 -2
- package/dist/plots/{box → distribution/box}/Plot.svelte.d.ts +2 -2
- package/dist/plots/{box → distribution/box}/defaults.d.ts +2 -2
- package/dist/plots/{box → distribution/box}/defaults.js +1 -1
- package/dist/plots/{box → distribution/box}/markers.d.ts +2 -2
- 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 +3 -3
- package/dist/plots/{histogram → distribution/histogram}/markers.d.ts +3 -3
- package/dist/plots/{histogram → distribution/histogram}/markers.js +5 -5
- 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 +6 -6
- package/dist/plots/{pyramid → distribution/pyramid}/markers.d.ts +4 -4
- package/dist/plots/{pyramid → distribution/pyramid}/markers.js +6 -6
- 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 +1 -1
- 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 +6 -4
- 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 +2 -2
- package/dist/plots/{geo → map/geo}/phases/markers.d.ts +1 -1
- package/dist/plots/{geo → map/geo}/phases/markers.js +6 -10
- 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 +2 -2
- 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 +15 -9
- package/dist/plots/{bar → ranking/bar}/markers.d.ts +8 -8
- package/dist/plots/{bar → ranking/bar}/markers.js +8 -17
- 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.d.ts +4 -1
- package/dist/plots/utils/segments.js +20 -7
- package/dist/types/configuration/styling.d.ts +284 -143
- package/dist/types/layout/coordinates.d.ts +5 -4
- package/dist/types/layout/facet.d.ts +18 -0
- package/dist/types/layout/legend.d.ts +23 -5
- package/dist/types/layout/plot.d.ts +46 -1
- package/dist/types/layout/scales.d.ts +39 -7
- 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 +5 -2
- 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/delta.d.ts +15 -2
- 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 +18 -2
- 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/facet/phase.d.ts +4 -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 +15 -2
- package/dist/types/phases/statistics/source.d.ts +3 -1
- package/dist/types/phases/transforms/phase.d.ts +22 -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/{box → distribution/box}/props.d.ts +6 -6
- package/dist/types/plots/{box → distribution/box}/state.d.ts +3 -3
- 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/{histogram → distribution/histogram}/props.d.ts +7 -7
- 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 +7 -4
- 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/types/plots/segments/config.d.ts +4 -2
- 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 +2 -2
- package/docs/composer.md +2 -2
- package/docs/concepts.md +1 -1
- package/docs/development.md +1 -1
- package/docs/facets.md +50 -3
- package/docs/getting-started.md +2 -2
- package/docs/legend.md +13 -11
- package/docs/markers.md +57 -27
- 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 -280
- package/docs/scales.md +30 -24
- package/docs/styles-and-segments.md +25 -21
- package/docs/theming.md +23 -20
- package/docs/timeline.md +3 -3
- package/docs/tooltip-and-hover.md +10 -10
- package/docs/transforms-and-statistics.md +13 -12
- package/examples/BarValues.svelte +1 -1
- package/examples/Box.svelte +1 -1
- package/examples/Bullet.svelte +17 -0
- package/examples/Chrome.svelte +1 -1
- package/examples/ChromeOrder.svelte +1 -1
- package/examples/Cleveland.svelte +15 -0
- package/examples/Composer.svelte +2 -2
- package/examples/CustomTooltip.svelte +1 -1
- package/examples/Density.svelte +7 -0
- package/examples/Dumbbell.svelte +16 -0
- package/examples/Facets.svelte +1 -1
- package/examples/FacetsCarousel.svelte +1 -1
- package/examples/FacetsRowsCols.svelte +1 -1
- package/examples/FacetsScoped.svelte +26 -0
- package/examples/FirstPlot.svelte +1 -1
- package/examples/Forest.svelte +17 -0
- package/examples/Gaps.svelte +2 -2
- package/examples/GroupedBars.svelte +1 -1
- package/examples/Heatmap.svelte +3 -3
- package/examples/HeatmapSegments.svelte +8 -8
- package/examples/Histogram.svelte +1 -1
- package/examples/HorizontalBars.svelte +1 -1
- package/examples/LegendSections.svelte +1 -1
- package/examples/LegendToggle.svelte +1 -1
- package/examples/LineByRegion.svelte +1 -1
- package/examples/LineDates.svelte +1 -1
- package/examples/LineStep.svelte +16 -0
- package/examples/LineStepSegment.svelte +18 -0
- package/examples/Lollipop.svelte +17 -0
- package/examples/Markers.svelte +1 -1
- package/examples/MovingAverage.svelte +1 -1
- package/examples/Pyramid.svelte +9 -2
- package/examples/Regression.svelte +2 -2
- package/examples/ResponsiveLine.svelte +1 -1
- package/examples/Scales.svelte +1 -1
- package/examples/Scatter.svelte +2 -2
- package/examples/SegmentHighlight.svelte +1 -1
- package/examples/Segments.svelte +1 -1
- package/examples/SegmentsBySeries.svelte +1 -1
- package/examples/Slope.svelte +17 -0
- package/examples/Sparkline.svelte +14 -0
- package/examples/StackedArea.svelte +1 -1
- package/examples/StackedBars.svelte +1 -1
- package/examples/TimelinePlayer.svelte +1 -1
- package/examples/TimelineRule.svelte +1 -1
- package/examples/Tooltip.svelte +1 -1
- package/examples/ValueLabels.svelte +1 -1
- 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 +27 -14
- package/llms.txt +33 -4
- package/package.json +10 -1
- 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 -324
- /package/dist/plots/{box → distribution/box}/markers.js +0 -0
- /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/box/props.js → layout/styles/gaps.js} +0 -0
- /package/dist/types/{plots/box/state.js → layout/styles/geo.js} +0 -0
- /package/dist/types/{plots/geo/props.js → layout/styles/values.js} +0 -0
- /package/dist/types/{plots/geo/state.js → markers/axis/violin.js} +0 -0
- /package/dist/types/{plots/heatmap/props.js → markers/channels/commonMarkerConfigWithRowOffset.js} +0 -0
- /package/dist/types/plots/{histogram → correlation/heatmap}/props.js +0 -0
- /package/dist/types/plots/{heatmap → correlation/heatmap}/state.js +0 -0
- /package/dist/types/plots/{line → correlation/scatter}/props.js +0 -0
- /package/dist/types/plots/{histogram → correlation/scatter}/state.js +0 -0
- /package/dist/types/plots/{pyramid → distribution/box}/props.js +0 -0
- /package/dist/types/plots/{line → distribution/box}/state.js +0 -0
- /package/dist/types/plots/{scatter → distribution/density}/props.js +0 -0
- /package/dist/types/plots/{pyramid → distribution/density}/state.js +0 -0
- /package/dist/types/plots/{scatter/state.js → distribution/histogram/props.js} +0 -0
- /package/dist/{plots/utils → utils}/accessors.d.ts +0 -0
- /package/dist/{plots/utils → utils}/accessors.js +0 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ProcessedPositions } from '../../../phases/transforms/ProcessedPositions';
|
|
2
|
+
import { PlotAxes } from '../../../phases/data/PlotAxes';
|
|
3
|
+
import { isGapValue } from '../../utils/gaps';
|
|
4
|
+
import { RowNumbers } from '../../utils/RowNumbers';
|
|
5
|
+
/**
|
|
6
|
+
* Where the dots of a Cleveland-style plot sit category by category: each
|
|
7
|
+
* category's values - across every series that has one - and the range they
|
|
8
|
+
* span, with the baseline counted as one end when the plot asks for it.
|
|
9
|
+
* Built from the rows the "transforms" phase left, so a series the legend
|
|
10
|
+
* omits is not in it.
|
|
11
|
+
*/
|
|
12
|
+
export class ClevelandRanges {
|
|
13
|
+
entries;
|
|
14
|
+
layout;
|
|
15
|
+
constructor(entries, layout) {
|
|
16
|
+
this.entries = entries;
|
|
17
|
+
this.layout = layout;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The ranges of `state`'s rows; `fromBaseline` adds the plot's baseline to each
|
|
21
|
+
* category's values. A category's difference runs from the series `ends.from`
|
|
22
|
+
* to `ends.to` - by default the first and the last one the plot draws.
|
|
23
|
+
*/
|
|
24
|
+
static of(state, fromBaseline, ends = {}, interval = false) {
|
|
25
|
+
const valueAxis = PlotAxes.valueOf(state);
|
|
26
|
+
const categoryAxis = PlotAxes.categoryOf(state);
|
|
27
|
+
const position = ProcessedPositions.of(state.processedData, valueAxis);
|
|
28
|
+
const baseline = PlotAxes.baselineOf(state);
|
|
29
|
+
const byCategory = new Map();
|
|
30
|
+
const seriesOf = new Map();
|
|
31
|
+
const groups = state.processedGroups ?? [];
|
|
32
|
+
for (const group of groups) {
|
|
33
|
+
for (const segment of group.visualSegments) {
|
|
34
|
+
for (const row of segment.data) {
|
|
35
|
+
const raw = position[valueAxis](row);
|
|
36
|
+
const value = Number(raw);
|
|
37
|
+
if (isGapValue(raw) || !Number.isFinite(value))
|
|
38
|
+
continue;
|
|
39
|
+
const category = position[categoryAxis](row);
|
|
40
|
+
const key = String(category);
|
|
41
|
+
let entry = byCategory.get(key);
|
|
42
|
+
if (!entry) {
|
|
43
|
+
const ends = fromBaseline ? baseline : value;
|
|
44
|
+
entry = {
|
|
45
|
+
category,
|
|
46
|
+
dots: [],
|
|
47
|
+
from: ends,
|
|
48
|
+
to: ends,
|
|
49
|
+
difference: undefined,
|
|
50
|
+
span: undefined,
|
|
51
|
+
change: undefined
|
|
52
|
+
};
|
|
53
|
+
byCategory.set(key, entry);
|
|
54
|
+
seriesOf.set(key, new Set());
|
|
55
|
+
}
|
|
56
|
+
entry.dots.push({ row, value, series: group.series.name });
|
|
57
|
+
// A dot that stands for an interval spans it; else only its own value.
|
|
58
|
+
const [low, high] = interval ? RowNumbers.interval(state, row, value) : [value, value];
|
|
59
|
+
entry.from = Math.min(entry.from, low);
|
|
60
|
+
entry.to = Math.max(entry.to, high);
|
|
61
|
+
seriesOf.get(key).add(group.series.name);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const names = groups.map((group) => group.series.name);
|
|
66
|
+
for (const entry of byCategory.values()) {
|
|
67
|
+
// An end of the difference: a series' dot, the first or last series', or the lowest or highest dot.
|
|
68
|
+
const at = (which) => {
|
|
69
|
+
if (which === 'min')
|
|
70
|
+
return Math.min(...entry.dots.map((dot) => dot.value));
|
|
71
|
+
if (which === 'max')
|
|
72
|
+
return Math.max(...entry.dots.map((dot) => dot.value));
|
|
73
|
+
const series = which === 'first' ? names[0] : which === 'last' ? names[names.length - 1] : which;
|
|
74
|
+
return entry.dots.find((dot) => dot.series === series)?.value;
|
|
75
|
+
};
|
|
76
|
+
const last = at(ends.to ?? 'last');
|
|
77
|
+
const first = fromBaseline ? baseline : at(ends.from ?? 'first');
|
|
78
|
+
entry.difference = last === undefined || first === undefined ? undefined : last - first;
|
|
79
|
+
entry.change = last === undefined || first === undefined ? undefined : [first, last];
|
|
80
|
+
entry.span =
|
|
81
|
+
last === undefined || first === undefined
|
|
82
|
+
? undefined
|
|
83
|
+
: [Math.min(first, last), Math.max(first, last)];
|
|
84
|
+
}
|
|
85
|
+
if (interval) {
|
|
86
|
+
// What an interval says is its own width, from its lower end to its upper.
|
|
87
|
+
for (const entry of byCategory.values()) {
|
|
88
|
+
entry.difference = entry.to - entry.from;
|
|
89
|
+
entry.change = [entry.from, entry.to];
|
|
90
|
+
entry.span = [entry.from, entry.to];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const maxSeriesPerCategory = Math.max(0, ...[...seriesOf.values()].map((s) => s.size));
|
|
94
|
+
return new ClevelandRanges([...byCategory.values()], {
|
|
95
|
+
seriesCount: groups.length,
|
|
96
|
+
maxSeriesPerCategory
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** The rows that cannot be labelled, because they have no value: for the "transforms" phase's `labels.skip`. */
|
|
100
|
+
static skipGaps(state) {
|
|
101
|
+
const valueAxis = PlotAxes.valueOf(state);
|
|
102
|
+
const read = ProcessedPositions.of(state.processedData, valueAxis)[valueAxis];
|
|
103
|
+
return (row) => {
|
|
104
|
+
const raw = read(row);
|
|
105
|
+
return isGapValue(raw) || !Number.isFinite(Number(raw));
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** Where `value` sits in its category's range: the top end when it is the largest (or the only one), the bottom end when the smallest, else between. */
|
|
109
|
+
static roleOf(entry, value) {
|
|
110
|
+
if (value >= entry.to)
|
|
111
|
+
return 'max';
|
|
112
|
+
if (value <= entry.from)
|
|
113
|
+
return 'min';
|
|
114
|
+
return 'between';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
3
|
+
import { buildClevelandDefaults } from './defaults';
|
|
4
|
+
import type {
|
|
5
|
+
ClevelandPlotProps,
|
|
6
|
+
ClevelandPlotCoreProps
|
|
7
|
+
} from '../../../types/plots/ranking/cleveland/props';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A Cleveland dot plot: per category, one dot for each series that has a value there, joined by a connector from the lowest to the highest - the general form of `LollipopPlot` (one value) and `DumbbellPlot` (two). Upright, or sideways when the categories run along `y`. Draws from pre-built `series` or flat `data` rows.
|
|
11
|
+
* Optional chrome (`title`, `subtitle`, `caption`, `header`, `footer`,
|
|
12
|
+
* `legend`) frames it; `timeline` and `facet` slice its `data` rows.
|
|
13
|
+
* `margins` is bindable: it reports the margin the plot settled on.
|
|
14
|
+
*/
|
|
15
|
+
let {
|
|
16
|
+
title,
|
|
17
|
+
subtitle,
|
|
18
|
+
caption,
|
|
19
|
+
header,
|
|
20
|
+
footer,
|
|
21
|
+
legend,
|
|
22
|
+
order,
|
|
23
|
+
timeline,
|
|
24
|
+
facet,
|
|
25
|
+
tooltip,
|
|
26
|
+
margins = $bindable(),
|
|
27
|
+
...core
|
|
28
|
+
}: ClevelandPlotProps<TData> = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Plot
|
|
32
|
+
core={core as ClevelandPlotCoreProps<TData>}
|
|
33
|
+
defaults={buildClevelandDefaults}
|
|
34
|
+
bind:margins
|
|
35
|
+
{title}
|
|
36
|
+
{subtitle}
|
|
37
|
+
{caption}
|
|
38
|
+
{header}
|
|
39
|
+
{footer}
|
|
40
|
+
{legend}
|
|
41
|
+
{order}
|
|
42
|
+
{timeline}
|
|
43
|
+
{facet}
|
|
44
|
+
{tooltip}
|
|
45
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
2
|
+
import type { ClevelandPlotProps } from '../../../types/plots/ranking/cleveland/props';
|
|
3
|
+
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
4
|
+
props: ClevelandPlotProps<TData>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "margins";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TData extends Record<string, unknown>> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
14
|
+
bindings(): "margins";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
21
|
+
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Plot: $$IsomorphicComponent;
|
|
25
|
+
type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
|
|
26
|
+
export default Plot;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
+
import type { ClevelandOptions, ClevelandPlotState, ClevelandPlotCtx } from '../../../types/plots/ranking/cleveland/state';
|
|
3
|
+
/**
|
|
4
|
+
* ClevelandPlot on the shared pipeline, and the base of its wrappers: per
|
|
5
|
+
* category along one category axis - `x`, or `y` for sideways rows, as the
|
|
6
|
+
* "data" phase reads it off the values - one dot for each series that has a
|
|
7
|
+
* value there, joined by a connector from the lowest to the highest. The
|
|
8
|
+
* `options` set one plot of the family apart: its name, its configuration
|
|
9
|
+
* block, whether the baseline is an end of the range (a lollipop's stem), and
|
|
10
|
+
* what it checks about the series before drawing. Its plot defaults to hover
|
|
11
|
+
* along the category axis.
|
|
12
|
+
*/
|
|
13
|
+
export declare function buildClevelandDefaults<TData extends Record<string, unknown>>(options?: ClevelandOptions): AxisPlotDefaults<ClevelandPlotState<TData>, ClevelandPlotCtx>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { ClevelandMarkers } from './ClevelandMarkers';
|
|
2
|
+
import { ClevelandRanges } from './ClevelandRanges';
|
|
3
|
+
import { NiceTicks } from '../../../layout/scales/NiceTicks';
|
|
4
|
+
import { PlotAxes } from '../../../phases/data/PlotAxes';
|
|
5
|
+
/**
|
|
6
|
+
* The domain a plot of intervals fits to them on its value axis, niced to as many
|
|
7
|
+
* ticks as fit the plot. Left out when the author pins the axis, or there is
|
|
8
|
+
* nothing to fit.
|
|
9
|
+
*/
|
|
10
|
+
function fitInterval(state, fromBaseline) {
|
|
11
|
+
const axis = PlotAxes.valueOf(state);
|
|
12
|
+
const scale = state.scales[axis];
|
|
13
|
+
if (scale?.domain != null || scale?.ticks != null || typeof scale?.nice === 'boolean')
|
|
14
|
+
return {};
|
|
15
|
+
const { entries } = ClevelandRanges.of(state, fromBaseline, {}, true);
|
|
16
|
+
if (entries.length === 0)
|
|
17
|
+
return {};
|
|
18
|
+
const lo = Math.min(...entries.map((entry) => entry.from));
|
|
19
|
+
const hi = Math.max(...entries.map((entry) => entry.to));
|
|
20
|
+
if (!(hi > lo))
|
|
21
|
+
return {};
|
|
22
|
+
return {
|
|
23
|
+
[axis]: { domain: NiceTicks.fit(state, axis, lo, hi, NiceTicks.toleranceOf(scale?.nice)) }
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* ClevelandPlot on the shared pipeline, and the base of its wrappers: per
|
|
28
|
+
* category along one category axis - `x`, or `y` for sideways rows, as the
|
|
29
|
+
* "data" phase reads it off the values - one dot for each series that has a
|
|
30
|
+
* value there, joined by a connector from the lowest to the highest. The
|
|
31
|
+
* `options` set one plot of the family apart: its name, its configuration
|
|
32
|
+
* block, whether the baseline is an end of the range (a lollipop's stem), and
|
|
33
|
+
* what it checks about the series before drawing. Its plot defaults to hover
|
|
34
|
+
* along the category axis.
|
|
35
|
+
*/
|
|
36
|
+
export function buildClevelandDefaults(options = { name: 'ClevelandPlot', config: 'cleveland' }) {
|
|
37
|
+
const markers = new ClevelandMarkers(options);
|
|
38
|
+
return {
|
|
39
|
+
data: {
|
|
40
|
+
discreteAxes: 1,
|
|
41
|
+
segments: {
|
|
42
|
+
color: (style) => style?.dots?.dotFill ?? style?.stroke?.stroke,
|
|
43
|
+
connect: false
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
scales: {
|
|
47
|
+
// A stem rises from the baseline, which the value axis then reaches.
|
|
48
|
+
zero: options.fromBaseline ? ['value'] : [],
|
|
49
|
+
bandOrder: 'data',
|
|
50
|
+
// An interval's ends are values the axis must reach, and the dots alone do not say where they are.
|
|
51
|
+
fit: options.interval
|
|
52
|
+
? (state) => fitInterval(state, options.fromBaseline ?? false)
|
|
53
|
+
: undefined,
|
|
54
|
+
defaults: (_state, ctx) => ({
|
|
55
|
+
category: {
|
|
56
|
+
paddingInner: ctx.cfg[options.config].paddingInner,
|
|
57
|
+
paddingOuter: ctx.cfg[options.config].paddingOuter
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
},
|
|
61
|
+
// A dot is labelled by what its category's dots say: the first, the highest... of each.
|
|
62
|
+
transforms: { labels: { group: 'category', skip: ClevelandRanges.skipGaps } },
|
|
63
|
+
styles: { values: { reach: markers.reach } },
|
|
64
|
+
markers: { marks: markers.marks, valueLabels: markers.valueLabels }
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
3
|
+
import { buildDumbbellDefaults } from './defaults';
|
|
4
|
+
import type {
|
|
5
|
+
DumbbellPlotProps,
|
|
6
|
+
DumbbellPlotCoreProps
|
|
7
|
+
} from '../../../types/plots/ranking/dumbbell/props';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A dumbbell plot: per category, the values of exactly two series as two dots joined by a connector, so the gap between them reads at a glance. Upright, or sideways when the categories run along `y`. Draws from pre-built `series` or flat `data` rows. For another number of series, see `LollipopPlot` and `ClevelandPlot`.
|
|
11
|
+
* Optional chrome (`title`, `subtitle`, `caption`, `header`, `footer`,
|
|
12
|
+
* `legend`) frames it; `timeline` and `facet` slice its `data` rows.
|
|
13
|
+
* `margins` is bindable: it reports the margin the plot settled on.
|
|
14
|
+
*/
|
|
15
|
+
let {
|
|
16
|
+
title,
|
|
17
|
+
subtitle,
|
|
18
|
+
caption,
|
|
19
|
+
header,
|
|
20
|
+
footer,
|
|
21
|
+
legend,
|
|
22
|
+
order,
|
|
23
|
+
timeline,
|
|
24
|
+
facet,
|
|
25
|
+
tooltip,
|
|
26
|
+
margins = $bindable(),
|
|
27
|
+
...core
|
|
28
|
+
}: DumbbellPlotProps<TData> = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Plot
|
|
32
|
+
core={core as DumbbellPlotCoreProps<TData>}
|
|
33
|
+
defaults={buildDumbbellDefaults}
|
|
34
|
+
bind:margins
|
|
35
|
+
{title}
|
|
36
|
+
{subtitle}
|
|
37
|
+
{caption}
|
|
38
|
+
{header}
|
|
39
|
+
{footer}
|
|
40
|
+
{legend}
|
|
41
|
+
{order}
|
|
42
|
+
{timeline}
|
|
43
|
+
{facet}
|
|
44
|
+
{tooltip}
|
|
45
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
2
|
+
import type { DumbbellPlotProps } from '../../../types/plots/ranking/dumbbell/props';
|
|
3
|
+
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
4
|
+
props: DumbbellPlotProps<TData>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "margins";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TData extends Record<string, unknown>> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
14
|
+
bindings(): "margins";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
21
|
+
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Plot: $$IsomorphicComponent;
|
|
25
|
+
type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
|
|
26
|
+
export default Plot;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
+
import type { DumbbellPlotState, DumbbellPlotCtx } from '../../../types/plots/ranking/dumbbell/state';
|
|
3
|
+
/**
|
|
4
|
+
* DumbbellPlot on the shared pipeline: a ClevelandPlot of exactly two series,
|
|
5
|
+
* so every category is two dots joined by a connector - the change, or the gap,
|
|
6
|
+
* between them. It warns when it has another number of series, which
|
|
7
|
+
* `LollipopPlot` (one) and `ClevelandPlot` (any) are for.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildDumbbellDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<DumbbellPlotState<TData>, DumbbellPlotCtx>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { buildClevelandDefaults } from '../cleveland/defaults';
|
|
2
|
+
/**
|
|
3
|
+
* DumbbellPlot on the shared pipeline: a ClevelandPlot of exactly two series,
|
|
4
|
+
* so every category is two dots joined by a connector - the change, or the gap,
|
|
5
|
+
* between them. It warns when it has another number of series, which
|
|
6
|
+
* `LollipopPlot` (one) and `ClevelandPlot` (any) are for.
|
|
7
|
+
*/
|
|
8
|
+
export function buildDumbbellDefaults() {
|
|
9
|
+
return buildClevelandDefaults({
|
|
10
|
+
name: 'DumbbellPlot',
|
|
11
|
+
config: 'dumbbell',
|
|
12
|
+
validate: ({ seriesCount }) => seriesCount !== 2
|
|
13
|
+
? `a dumbbell joins exactly two series, but it has ${seriesCount}. ` +
|
|
14
|
+
(seriesCount === 1
|
|
15
|
+
? 'Use LollipopPlot for one series.'
|
|
16
|
+
: 'Use ClevelandPlot for any number of series.')
|
|
17
|
+
: undefined
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
3
|
+
import { buildForestDefaults } from './defaults';
|
|
4
|
+
import type { ForestPlotProps, ForestPlotCoreProps } from '../../../types/plots/ranking/forest/props';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A forest plot: per category, a dot - an estimate - on a stem that spans its interval, given by each row's `lower` and `upper` (or an `error` either side of it), upright or sideways when the categories run along `y`. Draws from pre-built `series` or flat `data` rows. For several series sharing a category, see `facet`, `DumbbellPlot` and `ClevelandPlot`.
|
|
8
|
+
* Optional chrome (`title`, `subtitle`, `caption`, `header`, `footer`,
|
|
9
|
+
* `legend`) frames it; `timeline` and `facet` slice its `data` rows.
|
|
10
|
+
* `margins` is bindable: it reports the margin the plot settled on.
|
|
11
|
+
*/
|
|
12
|
+
let {
|
|
13
|
+
title,
|
|
14
|
+
subtitle,
|
|
15
|
+
caption,
|
|
16
|
+
header,
|
|
17
|
+
footer,
|
|
18
|
+
legend,
|
|
19
|
+
order,
|
|
20
|
+
timeline,
|
|
21
|
+
facet,
|
|
22
|
+
tooltip,
|
|
23
|
+
margins = $bindable(),
|
|
24
|
+
...core
|
|
25
|
+
}: ForestPlotProps<TData> = $props();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<Plot
|
|
29
|
+
core={core as ForestPlotCoreProps<TData>}
|
|
30
|
+
defaults={buildForestDefaults}
|
|
31
|
+
bind:margins
|
|
32
|
+
{title}
|
|
33
|
+
{subtitle}
|
|
34
|
+
{caption}
|
|
35
|
+
{header}
|
|
36
|
+
{footer}
|
|
37
|
+
{legend}
|
|
38
|
+
{order}
|
|
39
|
+
{timeline}
|
|
40
|
+
{facet}
|
|
41
|
+
{tooltip}
|
|
42
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
2
|
+
import type { ForestPlotProps } from '../../../types/plots/ranking/forest/props';
|
|
3
|
+
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
4
|
+
props: ForestPlotProps<TData>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "margins";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TData extends Record<string, unknown>> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
14
|
+
bindings(): "margins";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
21
|
+
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Plot: $$IsomorphicComponent;
|
|
25
|
+
type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
|
|
26
|
+
export default Plot;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
+
import type { ForestPlotState, ForestPlotCtx } from '../../../types/plots/ranking/forest/state';
|
|
3
|
+
/**
|
|
4
|
+
* ForestPlot on the shared pipeline: a ClevelandPlot whose dot is an estimate
|
|
5
|
+
* and whose stem is its interval - each row's `lower` and `upper`, or `error`
|
|
6
|
+
* either side of it. One interval per category, so it warns when a category
|
|
7
|
+
* has values in several series, which `ClevelandPlot` and `DumbbellPlot` are
|
|
8
|
+
* for - or `facet`, to compare the series side by side. The value axis fits the
|
|
9
|
+
* intervals' ends.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildForestDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<ForestPlotState<TData>, ForestPlotCtx>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { buildClevelandDefaults } from '../cleveland/defaults';
|
|
2
|
+
/**
|
|
3
|
+
* ForestPlot on the shared pipeline: a ClevelandPlot whose dot is an estimate
|
|
4
|
+
* and whose stem is its interval - each row's `lower` and `upper`, or `error`
|
|
5
|
+
* either side of it. One interval per category, so it warns when a category
|
|
6
|
+
* has values in several series, which `ClevelandPlot` and `DumbbellPlot` are
|
|
7
|
+
* for - or `facet`, to compare the series side by side. The value axis fits the
|
|
8
|
+
* intervals' ends.
|
|
9
|
+
*/
|
|
10
|
+
export function buildForestDefaults() {
|
|
11
|
+
return buildClevelandDefaults({
|
|
12
|
+
name: 'ForestPlot',
|
|
13
|
+
config: 'forest',
|
|
14
|
+
interval: true,
|
|
15
|
+
validate: ({ maxSeriesPerCategory }) => maxSeriesPerCategory > 1
|
|
16
|
+
? 'a forest plot draws one interval per category, but a category has values in several series. ' +
|
|
17
|
+
'Split the series into panels with `facet`.'
|
|
18
|
+
: undefined
|
|
19
|
+
});
|
|
20
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts" generics="TData extends Record<string, unknown>">
|
|
2
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
3
|
+
import { buildLollipopDefaults } from './defaults';
|
|
4
|
+
import type {
|
|
5
|
+
LollipopPlotProps,
|
|
6
|
+
LollipopPlotCoreProps
|
|
7
|
+
} from '../../../types/plots/ranking/lollipop/props';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A lollipop plot: one value per category as a dot on a thin stem that rises from the baseline, upright, or sideways when the categories run along `y`. Draws from pre-built `series` or flat `data` rows. For several series per category, see `DumbbellPlot` and `ClevelandPlot`.
|
|
11
|
+
* Optional chrome (`title`, `subtitle`, `caption`, `header`, `footer`,
|
|
12
|
+
* `legend`) frames it; `timeline` and `facet` slice its `data` rows.
|
|
13
|
+
* `margins` is bindable: it reports the margin the plot settled on.
|
|
14
|
+
*/
|
|
15
|
+
let {
|
|
16
|
+
title,
|
|
17
|
+
subtitle,
|
|
18
|
+
caption,
|
|
19
|
+
header,
|
|
20
|
+
footer,
|
|
21
|
+
legend,
|
|
22
|
+
order,
|
|
23
|
+
timeline,
|
|
24
|
+
facet,
|
|
25
|
+
tooltip,
|
|
26
|
+
margins = $bindable(),
|
|
27
|
+
...core
|
|
28
|
+
}: LollipopPlotProps<TData> = $props();
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<Plot
|
|
32
|
+
core={core as LollipopPlotCoreProps<TData>}
|
|
33
|
+
defaults={buildLollipopDefaults}
|
|
34
|
+
bind:margins
|
|
35
|
+
{title}
|
|
36
|
+
{subtitle}
|
|
37
|
+
{caption}
|
|
38
|
+
{header}
|
|
39
|
+
{footer}
|
|
40
|
+
{legend}
|
|
41
|
+
{order}
|
|
42
|
+
{timeline}
|
|
43
|
+
{facet}
|
|
44
|
+
{tooltip}
|
|
45
|
+
/>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Plot from '../../../layout/plot/Plot.svelte';
|
|
2
|
+
import type { LollipopPlotProps } from '../../../types/plots/ranking/lollipop/props';
|
|
3
|
+
declare function $$render<TData extends Record<string, unknown>>(): {
|
|
4
|
+
props: LollipopPlotProps<TData>;
|
|
5
|
+
exports: {};
|
|
6
|
+
bindings: "margins";
|
|
7
|
+
slots: {};
|
|
8
|
+
events: {};
|
|
9
|
+
};
|
|
10
|
+
declare class __sveltets_Render<TData extends Record<string, unknown>> {
|
|
11
|
+
props(): ReturnType<typeof $$render<TData>>['props'];
|
|
12
|
+
events(): ReturnType<typeof $$render<TData>>['events'];
|
|
13
|
+
slots(): ReturnType<typeof $$render<TData>>['slots'];
|
|
14
|
+
bindings(): "margins";
|
|
15
|
+
exports(): {};
|
|
16
|
+
}
|
|
17
|
+
interface $$IsomorphicComponent {
|
|
18
|
+
new <TData extends Record<string, unknown>>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TData>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TData>['props']>, ReturnType<__sveltets_Render<TData>['events']>, ReturnType<__sveltets_Render<TData>['slots']>> & {
|
|
19
|
+
$$bindings?: ReturnType<__sveltets_Render<TData>['bindings']>;
|
|
20
|
+
} & ReturnType<__sveltets_Render<TData>['exports']>;
|
|
21
|
+
<TData extends Record<string, unknown>>(internal: unknown, props: ReturnType<__sveltets_Render<TData>['props']> & {}): ReturnType<__sveltets_Render<TData>['exports']>;
|
|
22
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
23
|
+
}
|
|
24
|
+
declare const Plot: $$IsomorphicComponent;
|
|
25
|
+
type Plot<TData extends Record<string, unknown>> = InstanceType<typeof Plot<TData>>;
|
|
26
|
+
export default Plot;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AxisPlotDefaults } from '../../../types/phases';
|
|
2
|
+
import type { LollipopPlotState, LollipopPlotCtx } from '../../../types/plots/ranking/lollipop/state';
|
|
3
|
+
/**
|
|
4
|
+
* LollipopPlot on the shared pipeline: a ClevelandPlot of one value per
|
|
5
|
+
* category, whose stem rises from the baseline - zero, or the nearest end of a
|
|
6
|
+
* pinned value domain - to the dot. It warns when a category has values in
|
|
7
|
+
* several series, which `DumbbellPlot` and `ClevelandPlot` are for.
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildLollipopDefaults<TData extends Record<string, unknown>>(): AxisPlotDefaults<LollipopPlotState<TData>, LollipopPlotCtx>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { buildClevelandDefaults } from '../cleveland/defaults';
|
|
2
|
+
/**
|
|
3
|
+
* LollipopPlot on the shared pipeline: a ClevelandPlot of one value per
|
|
4
|
+
* category, whose stem rises from the baseline - zero, or the nearest end of a
|
|
5
|
+
* pinned value domain - to the dot. It warns when a category has values in
|
|
6
|
+
* several series, which `DumbbellPlot` and `ClevelandPlot` are for.
|
|
7
|
+
*/
|
|
8
|
+
export function buildLollipopDefaults() {
|
|
9
|
+
return buildClevelandDefaults({
|
|
10
|
+
name: 'LollipopPlot',
|
|
11
|
+
config: 'lollipop',
|
|
12
|
+
fromBaseline: true,
|
|
13
|
+
validate: ({ maxSeriesPerCategory }) => maxSeriesPerCategory > 1
|
|
14
|
+
? 'a lollipop draws one value per category, but a category has values in several series. ' +
|
|
15
|
+
'Use DumbbellPlot for two series, or ClevelandPlot for any number.'
|
|
16
|
+
: undefined
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** The accessors a plot reads a row's interval from. */
|
|
2
|
+
export type IntervalAccessors = {
|
|
3
|
+
lower?: unknown;
|
|
4
|
+
upper?: unknown;
|
|
5
|
+
error?: unknown;
|
|
6
|
+
};
|
|
7
|
+
/** The numbers a plot reads off a row: a single value, or the interval around one. */
|
|
8
|
+
export declare class RowNumbers {
|
|
9
|
+
/** A number of a row: a literal, or read through a field key or a function of the row; `undefined` where it is not a finite number. */
|
|
10
|
+
static of(source: unknown, row: unknown): number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* The ends of a row's interval: its `lower` and `upper`, or `error` either side of
|
|
13
|
+
* `value`; the value itself where it has none. Always holds the value.
|
|
14
|
+
*/
|
|
15
|
+
static interval(accessors: IntervalAccessors, row: unknown, value: number): [number, number];
|
|
16
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { resolveAccessor } from '../../utils/accessors';
|
|
2
|
+
/** The numbers a plot reads off a row: a single value, or the interval around one. */
|
|
3
|
+
export class RowNumbers {
|
|
4
|
+
/** A number of a row: a literal, or read through a field key or a function of the row; `undefined` where it is not a finite number. */
|
|
5
|
+
static of(source, row) {
|
|
6
|
+
if (source === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const raw = typeof source === 'number' ? source : resolveAccessor(source)(row);
|
|
9
|
+
const value = Number(raw);
|
|
10
|
+
return raw === null || raw === '' || !Number.isFinite(value) ? undefined : value;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The ends of a row's interval: its `lower` and `upper`, or `error` either side of
|
|
14
|
+
* `value`; the value itself where it has none. Always holds the value.
|
|
15
|
+
*/
|
|
16
|
+
static interval(accessors, row, value) {
|
|
17
|
+
const error = RowNumbers.of(accessors.error, row);
|
|
18
|
+
const lower = RowNumbers.of(accessors.lower, row);
|
|
19
|
+
const upper = RowNumbers.of(accessors.upper, row);
|
|
20
|
+
const low = lower ?? (error === undefined ? value : value - error);
|
|
21
|
+
const high = upper ?? (error === undefined ? value : value + error);
|
|
22
|
+
return [Math.min(low, value), Math.max(high, value)];
|
|
23
|
+
}
|
|
24
|
+
}
|
package/dist/plots/utils/gaps.js
CHANGED
|
@@ -8,8 +8,11 @@ import type { ScopedMarkerGroup } from '../../types/layout/geometry';
|
|
|
8
8
|
* Returns the flat {@link Segment} list for one series.
|
|
9
9
|
* Series-specific segments are added before `'default'` segments so that
|
|
10
10
|
* series-specific catch-alls win over default catch-alls on tie-breaks.
|
|
11
|
+
* A series split by facet panel also reads the segments its panel was given
|
|
12
|
+
* for it - under its id - and for every series of the panel - under the
|
|
13
|
+
* panel's own `'default'` - ahead of the plot's own, as the more specific.
|
|
11
14
|
*/
|
|
12
|
-
export declare function resolveSegmentsForSeries<TStyle>(segments: SegmentsConfig<TStyle>,
|
|
15
|
+
export declare function resolveSegmentsForSeries<TStyle>(segments: SegmentsConfig<TStyle>, series: Pick<Series, 'name' | 'id' | 'panel'>): Segment<TStyle>[];
|
|
13
16
|
/** Returns true when `xVal` falls inside any of a segment's x ranges. */
|
|
14
17
|
export declare function matchesSegmentX<TStyle>(xVal: AxisValue, seg: Segment<TStyle>): boolean;
|
|
15
18
|
/**
|