@fundar/data-chart-telling 1.16.0 → 1.18.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 +56 -0
- package/dist/configuration/ConfigVars.svelte +14 -0
- package/dist/configuration/ConfigVars.svelte.d.ts +3 -0
- package/dist/configuration/config.svelte.d.ts +5 -0
- package/dist/configuration/config.svelte.js +20 -6
- package/dist/configuration/themes/dark.js +1 -1
- package/dist/configuration/themes/editorial.js +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +4 -1
- package/dist/layout/base/BasePlotLayout.svelte +1 -1
- package/dist/layout/figure/Figure.svelte +5 -12
- package/dist/layout/figure/FigureChrome.svelte +2 -10
- package/dist/layout/geometry/GeometryLayout.svelte +219 -44
- package/dist/layout/hover/HoverDefaults.d.ts +52 -0
- package/dist/layout/hover/HoverDefaults.js +96 -0
- package/dist/layout/hover/HoverLayers.d.ts +35 -0
- package/dist/layout/hover/HoverLayers.js +122 -0
- package/dist/layout/hover/HoverSettings.js +4 -1
- package/dist/layout/hover/HoverShapes.d.ts +44 -0
- package/dist/layout/hover/HoverShapes.js +103 -0
- package/dist/layout/hover/PlotHover.svelte.d.ts +18 -0
- package/dist/layout/hover/PlotHover.svelte.js +54 -1
- package/dist/layout/legend/DisabledStyle.d.ts +1 -1
- package/dist/layout/legend/DisabledStyle.js +1 -1
- package/dist/layout/legend/DiscreteBadgeItem.svelte +1 -1
- package/dist/layout/legend/DiscreteSection.svelte +1 -1
- package/dist/layout/legend/LegendState.svelte.d.ts +14 -2
- package/dist/layout/legend/LegendState.svelte.js +23 -4
- package/dist/layout/legend/LegendText.d.ts +4 -1
- package/dist/layout/legend/LegendText.js +7 -1
- package/dist/layout/margins/PlotMargins.svelte.d.ts +2 -2
- package/dist/layout/margins/PlotMargins.svelte.js +2 -2
- package/dist/layout/plot/Core.svelte +2 -2
- package/dist/layout/plot/Plot.svelte +4 -2
- package/dist/layout/plot/Plot.svelte.d.ts +2 -1
- package/dist/layout/plot/PublicPlotContext.d.ts +6 -0
- package/dist/layout/plot/PublicPlotContext.js +8 -0
- package/dist/layout/scales/ScalesLayout.svelte +1 -1
- package/dist/layout/styles/ValueLabels.d.ts +43 -4
- package/dist/layout/styles/ValueLabels.js +87 -19
- package/dist/layout/timeline/Timeline.svelte +5 -1
- package/dist/layout/tooltip/TooltipState.svelte.d.ts +8 -9
- package/dist/layout/tooltip/TooltipState.svelte.js +28 -29
- package/dist/markers/MarkerKinds.d.ts +5 -0
- package/dist/markers/MarkerKinds.js +1 -0
- package/dist/markers/area/AreaMarker.svelte +3 -0
- package/dist/markers/arrow/ArrowMarker.svelte +9 -5
- package/dist/markers/band/BandMarker.svelte +74 -0
- package/dist/markers/band/BandMarker.svelte.d.ts +7 -0
- package/dist/markers/band/Bands.d.ts +16 -0
- package/dist/markers/band/Bands.js +48 -0
- package/dist/markers/bar/BarMarker.svelte +50 -96
- package/dist/markers/bollinger/BollingerMarker.svelte +3 -0
- package/dist/markers/box/BoxMarker.svelte +3 -1
- package/dist/markers/cell/CellMarker.svelte +11 -7
- package/dist/markers/contour/ContourMarker.svelte +3 -0
- package/dist/markers/delaunay/DelaunayLinkMarker.svelte +9 -5
- package/dist/markers/delaunay/DelaunayMeshMarker.svelte +3 -0
- package/dist/markers/density/DensityMarker.svelte +3 -0
- package/dist/markers/difference/DifferenceMarker.svelte +3 -0
- package/dist/markers/dot/DotMarker.svelte +11 -6
- package/dist/markers/geo/GraticuleMarker.svelte +3 -0
- package/dist/markers/geo/SphereMarker.svelte +3 -0
- package/dist/markers/hover/HoverMarker.svelte +7 -249
- package/dist/markers/hover/HoverMarker.svelte.d.ts +4 -27
- package/dist/markers/hull/HullMarker.svelte +3 -0
- package/dist/markers/image/ImageMarker.svelte +3 -0
- package/dist/markers/line/LineMarker.svelte +3 -0
- package/dist/markers/link/LinkMarker.svelte +3 -0
- package/dist/markers/raster/RasterMarker.svelte +3 -0
- package/dist/markers/rect/RectMarker.svelte +25 -17
- package/dist/markers/regression/RegressionMarker.svelte +3 -0
- package/dist/markers/rule/RuleMarker.svelte +15 -5
- package/dist/markers/text/TextFit.d.ts +44 -0
- package/dist/markers/text/TextFit.js +86 -0
- package/dist/markers/text/TextMarker.svelte +186 -90
- package/dist/markers/text/TextMarker.svelte.d.ts +2 -0
- package/dist/markers/tick/TickMarker.svelte +9 -3
- package/dist/markers/trail/TrailMarker.svelte +3 -0
- package/dist/markers/utils/BoxLabel.d.ts +58 -0
- package/dist/markers/utils/BoxLabel.js +175 -0
- package/dist/markers/utils/MarkerEvents.d.ts +23 -0
- package/dist/markers/utils/MarkerEvents.js +44 -0
- package/dist/markers/utils/MarkerLabel.svelte +33 -0
- package/dist/markers/utils/MarkerLabel.svelte.d.ts +10 -0
- package/dist/markers/utils/PointPixel.d.ts +37 -0
- package/dist/markers/utils/PointPixel.js +44 -0
- package/dist/markers/utils/RowStroke.d.ts +9 -21
- package/dist/markers/utils/RowStroke.js +10 -21
- package/dist/markers/utils/RowStyle.d.ts +26 -0
- package/dist/markers/utils/RowStyle.js +55 -0
- package/dist/markers/vector/VectorMarker.svelte +3 -0
- package/dist/markers/voronoi/VoronoiMarker.svelte +9 -5
- package/dist/markers/voronoi/VoronoiMeshMarker.svelte +3 -0
- package/dist/markers/waffle/WaffleMarker.svelte +9 -5
- package/dist/phases/Pipeline.d.ts +10 -8
- package/dist/phases/Pipeline.js +13 -9
- package/dist/phases/context/ContextPhase.d.ts +22 -0
- package/dist/phases/context/ContextPhase.js +23 -0
- package/dist/phases/context/RowContext.d.ts +35 -0
- package/dist/phases/context/RowContext.js +95 -0
- package/dist/phases/data/DataPhase.d.ts +4 -4
- package/dist/phases/data/DataPhase.js +53 -12
- package/dist/phases/hover/HoverPhase.d.ts +6 -7
- package/dist/phases/hover/HoverPhase.js +28 -15
- package/dist/phases/mapping/MappingPhase.d.ts +4 -4
- package/dist/phases/mapping/MappingPhase.js +4 -3
- package/dist/phases/markers/MarkerStyles.d.ts +26 -0
- package/dist/phases/markers/MarkerStyles.js +126 -0
- package/dist/phases/markers/MarkersPhase.d.ts +5 -5
- package/dist/phases/markers/MarkersPhase.js +8 -6
- package/dist/phases/scales/ScalesPhase.d.ts +4 -4
- package/dist/phases/scales/ScalesPhase.js +4 -4
- package/dist/phases/sharedScales/SharedScalesPhase.d.ts +2 -2
- package/dist/phases/sharedScales/SharedScalesPhase.js +2 -2
- package/dist/phases/statistics/MarkerGrouping.d.ts +0 -9
- package/dist/phases/statistics/MarkerGrouping.js +0 -16
- package/dist/phases/statistics/StatisticsPhase.js +1 -1
- package/dist/phases/styles/StylesPhase.d.ts +3 -3
- package/dist/phases/styles/StylesPhase.js +2 -2
- package/dist/phases/tooltip/TooltipPhase.d.ts +4 -4
- package/dist/phases/tooltip/TooltipPhase.js +10 -7
- package/dist/phases/transforms/Transforms.js +3 -1
- package/dist/phases/transforms/TransformsPhase.d.ts +3 -3
- package/dist/phases/transforms/TransformsPhase.js +60 -6
- package/dist/phases/transforms/methods/TreemapTransform.d.ts +28 -0
- package/dist/phases/transforms/methods/TreemapTransform.js +119 -0
- package/dist/plots/correlation/heatmap/defaults.d.ts +2 -2
- package/dist/plots/correlation/heatmap/defaults.js +23 -8
- package/dist/plots/correlation/heatmap/markers.d.ts +2 -10
- package/dist/plots/correlation/heatmap/markers.js +11 -37
- package/dist/plots/correlation/scatter/defaults.d.ts +2 -2
- package/dist/plots/correlation/scatter/defaults.js +9 -3
- package/dist/plots/correlation/scatter/markers.d.ts +3 -3
- package/dist/plots/correlation/scatter/markers.js +6 -5
- package/dist/plots/distribution/box/BoxSummaries.d.ts +17 -8
- package/dist/plots/distribution/box/BoxSummaries.js +90 -40
- package/dist/plots/distribution/box/defaults.d.ts +2 -2
- package/dist/plots/distribution/box/defaults.js +9 -6
- package/dist/plots/distribution/box/markers.d.ts +2 -2
- package/dist/plots/distribution/box/markers.js +3 -3
- package/dist/plots/distribution/density/defaults.d.ts +2 -2
- package/dist/plots/distribution/density/defaults.js +17 -1
- package/dist/plots/distribution/density/markers.d.ts +2 -2
- package/dist/plots/distribution/density/markers.js +4 -4
- package/dist/plots/distribution/histogram/defaults.d.ts +2 -2
- package/dist/plots/distribution/histogram/defaults.js +22 -27
- package/dist/plots/distribution/histogram/markers.d.ts +3 -12
- package/dist/plots/distribution/histogram/markers.js +21 -62
- package/dist/plots/distribution/pyramid/defaults.d.ts +2 -2
- package/dist/plots/distribution/pyramid/defaults.js +7 -4
- package/dist/plots/distribution/pyramid/markers.d.ts +2 -12
- package/dist/plots/distribution/pyramid/markers.js +16 -66
- package/dist/plots/distribution/violin/defaults.d.ts +2 -2
- package/dist/plots/distribution/violin/defaults.js +9 -7
- package/dist/plots/distribution/violin/markers.d.ts +2 -2
- package/dist/plots/distribution/violin/markers.js +4 -4
- package/dist/plots/evolution/area/defaults.d.ts +2 -2
- package/dist/plots/evolution/area/defaults.js +1 -1
- package/dist/plots/evolution/area/markers.d.ts +2 -2
- package/dist/plots/evolution/area/markers.js +4 -4
- package/dist/plots/evolution/line/defaults.d.ts +2 -2
- package/dist/plots/evolution/line/defaults.js +1 -1
- package/dist/plots/evolution/line/markers.d.ts +2 -2
- package/dist/plots/evolution/line/markers.js +3 -3
- package/dist/plots/evolution/slope/defaults.d.ts +2 -2
- package/dist/plots/evolution/slope/defaults.js +8 -4
- package/dist/plots/evolution/slope/markers.d.ts +2 -2
- package/dist/plots/evolution/slope/markers.js +3 -3
- package/dist/plots/evolution/sparkline/defaults.d.ts +2 -2
- package/dist/plots/evolution/sparkline/defaults.js +5 -2
- package/dist/plots/evolution/sparkline/markers.d.ts +2 -2
- package/dist/plots/evolution/sparkline/markers.js +3 -3
- package/dist/plots/map/geo/Core.svelte +3 -3
- package/dist/plots/map/geo/defaults.d.ts +2 -2
- package/dist/plots/map/geo/phases/data.d.ts +1 -1
- package/dist/plots/map/geo/phases/data.js +1 -1
- package/dist/plots/map/geo/phases/hover.d.ts +2 -2
- package/dist/plots/map/geo/phases/hover.js +3 -3
- package/dist/plots/map/geo/phases/markers.d.ts +2 -2
- package/dist/plots/map/geo/phases/markers.js +5 -4
- package/dist/plots/map/geo/phases/scales.d.ts +2 -2
- package/dist/plots/map/geo/phases/scales.js +2 -2
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte +47 -0
- package/dist/plots/part-of-a-whole/treemap/Plot.svelte.d.ts +26 -0
- package/dist/plots/part-of-a-whole/treemap/defaults.d.ts +10 -0
- package/dist/plots/part-of-a-whole/treemap/defaults.js +183 -0
- package/dist/plots/ranking/bar/defaults.d.ts +2 -2
- package/dist/plots/ranking/bar/defaults.js +15 -9
- package/dist/plots/ranking/bar/markers.d.ts +4 -14
- package/dist/plots/ranking/bar/markers.js +45 -86
- package/dist/plots/ranking/bullet/defaults.d.ts +2 -2
- package/dist/plots/ranking/bullet/defaults.js +4 -4
- package/dist/plots/ranking/bullet/markers.d.ts +3 -3
- package/dist/plots/ranking/bullet/markers.js +11 -12
- package/dist/plots/ranking/cleveland/ClevelandMarkers.d.ts +3 -3
- package/dist/plots/ranking/cleveland/ClevelandMarkers.js +28 -23
- package/dist/plots/ranking/cleveland/defaults.d.ts +2 -2
- package/dist/plots/ranking/cleveland/defaults.js +7 -4
- package/dist/plots/ranking/dumbbell/defaults.d.ts +2 -2
- package/dist/plots/ranking/forest/defaults.d.ts +2 -2
- package/dist/plots/ranking/lollipop/defaults.d.ts +2 -2
- package/dist/types/configuration/styling.d.ts +31 -2
- package/dist/types/layout/context.d.ts +21 -0
- package/dist/types/layout/context.js +1 -0
- package/dist/types/layout/hover.d.ts +3 -0
- package/dist/types/layout/legend.d.ts +8 -1
- package/dist/types/layout/mapping.d.ts +12 -3
- package/dist/types/layout/scales.d.ts +6 -0
- package/dist/types/layout/styles/values.d.ts +8 -2
- package/dist/types/layout/tooltip.d.ts +11 -4
- package/dist/types/markers/axis/arrow.d.ts +2 -8
- package/dist/types/markers/axis/axisBasedMarkersConfig.d.ts +2 -1
- package/dist/types/markers/axis/band.d.ts +24 -0
- package/dist/types/markers/axis/band.js +1 -0
- package/dist/types/markers/axis/bar.d.ts +6 -10
- package/dist/types/markers/axis/cell.d.ts +5 -5
- package/dist/types/markers/axis/delaunayLink.d.ts +2 -2
- package/dist/types/markers/axis/hover.d.ts +60 -15
- package/dist/types/markers/axis/rect.d.ts +4 -8
- package/dist/types/markers/axis/rule.d.ts +2 -16
- package/dist/types/markers/axis/tick.d.ts +2 -2
- package/dist/types/markers/axis/voronoi.d.ts +2 -2
- package/dist/types/markers/axis/waffle.d.ts +4 -3
- package/dist/types/markers/basic/dot.d.ts +2 -2
- package/dist/types/markers/basic/text.d.ts +56 -14
- package/dist/types/markers/channels/commonMarkerConfig.d.ts +8 -1
- package/dist/types/markers/channels/commonMarkerConfigWithArea.d.ts +1 -2
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.d.ts +10 -0
- package/dist/types/markers/channels/commonMarkerConfigWithLabel.js +1 -0
- package/dist/types/markers/channels/commonMarkerEvents.d.ts +17 -0
- package/dist/types/markers/channels/commonMarkerEvents.js +13 -0
- package/dist/types/markers/common.d.ts +1 -0
- package/dist/types/markers/common.js +1 -0
- package/dist/types/markers/geo/contour.d.ts +2 -1
- package/dist/types/markers/geo/graticule.d.ts +2 -1
- package/dist/types/markers/geo/link.d.ts +2 -1
- package/dist/types/markers/geo/sphere.d.ts +2 -1
- package/dist/types/markers/geo/vector.d.ts +2 -1
- package/dist/types/phases/context/phase.d.ts +7 -0
- package/dist/types/phases/context/phase.js +1 -0
- package/dist/types/phases/data/phase.d.ts +7 -2
- package/dist/types/phases/hover/phase.d.ts +10 -5
- package/dist/types/phases/index.d.ts +2 -1
- package/dist/types/phases/kind.d.ts +11 -8
- package/dist/types/phases/mapping/phase.d.ts +2 -2
- package/dist/types/phases/markers/phase.d.ts +3 -3
- package/dist/types/phases/scales/phase.d.ts +4 -4
- package/dist/types/phases/stage.d.ts +3 -3
- package/dist/types/phases/state.d.ts +8 -1
- package/dist/types/phases/statistics/phase.d.ts +2 -1
- package/dist/types/phases/styles/phase.d.ts +3 -2
- package/dist/types/phases/transforms/phase.d.ts +13 -2
- package/dist/types/plots/constants.d.ts +17 -19
- package/dist/types/plots/correlation/heatmap/props.d.ts +3 -3
- package/dist/types/plots/correlation/heatmap/state.d.ts +2 -2
- package/dist/types/plots/correlation/scatter/props.d.ts +3 -3
- package/dist/types/plots/correlation/scatter/state.d.ts +2 -2
- package/dist/types/plots/data/common.d.ts +19 -6
- package/dist/types/plots/data/geo.d.ts +1 -1
- package/dist/types/plots/distribution/box/props.d.ts +25 -3
- package/dist/types/plots/distribution/box/state.d.ts +6 -17
- package/dist/types/plots/distribution/density/props.d.ts +3 -11
- package/dist/types/plots/distribution/density/state.d.ts +2 -2
- package/dist/types/plots/distribution/histogram/props.d.ts +16 -11
- package/dist/types/plots/distribution/histogram/state.d.ts +2 -2
- package/dist/types/plots/distribution/pyramid/props.d.ts +3 -3
- package/dist/types/plots/distribution/pyramid/state.d.ts +2 -2
- package/dist/types/plots/distribution/violin/props.d.ts +4 -3
- package/dist/types/plots/distribution/violin/state.d.ts +2 -2
- package/dist/types/plots/evolution/area/props.d.ts +3 -3
- package/dist/types/plots/evolution/area/state.d.ts +2 -2
- package/dist/types/plots/evolution/line/props.d.ts +3 -3
- package/dist/types/plots/evolution/line/state.d.ts +2 -2
- package/dist/types/plots/evolution/slope/state.d.ts +2 -2
- package/dist/types/plots/evolution/sparkline/state.d.ts +2 -2
- package/dist/types/plots/map/geo/state.d.ts +1 -1
- package/dist/types/plots/part-of-a-whole/treemap/props.d.ts +29 -0
- package/dist/types/plots/part-of-a-whole/treemap/props.js +1 -0
- package/dist/types/plots/part-of-a-whole/treemap/state.d.ts +6 -0
- package/dist/types/plots/part-of-a-whole/treemap/state.js +1 -0
- package/dist/types/plots/props.d.ts +10 -4
- package/dist/types/plots/ranking/bar/props.d.ts +3 -3
- package/dist/types/plots/ranking/bar/state.d.ts +2 -2
- package/dist/types/plots/ranking/bullet/state.d.ts +2 -2
- package/dist/types/plots/ranking/cleveland/props.d.ts +3 -3
- package/dist/types/plots/ranking/cleveland/state.d.ts +2 -2
- package/dist/types/plots/ranking/dumbbell/props.d.ts +3 -3
- package/dist/types/plots/ranking/dumbbell/state.d.ts +2 -2
- package/dist/types/plots/ranking/forest/props.d.ts +3 -3
- package/dist/types/plots/ranking/forest/state.d.ts +2 -2
- package/dist/types/plots/ranking/lollipop/props.d.ts +3 -3
- package/dist/types/plots/ranking/lollipop/state.d.ts +2 -2
- package/dist/types/plots/styling.d.ts +24 -0
- package/dist/types/transforms/index.d.ts +3 -1
- package/dist/types/transforms/treemap.d.ts +32 -0
- package/dist/types/transforms/treemap.js +5 -0
- package/dist/utils/color/ColorTones.d.ts +19 -0
- package/dist/utils/color/ColorTones.js +64 -0
- package/dist/utils/color/CssColor.d.ts +14 -5
- package/dist/utils/color/CssColor.js +69 -27
- package/dist/utils/color/index.d.ts +4 -0
- package/dist/utils/color/index.js +4 -0
- package/dist/utils/grouping.d.ts +18 -1
- package/dist/utils/grouping.js +31 -0
- package/docs/concepts.md +3 -2
- package/docs/legend.md +8 -5
- package/docs/markers.md +110 -28
- package/docs/plots/evolution/line.md +1 -1
- package/docs/plots/evolution/slope.md +1 -1
- package/docs/plots/part-of-a-whole/treemap.md +103 -0
- package/docs/plots/ranking/bar.md +2 -1
- package/docs/plots/ranking/cleveland.md +1 -1
- package/docs/plots.md +21 -20
- package/docs/scales.md +3 -0
- package/docs/state.md +34 -1
- package/docs/styles-and-segments.md +20 -19
- package/docs/theming.md +6 -12
- package/docs/tooltip-and-hover.md +81 -3
- package/docs/transforms-and-statistics.md +17 -16
- package/examples/LineDates.svelte +1 -1
- package/examples/ResponsiveLine.svelte +3 -1
- package/examples/Treemap.svelte +13 -0
- package/examples/TreemapHover.svelte +25 -0
- package/examples/ValueLabels.svelte +1 -1
- package/examples/datasets/economic-activity.ts +40 -0
- package/examples/datasets/index.ts +1 -0
- package/llms-full.txt +11 -9
- package/llms.txt +4 -1
- package/package.json +3 -1
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
styles={{
|
|
36
36
|
values: {
|
|
37
37
|
show: true,
|
|
38
|
-
format: (value,
|
|
38
|
+
format: (value, _number, context) => `${context.series}: ${value.toFixed(0)}`,
|
|
39
39
|
fontStyle: { fontSize: 13 }
|
|
40
40
|
}
|
|
41
41
|
}}
|
|
@@ -46,18 +46,18 @@
|
|
|
46
46
|
|
|
47
47
|

|
|
48
48
|
|
|
49
|
-
| Field | Meaning
|
|
50
|
-
| --------------------------------------------- |
|
|
51
|
-
| `show` | Draws the labels. Off by default, except on a heatmap
|
|
52
|
-
| `anchor` | `'outside'`, `'start'`, `'middle'`, `'end'
|
|
53
|
-
| `select` | Which row of each group is labelled: `'first'`, `'last'`, `'min'`, `'max'`, or a list of them. A group is a series on a line or area plot (default `'last'`), a category on the plots that join dots (default: every dot)
|
|
54
|
-
| `series` | Labels only these series, by name
|
|
55
|
-
| `color` | `'series'` writes each label in its series' color; any other CSS color writes them all in it (`fontStyle.fill` wins)
|
|
56
|
-
| `decimals`, `prefix`, `suffix`, `signDisplay` | How the value reads, over `numbers.decimals` ([Number format](theming.md#number-format)); `format` replaces them
|
|
57
|
-
| `format` | `(value,
|
|
58
|
-
| `hoverIsolate` | Hovering a label dims every other series
|
|
59
|
-
| `fontStyle` | Text style: `fontSize`, `fill`, `dx`, `dy`, `textAnchor`, `lineAnchor`, `rotate`, `class`, ... Overrides the anchor's placement field by field
|
|
60
|
-
| `strokeStyle` | Style of the connector lines drawn from labels that had to move apart
|
|
49
|
+
| Field | Meaning |
|
|
50
|
+
| --------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| `show` | Draws the labels. Off by default, except on a heatmap |
|
|
52
|
+
| `anchor` | Where a label sits on its mark. On a line, area, slope or scatter plot: `'outside'`, `'start'`, `'middle'`, `'end'`, the side of its point the text is written on. On a bar, bullet, pyramid, histogram or heatmap - plots that label a shape - the label is in the shape: `'middle'`, an edge as the page draws it (`'top'`, `'bottom'`, `'left'`, `'right'`), a corner (`'top-left'`...), the end of the bar away from zero (`'tip'`) or the one on zero (`'base'`), whichever side of zero the value is; or beyond the tip, outside it: `'outside'` (the default). The labels are those of the shapes' own `label` - see [Markers](markers.md#a-label-in-each-shape) |
|
|
53
|
+
| `select` | Which row of each group is labelled: `'first'`, `'last'`, `'min'`, `'max'`, or a list of them. A group is a series on a line or area plot (default `'last'`), a category on the plots that join dots (default: every dot) |
|
|
54
|
+
| `series` | Labels only these series, by name |
|
|
55
|
+
| `color` | `'series'` writes each label in its series' color; any other CSS color writes them all in it (`fontStyle.fill` wins) |
|
|
56
|
+
| `decimals`, `prefix`, `suffix`, `signDisplay` | How the value reads, over `numbers.decimals` ([Number format](theming.md#number-format)); `format` replaces them |
|
|
57
|
+
| `format` | `(value, number, context) => string`; `number` writes a value as the fields above ask, `context` is the labelled row's [context](state.md#row-context): its `series`, the `row` itself for its other fields, and what the plot works out |
|
|
58
|
+
| `hoverIsolate` | Hovering a label dims every other series |
|
|
59
|
+
| `fontStyle` | Text style: `fontSize`, `fill`, `dx`, `dy`, `textAnchor`, `lineAnchor`, `rotate`, `class`, ... Overrides the anchor's placement field by field |
|
|
60
|
+
| `strokeStyle` | Style of the connector lines drawn from labels that had to move apart |
|
|
61
61
|
|
|
62
62
|
Where the labels go depends on the plot: the end of each series on a line or area plot, one per bar on a bar, pyramid or histogram, one per point on a scatter, one per cell on a heatmap. On lines, overlapping labels spread apart, share one column and are joined to their points by elbow connectors; the right margin grows to fit them when it is `'auto'`. The spread is tuned by `text.declutter` in the [configuration](theming.md).
|
|
63
63
|
|
|
@@ -121,12 +121,12 @@ A row whose value is `null`, `undefined` or `NaN` breaks a line. `styles.gaps` b
|
|
|
121
121
|
|
|
122
122
|
- A plot uses the ones its own marks are made of and ignores the rest, so one `styles` can be shared between plots:
|
|
123
123
|
|
|
124
|
-
| Plot
|
|
125
|
-
|
|
|
126
|
-
| `LinePlot`, `SlopePlot`, `SparklinePlot`
|
|
127
|
-
| `AreaPlot`, `BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`, `BoxPlot`, `DensityPlot`, `ViolinPlot`, `HeatmapPlot` | `area` |
|
|
128
|
-
| `ScatterPlot`
|
|
129
|
-
| `LollipopPlot`, `DumbbellPlot`, `ClevelandPlot`, `ForestPlot`
|
|
124
|
+
| Plot | Uses |
|
|
125
|
+
| ----------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
126
|
+
| `LinePlot`, `SlopePlot`, `SparklinePlot` | `stroke` (the line), `dot` (a dot on every point; unset, none) |
|
|
127
|
+
| `AreaPlot`, `BarPlot`, `BulletPlot`, `PyramidPlot`, `HistogramPlot`, `BoxPlot`, `DensityPlot`, `ViolinPlot`, `HeatmapPlot`, `TreemapPlot` | `area` |
|
|
128
|
+
| `ScatterPlot` | `dot` |
|
|
129
|
+
| `LollipopPlot`, `DumbbellPlot`, `ClevelandPlot`, `ForestPlot` | `stroke` (the stems and connectors), `dot` |
|
|
130
130
|
|
|
131
131
|
`GeoPlot` has styles of its own and uses none of them.
|
|
132
132
|
|
|
@@ -161,6 +161,7 @@ The style shape depends on the plot:
|
|
|
161
161
|
| `AreaPlot`, `HistogramPlot` | `AreaStyle` | `fill`, `fillOpacity`, `stroke`, ... |
|
|
162
162
|
| `BarPlot`, `PyramidPlot` | `BarSegmentStyle` (`AreaStyle`) | `fill`, `fillOpacity`, `stroke`, ... |
|
|
163
163
|
| `HeatmapPlot` | `CellSegmentStyle` (`AreaStyle`) | `fill`, `fillOpacity`, `stroke`, `strokeWidth` |
|
|
164
|
+
| `TreemapPlot` | `BarSegmentStyle` (`AreaStyle`) | `fill`, `fillOpacity`, `stroke`, ... |
|
|
164
165
|
| `ScatterPlot` | `ScatterSegmentStyle` (`DotStyle`) | dot fill, stroke, radius, symbol |
|
|
165
166
|
| `GeoPlot` | `GeoSegmentStyle` | `fill`, `fillOpacity`, `stroke`, `strokeWidth` |
|
|
166
167
|
|
package/docs/theming.md
CHANGED
|
@@ -36,7 +36,7 @@ resetConfiguration(); // back to the shipped defaults
|
|
|
36
36
|
| `font`, `color`, `background` | Base text of every figure |
|
|
37
37
|
| `palette` | Categorical series colors, in order: a list of colors, or the name of a [d3-scale-chromatic](https://d3js.org/d3-scale-chromatic) scheme - a color list (`'dark2'`, `'tableau10'`) or a ramp (`'viridis'`, `'blues'`) - or `{ scheme, count, schemeRange }` for a ramp with its own number of colors (8 by default) and part of the ramp (`[0.3, 1]` skips the near-white start of `'blues'`). A name is turned into the list of colors when it is set |
|
|
38
38
|
| `symbols` | Shape cycle for the `symbol` channel |
|
|
39
|
-
| `continuous` | Default ramp endpoints
|
|
39
|
+
| `continuous` | Default ramp endpoints and opacity range for continuous color and opacity |
|
|
40
40
|
| `spacing`, `chrome` | Padding around header, legend and caption; the chrome `order` and `rowGap` |
|
|
41
41
|
| `title`, `subtitle`, `caption` | Text blocks: `font`, `size`, `weight`, `color`, `leading`, `spacing` |
|
|
42
42
|
| `divider` | The line a `'divider'` in the chrome `order` draws |
|
|
@@ -45,10 +45,12 @@ resetConfiguration(); // back to the shipped defaults
|
|
|
45
45
|
| `tooltip` | Tooltip background, color, font size, padding, radius, border |
|
|
46
46
|
| `margins` | Default margin per side (`'auto'` or a number) |
|
|
47
47
|
| `line`, `area`, `bar`, `pyramid`, `histogram`, `density`, `violin`, `box`, `lollipop`, `dumbbell`, `cleveland`, `forest`, `bullet`, `slope`, `sparkline`, `scatter` | Per-kind defaults: line curve (`'auto'`, straight segments), stroke width, dot radius, series padding, gap fills, fill opacity, inset, density stroke width, violin padding and box width, box, lollipop, dumbbell, Cleveland and forest padding, stem width, forest caps, bullet bar thickness, ranges and target tick, slope stroke width, dot radius and padding, sparkline stroke width and dot radius |
|
|
48
|
-
| `text` | `declutter` geometry of value labels and connectors
|
|
48
|
+
| `text` | `label` defaults (`gap`, `padding`, `minFontSize`, `minLetters`, and `contrast`, the colors a label inside its shape picks from) of the label a shape writes in itself, and `declutter` geometry of value labels and connectors |
|
|
49
49
|
| `connector` | What `styles.connector` falls back to on lollipop, dumbbell, Cleveland and forest plots: `sign` (`positive`, `negative`, `zero` colors), `lengthScheme` and `differenceScheme` (color ramps), `arrow` (`width`, `headLength`, `headAngle` of a connector drawn as an arrow), `outsideOpacity` (the part of a connector outside its `from`-`to` stretch), `capLength` (px, of a forest plot's end caps), `labelFontSize` and `labelGap` |
|
|
50
|
-
| `hover` |
|
|
50
|
+
| `hover` | The look of the markers a hover draws, under their own `styles`: `rule` (a crosshair), `dot`, `font` (a label), `area` (a band or a span), and `active`, the outline of the hovered shape on a treemap or a heatmap |
|
|
51
|
+
| `band` | The look of a `band` marker under its own `styles`: `fill` (`#94a3b8`) and `fillOpacity` (`0.25`), and any other `AreaStyle` field |
|
|
51
52
|
| `delta` | The `delta` marker's label, per axis the delta is taken on: `text.x` (beside a vertical delta: `dx: 12`, `textAnchor: 'start'`) and `text.y` (above a horizontal one: `dy: -10`, `textAnchor: 'middle'`). `lineAnchor` picks where along the delta the label sits and how it aligns there |
|
|
53
|
+
| `treemap` | The tiles of a `TreemapPlot`: `stroke` (the line between tiles, white by default) and `strokeWidth`, `fontSize`, `padding` (the room kept around a label) and `lineHeight` |
|
|
52
54
|
| `timeline` | The rule (`rule`) and the player bar (`player`: controls, speeds, `stepDuration`, button, track, thumb, toggle); `snap` is how close to its last step (a fraction of the span, `1e-4` by default) a tweened timeline counts as being at it |
|
|
53
55
|
| `facet` | The position badge and prev/next buttons |
|
|
54
56
|
| `frameClip` | Tolerance for clipping marks to the plot frame |
|
|
@@ -98,7 +100,7 @@ A plot overrides it with `scales.x.edgeTicks` or `scales.y.edgeTicks` (see [Scal
|
|
|
98
100
|
|
|
99
101
|
## CSS variables
|
|
100
102
|
|
|
101
|
-
Some fields reach the DOM as CSS custom properties, which
|
|
103
|
+
Some fields reach the DOM as CSS custom properties, which the components read with a fallback. The configuration sets them once on the document root, as a rule with no specificity (`:where(:root)`), so plain CSS of your own overrides them - on a wrapping element, for one dashboard, or anywhere else:
|
|
102
104
|
|
|
103
105
|
```css
|
|
104
106
|
.my-dashboard {
|
|
@@ -225,14 +227,6 @@ The text blocks map `title`, `subtitle` and `caption` to `--dct-{block}-{font|si
|
|
|
225
227
|
| `--dct-player-toggle-size` | `timeline.player.toggle.fontSize` |
|
|
226
228
|
| `--dct-player-toggle-pad` | `timeline.player.toggle.padding` |
|
|
227
229
|
|
|
228
|
-
### heatmap ramp
|
|
229
|
-
|
|
230
|
-
| CSS variable | Config path |
|
|
231
|
-
| ----------------- | ----------------------- |
|
|
232
|
-
| `--dct-heat-min` | `continuous.min` |
|
|
233
|
-
| `--dct-heat-max` | `continuous.max` |
|
|
234
|
-
| `--dct-heat-text` | `continuous.labelColor` |
|
|
235
|
-
|
|
236
230
|
### facet
|
|
237
231
|
|
|
238
232
|
| CSS variable | Config path |
|
|
@@ -43,7 +43,7 @@ A plot becomes interactive when it is given a `tooltip`, a `{ type: 'hover' }` m
|
|
|
43
43
|
| `series` | Only these series appear in the tooltip |
|
|
44
44
|
| `anchorX`, `anchorY` | Preferred side of the cursor: `'left' \| 'middle' \| 'right'` (default `'right'`) and `'top' \| 'middle' \| 'bottom'` (default `'bottom'`). It moves to the other side when it would overflow |
|
|
45
45
|
|
|
46
|
-
`decimals`, `prefix`, `suffix` and `signDisplay` ([Number format](theming.md#number-format)) write the value the default text shows - the one on the value axis, the `x` of horizontal bars - and a heatmap's color value. A custom `format` gets a second argument, `number`, that writes a number the same way: `format: (row, number) => `${row.region}: ${number(row.value)}``.
|
|
46
|
+
`decimals`, `prefix`, `suffix` and `signDisplay` ([Number format](theming.md#number-format)) write the value the default text shows - the one on the value axis, the `x` of horizontal bars - and a heatmap's color value. A custom `format` gets a second argument, `number`, that writes a number the same way: `format: (row, number) => `${row.region}: ${number(row.value)}``. Its third, `context`, is what the plot knows of the row: the `series`it is drawn in, its`x`, `y`and`value`, and what its kind works out - a [treemap](plots/part-of-a-whole/treemap.md)'s `share`, a histogram's bin edges, a box's quartiles (see [Row context](state.md#row-context)).
|
|
47
47
|
|
|
48
48
|
<!-- example: examples/CustomTooltip.svelte -->
|
|
49
49
|
|
|
@@ -104,14 +104,92 @@ The default strategy follows the plot's axes: it matches along the category (or
|
|
|
104
104
|
|
|
105
105
|
## In-plot hover
|
|
106
106
|
|
|
107
|
-
`markers={[{ type: 'hover' }]}` draws
|
|
107
|
+
`markers={[{ type: 'hover' }]}` draws the plot's own hover inside the SVG: markers behind its shapes, markers in front of them, and a new look for the shapes the hover reaches. What each plot kind draws:
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
| Plot | Behind (`back`) | In front (`front`) |
|
|
110
|
+
| -------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------- |
|
|
111
|
+
| `LinePlot`, `AreaPlot`, `DensityPlot` | a dashed crosshair along each axis the strategy matches along: `x`, `y`, both for `'punctual'`, none for `'series'` | a dot and the value |
|
|
112
|
+
| `ScatterPlot` | a crosshair along both axes, through the hovered point | the value |
|
|
113
|
+
| `SlopePlot`, `ClevelandPlot`, `DumbbellPlot`, `ForestPlot`, `LollipopPlot` | a rule along the value axis, at the hovered point | a dot and the value |
|
|
114
|
+
| `BarPlot`, `BulletPlot`, `BoxPlot`, `ViolinPlot`, `PyramidPlot` | the hovered category's band (a series' slice, when grouped and alone) | - |
|
|
115
|
+
| `HistogramPlot` | the hovered bin's span | - |
|
|
116
|
+
| `SparklinePlot` | - | a dot |
|
|
117
|
+
| `TreemapPlot`, `HeatmapPlot` | - (the hovered tile or cell is outlined, in the configuration's `hover.active`) | - |
|
|
118
|
+
|
|
119
|
+
What a plot draws follows the strategy in force as it is shown: a [composer](composer.md)'s `hover={{ strategy }}` changed from one step of a story to the next changes the crosshair a line plot draws, with no new `hover` marker. `GeoPlot` has a hover of its own, the `geo-hover` marker (see [Maps](#maps)).
|
|
120
|
+
|
|
121
|
+
Use it with a tooltip for the usual result:
|
|
110
122
|
|
|
111
123
|
```svelte
|
|
112
124
|
<LinePlot ... tooltip markers={[{ type: 'hover' }]} />
|
|
113
125
|
```
|
|
114
126
|
|
|
127
|
+
The marker's own fields are laid over the plot's:
|
|
128
|
+
|
|
129
|
+
- `back` and `front` are lists of markers - any but another `hover`, a `component` too - that replace the plot's when set; `back: []` draws nothing behind.
|
|
130
|
+
- `active` and `others` restyle the shapes (see [Restyling the hovered shapes](#restyling-the-hovered-shapes)), field by field over the plot's.
|
|
131
|
+
- `strategy`, `sync`, `series` and `scope` say what it reaches, as for a tooltip, and the number fields `decimals`, `prefix`, `suffix` and `signDisplay` (or `format(point, number)`) write each point's label.
|
|
132
|
+
|
|
133
|
+
```svelte
|
|
134
|
+
<!-- A band behind the hovered category, and a dot and its value on each bar. -->
|
|
135
|
+
<BarPlot
|
|
136
|
+
{data}
|
|
137
|
+
x="province"
|
|
138
|
+
y="value"
|
|
139
|
+
markers={[
|
|
140
|
+
{
|
|
141
|
+
type: 'hover',
|
|
142
|
+
back: [{ type: 'band', axis: 'x' }],
|
|
143
|
+
front: [{ type: 'dot' }, { type: 'text' }]
|
|
144
|
+
}
|
|
145
|
+
]}
|
|
146
|
+
/>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### The markers it draws
|
|
150
|
+
|
|
151
|
+
A marker in `back` or `front` draws the hovered points, unless it has `data` of its own. Each point is a row with its `x`, `y`, `label` (the value, written as the hover marker's number fields ask), `series`, `color` (its series'), `areaInset` (its series' slice of a grouped band) and `row` (the plot's row it stands for). What a marker leaves unset comes from the hover:
|
|
152
|
+
|
|
153
|
+
- `x` and `y` are the point's;
|
|
154
|
+
- a `rule` sits at each point along its `axis`, and a `band` around it, in its series' slice;
|
|
155
|
+
- a `text` writes the point's `label`;
|
|
156
|
+
- each takes the look of `hover` in the [configuration](theming.md) (`rule`, `area` for a `band` and a `rect`, `dot`, `font`), and a `dot` and a `text` the point's series color.
|
|
157
|
+
|
|
158
|
+
`points` picks which of the points a marker draws: `'all'` (the default), `'active'` (the one nearest the pointer of those the hover reaches - moving the pointer up and down a category moves it from one series' point to another's - so a crosshair is drawn once, not once per series) or a function of the point that keeps some. On a pyramid, two labels each on their side of zero:
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
front: [
|
|
162
|
+
{ type: 'dot' },
|
|
163
|
+
{ type: 'text', points: (p) => Number(p.x) >= 0, styles: { textAnchor: 'start', dx: 10, dy: 0 } },
|
|
164
|
+
{ type: 'text', points: (p) => Number(p.x) < 0, styles: { textAnchor: 'end', dx: -10, dy: 0 } }
|
|
165
|
+
];
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
On a grouped bar plot a point sits in its series' slice of the band, and each marker is drawn there - but a `band`, which takes the slice itself and covers the whole band where the hover matches every series of it.
|
|
169
|
+
|
|
170
|
+
## Restyling the hovered shapes
|
|
171
|
+
|
|
172
|
+
`active` and `others` on the `hover` marker restyle the shapes themselves: the ones the hover matches take `active`, every other one `others`, while the hover is on. Each takes `fill`, `fillOpacity`, `stroke`, `strokeWidth`, `strokeOpacity` and `strokeDasharray`, a value for every shape or a function of its row, and each value replaces the shape's own.
|
|
173
|
+
|
|
174
|
+
```svelte
|
|
175
|
+
<TreemapPlot
|
|
176
|
+
{data}
|
|
177
|
+
value="value"
|
|
178
|
+
grouping="sector.branch"
|
|
179
|
+
markers={[{ type: 'hover', active: { fillOpacity: 1 }, others: { fillOpacity: 0.3 } }]}
|
|
180
|
+
/>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- What is hovered is what the hover already matches: its `strategy` decides. A treemap tile or a heatmap cell is one shape (`punctual`); on a `BarPlot` the bars of the hovered category (`'x'`), of the hovered series (`'series'`) or the one bar (`'punctual'`).
|
|
184
|
+
- The shapes of a plot's own kind are linked to it: a `TreemapPlot`'s tiles, a `HeatmapPlot`'s cells, the bars of a `BarPlot`, a `BulletPlot` and a `PyramidPlot`, a `HistogramPlot`'s bins, a `ScatterPlot`'s dots and the dots of a `ClevelandPlot`, a `DumbbellPlot`, a `ForestPlot` and a `LollipopPlot`. On a dot, `fill`, `stroke` and the rest are its `dotFill`, `dotStroke`... A line or an area has no shape of a row to restyle: its point is the dot its hover draws in `front`. A marker of yours is linked with `hover: true` (it also hovers the row of the shape under the pointer, see [Markers](markers.md#hover-highlight)) or `hover: 'style'` (it only takes the styles).
|
|
185
|
+
- The shape is restyled, nothing is drawn over it: a label inside it stays on top and, with no `fill` of its own, is written in the color that reads best on the shape's new color.
|
|
186
|
+
- A `series` on the marker restyles that series' shapes only.
|
|
187
|
+
|
|
188
|
+
The styles a shape is drawn with, from the weakest: the kind's defaults and the configuration, `styles` (`styles.area`), `segments`, then `others` or `active`. The [legend](legend.md) goes over all of them:
|
|
189
|
+
|
|
190
|
+
- A series it dims (`mode: 'dim'`, the default, or another series isolated) stays hoverable: it is matched, shows in the tooltip and takes `active` or `others`, but keeps its dimmed `fill`, `fillOpacity` and `strokeOpacity`, so the hover never brings it back to full strength. An outline (`stroke`, `strokeWidth`, `strokeDasharray`) still applies.
|
|
191
|
+
- A series it hides, omits or rescales away is out of the hover: never matched, never restyled.
|
|
192
|
+
|
|
115
193
|
## Bars
|
|
116
194
|
|
|
117
195
|
On a `BarPlot` a hover candidate is the bar's whole band (or its series' slice, when grouped), so the tooltip triggers anywhere along the column.
|
|
@@ -54,22 +54,23 @@ Both derive rows from the data before drawing. A **transform** reshapes the rows
|
|
|
54
54
|
|
|
55
55
|

|
|
56
56
|
|
|
57
|
-
| Family | `type` | Does
|
|
58
|
-
| --------- | --------------------------------------------------------------------------------------------- |
|
|
59
|
-
| Stack | `stackX`, `stackY`, `stackMosaicX`, `stackMosaicY` | Cumulative stacking. Options: `offset` (`'none'`, `'wiggle'`, `'center'`, `'normalize'`, `'diverging'`), `order`, `reverse`
|
|
60
|
-
| Bin | `binX`, `binY`, `bin` | Count or reduce rows into bins. Options: `thresholds` (a count, a list, or `'auto'`, `'scott'`, `'sturges'`, `'freedman-diaconis'`), `interval`, `domain`, `cumulative`; reducers by channel (`y: 'count'`, `fill: 'mean'`, ...)
|
|
61
|
-
| Group | `groupX`, `groupY`, `groupZ`, `group` | Reduce rows per category with named reducers (`count`, `sum`, `mean`, `p25`, ...) or functions
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
57
|
+
| Family | `type` | Does |
|
|
58
|
+
| --------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
59
|
+
| Stack | `stackX`, `stackY`, `stackMosaicX`, `stackMosaicY` | Cumulative stacking. Options: `offset` (`'none'`, `'wiggle'`, `'center'`, `'normalize'`, `'diverging'`), `order`, `reverse` |
|
|
60
|
+
| Bin | `binX`, `binY`, `bin` | Count or reduce rows into bins. Options: `thresholds` (a count, a list, or `'auto'`, `'scott'`, `'sturges'`, `'freedman-diaconis'`), `interval`, `domain`, `cumulative`; reducers by channel (`y: 'count'`, `fill: 'mean'`, ...) |
|
|
61
|
+
| Group | `groupX`, `groupY`, `groupZ`, `group` | Reduce rows per category with named reducers (`count`, `sum`, `mean`, `p25`, ...) or functions |
|
|
62
|
+
| Treemap | `treemap` | Lay rows out as tiles in the unit square, with d3-hierarchy. `value` (the area), `levels` (what the tiles nest by, outermost first; rows with the same path are one tile and their values add up), `tile` (`'squarify'`, `'binary'`, `'slice'`, `'dice'`, `'sliceDice'`), `aspect` (width over height of the box). Produces `x1`/`x2`/`y1`/`y2` for a `rect` marker and `x`/`y` at each tile's centre for a `text`; the tile's name, path, value and share are left on its row |
|
|
63
|
+
| Window | `windowX`, `windowY` | Sliding window: `k` (size), `reduce` (`'mean'`, `'median'`, `'sum'`, `'max'`, ...), `anchor`, `strict` |
|
|
64
|
+
| Bollinger | `bollingerX`, `bollingerY` | Moving average and band: `n`, `k` |
|
|
65
|
+
| Normalize | `normalizeX`, `normalizeY`, `normalizeParallelX`, `normalizeParallelY` | Rebase to a reference: `basis` (`'first'`, `'last'`, `'min'`, `'max'`, `'mean'`, `'median'`, `'sum'`, `'deviation'`) |
|
|
66
|
+
| Map | `mapX`, `mapY` | `map`: `'cumsum'`, `'rank'`, `'quantile'` or a function |
|
|
67
|
+
| Interval | `intervalX`, `intervalY` | Turn a value into an `[x1, x2]` interval of a given size |
|
|
68
|
+
| Jitter | `jitterX`, `jitterY` | Random offset: `width`, `std`, `distribution` (`'uniform'`, `'normal'`), `seed` |
|
|
69
|
+
| Shift | `shiftX`, `shiftY` | Move by `by` (a number, or a string offset) |
|
|
70
|
+
| Density | `densityX`, `densityY` | Kernel density estimate: `kernel`, `bandwidth` |
|
|
71
|
+
| Sort | `sort`, `shuffle`, `reverse` | Reorder rows (matters for the path a line takes and which dot lands on top) |
|
|
72
|
+
| Filter | `filter` | Keep rows a test holds for |
|
|
73
|
+
| Select | `select`, `selectFirst`, `selectLast`, `selectMinX`, `selectMaxX`, `selectMinY`, `selectMaxY` | Keep one row per group, such as each series' last point or peak |
|
|
73
74
|
|
|
74
75
|
Bar stacking is always `stackY`, also for horizontal bars. A transform on a `HistogramPlot` is merged over the plot's default binning, so `{ type: 'binX', thresholds: 20 }` changes the bins and the rest stays.
|
|
75
76
|
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
x: { label: 'Month' },
|
|
24
24
|
y: { label: 'Inflation (%)' }
|
|
25
25
|
}}
|
|
26
|
-
styles={{
|
|
26
|
+
styles={{
|
|
27
|
+
values: { show: true, format: (v, _number, context) => `${context.series}: ${v}` }
|
|
28
|
+
}}
|
|
27
29
|
margins={{ right: 'auto' }}
|
|
28
30
|
/>
|
|
29
31
|
{/if}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { TreemapPlot } from '@fundar/data-chart-telling';
|
|
3
|
+
import { ACTIVITY_BRANCHES } from './datasets';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<!-- One tile per branch, sized by its value and colored by its sector. -->
|
|
7
|
+
<TreemapPlot
|
|
8
|
+
width={760}
|
|
9
|
+
height={440}
|
|
10
|
+
data={ACTIVITY_BRANCHES}
|
|
11
|
+
value="value"
|
|
12
|
+
grouping="sector.branch"
|
|
13
|
+
/>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { TreemapPlot } from '@fundar/data-chart-telling';
|
|
3
|
+
import { ACTIVITY_BRANCHES } from './datasets';
|
|
4
|
+
</script>
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
The hover marker restyles the tiles themselves: the hovered one at full strength and outlined, every other
|
|
8
|
+
faded. Each label is still written on its tile, in the color that reads best on it.
|
|
9
|
+
-->
|
|
10
|
+
<TreemapPlot
|
|
11
|
+
width={760}
|
|
12
|
+
height={440}
|
|
13
|
+
data={ACTIVITY_BRANCHES}
|
|
14
|
+
value="value"
|
|
15
|
+
grouping="sector.branch"
|
|
16
|
+
styles={{ area: { fillOpacity: 0.85 } }}
|
|
17
|
+
tooltip
|
|
18
|
+
markers={[
|
|
19
|
+
{
|
|
20
|
+
type: 'hover',
|
|
21
|
+
active: { fillOpacity: 1, stroke: '#111827', strokeWidth: 2 },
|
|
22
|
+
others: { fillOpacity: 0.35 }
|
|
23
|
+
}
|
|
24
|
+
]}
|
|
25
|
+
/>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// ── The weight of each branch of activity in a city's gross added value ──────
|
|
2
|
+
// IDECBA, value added at basic prices by branch of activity, Ciudad de Buenos Aires,
|
|
3
|
+
// 2024 (preliminary), in millions of pesos of 2004. A selection of the larger branches.
|
|
4
|
+
|
|
5
|
+
export type ActivityRow = {
|
|
6
|
+
sector: 'Primary' | 'Secondary' | 'Tertiary';
|
|
7
|
+
kind: string;
|
|
8
|
+
branch: string;
|
|
9
|
+
/** Millions of pesos of 2004. */
|
|
10
|
+
value: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const ACTIVITY_BRANCHES: ActivityRow[] = [
|
|
14
|
+
{ sector: 'Primary', kind: 'Extraction', branch: 'Oil, gas and coal', value: 778 },
|
|
15
|
+
{ sector: 'Primary', kind: 'Agriculture', branch: 'Agriculture and livestock', value: 193 },
|
|
16
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Chemicals', value: 2999 },
|
|
17
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Food and beverages', value: 2882 },
|
|
18
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Publishing and printing', value: 1251 },
|
|
19
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Machinery and equipment', value: 973 },
|
|
20
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Clothing', value: 814 },
|
|
21
|
+
{ sector: 'Secondary', kind: 'Manufacturing', branch: 'Textiles', value: 381 },
|
|
22
|
+
{
|
|
23
|
+
sector: 'Tertiary',
|
|
24
|
+
kind: 'Trade and transport',
|
|
25
|
+
branch: 'Wholesale and retail trade',
|
|
26
|
+
value: 15365
|
|
27
|
+
},
|
|
28
|
+
{ sector: 'Tertiary', kind: 'Trade and transport', branch: 'Transport', value: 3707 },
|
|
29
|
+
{ sector: 'Tertiary', kind: 'Trade and transport', branch: 'Communications', value: 8210 },
|
|
30
|
+
{ sector: 'Tertiary', kind: 'Finance', branch: 'Banking and finance', value: 7857 },
|
|
31
|
+
{ sector: 'Tertiary', kind: 'Finance', branch: 'Insurance', value: 3106 },
|
|
32
|
+
{ sector: 'Tertiary', kind: 'Public services', branch: 'Public administration', value: 7606 },
|
|
33
|
+
{ sector: 'Tertiary', kind: 'Public services', branch: 'Public education', value: 2374 },
|
|
34
|
+
{ sector: 'Tertiary', kind: 'Public services', branch: 'Public health', value: 1525 },
|
|
35
|
+
{ sector: 'Tertiary', kind: 'Private services', branch: 'Private health', value: 5439 },
|
|
36
|
+
{ sector: 'Tertiary', kind: 'Private services', branch: 'Private education', value: 1952 },
|
|
37
|
+
{ sector: 'Tertiary', kind: 'Private services', branch: 'Restaurants and bars', value: 2439 },
|
|
38
|
+
{ sector: 'Tertiary', kind: 'Real estate', branch: 'Housing', value: 6179 },
|
|
39
|
+
{ sector: 'Tertiary', kind: 'Real estate', branch: 'Construction', value: 3905 }
|
|
40
|
+
];
|
|
@@ -5,6 +5,7 @@ export * from './commodity-prices';
|
|
|
5
5
|
export * from './countries-over-time';
|
|
6
6
|
export * from './daily-temperature';
|
|
7
7
|
export * from './earthquakes';
|
|
8
|
+
export * from './economic-activity';
|
|
8
9
|
export * from './flight-routes';
|
|
9
10
|
export * from './height-density';
|
|
10
11
|
export * from './heights';
|
package/llms-full.txt
CHANGED
|
@@ -12,7 +12,7 @@ Svelte 5 plot components on top of svelteplot. This file is checked against the
|
|
|
12
12
|
## The mental model
|
|
13
13
|
|
|
14
14
|
- A **plot** is one graph (axes + marks). Titles, subtitle, caption, legend, facets and a timeline are props of the plot itself.
|
|
15
|
-
- Plots: `LinePlot AreaPlot BarPlot DensityPlot HistogramPlot BoxPlot ViolinPlot LollipopPlot DumbbellPlot ClevelandPlot ForestPlot BulletPlot SlopePlot SparklinePlot HeatmapPlot PyramidPlot ScatterPlot GeoPlot`.
|
|
15
|
+
- Plots: `LinePlot AreaPlot BarPlot DensityPlot HistogramPlot BoxPlot ViolinPlot LollipopPlot DumbbellPlot ClevelandPlot ForestPlot BulletPlot SlopePlot SparklinePlot TreemapPlot HeatmapPlot PyramidPlot ScatterPlot GeoPlot`.
|
|
16
16
|
- `PlotComposer` lays several plots out in one figure with shared hover, legend and timeline.
|
|
17
17
|
- `width` and `height` are pixel numbers on a standalone plot. To fill a container or the window, bind its size (`examples/ResponsiveLine.svelte`) and render the plot once both are > 0.
|
|
18
18
|
|
|
@@ -43,17 +43,17 @@ Two ways to give data, one per plot:
|
|
|
43
43
|
| `segments` | Style ranges of the data (rule 1 below). |
|
|
44
44
|
| `markers` | Extra marks, an array of `{ type: '...', ... }`. |
|
|
45
45
|
| `margins` | `{ top, right, bottom, left }`, each a number or `'auto'` (all `'auto'` by default). |
|
|
46
|
-
| `tooltip` | `true` or `{ strategy, sync, format, content, series, anchorX, anchorY }
|
|
46
|
+
| `tooltip` | `true` or `{ strategy, sync, format, content, series, anchorX, anchorY }`; `format(row, number, context)`, `context` holding the row's `series`, `x`, `y`, `value`, `row` and what the kind adds (a treemap's `share`, a histogram's `from`/`to`/`count`, a box's quartiles). The text lists matched rows highest value first; a `content` snippet gets them unsorted. |
|
|
47
47
|
| `timeline` | `{ accessor: 'year' }` steps through the rows by a field, drawn as a player bar (default); `type: 'rule'` draws a rule beside the plot instead. The field may hold numbers, `Date`s or date strings (ISO, or any other with `dateFormat: 'DD/MM/YYYY'`); date steps read as dates, and reach `onvalue`, `player.format` and `useFigure().timeline` (`steps`, `value`, `seekValue`) as `Date`s. Other options: `progress` (position, `0`-`1`), `values` (the steps, when not every distinct value), `filterMode` (`'exact'` shows the current step's rows, `'upTo'` every row up to it; `LinePlot` defaults to `'upTo'`), `interpolate` (tween values between steps), `scales` (`'shared'` keeps both axes still across steps, `'free'` refits both to each step, `'free-x'`/`'free-y'` refit one and keep the other still), `onprogress`, `onvalue`, and a rule's `orientation`, `show` and `thickness`. |
|
|
48
48
|
| `facet` | `{ by: 'field', columns, gap, scales: 'shared'\|'free'\|'free-x'\|'free-y', mode: 'grid'\|'carousel'\|'paginated' }` or `{ rows, cols }`. |
|
|
49
|
-
| `transforms` `statistics` | svelteplot transforms / derived summaries. `statistics` is `[{ type, ...options, series?, pooled? }]` (per series by default, `series: ['a']` only those, `pooled: true` all rows at once; a marker's own `.statistics` runs over its own `data`). Types: `regression` (`regressionType`: `'linear'|'quad'|'poly'|'exp'|'log'|'pow'|'loess'`, `order`, `base`, `span`, `confidence`, `styles`), `movingAverage` (`k`, `reduce`, `styles`), `bollinger` (`n`, `k`, `styles`), `density` (`kernel`, `bandwidth`, `styles`), `density2d` (`bandwidth`, `thresholds`, `styles`), `box` (the `box` marker's options), `deviation` (a rule at an estimator and a band around it, along the plot's value axis: `estimator`: `'mean'|'median'|'midrange'`, `spread`: `'stdev'|'mad'`, `k`, `rule` and `band`: styles or `false`, each with an optional `label: true | { text, styles: FontStyle }`, the band's also `edge: 'lower'|'upper'` and `position: 'inside'|'outside'`)|'upper'`). |
|
|
49
|
+
| `transforms` `statistics` | svelteplot transforms / derived summaries. `treemap` is the library's own transform: `{ type: 'treemap', value: 'count', levels: ['island', 'species'], tile: 'squarify', aspect: 1 }` makes a tile per distinct path of `levels` (outermost first), its area the sum of its rows' `value`, and gives a `rect` marker `x1`/`x2`/`y1`/`y2` in the unit square (`x`/`y` at each tile's centre for a `text`). `statistics` is `[{ type, ...options, series?, pooled? }]` (per series by default, `series: ['a']` only those, `pooled: true` all rows at once; a marker's own `.statistics` runs over its own `data`). Types: `regression` (`regressionType`: `'linear'|'quad'|'poly'|'exp'|'log'|'pow'|'loess'`, `order`, `base`, `span`, `confidence`, `styles`), `movingAverage` (`k`, `reduce`, `styles`), `bollinger` (`n`, `k`, `styles`), `density` (`kernel`, `bandwidth`, `styles`), `density2d` (`bandwidth`, `thresholds`, `styles`), `box` (the `box` marker's options), `deviation` (a rule at an estimator and a band around it, along the plot's value axis: `estimator`: `'mean'|'median'|'midrange'`, `spread`: `'stdev'|'mad'`, `k`, `rule` and `band`: styles or `false`, each with an optional `label: true | { text, styles: FontStyle }`, the band's also `edge: 'lower'|'upper'` and `position: 'inside'|'outside'`)|'upper'`). |
|
|
50
50
|
|
|
51
|
-
Per kind: `BarPlot` x = category, y = value (swap for horizontal bars); `PyramidPlot` mirrors two series around zero; `HeatmapPlot` colors cells by `color`; `HistogramPlot` bins one numeric field; `DensityPlot` smooths one numeric field into a kernel density curve (`styles.mark: 'line'` draws a line instead of an area; a `densityX` transform sets `kernel` and `bandwidth`); `BoxPlot` x = category, y = value, one box per category (its tooltip row is the box summary: `min`, `p25`, `median`, `p75`, `max`, `count`, `outliers`); `ViolinPlot` x = category, y = value (swap for horizontal), the mirrored density of each category's values with a box inside (`styles`: `kernel`, `bandwidth`, `trim`, `scale: 'width'|'shared'`, `box: false | width`; its tooltip row is a box plot's); `LollipopPlot` x = category, y = value, one dot on a stem per category (stems start at zero, or at the nearest end of a pinned domain; `styles.values` labels each dot); `DumbbellPlot` x = category, y = value, `color`/`grouping` names exactly two series, joined by a connector per category (another count warns); `ClevelandPlot` is the same for any number of series, joined from the lowest to the highest (use `grouping` for a numeric series field; `styles.values.select` (`'first'|'last'|'min'|'max'` or a list), `series` and `color: 'series'` choose and color the labelled dots; `styles.connector` sets the connector's `width` (number or `'dots'` for a band), `color` (one, `{ by: 'sign' | 'difference' | 'length' }` or a function), `opacity`, `arrow` (draws the from-to stretch as an arrow), `outside` (the part past the from/to dots), `label` (centered on the from-to stretch) and the `from`/`to` series of its difference); `ForestPlot` x = value, y = category (or swapped), one dot per row on a stem spanning its interval given by `lower`/`upper` fields or an `error` either side (the value axis fits the intervals; `styles.connector.caps` toggles the end ticks, on by default); `BulletPlot` is a bar plot with a `target` (field, function or number: a tick across the band) and `ranges` (upper bounds, each a field, function or number: bands from the baseline, the smallest darkest) drawn around its thin bars (the value axis reaches them); `SlopePlot` x = category (its first and last positions are the two moments), y = value, a line with a dot on every point per series, its first and last labelled before and after it by `styles.values` (the value axis is hidden by default; `scales.y.axisDisplay: 'visible'` shows it); `SparklinePlot` is a small `LinePlot` with no axes and no legend (`legend` and `margins` bring them back), a dot on each series' last point and its value beside it (`styles.values` formats it or turns it off with `show: false`; `facet` makes one per category); `ScatterPlot` takes `r` (size) and `symbol`; `GeoPlot` takes GeoJSON/TopoJSON in `data` and `coordinates` for the projection (`docs/geo.md`).
|
|
51
|
+
Per kind: `BarPlot` x = category, y = value (swap for horizontal bars); `PyramidPlot` mirrors two series around zero; `HeatmapPlot` colors cells by `color`; `HistogramPlot` bins one numeric field; `DensityPlot` smooths one numeric field into a kernel density curve (`styles.mark: 'line'` draws a line instead of an area; a `densityX` transform sets `kernel` and `bandwidth`); `BoxPlot` x = category, y = value, one box per category (its tooltip row is the box summary: `min`, `p25`, `median`, `p75`, `max`, `count`, `outliers`); `ViolinPlot` x = category, y = value (swap for horizontal), the mirrored density of each category's values with a box inside (`styles`: `kernel`, `bandwidth`, `trim`, `scale: 'width'|'shared'`, `box: false | width`; its tooltip row is a box plot's); `LollipopPlot` x = category, y = value, one dot on a stem per category (stems start at zero, or at the nearest end of a pinned domain; `styles.values` labels each dot); `DumbbellPlot` x = category, y = value, `color`/`grouping` names exactly two series, joined by a connector per category (another count warns); `ClevelandPlot` is the same for any number of series, joined from the lowest to the highest (use `grouping` for a numeric series field; `styles.values.select` (`'first'|'last'|'min'|'max'` or a list), `series` and `color: 'series'` choose and color the labelled dots; `styles.connector` sets the connector's `width` (number or `'dots'` for a band), `color` (one, `{ by: 'sign' | 'difference' | 'length' }` or a function), `opacity`, `arrow` (draws the from-to stretch as an arrow), `outside` (the part past the from/to dots), `label` (centered on the from-to stretch) and the `from`/`to` series of its difference); `ForestPlot` x = value, y = category (or swapped), one dot per row on a stem spanning its interval given by `lower`/`upper` fields or an `error` either side (the value axis fits the intervals; `styles.connector.caps` toggles the end ticks, on by default); `BulletPlot` is a bar plot with a `target` (field, function or number: a tick across the band) and `ranges` (upper bounds, each a field, function or number: bands from the baseline, the smallest darkest) drawn around its thin bars (the value axis reaches them); `SlopePlot` x = category (its first and last positions are the two moments), y = value, a line with a dot on every point per series, its first and last labelled before and after it by `styles.values` (the value axis is hidden by default; `scales.y.axisDisplay: 'visible'` shows it); `SparklinePlot` is a small `LinePlot` with no axes and no legend (`legend` and `margins` bring them back), a dot on each series' last point and its value beside it (`styles.values` formats it or turns it off with `show: false`; `facet` makes one per category); `TreemapPlot` takes `value` (a tile's area) and `grouping` (the whole path of a tile, fields joined by dots, outermost first: `'sector.branch'` - the last level names it, rows with one path are one tile, the outermost colors the tiles and the legend); a `treemap` entry in its `transforms` sets `tile` (`'squarify'` default, `'binary'`, `'slice'`, `'dice'`, `'sliceDice'`); its tiles are labelled by `styles.values` with their name over their share of the whole, cut short or reduced to the share alone where they do not fit; its `segments` can be keyed by the path of a tile (`'Tertiary.Finance'`) and `tooltip.format(row, number, context)` gets the tile's row and a `context` with its `series`, `name`, `path`, `value` and `share` (0-100); `ScatterPlot` takes `r` (size) and `symbol`; `GeoPlot` takes GeoJSON/TopoJSON in `data` and `coordinates` for the projection (`docs/geo.md`).
|
|
52
52
|
|
|
53
53
|
## Switches
|
|
54
54
|
|
|
55
|
-
- **Hover and tooltip** are enabled by `tooltip` and/or a hover marker. The usual look: `tooltip={true} markers={[{ type: 'hover' }]}`. `tooltip.strategy` is `'x' | 'y' | 'punctual' | 'series'`.
|
|
56
|
-
- **Value labels**: `styles={{ values: { show: true } }}`. On a LinePlot they sit at the end of each series, spread apart automatically, and the right margin grows to fit them (keep `margins.right` at `'auto'`). Format with `values.format: (value,
|
|
55
|
+
- **Hover and tooltip** are enabled by `tooltip` and/or a hover marker. The usual look: `tooltip={true} markers={[{ type: 'hover' }]}`. `tooltip.strategy` is `'x' | 'y' | 'punctual' | 'series'`. The hover marker's `active` and `others` restyle the hovered shapes and the rest (`fill`, `fillOpacity`, `stroke`, `strokeWidth`, `strokeOpacity`, `strokeDasharray`, each a value or a function of the row): `markers={[{ type: 'hover', active: { fillOpacity: 1 }, others: { fillOpacity: 0.3 } }]}`. It works on a treemap's tiles, a bar plot's bars and a heatmap's cells as they are; a marker of yours takes it with `hover: true` (also a hit area) or `hover: 'style'`. A series the legend dims stays hoverable but keeps its dimmed fill; one it hides, omits or rescales is never hovered. The hover marker draws its plot kind's own hover - a crosshair along the strategy's axes with a dot and the value on line, area and density plots; a crosshair through the point and its value on a scatter plot; a rule along the value axis with a dot and the value on slope and Cleveland-family plots; the hovered category's `band` behind bar, bullet, box, violin and pyramid plots; the hovered bin's span behind a histogram; a dot on a sparkline; on a treemap or a heatmap, only the hovered tile or cell outlined (`hover.active` in the configuration) - following the strategy in force (a composer's can change while shown), laid out as `back` (markers behind the plot's shapes) and `front` (in front), lists of any markers but `hover` that replace the kind's when set (`back: []` draws nothing behind). They draw the hovered points (`x`, `y`, `label`, `series`, `color`, `areaInset`, `row`), and what they leave unset comes from the hover: `x`/`y`, a `rule`'s and a `band`'s `value`, a `text`'s `text`, the configuration's `hover` look and the series color. `points: 'active' | (point) => boolean` draws only the point under the pointer, or some: `{ type: 'hover', back: [{ type: 'rule', axis: 'x', points: 'active' }], front: [{ type: 'dot' }] }`.
|
|
56
|
+
- **Value labels**: `styles={{ values: { show: true } }}`. On a LinePlot they sit at the end of each series, spread apart automatically, and the right margin grows to fit them (keep `margins.right` at `'auto'`). Format with `values.format: (value, number, context) => string` (`context.series`, `context.row`); style with `values.fontStyle`.
|
|
57
57
|
- **Toggling series from the legend**: `interactive.enabled` on the series section.
|
|
58
58
|
- **A frame** around the plot area: `styles={{ frame: true }}`.
|
|
59
59
|
|
|
@@ -76,8 +76,9 @@ Per kind: `BarPlot` x = category, y = value (swap for horizontal bars); `Pyramid
|
|
|
76
76
|
Inside a plot's snippets (`header`, `footer`, tooltip `content`) or any child of a figure, call during component init:
|
|
77
77
|
|
|
78
78
|
- `useFigure()` returns `{ hover, legend, timeline }` for the whole figure.
|
|
79
|
-
- `usePlot()` returns the same plus `margins`, `scales`, `axes`, `data`, `width`, `height`, `svelteplot` (inside a plot, e.g. a `component` marker)
|
|
80
|
-
-
|
|
79
|
+
- `usePlot()` returns the same plus `margins`, `scales`, `axes`, `data`, `width`, `height`, `svelteplot` (inside a plot, e.g. a `component` marker), and `contextOf(row)`.
|
|
80
|
+
- Row context: every row a plot draws has a context worked out once - `series`, `x`, `y`, `value`, `row` and what the kind adds (`TreemapPlot`: `name`, `path`, `share`; `HistogramPlot`: `count`, `from`, `to`; `BoxPlot`/`ViolinPlot`: `category`, `min`, `p25`, `median`, `p75`, `max`, `count`, `outliers`; `DensityPlot`'s `value` is the estimate). `tooltip.format`, `styles.values.format`, the `hover` marker's points (`point.context`) and `RowContext.of(row)` all read it.
|
|
81
|
+
- `legend.off` (names of hidden series), `legend.isOff(name)`, `legend.toggle(name, action)`, `turnOff`, `turnOn`. `action` is `{ mode: 'dim' | 'hide' | 'omit' | 'rescale' }`; `'omit'` removes the series and refits the axes, and `'rescale'` also makes the parts left of a whole (a stack, a treemap) the new 100%, so the visible domain follows `legend.off`.
|
|
81
82
|
- `timeline.steps`, `value`, `progress`, `playing`, `seek(p)`, `seekValue(v)`, `next()`, `previous()`, `play()`, `pause()`, `toggle()`, `setSpeed()`.
|
|
82
83
|
- `hover.activeX`, `activeY`, `activeSeries`, `source`.
|
|
83
84
|
|
|
@@ -86,7 +87,7 @@ The timeline is a player bar by default: `timeline={{ accessor: 'year', player:
|
|
|
86
87
|
## Markers
|
|
87
88
|
|
|
88
89
|
Add with `markers={[{ type: '...' }]}`. For x/y plots:
|
|
89
|
-
`area arrow bar bollinger box brush cell component delaunayLink delaunayMesh delta density difference dot hover hull image line raster rect regression rule text tick trail violin voronoi voronoiMesh waffle`.
|
|
90
|
+
`area arrow band bar bollinger box brush cell component delaunayLink delaunayMesh delta density difference dot hover hull image line raster rect regression rule text tick trail violin voronoi voronoiMesh waffle`.
|
|
90
91
|
GeoPlot: `graticule sphere dot text vector link contour inset geo-hover geo-component`.
|
|
91
92
|
|
|
92
93
|
- `delta` annotates the difference between two series at a position: `{ type: 'delta', axis: 'x', at: 2020, from: { type: 'series', series: 'A' }, to: { type: 'series', series: 'B' }, formatDiff: (d) => d.toFixed(1) }`; `at` can be a list of positions, one delta at each (`at: [1991, 2001]`), and `line`, `text` and `dot` can be functions of the position (`text: (at) => at === 2022 ? { dx: -20, textAnchor: 'end' } : { dx: 20 }`).
|
|
@@ -108,6 +109,7 @@ GeoPlot: `graticule sphere dot text vector link contour inset geo-hover geo-comp
|
|
|
108
109
|
- `LineByRegion.svelte` - one line per region with title, legend, end labels and tooltip.
|
|
109
110
|
- `ResponsiveLine.svelte` - fill the window, end-of-line labels, axis labels.
|
|
110
111
|
- `Tooltip.svelte` - tooltip + hover marker.
|
|
112
|
+
- `TreemapHover.svelte` - a treemap whose hover lightens the hovered tile and fades the rest.
|
|
111
113
|
- `Segments.svelte` - styling a range of the data.
|
|
112
114
|
- `LegendToggle.svelte` + `LegendReader.svelte` - interactive legend and reading its state.
|
|
113
115
|
- `TimelinePlayer.svelte` - animated bar chart with a player.
|
package/llms.txt
CHANGED
|
@@ -26,6 +26,7 @@ Start with the full guide: it lists the mental model, the props every plot share
|
|
|
26
26
|
- [BulletPlot](./docs/plots/ranking/bullet.md)
|
|
27
27
|
- [SlopePlot](./docs/plots/evolution/slope.md)
|
|
28
28
|
- [SparklinePlot](./docs/plots/evolution/sparkline.md)
|
|
29
|
+
- [TreemapPlot](./docs/plots/part-of-a-whole/treemap.md)
|
|
29
30
|
- [ClevelandPlot](./docs/plots/ranking/cleveland.md)
|
|
30
31
|
- [HeatmapPlot](./docs/plots/correlation/heatmap.md)
|
|
31
32
|
- [PyramidPlot](./docs/plots/distribution/pyramid.md)
|
|
@@ -40,7 +41,7 @@ Start with the full guide: it lists the mental model, the props every plot share
|
|
|
40
41
|
- [Chrome](./docs/chrome.md): title, caption, header, footer, order, dividers
|
|
41
42
|
- [Facets](./docs/facets.md): small multiples
|
|
42
43
|
- [Composer](./docs/composer.md): several plots in one figure
|
|
43
|
-
- [Reading plot state](./docs/state.md): `useFigure`, `usePlot
|
|
44
|
+
- [Reading plot state](./docs/state.md): `useFigure`, `usePlot`, the row context every format reads
|
|
44
45
|
- [Maps](./docs/geo.md): GeoPlot, projections, camera, map markers
|
|
45
46
|
- [Theming](./docs/theming.md): configuration, themes, locale, CSS variables
|
|
46
47
|
|
|
@@ -55,6 +56,8 @@ Start with the full guide: it lists the mental model, the props every plot share
|
|
|
55
56
|
- [Timeline rule driven by a slider](./examples/TimelineRule.svelte)
|
|
56
57
|
- [Facets with a synced tooltip](./examples/Facets.svelte)
|
|
57
58
|
- [Bars with value labels](./examples/BarValues.svelte)
|
|
59
|
+
- [Treemap: a tile per row, sized by its value and nested by grouping](./examples/Treemap.svelte)
|
|
60
|
+
- [Treemap whose hover lightens the hovered tile and fades the rest](./examples/TreemapHover.svelte)
|
|
58
61
|
- [Custom tooltip card](./examples/CustomTooltip.svelte)
|
|
59
62
|
- [The smallest plot: rows, fields and a pixel size](./examples/FirstPlot.svelte)
|
|
60
63
|
- [Line per series over a date axis, with end labels](./examples/LineDates.svelte)
|