@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
|
@@ -1,10 +1,54 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { AxisBasedMarkersConfig } from './axisBasedMarkersConfig';
|
|
2
2
|
import type { HoverDisplayPoint, HoverStrategy } from '../../layout/hover';
|
|
3
3
|
import type { NumberDisplay } from '../../layout/numbers';
|
|
4
|
+
import type { LineStyle } from '../../plots/constants';
|
|
5
|
+
/** A style value: the same for every shape, or a function of the row a shape draws. */
|
|
6
|
+
type ShapeStyleValue<T> = T | ((row: any) => T);
|
|
4
7
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* How the shapes of a marker linked to the hover (`hover: true` or `'style'`) look while the hover is on: the
|
|
9
|
+
* hovered ones under `active`, the rest under `others`. Each value replaces the shape's own, and may be a
|
|
10
|
+
* function of its row.
|
|
11
|
+
*/
|
|
12
|
+
export type HoverShapeStyle = {
|
|
13
|
+
fill?: ShapeStyleValue<string>;
|
|
14
|
+
fillOpacity?: ShapeStyleValue<number>;
|
|
15
|
+
stroke?: ShapeStyleValue<string>;
|
|
16
|
+
strokeWidth?: ShapeStyleValue<number>;
|
|
17
|
+
strokeOpacity?: ShapeStyleValue<number>;
|
|
18
|
+
strokeDasharray?: string | LineStyle;
|
|
19
|
+
};
|
|
20
|
+
/** `T` with its `K` fields left to be set. */
|
|
21
|
+
type Optional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
22
|
+
/** A marker as the hover takes it: a `rule`'s and a `band`'s `value` and a `text`'s `text` default to the point's. */
|
|
23
|
+
type InHover<T> = T extends {
|
|
24
|
+
type: 'rule' | 'band';
|
|
25
|
+
} ? Optional<T, 'value' & keyof T> : T extends {
|
|
26
|
+
type: 'text';
|
|
27
|
+
} ? Optional<T, 'text' & keyof T> : T;
|
|
28
|
+
/**
|
|
29
|
+
* A marker the hover draws: any marker but another hover, over the hovered points. Without `data` of its own its
|
|
30
|
+
* rows are the points - each its `x`, `y`, `label` (written as the hover marker's number fields ask), `series`,
|
|
31
|
+
* `color` (its series'), `areaInset` (its slice of the band) and `row` (the row it stands for) - and its `x` and
|
|
32
|
+
* `y` default to the point's. What it leaves unset comes from the hover: a `rule` sits at each point along its
|
|
33
|
+
* `axis`, a `band` around it (in its series' slice), a `text` writes its label; each in the configuration's `hover`
|
|
34
|
+
* look (a `rect` in its `area`), and a `dot` and a `text` in the point's series color.
|
|
35
|
+
*/
|
|
36
|
+
export type HoverLayerMarker = InHover<Exclude<AxisBasedMarkersConfig, {
|
|
37
|
+
type: 'hover';
|
|
38
|
+
}>> & {
|
|
39
|
+
/**
|
|
40
|
+
* Which points it draws: every one the hover matches (the default), only the one under the pointer, or those a
|
|
41
|
+
* function of the point keeps.
|
|
42
|
+
*/
|
|
43
|
+
points?: 'all' | 'active' | ((point: HoverDisplayPoint) => boolean);
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The plot's hover, inside the plot: how the hovered shapes look (`active`) and the rest (`others`), and the
|
|
47
|
+
* markers it draws behind the plot's shapes (`back`) and in front of them (`front`) - a rule, a band, a dot, a
|
|
48
|
+
* label, a component. Each plot kind has a hover of its own that this one is laid over: `active` and `others`
|
|
49
|
+
* field by field, `back` and `front` replacing the kind's lists when set (`back: []` draws nothing behind).
|
|
50
|
+
* The points' label is the hovered value as `decimals`, `prefix`, `suffix` and `signDisplay` write it - as the
|
|
51
|
+
* plot writes it while none of them (nor `numbers.decimals`) is set - unless `format` writes it.
|
|
8
52
|
*/
|
|
9
53
|
export type HoverMarkerConfig = NumberDisplay & {
|
|
10
54
|
type: 'hover';
|
|
@@ -12,16 +56,17 @@ export type HoverMarkerConfig = NumberDisplay & {
|
|
|
12
56
|
scope?: 'series' | 'segment';
|
|
13
57
|
strategy?: HoverStrategy;
|
|
14
58
|
sync?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
/** The
|
|
59
|
+
/** How the hovered shapes of every marker linked to the hover look - the plot's own tiles, bars and cells among them. */
|
|
60
|
+
active?: HoverShapeStyle;
|
|
61
|
+
/** How the shapes the hover does not reach look, while it is on. */
|
|
62
|
+
others?: HoverShapeStyle;
|
|
63
|
+
/** The markers drawn behind every other one of the plot, over the hovered points. */
|
|
64
|
+
back?: HoverLayerMarker[];
|
|
65
|
+
/** The markers drawn in front of the plot's shapes, over the hovered points. */
|
|
66
|
+
front?: HoverLayerMarker[];
|
|
67
|
+
/** A point's label, in place of its value. `number` writes a value as the display fields above ask. */
|
|
22
68
|
format?: (point: HoverDisplayPoint, number: (value: number) => string) => string;
|
|
23
|
-
rule?: StrokeStyle;
|
|
24
|
-
area?: AreaStyle;
|
|
25
|
-
dot?: DotStyle;
|
|
26
|
-
text?: FontStyle;
|
|
27
69
|
};
|
|
70
|
+
/** What a plot kind's own hover is made of, which an author's `hover` marker is laid over. */
|
|
71
|
+
export type HoverLook = Pick<HoverMarkerConfig, 'active' | 'others' | 'back' | 'front'>;
|
|
72
|
+
export {};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import type { AreaStyle } from '../../plots/styling';
|
|
1
|
+
import type { AreaStyle, PerRow, InsetStyle } from '../../plots/styling';
|
|
2
2
|
import type { CommonMarkerConfigWithArea } from '../channels/commonMarkerConfigWithArea';
|
|
3
3
|
import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
|
|
4
|
+
import type { CommonMarkerConfigWithLabel } from '../channels/commonMarkerConfigWithLabel';
|
|
4
5
|
import type { CommonMarkerConfigWithInterval } from '../channels/commonMarkerConfigWithInterval';
|
|
5
6
|
/** An arbitrary rectangle (svelteplot's `Rect`); `interval` turns `x`/`y` into ranges. */
|
|
6
7
|
export type RectMarkerConfig = {
|
|
7
8
|
type: 'rect';
|
|
8
9
|
interval?: number | string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
insetRight?: number;
|
|
12
|
-
insetTop?: number;
|
|
13
|
-
insetBottom?: number;
|
|
14
|
-
styles?: AreaStyle;
|
|
15
|
-
} & CommonMarkerConfigWithArea & CommonMarkerConfigWithColor & CommonMarkerConfigWithInterval;
|
|
10
|
+
styles?: PerRow<AreaStyle & InsetStyle>;
|
|
11
|
+
} & CommonMarkerConfigWithArea & CommonMarkerConfigWithColor & CommonMarkerConfigWithInterval & CommonMarkerConfigWithLabel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AxisValue } from '../../layout/mapping';
|
|
2
|
-
import type { StrokeStyle } from '../../plots/styling';
|
|
2
|
+
import type { StrokeStyle, PerRow, InsetStyle } from '../../plots/styling';
|
|
3
3
|
import type { CommonMarkerConfigWithInterval } from '../channels/commonMarkerConfigWithInterval';
|
|
4
4
|
/**
|
|
5
5
|
* A vertical or horizontal reference line, one line per row when `data` is given, or one per value
|
|
@@ -13,19 +13,5 @@ export type RuleMarkerConfig = {
|
|
|
13
13
|
* a field key or a function of the row gives each row's own.
|
|
14
14
|
*/
|
|
15
15
|
value: AxisValue | string | (AxisValue | string)[] | ((d: any) => AxisValue);
|
|
16
|
-
|
|
17
|
-
insetTop?: number;
|
|
18
|
-
insetBottom?: number;
|
|
19
|
-
insetLeft?: number;
|
|
20
|
-
insetRight?: number;
|
|
21
|
-
/**
|
|
22
|
-
* A stroke color for each row - a field key or a function of the row - drawn
|
|
23
|
-
* as it is, not mapped through a color scale. Wins over `styles.stroke`.
|
|
24
|
-
*/
|
|
25
|
-
stroke?: string | ((d: any) => string | undefined);
|
|
26
|
-
/** A stroke width for each row - a field key or a function of the row. Wins over `styles.strokeWidth`. */
|
|
27
|
-
strokeWidth?: string | ((d: any) => number);
|
|
28
|
-
/** A stroke opacity for each row - a field key or a function of the row - drawn as it is. Wins over `styles.strokeOpacity`. */
|
|
29
|
-
strokeOpacity?: string | ((d: any) => number);
|
|
30
|
-
styles?: StrokeStyle;
|
|
16
|
+
styles?: PerRow<StrokeStyle & InsetStyle>;
|
|
31
17
|
} & CommonMarkerConfigWithInterval;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { StrokeStyle } from '../../plots/styling';
|
|
1
|
+
import type { StrokeStyle, PerRow } from '../../plots/styling';
|
|
2
2
|
import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
|
|
3
3
|
/** A short tick per row along one axis (svelteplot's `TickX`/`TickY`). */
|
|
4
4
|
export type TickMarkerConfig = {
|
|
5
5
|
type: 'tick';
|
|
6
6
|
tickLength?: number | ((d: any) => number);
|
|
7
|
-
styles?: StrokeStyle
|
|
7
|
+
styles?: PerRow<StrokeStyle>;
|
|
8
8
|
} & CommonMarkerConfigWithColor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AreaStyle } from '../../plots/styling';
|
|
1
|
+
import type { AreaStyle, PerRow } from '../../plots/styling';
|
|
2
2
|
import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
|
|
3
3
|
/** One polygon per point, its Voronoi cell (svelteplot's `Voronoi`). */
|
|
4
4
|
export type VoronoiMarkerConfig = {
|
|
5
5
|
type: 'voronoi';
|
|
6
|
-
styles?: AreaStyle
|
|
6
|
+
styles?: PerRow<AreaStyle>;
|
|
7
7
|
} & CommonMarkerConfigWithColor;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { AreaStyle } from '../../plots/styling';
|
|
1
|
+
import type { AreaStyle, PerRow } from '../../plots/styling';
|
|
2
|
+
import type { CommonMarkerConfigWithLabel } from '../channels/commonMarkerConfigWithLabel';
|
|
2
3
|
import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
|
|
3
4
|
import type { CommonMarkerConfigWithInterval } from '../channels/commonMarkerConfigWithInterval';
|
|
4
5
|
/** A waffle chart bar: the value as a grid of unit squares (svelteplot's `WaffleX`/`WaffleY`). */
|
|
@@ -9,5 +10,5 @@ export type WaffleMarkerConfig = {
|
|
|
9
10
|
multiple?: number;
|
|
10
11
|
gap?: number;
|
|
11
12
|
round?: boolean;
|
|
12
|
-
styles?: AreaStyle
|
|
13
|
-
} & CommonMarkerConfigWithColor & CommonMarkerConfigWithInterval;
|
|
13
|
+
styles?: PerRow<AreaStyle>;
|
|
14
|
+
} & CommonMarkerConfigWithColor & CommonMarkerConfigWithInterval & CommonMarkerConfigWithLabel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DotStyle } from '../../plots/styling';
|
|
1
|
+
import type { DotStyle, PerRow } from '../../plots/styling';
|
|
2
2
|
import type { CommonMarkerConfigWithColor } from '../channels/commonMarkerConfigWithColor';
|
|
3
3
|
import type { CommonMarkerConfigWithRadius } from '../channels/commonMarkerConfigWithRadius';
|
|
4
4
|
import type { CommonMarkerConfigWithRowOffset } from '../channels/commonMarkerConfigWithRowOffset';
|
|
@@ -6,5 +6,5 @@ import type { CommonMarkerConfigWithSymbol } from '../channels/commonMarkerConfi
|
|
|
6
6
|
/** A point mark (svelteplot's `Dot`), usable on any plot kind. */
|
|
7
7
|
export type DotMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
8
8
|
type: 'dot';
|
|
9
|
-
styles?: DotStyle
|
|
9
|
+
styles?: PerRow<DotStyle>;
|
|
10
10
|
} & CommonMarkerConfigWithRadius & CommonMarkerConfigWithColor & CommonMarkerConfigWithSymbol>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FontStyle, StrokeStyle } from '../../plots/styling';
|
|
1
|
+
import type { FontStyle, StrokeStyle, PerRow } from '../../plots/styling';
|
|
2
2
|
import type { CommonMarkerConfig } from '../channels/commonMarkerConfig';
|
|
3
3
|
import type { CommonMarkerConfigWithRowOffset } from '../channels/commonMarkerConfigWithRowOffset';
|
|
4
4
|
import type { Margins } from '../../../layout/margins/Margins';
|
|
5
5
|
import type { BandSlice } from '../../layout/hover';
|
|
6
|
-
import type { TextAnchor } from '../../plots/constants';
|
|
6
|
+
import type { LabelAnchor, TextAnchor } from '../../plots/constants';
|
|
7
7
|
import type { NumberDisplay } from '../../layout/numbers';
|
|
8
8
|
/**
|
|
9
9
|
* Spreads labels that would overlap apart vertically, all reaching out to one
|
|
@@ -24,7 +24,35 @@ export type TextDeclutterConfig = {
|
|
|
24
24
|
/** The connectors' stroke. Unset opacity follows each label's own `fillOpacity`. */
|
|
25
25
|
connector?: StrokeStyle;
|
|
26
26
|
};
|
|
27
|
-
/**
|
|
27
|
+
/** Where a row's `x1`, `x2`, `y1` and `y2` are: a field of the rows, the symbol a transform keyed it by, or a function of the row. */
|
|
28
|
+
type FitChannel = string | symbol | ((d: any) => unknown);
|
|
29
|
+
/**
|
|
30
|
+
* What a label is fitted to: the rectangle its row spans, from `x1` to `x2` along the x axis and from `y1` to `y2`
|
|
31
|
+
* along the y - a tile of a `treemap` transform, say. A label too big for it is written smaller, down to
|
|
32
|
+
* `minFontSize`; at that size, broken into as many lines as the box holds and cut short with an ellipsis; and
|
|
33
|
+
* when almost none of it would show, as its `fallback`. A label with no room for even that is left out.
|
|
34
|
+
*/
|
|
35
|
+
export type TextFitConfig = {
|
|
36
|
+
/** The edges of a box of your own. A marker that draws a shape for each label gives its own, and these are left out. */
|
|
37
|
+
x1?: FitChannel;
|
|
38
|
+
x2?: FitChannel;
|
|
39
|
+
y1?: FitChannel;
|
|
40
|
+
y2?: FitChannel;
|
|
41
|
+
/** Pixels left free inside each edge of the box. Defaults to the configuration's `text.label.padding`, `4`. */
|
|
42
|
+
padding?: number;
|
|
43
|
+
/** The smallest size a label is written at, in px. Defaults to the configuration's `text.label.minFontSize`, `8`. */
|
|
44
|
+
minFontSize?: number;
|
|
45
|
+
/** The fewest letters worth writing when a text is cut short; under them the `fallback` is written. Defaults to the configuration's `text.label.minLetters`, `3`. */
|
|
46
|
+
minLetters?: number;
|
|
47
|
+
/** What to write when the text does not fit, cut short or not - a value alone, say; a number is written as the marker's `decimals` and the rest ask. */
|
|
48
|
+
fallback?: string | number | ((d: any) => string | number);
|
|
49
|
+
};
|
|
50
|
+
/** The text styles that can be a function of the row. */
|
|
51
|
+
type TextRowStyleKey = 'fill' | 'stroke' | 'strokeWidth' | 'fontWeight' | 'fontStyle';
|
|
52
|
+
/** The text styles that can be a function of the row. */
|
|
53
|
+
type TextRowStyle = Pick<FontStyle, TextRowStyleKey> & {
|
|
54
|
+
fillOpacity?: number;
|
|
55
|
+
};
|
|
28
56
|
export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
29
57
|
type: 'text';
|
|
30
58
|
/**
|
|
@@ -33,15 +61,17 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
|
33
61
|
* `decimals`, `prefix`, `suffix` and `signDisplay`, over the configuration's `numbers`.
|
|
34
62
|
*/
|
|
35
63
|
text: string | number | ((d: any) => string | number);
|
|
36
|
-
|
|
64
|
+
/**
|
|
65
|
+
* How the labels are drawn. `fill`, `fillOpacity`, `stroke`, `strokeWidth`, `fontWeight` and `fontStyle` can each be a function of the row;
|
|
66
|
+
* the rest place and measure the labels, so they are the same for all of them.
|
|
67
|
+
*/
|
|
68
|
+
styles?: PerRow<TextRowStyle> & Omit<FontStyle, TextRowStyleKey>;
|
|
37
69
|
/** Which side of its point the text sits on: a value, or a function of the row. Wins over `styles.textAnchor`. */
|
|
38
70
|
textAnchor?: TextAnchor | ((d: any) => TextAnchor);
|
|
39
|
-
/** Per-row fill, over `styles.fill`. */
|
|
40
|
-
fill?: string | ((d: any) => string | undefined);
|
|
41
|
-
/** Per-row fill opacity. */
|
|
42
|
-
fillOpacity?: number | ((d: any) => number | undefined);
|
|
43
71
|
/** Spreads overlapping labels apart - see {@link TextDeclutterConfig}. `true` takes every default. */
|
|
44
72
|
declutter?: boolean | TextDeclutterConfig;
|
|
73
|
+
/** Writes each label to fit its box - see {@link TextFitConfig}. `true` takes every default. */
|
|
74
|
+
fit?: boolean | TextFitConfig;
|
|
45
75
|
/**
|
|
46
76
|
* Flips each label to the other side of its point (or nudges a centred one
|
|
47
77
|
* back in) where its text would cross the plot's edge. `styles.textAnchor`/
|
|
@@ -51,16 +81,28 @@ export type TextMarkerConfig = CommonMarkerConfigWithRowOffset<{
|
|
|
51
81
|
/** The slice of its category band each label sits in (a grouped bar's series); it is drawn off the band's middle, whatever the band's width. */
|
|
52
82
|
bandSlice?: BandSlice;
|
|
53
83
|
/** Where, in the plot's frame, a label sits on an axis it sets no position for: `{ type: 'text', x: 5, frameAnchor: 'top' }` is at the frame's top edge. */
|
|
54
|
-
frameAnchor?:
|
|
84
|
+
frameAnchor?: LabelAnchor;
|
|
55
85
|
/** Grows the plot's margins, on every side the author left open, so the labels fit. */
|
|
56
86
|
fitMargins?: boolean;
|
|
57
87
|
/** Reports how far the rendered labels reach past the plot's content box, in pixels, on each side. */
|
|
58
|
-
|
|
59
|
-
/** Fired when the pointer enters a row's label. */
|
|
60
|
-
onPointerEnter?: (d: any) => void;
|
|
61
|
-
/** Fired when the pointer leaves a row's label. */
|
|
62
|
-
onPointerLeave?: (d: any) => void;
|
|
88
|
+
onoverflow?: (overflow: Margins) => void;
|
|
63
89
|
} & NumberDisplay & CommonMarkerConfig>;
|
|
90
|
+
/** A `text` marker as a shape's `label`: all of it but what the shape sets - its `type`, its rows and the label's position. */
|
|
91
|
+
export type TextLabelConfig = Omit<TextMarkerConfig, 'type' | 'data' | 'x' | 'y' | 'frameAnchor'> & {
|
|
92
|
+
/**
|
|
93
|
+
* Where in its shape the label sits: its `'middle'` (the default), against one of its edges (`'top'`, `'bottom'`,
|
|
94
|
+
* `'left'`, `'right'`) or in one of its corners (`'top-left'`...). The label's `dx` and `dy` move it from there.
|
|
95
|
+
*/
|
|
96
|
+
anchor?: LabelAnchor;
|
|
97
|
+
/**
|
|
98
|
+
* Puts a label anchored to an edge beyond that edge, outside the shape, instead of inside it. A label out there is not
|
|
99
|
+
* fitted to the shape, and with `fitMargins` the plot's margins grow to hold it.
|
|
100
|
+
*/
|
|
101
|
+
outside?: boolean;
|
|
102
|
+
/** Pixels between the label and the edge it is anchored to. Defaults to the configuration's `text.label.gap`, `4`. */
|
|
103
|
+
gap?: number;
|
|
104
|
+
};
|
|
105
|
+
export type { LabelAnchor };
|
|
64
106
|
/** Where one decluttered label goes - see `Declutter.buildLanes`. */
|
|
65
107
|
export type LabelLane = {
|
|
66
108
|
/** Vertical shift (px) clearing its neighbours and the content box's edges. */
|
|
@@ -3,8 +3,9 @@ import type { AxisValue } from '../../layout/mapping';
|
|
|
3
3
|
import type { StatisticConfig } from '../../layout/statistics';
|
|
4
4
|
import type { MarkerTransform } from '../../transforms';
|
|
5
5
|
import type { MarkLegend } from '../../layout/legend';
|
|
6
|
+
import type { CommonMarkerEvents } from './commonMarkerEvents';
|
|
6
7
|
/** Props every marker kind shares: rows, grouping, series scope, position, offset, statistics, transforms. */
|
|
7
|
-
export type CommonMarkerConfig = {
|
|
8
|
+
export type CommonMarkerConfig = CommonMarkerEvents & {
|
|
8
9
|
data?: Record<string, unknown>[];
|
|
9
10
|
grouping?: string | ((d: any) => unknown);
|
|
10
11
|
series?: string;
|
|
@@ -27,4 +28,10 @@ export type CommonMarkerConfig = {
|
|
|
27
28
|
clip?: boolean;
|
|
28
29
|
/** Names the marker on its plot's automatic legend - see {@link MarkLegend}. `false` keeps a decorative marker out of it, and out of how the plot's series look there. */
|
|
29
30
|
legend?: MarkLegend | false;
|
|
31
|
+
/**
|
|
32
|
+
* Links the marker to the plot's hover. `'trigger'` makes it a hit area: the pointer entering any of its shapes
|
|
33
|
+
* hovers its `data` rows. `'style'` has its shapes take the hover marker's `active` and `others` styles.
|
|
34
|
+
* `true` does both.
|
|
35
|
+
*/
|
|
36
|
+
hover?: boolean | 'trigger' | 'style';
|
|
30
37
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CommonMarkerConfig } from './commonMarkerConfig';
|
|
2
|
-
/** Common props plus the
|
|
2
|
+
/** Common props plus the opacity channel. */
|
|
3
3
|
export type CommonMarkerConfigWithArea = CommonMarkerConfig & {
|
|
4
|
-
fill?: (d: any) => string;
|
|
5
4
|
opacity?: string | ((d: any) => unknown);
|
|
6
5
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TextLabelConfig } from '../basic/text';
|
|
2
|
+
/** The markers that draw a shape per row, which can write a label in each one. */
|
|
3
|
+
export type CommonMarkerConfigWithLabel = {
|
|
4
|
+
/**
|
|
5
|
+
* A label for each shape, written by a `text` marker: every option of one but `type`, `data`, `x` and `y`,
|
|
6
|
+
* which the shape sets. The label is centred on its shape, and fitted to it unless `fit` is `false` - see
|
|
7
|
+
* {@link TextFitConfig}. It never takes the pointer from the shape under it.
|
|
8
|
+
*/
|
|
9
|
+
label?: TextLabelConfig;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The events a mark can be given a handler for, as svelteplot's own marks name them. */
|
|
2
|
+
export declare const MARK_EVENTS: readonly ["onclick", "ondblclick", "oncontextmenu", "onpointerdown", "onpointerup", "onpointerenter", "onpointerleave", "onpointermove", "onmouseenter", "onmouseleave"];
|
|
3
|
+
/** The name of an event a mark takes a handler for. */
|
|
4
|
+
export type MarkEventName = (typeof MARK_EVENTS)[number];
|
|
5
|
+
/**
|
|
6
|
+
* A handler of an event on one of a mark's shapes: the event, the row the shape draws and
|
|
7
|
+
* that row's index - as svelteplot's marks call it.
|
|
8
|
+
*/
|
|
9
|
+
export type MarkEventHandler = (event: Event, row: any, index: number) => void;
|
|
10
|
+
/**
|
|
11
|
+
* Handlers a marker passes on to the shapes svelteplot draws for it. svelteplot documents these props on every
|
|
12
|
+
* mark (`BaseMarkProps`), and every marker hands them on; svelteplot's code wires them up on some marks only
|
|
13
|
+
* today (`Rect`, `Bar`, `Cell`, `Area`, `Arrow`, `Dot`, `Trail`, `Vector`, `Geo`, `Line`, `Link`,
|
|
14
|
+
* `DelaunayLink` and `Voronoi`), so on the others they do nothing yet - they will, whenever svelteplot's code
|
|
15
|
+
* catches up.
|
|
16
|
+
*/
|
|
17
|
+
export type CommonMarkerEvents = Partial<Record<MarkEventName, MarkEventHandler>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** The events a mark can be given a handler for, as svelteplot's own marks name them. */
|
|
2
|
+
export const MARK_EVENTS = [
|
|
3
|
+
'onclick',
|
|
4
|
+
'ondblclick',
|
|
5
|
+
'oncontextmenu',
|
|
6
|
+
'onpointerdown',
|
|
7
|
+
'onpointerup',
|
|
8
|
+
'onpointerenter',
|
|
9
|
+
'onpointerleave',
|
|
10
|
+
'onpointermove',
|
|
11
|
+
'onmouseenter',
|
|
12
|
+
'onmouseleave'
|
|
13
|
+
];
|
|
@@ -22,6 +22,7 @@ export * from './axis/trail';
|
|
|
22
22
|
export * from './axis/waffle';
|
|
23
23
|
export * from './axis/violin';
|
|
24
24
|
export * from './axis/rule';
|
|
25
|
+
export * from './axis/band';
|
|
25
26
|
export * from './axis/hover';
|
|
26
27
|
export * from './axis/component';
|
|
27
28
|
export * from './axis/axisBasedMarkersConfig';
|
|
@@ -22,6 +22,7 @@ export * from './axis/trail';
|
|
|
22
22
|
export * from './axis/waffle';
|
|
23
23
|
export * from './axis/violin';
|
|
24
24
|
export * from './axis/rule';
|
|
25
|
+
export * from './axis/band';
|
|
25
26
|
export * from './axis/hover';
|
|
26
27
|
export * from './axis/component';
|
|
27
28
|
export * from './axis/axisBasedMarkersConfig';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
|
|
1
2
|
import type { Accessor } from '../../plots/data/common';
|
|
2
3
|
/**
|
|
3
4
|
* Marching-squares contours from a scalar field (svelteplot's `Contour`).
|
|
4
5
|
* Pass `data` with `x`/`y`/`value` to interpolate samples, or omit `data` and
|
|
5
6
|
* pass `value` as an `(x, y) => number` sampler.
|
|
6
7
|
*/
|
|
7
|
-
export type GeoContourMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
8
|
+
export type GeoContourMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
|
|
8
9
|
type: 'contour';
|
|
9
10
|
data?: TRow[];
|
|
10
11
|
x?: Accessor<TRow, number>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
|
|
1
2
|
import type { StrokeStyle } from '../../plots/styling';
|
|
2
3
|
/** Longitude and latitude gridlines (svelteplot's `Graticule`). */
|
|
3
|
-
export type GeoGraticuleMarkerConfig = {
|
|
4
|
+
export type GeoGraticuleMarkerConfig = CommonMarkerEvents & {
|
|
4
5
|
type: 'graticule';
|
|
5
6
|
step?: number;
|
|
6
7
|
stepX?: number;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
|
|
1
2
|
import type { Accessor } from '../../plots/data/common';
|
|
2
3
|
import type { StrokeStyle } from '../../plots/styling';
|
|
3
4
|
/** Lines between point pairs: `curve: 'auto'` traces great-circle arcs, `'linear'` joins their projected positions with a straight line. */
|
|
4
|
-
export type GeoLinkMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
5
|
+
export type GeoLinkMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
|
|
5
6
|
type: 'link';
|
|
6
7
|
data: TRow[];
|
|
7
8
|
x1: Accessor<TRow, number>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
|
|
1
2
|
import type { StrokeStyle } from '../../plots/styling';
|
|
2
3
|
/** The outer globe outline (svelteplot's `Sphere`), for orthographic-type projections. */
|
|
3
|
-
export type GeoSphereMarkerConfig = {
|
|
4
|
+
export type GeoSphereMarkerConfig = CommonMarkerEvents & {
|
|
4
5
|
type: 'sphere';
|
|
5
6
|
styles?: StrokeStyle & {
|
|
6
7
|
fill?: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import type { CommonMarkerEvents } from '../channels/commonMarkerEvents';
|
|
1
2
|
import type { Accessor } from '../../plots/data/common';
|
|
2
3
|
/** Arrows or spikes at points (svelteplot's `Vector`). */
|
|
3
|
-
export type GeoVectorMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
4
|
+
export type GeoVectorMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = CommonMarkerEvents & {
|
|
4
5
|
type: 'vector';
|
|
5
6
|
data: TRow[];
|
|
6
7
|
x: Accessor<TRow, number>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a plot kind works out for each of its processed rows beyond the shared context (its series, `x`, `y` and
|
|
3
|
+
* value): a tile's share, a bin's edges, a box's quartiles. Given the state once, it returns a function of a row,
|
|
4
|
+
* so whatever the rows share (a total, a box's summary) is worked out once. What it returns is laid over the
|
|
5
|
+
* shared context, so it can also replace the `value` a row shows.
|
|
6
|
+
*/
|
|
7
|
+
export type ContextStageOptions<TState, TEnv = unknown> = (state: TState, env: TEnv) => (row: never) => object | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,7 +15,7 @@ export type SegmentsStageOptions = {
|
|
|
15
15
|
* which channels the author set, what each axis is, which way the plot runs,
|
|
16
16
|
* whether `color` groups - the stage reads off the data itself.
|
|
17
17
|
*/
|
|
18
|
-
export type DataStageOptions<TState,
|
|
18
|
+
export type DataStageOptions<TState, TEnv> = {
|
|
19
19
|
/** How many axes the kind lays out as categories: 0 (line), 1 (bar) or 2 (heatmap). Defaults to 0. */
|
|
20
20
|
discreteAxes?: DiscreteAxesCount;
|
|
21
21
|
/** How the kind's own mark splits into visual segments. */
|
|
@@ -24,6 +24,11 @@ export type DataStageOptions<TState, TCtx> = {
|
|
|
24
24
|
orderSeries?: (series: Series<any>[], state: TState) => Series<any>[];
|
|
25
25
|
/** The order colors are assigned in. Defaults to the series' own order. */
|
|
26
26
|
colorOrder?: (series: Series<any>[]) => Series<any>[];
|
|
27
|
+
/**
|
|
28
|
+
* Whether the kind draws the levels of its `grouping` itself (a treemap's nesting): its series are then
|
|
29
|
+
* the outermost level's values, not every level's together.
|
|
30
|
+
*/
|
|
31
|
+
nested?: boolean;
|
|
27
32
|
/** The plot's own extra "data" output, once the shared one is in place. */
|
|
28
|
-
extend?: (state: TState,
|
|
33
|
+
extend?: (state: TState, env: TEnv) => TState;
|
|
29
34
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HoverDisplayPoint, HoverStrategy } from '../../layout/hover';
|
|
2
2
|
import type { HoverConfig, PointMatchingStrategy } from '../../plots/props';
|
|
3
|
+
import type { HoverLook } from '../../markers/common';
|
|
3
4
|
/** Where a row sits for hover matching and the hover controller: its `x` and `y`. */
|
|
4
5
|
export type HoverPosition = {
|
|
5
6
|
x: (row: never) => unknown;
|
|
@@ -11,7 +12,7 @@ export type HoverPosition = {
|
|
|
11
12
|
* row or a cell outside the legend's range can't), the rows themselves and
|
|
12
13
|
* their series' colors - the stage reads off the plot's own state.
|
|
13
14
|
*/
|
|
14
|
-
export type HoverStageOptions<TState,
|
|
15
|
+
export type HoverStageOptions<TState, TEnv = unknown> = {
|
|
15
16
|
/**
|
|
16
17
|
* The hover strategy, when the plot's axes don't say it: along the axis
|
|
17
18
|
* that isn't measured, or `'punctual'` with both axes holding categories.
|
|
@@ -27,14 +28,18 @@ export type HoverStageOptions<TState, TCtx = unknown> = {
|
|
|
27
28
|
position?: (state: TState) => HoverPosition;
|
|
28
29
|
/** The short label drawn next to a hovered row. Defaults to its value. */
|
|
29
30
|
label?: (state: TState) => (row: never) => string;
|
|
30
|
-
/** What a hovered row reads as, e.g. with derived fields added. Defaults to the processed row. */
|
|
31
|
-
row?: (state: TState) => (row: never) => unknown;
|
|
32
31
|
/** Fields a candidate carries besides its place, label and series color (a grouped bar's `dx`/`dy`). */
|
|
33
|
-
decorate?: (state: TState,
|
|
32
|
+
decorate?: (state: TState, env: TEnv) => (row: never) => Partial<Omit<HoverDisplayPoint, 'x' | 'y' | 'label'>>;
|
|
34
33
|
/** Invisible markers that drive the plot's hover themselves (a bar's band), given its resolved hover config. */
|
|
35
|
-
hitAreas?: (state: TState, hover: HoverConfig<any>,
|
|
34
|
+
hitAreas?: (state: TState, hover: HoverConfig<any>, env: TEnv) => {
|
|
36
35
|
type: string;
|
|
37
36
|
}[];
|
|
38
37
|
/** How a pointer event resolves to a candidate. Defaults to the nearest one. */
|
|
39
38
|
pointMatching?: PointMatchingStrategy;
|
|
39
|
+
/**
|
|
40
|
+
* The kind's own hover, which an author's `hover` marker is laid over - one look, or one for each strategy, as
|
|
41
|
+
* the strategy in force can change while the plot is shown (a composer's, a scrolly step's). Defaults to a
|
|
42
|
+
* crosshair along the axes the strategy matches along, and a dot and a label on each point.
|
|
43
|
+
*/
|
|
44
|
+
marker?: (state: TState, env: TEnv) => HoverLook | ((strategy: HoverStrategy) => HoverLook);
|
|
40
45
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export type { PlotPhase, PhaseStage } from './stage';
|
|
2
|
-
export type { AxisPlotState,
|
|
2
|
+
export type { AxisPlotState, AxisPlotEnv } from './state';
|
|
3
3
|
export type { AxisPlotKind, AxisPlotDefaults, SharedScalesOptions } from './kind';
|
|
4
4
|
export type { DataRunState } from './pipeline';
|
|
5
5
|
export type { DataStageOptions } from './data/phase';
|
|
6
6
|
export type { MappingStageOptions } from './mapping/phase';
|
|
7
7
|
export type { ProcessedRow, ProcessedChannel, ProcessedChannelName, ProcessedData, TransformsStageState, TransformsStageOptions } from './transforms/phase';
|
|
8
|
+
export type { ContextStageOptions } from './context/phase';
|
|
8
9
|
export type { StatisticsStageState, StatisticsStageOptions } from './statistics/phase';
|
|
9
10
|
export type { SharedAxisValues } from './sharedScales/phase';
|
|
10
11
|
export type { AxisFit, ScalesStageOptions } from './scales/phase';
|
|
@@ -4,6 +4,7 @@ import type { TransformsStageOptions, TransformsStageState } from './transforms/
|
|
|
4
4
|
import type { StatisticsStageOptions, StatisticsStageState } from './statistics/phase';
|
|
5
5
|
import type { ScalesStageOptions } from './scales/phase';
|
|
6
6
|
import type { HoverStageOptions } from './hover/phase';
|
|
7
|
+
import type { ContextStageOptions } from './context/phase';
|
|
7
8
|
import type { StylesStageOptions } from './styles/phase';
|
|
8
9
|
import type { MarkersStageOptions } from './markers/phase';
|
|
9
10
|
import type { AxisChannelName, ChannelName } from '../layout/mapping';
|
|
@@ -12,15 +13,17 @@ import type { AxisRole } from './data/axes';
|
|
|
12
13
|
* What one axis-based plot kind adds to the shared pipeline: options for each
|
|
13
14
|
* shared stage - its own marks and value labels among them.
|
|
14
15
|
*/
|
|
15
|
-
export type AxisPlotKind<TState extends TransformsStageState & StatisticsStageState,
|
|
16
|
-
data?: DataStageOptions<TState,
|
|
17
|
-
mapping?: MappingStageOptions<TState,
|
|
18
|
-
transforms?: TransformsStageOptions<TState,
|
|
16
|
+
export type AxisPlotKind<TState extends TransformsStageState & StatisticsStageState, TEnv> = {
|
|
17
|
+
data?: DataStageOptions<TState, TEnv>;
|
|
18
|
+
mapping?: MappingStageOptions<TState, TEnv>;
|
|
19
|
+
transforms?: TransformsStageOptions<TState, TEnv>;
|
|
20
|
+
/** What the kind works out for each of its rows, for everything that writes about a row to read - see `RowContext`. */
|
|
21
|
+
context?: ContextStageOptions<TState, TEnv>;
|
|
19
22
|
statistics?: StatisticsStageOptions<TState>;
|
|
20
|
-
scales?: ScalesStageOptions<TState,
|
|
23
|
+
scales?: ScalesStageOptions<TState, TEnv>;
|
|
21
24
|
styles?: StylesStageOptions<TState>;
|
|
22
|
-
markers: MarkersStageOptions<TState,
|
|
23
|
-
hover?: HoverStageOptions<TState,
|
|
25
|
+
markers: MarkersStageOptions<TState, TEnv>;
|
|
26
|
+
hover?: HoverStageOptions<TState, TEnv>;
|
|
24
27
|
/**
|
|
25
28
|
* How the slices of a plot (facet panels, timeline steps) share their
|
|
26
29
|
* domains. Every axis kind shares them - bands from its axes, zero from its
|
|
@@ -42,7 +45,7 @@ export type SharedScalesOptions = {
|
|
|
42
45
|
* runs with: the options for each pipeline phase (its hover among them),
|
|
43
46
|
* plus how its plot tweens a timeline unless the author says otherwise.
|
|
44
47
|
*/
|
|
45
|
-
export type AxisPlotDefaults<TState extends TransformsStageState & StatisticsStageState,
|
|
48
|
+
export type AxisPlotDefaults<TState extends TransformsStageState & StatisticsStageState, TEnv> = AxisPlotKind<TState, TEnv> & {
|
|
46
49
|
timeline?: {
|
|
47
50
|
/** Default for `timeline.filterMode`. */
|
|
48
51
|
filterMode?: 'exact' | 'upTo';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** What differs between plots in the shared "mapping" stage. */
|
|
2
|
-
export type MappingStageOptions<TState,
|
|
2
|
+
export type MappingStageOptions<TState, TEnv> = {
|
|
3
3
|
/** The plot's own extra "mapping" output, once every channel is resolved. */
|
|
4
|
-
extend?: (state: TState,
|
|
4
|
+
extend?: (state: TState, env: TEnv) => TState;
|
|
5
5
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { ValueLabels } from '../../../layout/styles/ValueLabels';
|
|
2
2
|
import type { AxisBasedMarkersConfig, TextMarkerConfig } from '../../markers/common';
|
|
3
3
|
/** What a plot kind adds to the shared "markers" stage. */
|
|
4
|
-
export type MarkersStageOptions<TState,
|
|
4
|
+
export type MarkersStageOptions<TState, TEnv> = {
|
|
5
5
|
/** The plot's own marks - its bars, lines, dots... - drawn under every other marker. */
|
|
6
|
-
marks: (state: TState,
|
|
6
|
+
marks: (state: TState, env: TEnv) => AxisBasedMarkersConfig[];
|
|
7
7
|
/**
|
|
8
8
|
* Its value labels, once they show: `text` markers drawn over everything.
|
|
9
9
|
* The stage adds what every label shares - see {@link ValueLabels.hooks}.
|
|
10
10
|
* Without it, the plot draws none.
|
|
11
11
|
*/
|
|
12
|
-
valueLabels?: (labels: ValueLabels, state: TState,
|
|
12
|
+
valueLabels?: (labels: ValueLabels, state: TState, env: TEnv) => TextMarkerConfig[];
|
|
13
13
|
};
|