@fundar/data-chart-telling 1.1.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 +32 -0
- package/README.md +6 -6
- package/dist/configuration/config.svelte.d.ts +1 -1
- package/dist/configuration/config.svelte.js +165 -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/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 +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 +4 -0
- package/dist/layout/legend/LegendState.svelte.js +20 -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/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 +72 -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.js +1 -1
- 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 +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/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 +7 -2
- 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.js +1 -1
- package/dist/types/configuration/styling.d.ts +276 -143
- 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 +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/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/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 +1 -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 +2 -2
- package/docs/composer.md +2 -2
- package/docs/concepts.md +1 -1
- package/docs/development.md +1 -1
- package/docs/facets.md +3 -3
- package/docs/getting-started.md +2 -2
- package/docs/legend.md +13 -11
- package/docs/markers.md +29 -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 +24 -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/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 +22 -11
- package/llms.txt +32 -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,207 @@
|
|
|
1
|
+
// ── Iris flowers ────────────────────────────────────────────────────────────
|
|
2
|
+
// Ronald Fisher's iris data (1936): 50 flowers of each of three species, as
|
|
3
|
+
// distributed by the UCI Machine Learning Repository, via mwaskom/seaborn-data.
|
|
4
|
+
// Lengths and widths in centimeters.
|
|
5
|
+
|
|
6
|
+
export type IrisRow = {
|
|
7
|
+
species: string;
|
|
8
|
+
sepalLength: number;
|
|
9
|
+
sepalWidth: number;
|
|
10
|
+
petalLength: number;
|
|
11
|
+
petalWidth: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** Per species, one `[sepalLength, sepalWidth, petalLength, petalWidth]` per flower. */
|
|
15
|
+
const IRIS_MEASUREMENTS = [
|
|
16
|
+
{
|
|
17
|
+
species: 'setosa',
|
|
18
|
+
measurements: [
|
|
19
|
+
[5.1, 3.5, 1.4, 0.2],
|
|
20
|
+
[4.9, 3, 1.4, 0.2],
|
|
21
|
+
[4.7, 3.2, 1.3, 0.2],
|
|
22
|
+
[4.6, 3.1, 1.5, 0.2],
|
|
23
|
+
[5, 3.6, 1.4, 0.2],
|
|
24
|
+
[5.4, 3.9, 1.7, 0.4],
|
|
25
|
+
[4.6, 3.4, 1.4, 0.3],
|
|
26
|
+
[5, 3.4, 1.5, 0.2],
|
|
27
|
+
[4.4, 2.9, 1.4, 0.2],
|
|
28
|
+
[4.9, 3.1, 1.5, 0.1],
|
|
29
|
+
[5.4, 3.7, 1.5, 0.2],
|
|
30
|
+
[4.8, 3.4, 1.6, 0.2],
|
|
31
|
+
[4.8, 3, 1.4, 0.1],
|
|
32
|
+
[4.3, 3, 1.1, 0.1],
|
|
33
|
+
[5.8, 4, 1.2, 0.2],
|
|
34
|
+
[5.7, 4.4, 1.5, 0.4],
|
|
35
|
+
[5.4, 3.9, 1.3, 0.4],
|
|
36
|
+
[5.1, 3.5, 1.4, 0.3],
|
|
37
|
+
[5.7, 3.8, 1.7, 0.3],
|
|
38
|
+
[5.1, 3.8, 1.5, 0.3],
|
|
39
|
+
[5.4, 3.4, 1.7, 0.2],
|
|
40
|
+
[5.1, 3.7, 1.5, 0.4],
|
|
41
|
+
[4.6, 3.6, 1, 0.2],
|
|
42
|
+
[5.1, 3.3, 1.7, 0.5],
|
|
43
|
+
[4.8, 3.4, 1.9, 0.2],
|
|
44
|
+
[5, 3, 1.6, 0.2],
|
|
45
|
+
[5, 3.4, 1.6, 0.4],
|
|
46
|
+
[5.2, 3.5, 1.5, 0.2],
|
|
47
|
+
[5.2, 3.4, 1.4, 0.2],
|
|
48
|
+
[4.7, 3.2, 1.6, 0.2],
|
|
49
|
+
[4.8, 3.1, 1.6, 0.2],
|
|
50
|
+
[5.4, 3.4, 1.5, 0.4],
|
|
51
|
+
[5.2, 4.1, 1.5, 0.1],
|
|
52
|
+
[5.5, 4.2, 1.4, 0.2],
|
|
53
|
+
[4.9, 3.1, 1.5, 0.2],
|
|
54
|
+
[5, 3.2, 1.2, 0.2],
|
|
55
|
+
[5.5, 3.5, 1.3, 0.2],
|
|
56
|
+
[4.9, 3.6, 1.4, 0.1],
|
|
57
|
+
[4.4, 3, 1.3, 0.2],
|
|
58
|
+
[5.1, 3.4, 1.5, 0.2],
|
|
59
|
+
[5, 3.5, 1.3, 0.3],
|
|
60
|
+
[4.5, 2.3, 1.3, 0.3],
|
|
61
|
+
[4.4, 3.2, 1.3, 0.2],
|
|
62
|
+
[5, 3.5, 1.6, 0.6],
|
|
63
|
+
[5.1, 3.8, 1.9, 0.4],
|
|
64
|
+
[4.8, 3, 1.4, 0.3],
|
|
65
|
+
[5.1, 3.8, 1.6, 0.2],
|
|
66
|
+
[4.6, 3.2, 1.4, 0.2],
|
|
67
|
+
[5.3, 3.7, 1.5, 0.2],
|
|
68
|
+
[5, 3.3, 1.4, 0.2]
|
|
69
|
+
]
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
species: 'versicolor',
|
|
73
|
+
measurements: [
|
|
74
|
+
[7, 3.2, 4.7, 1.4],
|
|
75
|
+
[6.4, 3.2, 4.5, 1.5],
|
|
76
|
+
[6.9, 3.1, 4.9, 1.5],
|
|
77
|
+
[5.5, 2.3, 4, 1.3],
|
|
78
|
+
[6.5, 2.8, 4.6, 1.5],
|
|
79
|
+
[5.7, 2.8, 4.5, 1.3],
|
|
80
|
+
[6.3, 3.3, 4.7, 1.6],
|
|
81
|
+
[4.9, 2.4, 3.3, 1],
|
|
82
|
+
[6.6, 2.9, 4.6, 1.3],
|
|
83
|
+
[5.2, 2.7, 3.9, 1.4],
|
|
84
|
+
[5, 2, 3.5, 1],
|
|
85
|
+
[5.9, 3, 4.2, 1.5],
|
|
86
|
+
[6, 2.2, 4, 1],
|
|
87
|
+
[6.1, 2.9, 4.7, 1.4],
|
|
88
|
+
[5.6, 2.9, 3.6, 1.3],
|
|
89
|
+
[6.7, 3.1, 4.4, 1.4],
|
|
90
|
+
[5.6, 3, 4.5, 1.5],
|
|
91
|
+
[5.8, 2.7, 4.1, 1],
|
|
92
|
+
[6.2, 2.2, 4.5, 1.5],
|
|
93
|
+
[5.6, 2.5, 3.9, 1.1],
|
|
94
|
+
[5.9, 3.2, 4.8, 1.8],
|
|
95
|
+
[6.1, 2.8, 4, 1.3],
|
|
96
|
+
[6.3, 2.5, 4.9, 1.5],
|
|
97
|
+
[6.1, 2.8, 4.7, 1.2],
|
|
98
|
+
[6.4, 2.9, 4.3, 1.3],
|
|
99
|
+
[6.6, 3, 4.4, 1.4],
|
|
100
|
+
[6.8, 2.8, 4.8, 1.4],
|
|
101
|
+
[6.7, 3, 5, 1.7],
|
|
102
|
+
[6, 2.9, 4.5, 1.5],
|
|
103
|
+
[5.7, 2.6, 3.5, 1],
|
|
104
|
+
[5.5, 2.4, 3.8, 1.1],
|
|
105
|
+
[5.5, 2.4, 3.7, 1],
|
|
106
|
+
[5.8, 2.7, 3.9, 1.2],
|
|
107
|
+
[6, 2.7, 5.1, 1.6],
|
|
108
|
+
[5.4, 3, 4.5, 1.5],
|
|
109
|
+
[6, 3.4, 4.5, 1.6],
|
|
110
|
+
[6.7, 3.1, 4.7, 1.5],
|
|
111
|
+
[6.3, 2.3, 4.4, 1.3],
|
|
112
|
+
[5.6, 3, 4.1, 1.3],
|
|
113
|
+
[5.5, 2.5, 4, 1.3],
|
|
114
|
+
[5.5, 2.6, 4.4, 1.2],
|
|
115
|
+
[6.1, 3, 4.6, 1.4],
|
|
116
|
+
[5.8, 2.6, 4, 1.2],
|
|
117
|
+
[5, 2.3, 3.3, 1],
|
|
118
|
+
[5.6, 2.7, 4.2, 1.3],
|
|
119
|
+
[5.7, 3, 4.2, 1.2],
|
|
120
|
+
[5.7, 2.9, 4.2, 1.3],
|
|
121
|
+
[6.2, 2.9, 4.3, 1.3],
|
|
122
|
+
[5.1, 2.5, 3, 1.1],
|
|
123
|
+
[5.7, 2.8, 4.1, 1.3]
|
|
124
|
+
]
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
species: 'virginica',
|
|
128
|
+
measurements: [
|
|
129
|
+
[6.3, 3.3, 6, 2.5],
|
|
130
|
+
[5.8, 2.7, 5.1, 1.9],
|
|
131
|
+
[7.1, 3, 5.9, 2.1],
|
|
132
|
+
[6.3, 2.9, 5.6, 1.8],
|
|
133
|
+
[6.5, 3, 5.8, 2.2],
|
|
134
|
+
[7.6, 3, 6.6, 2.1],
|
|
135
|
+
[4.9, 2.5, 4.5, 1.7],
|
|
136
|
+
[7.3, 2.9, 6.3, 1.8],
|
|
137
|
+
[6.7, 2.5, 5.8, 1.8],
|
|
138
|
+
[7.2, 3.6, 6.1, 2.5],
|
|
139
|
+
[6.5, 3.2, 5.1, 2],
|
|
140
|
+
[6.4, 2.7, 5.3, 1.9],
|
|
141
|
+
[6.8, 3, 5.5, 2.1],
|
|
142
|
+
[5.7, 2.5, 5, 2],
|
|
143
|
+
[5.8, 2.8, 5.1, 2.4],
|
|
144
|
+
[6.4, 3.2, 5.3, 2.3],
|
|
145
|
+
[6.5, 3, 5.5, 1.8],
|
|
146
|
+
[7.7, 3.8, 6.7, 2.2],
|
|
147
|
+
[7.7, 2.6, 6.9, 2.3],
|
|
148
|
+
[6, 2.2, 5, 1.5],
|
|
149
|
+
[6.9, 3.2, 5.7, 2.3],
|
|
150
|
+
[5.6, 2.8, 4.9, 2],
|
|
151
|
+
[7.7, 2.8, 6.7, 2],
|
|
152
|
+
[6.3, 2.7, 4.9, 1.8],
|
|
153
|
+
[6.7, 3.3, 5.7, 2.1],
|
|
154
|
+
[7.2, 3.2, 6, 1.8],
|
|
155
|
+
[6.2, 2.8, 4.8, 1.8],
|
|
156
|
+
[6.1, 3, 4.9, 1.8],
|
|
157
|
+
[6.4, 2.8, 5.6, 2.1],
|
|
158
|
+
[7.2, 3, 5.8, 1.6],
|
|
159
|
+
[7.4, 2.8, 6.1, 1.9],
|
|
160
|
+
[7.9, 3.8, 6.4, 2],
|
|
161
|
+
[6.4, 2.8, 5.6, 2.2],
|
|
162
|
+
[6.3, 2.8, 5.1, 1.5],
|
|
163
|
+
[6.1, 2.6, 5.6, 1.4],
|
|
164
|
+
[7.7, 3, 6.1, 2.3],
|
|
165
|
+
[6.3, 3.4, 5.6, 2.4],
|
|
166
|
+
[6.4, 3.1, 5.5, 1.8],
|
|
167
|
+
[6, 3, 4.8, 1.8],
|
|
168
|
+
[6.9, 3.1, 5.4, 2.1],
|
|
169
|
+
[6.7, 3.1, 5.6, 2.4],
|
|
170
|
+
[6.9, 3.1, 5.1, 2.3],
|
|
171
|
+
[5.8, 2.7, 5.1, 1.9],
|
|
172
|
+
[6.8, 3.2, 5.9, 2.3],
|
|
173
|
+
[6.7, 3.3, 5.7, 2.5],
|
|
174
|
+
[6.7, 3, 5.2, 2.3],
|
|
175
|
+
[6.3, 2.5, 5, 1.9],
|
|
176
|
+
[6.5, 3, 5.2, 2],
|
|
177
|
+
[6.2, 3.4, 5.4, 2.3],
|
|
178
|
+
[5.9, 3, 5.1, 1.8]
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
export const IRIS: IrisRow[] = IRIS_MEASUREMENTS.flatMap(({ species, measurements }) =>
|
|
184
|
+
measurements.map(([sepalLength, sepalWidth, petalLength, petalWidth]) => ({
|
|
185
|
+
species,
|
|
186
|
+
sepalLength,
|
|
187
|
+
sepalWidth,
|
|
188
|
+
petalLength,
|
|
189
|
+
petalWidth
|
|
190
|
+
}))
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
/** The four measurements, in the order the long form lists them. */
|
|
194
|
+
export const IRIS_METRICS = ['Sepal length', 'Sepal width', 'Petal length', 'Petal width'] as const;
|
|
195
|
+
|
|
196
|
+
/** One row per flower and measurement, for plots that put the measurements on one axis. */
|
|
197
|
+
export type IrisMetricRow = { flower: string; species: string; metric: string; value: number };
|
|
198
|
+
|
|
199
|
+
export const IRIS_LONG: IrisMetricRow[] = IRIS.flatMap(
|
|
200
|
+
({ species, sepalLength, sepalWidth, petalLength, petalWidth }, index) =>
|
|
201
|
+
[sepalLength, sepalWidth, petalLength, petalWidth].map((value, metricIndex) => ({
|
|
202
|
+
flower: `Flower ${index + 1}`,
|
|
203
|
+
species,
|
|
204
|
+
metric: IRIS_METRICS[metricIndex],
|
|
205
|
+
value
|
|
206
|
+
}))
|
|
207
|
+
);
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// ── Life expectancy at birth in Argentina, by sex ───────────────────────────
|
|
2
|
+
// INDEC, life tables: the country over the years, and each province in 2019.
|
|
3
|
+
|
|
4
|
+
import { PROVINCE_POPULATION_2022 } from './province-population';
|
|
5
|
+
|
|
6
|
+
// ── Country, over the years ─────────────────────────────────────────────────
|
|
7
|
+
// Each year stands for the period around it (1947 is 1946-1948, 2001 is
|
|
8
|
+
// 2000-2001, ...).
|
|
9
|
+
|
|
10
|
+
export type LifeRow = { year: number; sex: 'female' | 'male'; value: number };
|
|
11
|
+
|
|
12
|
+
/** A life expectancy row that may have a missing value. */
|
|
13
|
+
export type LifeRowWithGaps = Omit<LifeRow, 'value'> & { value: number | null };
|
|
14
|
+
|
|
15
|
+
const LIFE_EXPECTANCY = [
|
|
16
|
+
{ year: 1947, female: 61.4, male: 56.9 },
|
|
17
|
+
{ year: 1965, female: 69.5, male: 63.3 },
|
|
18
|
+
{ year: 1972, female: 70.8, male: 64.1 },
|
|
19
|
+
{ year: 1980, female: 72.7, male: 65.5 },
|
|
20
|
+
{ year: 1991, female: 75.6, male: 68.4 },
|
|
21
|
+
{ year: 2001, female: 77.5, male: 70 },
|
|
22
|
+
{ year: 2009, female: 78.8, male: 72.1 },
|
|
23
|
+
{ year: 2019, female: 80.2, male: 74.4 }
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const LIFE: LifeRow[] = LIFE_EXPECTANCY.flatMap(({ year, female, male }) => [
|
|
27
|
+
{ year, sex: 'female', value: female },
|
|
28
|
+
{ year, sex: 'male', value: male }
|
|
29
|
+
]);
|
|
30
|
+
|
|
31
|
+
export const FEMALE_LIFE: LifeRow[] = LIFE.filter((row) => row.sex === 'female');
|
|
32
|
+
|
|
33
|
+
export const MALE_LIFE: LifeRow[] = LIFE.filter((row) => row.sex === 'male');
|
|
34
|
+
|
|
35
|
+
/** The female series with holes: the first year, one in the middle and the last. */
|
|
36
|
+
export const FEMALE_LIFE_GAPS: LifeRowWithGaps[] = FEMALE_LIFE.map((row) =>
|
|
37
|
+
[1947, 1980, 2019].includes(row.year) ? { ...row, value: null } : row
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
/** The male series with a single hole, in a different place than the female one. */
|
|
41
|
+
export const MALE_LIFE_GAPS: LifeRowWithGaps[] = MALE_LIFE.map((row) =>
|
|
42
|
+
row.year === 1991 ? { ...row, value: null } : row
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// ── Provinces, 2019 ─────────────────────────────────────────────────────────
|
|
46
|
+
// `population` is the 2022 census population (`province-population.ts`), in millions.
|
|
47
|
+
|
|
48
|
+
export type ProvinceRow = {
|
|
49
|
+
province: string;
|
|
50
|
+
sex: 'female' | 'male';
|
|
51
|
+
value: number;
|
|
52
|
+
population: number;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** One row per province, a column per sex: for the plots that read two values off each row. */
|
|
56
|
+
export type ProvinceLifeRow = {
|
|
57
|
+
province: string;
|
|
58
|
+
female: number;
|
|
59
|
+
male: number;
|
|
60
|
+
population: number;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const LIFE_BY_PROVINCE = [
|
|
64
|
+
{ province: 'Buenos Aires', female: 79.9, male: 74.1 },
|
|
65
|
+
{ province: 'Córdoba', female: 80.8, male: 75.2 },
|
|
66
|
+
{ province: 'Mendoza', female: 81, male: 75.3 },
|
|
67
|
+
{ province: 'Salta', female: 79.5, male: 74 },
|
|
68
|
+
{ province: 'Chubut', female: 82.1, male: 74.9 }
|
|
69
|
+
];
|
|
70
|
+
|
|
71
|
+
const POPULATION_2022 = new Map(
|
|
72
|
+
PROVINCE_POPULATION_2022.map(({ province, population }) => [province, population])
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
export const PROVINCE_LIFE: ProvinceLifeRow[] = LIFE_BY_PROVINCE.map((row) => ({
|
|
76
|
+
...row,
|
|
77
|
+
population: Math.round(POPULATION_2022.get(row.province)! / 100_000) / 10
|
|
78
|
+
}));
|
|
79
|
+
|
|
80
|
+
export const PROVINCES = PROVINCE_LIFE.map(({ province }) => province);
|
|
81
|
+
|
|
82
|
+
export const PROVINCE_VALUES: ProvinceRow[] = PROVINCE_LIFE.flatMap(
|
|
83
|
+
({ province, female, male, population }) => [
|
|
84
|
+
{ province, sex: 'female', value: female, population },
|
|
85
|
+
{ province, sex: 'male', value: male, population }
|
|
86
|
+
]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
export const FEMALE_PROVINCE_VALUES: ProvinceRow[] = PROVINCE_VALUES.filter(
|
|
90
|
+
({ sex }) => sex === 'female'
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
export const MALE_PROVINCE_VALUES: ProvinceRow[] = PROVINCE_VALUES.filter(
|
|
94
|
+
({ sex }) => sex === 'male'
|
|
95
|
+
);
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// ── Napoleon's march on Moscow, 1812 ────────────────────────────────────────
|
|
2
|
+
// Data for Charles Joseph Minard's 1812 map of Napoleon's Russian campaign,
|
|
3
|
+
// from stdlib's `datasets-minard-napoleons-march`
|
|
4
|
+
// (https://github.com/stdlib-js/datasets-minard-napoleons-march; the data is
|
|
5
|
+
// CC0 / PDDL). The army's size, direction and position along the march to
|
|
6
|
+
// Moscow and the retreat, the cities it passed, where Minard wrote the size,
|
|
7
|
+
// and the temperature on the way back. The map's rivers are
|
|
8
|
+
// `napoleons-rivers`.
|
|
9
|
+
//
|
|
10
|
+
// One change to stdlib's army rows, to match R's `HistData::Minard`: each
|
|
11
|
+
// division's advance ends at the point its retreat starts from (Moscow for
|
|
12
|
+
// division 1), which stdlib leaves out, so a trail of each direction reaches
|
|
13
|
+
// the other. Division 1's retreat then leaves from (37.7, 55.7), a little off
|
|
14
|
+
// the advance's end - as Minard drew it, the two ribbons run side by side
|
|
15
|
+
// there instead of meeting at a point.
|
|
16
|
+
|
|
17
|
+
export type NapoleonsArmyRow = {
|
|
18
|
+
lon: number;
|
|
19
|
+
lat: number;
|
|
20
|
+
/** Soldiers still marching at this point. */
|
|
21
|
+
size: number;
|
|
22
|
+
/** `'A'` advance (toward Moscow), `'R'` retreat. */
|
|
23
|
+
direction: 'A' | 'R';
|
|
24
|
+
/** Which of the three army columns this row belongs to. */
|
|
25
|
+
division: 1 | 2 | 3;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type NapoleonsCity = { lon: number; lat: number; city: string };
|
|
29
|
+
|
|
30
|
+
/** An army size printed on Minard's map, at a position beside its trail. The labels follow the march; `NAPOLEONS_LABEL_ROWS` says where. Includes two sizes (400,000 and 14,000) that stdlib's labels lack. */
|
|
31
|
+
export type NapoleonsSizeLabel = { lon: number; lat: number; size: number; division: 1 | 2 | 3 };
|
|
32
|
+
|
|
33
|
+
/** The temperature (°C) on the retreat, at a longitude and date. */
|
|
34
|
+
export type NapoleonsTemperature = { lon: number; temp: number; date: string };
|
|
35
|
+
|
|
36
|
+
export const NAPOLEONS_ARMY: NapoleonsArmyRow[] = [
|
|
37
|
+
{ lon: 24.0, lat: 54.9, size: 340000, direction: 'A', division: 1 },
|
|
38
|
+
{ lon: 24.5, lat: 55.0, size: 340000, direction: 'A', division: 1 },
|
|
39
|
+
{ lon: 25.5, lat: 54.5, size: 340000, direction: 'A', division: 1 },
|
|
40
|
+
{ lon: 26.0, lat: 54.7, size: 320000, direction: 'A', division: 1 },
|
|
41
|
+
{ lon: 27.0, lat: 54.8, size: 300000, direction: 'A', division: 1 },
|
|
42
|
+
{ lon: 28.0, lat: 54.9, size: 280000, direction: 'A', division: 1 },
|
|
43
|
+
{ lon: 28.5, lat: 55.0, size: 240000, direction: 'A', division: 1 },
|
|
44
|
+
{ lon: 29.0, lat: 55.1, size: 210000, direction: 'A', division: 1 },
|
|
45
|
+
{ lon: 30.0, lat: 55.2, size: 180000, direction: 'A', division: 1 },
|
|
46
|
+
{ lon: 30.3, lat: 55.3, size: 175000, direction: 'A', division: 1 },
|
|
47
|
+
{ lon: 32.0, lat: 54.8, size: 145000, direction: 'A', division: 1 },
|
|
48
|
+
{ lon: 33.2, lat: 54.9, size: 140000, direction: 'A', division: 1 },
|
|
49
|
+
{ lon: 34.4, lat: 55.5, size: 127100, direction: 'A', division: 1 },
|
|
50
|
+
{ lon: 35.5, lat: 55.4, size: 100000, direction: 'A', division: 1 },
|
|
51
|
+
{ lon: 36.0, lat: 55.5, size: 100000, direction: 'A', division: 1 },
|
|
52
|
+
{ lon: 37.6, lat: 55.8, size: 100000, direction: 'A', division: 1 },
|
|
53
|
+
{ lon: 37.7, lat: 55.7, size: 100000, direction: 'R', division: 1 },
|
|
54
|
+
{ lon: 37.5, lat: 55.7, size: 98000, direction: 'R', division: 1 },
|
|
55
|
+
{ lon: 37.0, lat: 55.0, size: 97000, direction: 'R', division: 1 },
|
|
56
|
+
{ lon: 36.8, lat: 55.0, size: 96000, direction: 'R', division: 1 },
|
|
57
|
+
{ lon: 35.4, lat: 55.3, size: 87000, direction: 'R', division: 1 },
|
|
58
|
+
{ lon: 34.3, lat: 55.2, size: 55000, direction: 'R', division: 1 },
|
|
59
|
+
{ lon: 33.3, lat: 54.8, size: 37000, direction: 'R', division: 1 },
|
|
60
|
+
{ lon: 32.0, lat: 54.6, size: 24000, direction: 'R', division: 1 },
|
|
61
|
+
{ lon: 30.4, lat: 54.4, size: 20000, direction: 'R', division: 1 },
|
|
62
|
+
{ lon: 29.2, lat: 54.4, size: 20000, direction: 'R', division: 1 },
|
|
63
|
+
{ lon: 28.5, lat: 54.3, size: 20000, direction: 'R', division: 1 },
|
|
64
|
+
{ lon: 28.3, lat: 54.4, size: 20000, direction: 'R', division: 1 },
|
|
65
|
+
{ lon: 24.0, lat: 55.1, size: 60000, direction: 'A', division: 2 },
|
|
66
|
+
{ lon: 24.5, lat: 55.2, size: 60000, direction: 'A', division: 2 },
|
|
67
|
+
{ lon: 25.5, lat: 54.7, size: 60000, direction: 'A', division: 2 },
|
|
68
|
+
{ lon: 26.6, lat: 55.7, size: 40000, direction: 'A', division: 2 },
|
|
69
|
+
{ lon: 27.4, lat: 55.6, size: 33000, direction: 'A', division: 2 },
|
|
70
|
+
{ lon: 28.7, lat: 55.5, size: 33000, direction: 'A', division: 2 },
|
|
71
|
+
{ lon: 28.7, lat: 55.5, size: 33000, direction: 'R', division: 2 },
|
|
72
|
+
{ lon: 29.2, lat: 54.3, size: 30000, direction: 'R', division: 2 },
|
|
73
|
+
{ lon: 28.5, lat: 54.2, size: 30000, direction: 'R', division: 2 },
|
|
74
|
+
{ lon: 28.3, lat: 54.3, size: 28000, direction: 'R', division: 2 },
|
|
75
|
+
{ lon: 27.5, lat: 54.5, size: 20000, direction: 'R', division: 2 },
|
|
76
|
+
{ lon: 26.8, lat: 54.3, size: 12000, direction: 'R', division: 2 },
|
|
77
|
+
{ lon: 26.4, lat: 54.4, size: 14000, direction: 'R', division: 2 },
|
|
78
|
+
{ lon: 24.6, lat: 54.5, size: 8000, direction: 'R', division: 2 },
|
|
79
|
+
{ lon: 24.4, lat: 54.4, size: 4000, direction: 'R', division: 2 },
|
|
80
|
+
{ lon: 24.2, lat: 54.4, size: 4000, direction: 'R', division: 2 },
|
|
81
|
+
{ lon: 24.1, lat: 54.3, size: 4000, direction: 'R', division: 2 },
|
|
82
|
+
{ lon: 24.0, lat: 55.2, size: 22000, direction: 'A', division: 3 },
|
|
83
|
+
{ lon: 24.5, lat: 55.3, size: 22000, direction: 'A', division: 3 },
|
|
84
|
+
{ lon: 24.6, lat: 55.8, size: 6000, direction: 'A', division: 3 },
|
|
85
|
+
{ lon: 24.6, lat: 55.8, size: 6000, direction: 'R', division: 3 },
|
|
86
|
+
{ lon: 24.2, lat: 54.4, size: 6000, direction: 'R', division: 3 },
|
|
87
|
+
{ lon: 24.1, lat: 54.3, size: 6000, direction: 'R', division: 3 }
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
export const NAPOLEONS_CITIES: NapoleonsCity[] = [
|
|
91
|
+
{ lon: 24.0, lat: 55.0, city: 'Kowno' },
|
|
92
|
+
{ lon: 25.3, lat: 54.7, city: 'Wilna' },
|
|
93
|
+
{ lon: 26.4, lat: 54.4, city: 'Smorgoni' },
|
|
94
|
+
{ lon: 26.8, lat: 54.3, city: 'Molodexno' },
|
|
95
|
+
{ lon: 27.7, lat: 55.2, city: 'Gloubokoe' },
|
|
96
|
+
{ lon: 27.6, lat: 53.9, city: 'Minsk' },
|
|
97
|
+
{ lon: 28.5, lat: 54.3, city: 'Studienska' },
|
|
98
|
+
{ lon: 28.7, lat: 55.5, city: 'Polotzk' },
|
|
99
|
+
{ lon: 29.2, lat: 54.4, city: 'Bobr' },
|
|
100
|
+
{ lon: 30.2, lat: 55.3, city: 'Witebsk' },
|
|
101
|
+
{ lon: 30.4, lat: 54.5, city: 'Orscha' },
|
|
102
|
+
{ lon: 30.4, lat: 53.9, city: 'Mohilow' },
|
|
103
|
+
{ lon: 32.0, lat: 54.8, city: 'Smolensk' },
|
|
104
|
+
{ lon: 33.2, lat: 54.9, city: 'Dorogobouge' },
|
|
105
|
+
{ lon: 34.3, lat: 55.2, city: 'Wixma' },
|
|
106
|
+
{ lon: 34.4, lat: 55.5, city: 'Chjat' },
|
|
107
|
+
{ lon: 36.0, lat: 55.5, city: 'Mojaisk' },
|
|
108
|
+
{ lon: 37.6, lat: 55.8, city: 'Moscou' },
|
|
109
|
+
{ lon: 36.6, lat: 55.3, city: 'Tarantino' },
|
|
110
|
+
{ lon: 36.5, lat: 55.0, city: 'Malo-Jarosewli' }
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
export const NAPOLEONS_SIZE_LABELS: NapoleonsSizeLabel[] = [
|
|
114
|
+
{ lon: 24.0, lat: 54.9, size: 422000, division: 1 },
|
|
115
|
+
{ lon: 24.5, lat: 55.0, size: 400000, division: 1 },
|
|
116
|
+
{ lon: 30.3, lat: 55.3, size: 175000, division: 1 },
|
|
117
|
+
{ lon: 32.0, lat: 54.8, size: 145000, division: 1 },
|
|
118
|
+
{ lon: 34.4, lat: 55.5, size: 127100, division: 1 },
|
|
119
|
+
{ lon: 35.5, lat: 55.4, size: 100000, division: 1 },
|
|
120
|
+
{ lon: 37.7, lat: 55.7, size: 100000, division: 1 },
|
|
121
|
+
{ lon: 36.8, lat: 55.0, size: 96000, division: 1 },
|
|
122
|
+
{ lon: 35.4, lat: 55.3, size: 87000, division: 1 },
|
|
123
|
+
{ lon: 34.3, lat: 55.2, size: 55000, division: 1 },
|
|
124
|
+
{ lon: 33.3, lat: 54.8, size: 37000, division: 1 },
|
|
125
|
+
{ lon: 32.0, lat: 54.6, size: 24000, division: 1 },
|
|
126
|
+
{ lon: 30.4, lat: 54.4, size: 20000, division: 1 },
|
|
127
|
+
{ lon: 26.6, lat: 55.7, size: 60000, division: 2 },
|
|
128
|
+
{ lon: 28.7, lat: 55.5, size: 33000, division: 2 },
|
|
129
|
+
{ lon: 29.2, lat: 54.3, size: 50000, division: 1 },
|
|
130
|
+
{ lon: 28.5, lat: 54.2, size: 28000, division: 1 },
|
|
131
|
+
{ lon: 26.8, lat: 54.3, size: 12000, division: 1 },
|
|
132
|
+
{ lon: 26.4, lat: 54.4, size: 14000, division: 2 },
|
|
133
|
+
{ lon: 25.0, lat: 54.4, size: 8000, division: 1 },
|
|
134
|
+
{ lon: 24.4, lat: 54.4, size: 4000, division: 1 },
|
|
135
|
+
{ lon: 24.5, lat: 55.3, size: 22000, division: 3 },
|
|
136
|
+
{ lon: 24.1, lat: 54.4, size: 10000, division: 1 },
|
|
137
|
+
{ lon: 24.6, lat: 55.8, size: 6000, division: 3 }
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* The army row each label is printed at, so the label is shown once the march
|
|
142
|
+
* reaches it: `NAPOLEONS_SIZE_LABELS[0]` goes with `NAPOLEONS_ARMY[NAPOLEONS_LABEL_ROWS[0]]`,
|
|
143
|
+
* and so on. Set by hand against the original Minard's map.
|
|
144
|
+
*/
|
|
145
|
+
export const NAPOLEONS_LABEL_ROWS: number[] = [
|
|
146
|
+
0, // 422,000
|
|
147
|
+
1, // 400,000
|
|
148
|
+
9, // 175,000
|
|
149
|
+
10, // 145,000
|
|
150
|
+
12, // 127,100
|
|
151
|
+
13, // 100,000
|
|
152
|
+
16, // 100,000
|
|
153
|
+
19, // 96,000
|
|
154
|
+
20, // 87,000
|
|
155
|
+
21, // 55,000
|
|
156
|
+
22, // 37,000
|
|
157
|
+
23, // 24,000
|
|
158
|
+
24, // 20,000
|
|
159
|
+
31, // 60,000
|
|
160
|
+
33, // 33,000
|
|
161
|
+
35, // 50,000
|
|
162
|
+
37, // 28,000
|
|
163
|
+
39, // 12,000
|
|
164
|
+
40, // 14,000
|
|
165
|
+
41, // 8,000
|
|
166
|
+
42, // 4,000
|
|
167
|
+
46, // 22,000
|
|
168
|
+
47, // 10,000
|
|
169
|
+
50 // 6,000
|
|
170
|
+
];
|
|
171
|
+
|
|
172
|
+
export const NAPOLEONS_TEMPERATURES: NapoleonsTemperature[] = [
|
|
173
|
+
{ lon: 37.6, temp: 0, date: '18 Oct 1812' },
|
|
174
|
+
{ lon: 36.0, temp: 0, date: '24 Oct 1812' },
|
|
175
|
+
{ lon: 33.2, temp: -9, date: '09 Nov 1812' },
|
|
176
|
+
{ lon: 32.0, temp: -21, date: '14 Nov 1812' },
|
|
177
|
+
{ lon: 29.2, temp: -11, date: '24 Nov 1812' },
|
|
178
|
+
{ lon: 28.5, temp: -20, date: '28 Nov 1812' },
|
|
179
|
+
{ lon: 27.2, temp: -24, date: '01 Dec 1812' },
|
|
180
|
+
{ lon: 26.7, temp: -30, date: '06 Dec 1812' },
|
|
181
|
+
{ lon: 25.3, temp: -26, date: '07 Dec 1812' }
|
|
182
|
+
];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// ── Penguins ────────────────────────────────────────────────────────────────
|
|
2
|
+
// Palmer Station penguins (Gorman, Williams & Fraser, 2014), as distributed by
|
|
3
|
+
// mwaskom/seaborn-data. Count of the 333 penguins sexed in the study, by
|
|
4
|
+
// species, island and sex.
|
|
5
|
+
|
|
6
|
+
export type PenguinCount = {
|
|
7
|
+
species: string;
|
|
8
|
+
island: string;
|
|
9
|
+
sex: 'Female' | 'Male';
|
|
10
|
+
count: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const PENGUIN_SPECIES = ['Adelie', 'Chinstrap', 'Gentoo'];
|
|
14
|
+
|
|
15
|
+
export const PENGUIN_ISLANDS = ['Biscoe', 'Dream', 'Torgersen'];
|
|
16
|
+
|
|
17
|
+
export const PENGUIN_SEXES: PenguinCount['sex'][] = ['Female', 'Male'];
|
|
18
|
+
|
|
19
|
+
/** One row per species, island and sex; a species absent from an island counts 0. */
|
|
20
|
+
export const PENGUIN_COUNTS_BY_SEX: PenguinCount[] = [
|
|
21
|
+
{ species: 'Adelie', island: 'Biscoe', sex: 'Female', count: 22 },
|
|
22
|
+
{ species: 'Adelie', island: 'Dream', sex: 'Female', count: 27 },
|
|
23
|
+
{ species: 'Adelie', island: 'Torgersen', sex: 'Female', count: 24 },
|
|
24
|
+
{ species: 'Chinstrap', island: 'Biscoe', sex: 'Female', count: 0 },
|
|
25
|
+
{ species: 'Chinstrap', island: 'Dream', sex: 'Female', count: 34 },
|
|
26
|
+
{ species: 'Chinstrap', island: 'Torgersen', sex: 'Female', count: 0 },
|
|
27
|
+
{ species: 'Gentoo', island: 'Biscoe', sex: 'Female', count: 58 },
|
|
28
|
+
{ species: 'Gentoo', island: 'Dream', sex: 'Female', count: 0 },
|
|
29
|
+
{ species: 'Gentoo', island: 'Torgersen', sex: 'Female', count: 0 },
|
|
30
|
+
{ species: 'Adelie', island: 'Biscoe', sex: 'Male', count: 22 },
|
|
31
|
+
{ species: 'Adelie', island: 'Dream', sex: 'Male', count: 28 },
|
|
32
|
+
{ species: 'Adelie', island: 'Torgersen', sex: 'Male', count: 23 },
|
|
33
|
+
{ species: 'Chinstrap', island: 'Biscoe', sex: 'Male', count: 0 },
|
|
34
|
+
{ species: 'Chinstrap', island: 'Dream', sex: 'Male', count: 34 },
|
|
35
|
+
{ species: 'Chinstrap', island: 'Torgersen', sex: 'Male', count: 0 },
|
|
36
|
+
{ species: 'Gentoo', island: 'Biscoe', sex: 'Male', count: 61 },
|
|
37
|
+
{ species: 'Gentoo', island: 'Dream', sex: 'Male', count: 0 },
|
|
38
|
+
{ species: 'Gentoo', island: 'Torgersen', sex: 'Male', count: 0 }
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
/** One row per species and island, both sexes together; `speciesTotal` is the species' count on every island. */
|
|
42
|
+
export type PenguinSpeciesCount = Omit<PenguinCount, 'sex'> & { speciesTotal: number };
|
|
43
|
+
|
|
44
|
+
const sumCounts = (rows: PenguinCount[]) => rows.reduce((sum, d) => sum + d.count, 0);
|
|
45
|
+
|
|
46
|
+
export const PENGUIN_COUNTS: PenguinSpeciesCount[] = PENGUIN_SPECIES.flatMap((species) => {
|
|
47
|
+
const speciesRows = PENGUIN_COUNTS_BY_SEX.filter((d) => d.species === species);
|
|
48
|
+
return PENGUIN_ISLANDS.map((island) => ({
|
|
49
|
+
species,
|
|
50
|
+
island,
|
|
51
|
+
count: sumCounts(speciesRows.filter((d) => d.island === island)),
|
|
52
|
+
speciesTotal: sumCounts(speciesRows)
|
|
53
|
+
}));
|
|
54
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// ── Population of Buenos Aires City by age, with gaps ───────────────────────
|
|
2
|
+
// The 2022 census female series with holes, to demonstrate gap filling, and the male series whole beside it.
|
|
3
|
+
|
|
4
|
+
import { AGE_GROUPS, POPULATION_BY_AGE_AT_2022, type AgeRow } from './population-by-age';
|
|
5
|
+
|
|
6
|
+
export type AgeRowWithGaps = Omit<AgeRow, 'year' | 'share'> & { share: number | null };
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The 2022 'Female' series with three holes - the first two age groups
|
|
10
|
+
* (start), an internal pair bounded by real data on both sides (middle), and
|
|
11
|
+
* the last two (end) - used to demonstrate PyramidPlot's styles.gaps fill
|
|
12
|
+
* on the same series every other PyramidPlot story already uses.
|
|
13
|
+
*/
|
|
14
|
+
export const FEMALE_2022_WITH_GAPS: AgeRowWithGaps[] = POPULATION_BY_AGE_AT_2022.filter(
|
|
15
|
+
(d) => d.sex === 'Female'
|
|
16
|
+
).map((d, i) => ({
|
|
17
|
+
ageGroup: d.ageGroup,
|
|
18
|
+
sex: d.sex,
|
|
19
|
+
share: i < 2 || (i >= 8 && i < 10) || i >= AGE_GROUPS.length - 2 ? null : d.share
|
|
20
|
+
}));
|
|
21
|
+
|
|
22
|
+
/** The 2022 'Male' series, with no holes: the second series beside `FEMALE_2022_WITH_GAPS`. */
|
|
23
|
+
export const MALE_2022: AgeRow[] = POPULATION_BY_AGE_AT_2022.filter((d) => d.sex === 'Male');
|