@fundar/data-chart-telling 0.0.25 → 0.0.27
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/dist/charts/BaseChart.svelte +18 -10
- package/dist/charts/BaseChart.svelte.d.ts +4 -2
- package/dist/charts/bar/Chart.svelte +2 -0
- package/dist/charts/heatmap/Chart.svelte +5 -3
- package/dist/charts/heatmap/Chart.svelte.d.ts +1 -2
- package/dist/charts/line/Chart.svelte +2 -0
- package/dist/charts/pyramid/Chart.svelte +5 -3
- package/dist/charts/pyramid/Chart.svelte.d.ts +1 -2
- package/dist/charts/scatter/Chart.svelte +95 -0
- package/dist/charts/scatter/Chart.svelte.d.ts +28 -0
- package/dist/configuration/config.svelte.js +28 -0
- package/dist/configuration/themes/dark.js +4 -0
- package/dist/configuration/themes/index.d.ts +112 -0
- package/dist/index.d.ts +26 -16
- package/dist/index.js +11 -3
- package/dist/layout/coordinates/CoordinatesLayout.svelte +93 -0
- package/dist/layout/{plot/RuleLayout.svelte.d.ts → coordinates/CoordinatesLayout.svelte.d.ts} +13 -16
- package/dist/layout/coordinates/margins.d.ts +16 -0
- package/dist/layout/coordinates/margins.js +11 -0
- package/dist/{plots/geo → layout/coordinates}/projections/argentina.d.ts +1 -1
- package/dist/layout/{geo → coordinates}/resolveProjection.d.ts +1 -1
- package/dist/layout/coordinates/resolveProjection.js +24 -0
- package/dist/{plots/geo → layout/coordinates}/zoom.svelte.d.ts +1 -1
- package/dist/layout/facet/FacetIndicator.svelte +31 -0
- package/dist/layout/facet/FacetIndicator.svelte.d.ts +8 -0
- package/dist/layout/facet/FacetLayout.svelte +249 -24
- package/dist/layout/facet/FacetLayout.svelte.d.ts +7 -1
- package/dist/layout/geometry/GeometryLayout.svelte +231 -0
- package/dist/layout/geometry/GeometryLayout.svelte.d.ts +62 -0
- package/dist/layout/legend/ContinuousSection.svelte +1 -1
- package/dist/layout/legend/ContinuousSection.svelte.d.ts +1 -1
- package/dist/layout/legend/DiscreteSection.svelte +1 -1
- package/dist/layout/legend/DiscreteSection.svelte.d.ts +1 -1
- package/dist/layout/legend/LegendLayout.svelte +1 -1
- package/dist/layout/legend/LegendLayout.svelte.d.ts +1 -1
- package/dist/layout/legend/interaction.svelte.d.ts +9 -1
- package/dist/layout/legend/interaction.svelte.js +9 -1
- package/dist/layout/plot/BasePlotLayout.svelte +142 -155
- package/dist/layout/plot/BasePlotLayout.svelte.d.ts +61 -51
- package/dist/layout/plot/margins.d.ts +0 -16
- package/dist/layout/plot/margins.js +0 -11
- package/dist/layout/{plot/AxisLayout.svelte → scales/ScalesLayout.svelte} +23 -16
- package/dist/layout/{plot/AxisLayout.svelte.d.ts → scales/ScalesLayout.svelte.d.ts} +4 -5
- package/dist/layout/scales/buildScale.d.ts +8 -0
- package/dist/layout/scales/buildScale.js +43 -0
- package/dist/layout/styles/StylesLayout.svelte +75 -0
- package/dist/layout/styles/StylesLayout.svelte.d.ts +15 -0
- package/dist/{plots/geo → layout/styles}/TileLayer.svelte +2 -2
- package/dist/{plots/geo → layout/styles}/TileLayer.svelte.d.ts +1 -1
- package/dist/layout/timeline/Timeline.svelte +1 -1
- package/dist/layout/timeline/Timeline.svelte.d.ts +1 -1
- package/dist/layout/timeline/TimelineLayout.svelte +1 -1
- package/dist/layout/timeline/TimelineLayout.svelte.d.ts +1 -1
- package/dist/layout/tooltip/Tooltip.svelte +16 -20
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +5 -0
- package/dist/layout/tooltip/TooltipLayout.svelte +7 -1
- package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +4 -0
- package/dist/layout/tooltip/controller.svelte.d.ts +4 -5
- package/dist/layout/tooltip/controller.svelte.js +42 -16
- package/dist/layout/tooltip/resolveTooltipPlacement.d.ts +24 -0
- package/dist/layout/tooltip/resolveTooltipPlacement.js +49 -0
- package/dist/layout/tooltip/utils.d.ts +27 -19
- package/dist/layout/tooltip/utils.js +16 -15
- package/dist/markers/BarMarker.svelte +92 -0
- package/dist/markers/BarMarker.svelte.d.ts +7 -0
- package/dist/markers/CellMarker.svelte +21 -0
- package/dist/markers/CellMarker.svelte.d.ts +7 -0
- package/dist/markers/ContourMarker.svelte +28 -0
- package/dist/markers/ContourMarker.svelte.d.ts +7 -0
- package/dist/markers/DeltaMarker.svelte +32 -39
- package/dist/markers/DeltaMarker.svelte.d.ts +4 -5
- package/dist/markers/DotMarker.svelte +35 -6
- package/dist/markers/DotMarker.svelte.d.ts +11 -2
- package/dist/markers/GeoFeaturesMarker.svelte +19 -0
- package/dist/markers/GeoFeaturesMarker.svelte.d.ts +7 -0
- package/dist/markers/GeoHoverMarker.svelte +25 -0
- package/dist/markers/GeoHoverMarker.svelte.d.ts +9 -0
- package/dist/markers/GraticuleMarker.svelte +18 -0
- package/dist/markers/GraticuleMarker.svelte.d.ts +7 -0
- package/dist/markers/HoverMarker.svelte +34 -35
- package/dist/markers/HoverMarker.svelte.d.ts +15 -9
- package/dist/markers/LineMarker.svelte +19 -0
- package/dist/markers/LineMarker.svelte.d.ts +7 -0
- package/dist/markers/LinkMarker.svelte +42 -0
- package/dist/markers/LinkMarker.svelte.d.ts +7 -0
- package/dist/markers/RuleMarker.svelte +24 -0
- package/dist/markers/RuleMarker.svelte.d.ts +10 -0
- package/dist/markers/SphereMarker.svelte +15 -0
- package/dist/markers/SphereMarker.svelte.d.ts +7 -0
- package/dist/markers/TextMarker.svelte +1 -1
- package/dist/markers/TextMarker.svelte.d.ts +1 -1
- package/dist/markers/VectorMarker.svelte +20 -0
- package/dist/markers/VectorMarker.svelte.d.ts +7 -0
- package/dist/markers/inset/InsetMarker.svelte +38 -45
- package/dist/markers/inset/InsetMarker.svelte.d.ts +6 -2
- package/dist/plots/bar/Plot.svelte +96 -87
- package/dist/plots/bar/Plot.svelte.d.ts +4 -5
- package/dist/plots/bar/ValueLabels.svelte +70 -24
- package/dist/plots/bar/ValueLabels.svelte.d.ts +11 -2
- package/dist/plots/bar/buildBarMarkers.d.ts +30 -0
- package/dist/plots/bar/buildBarMarkers.js +100 -0
- package/dist/plots/bar/layout.svelte.d.ts +1 -2
- package/dist/plots/bar/layout.svelte.js +1 -1
- package/dist/plots/geo/Plot.svelte +113 -387
- package/dist/plots/geo/Plot.svelte.d.ts +5 -4
- package/dist/plots/geo/buildGeoMarkers.d.ts +33 -0
- package/dist/plots/geo/buildGeoMarkers.js +47 -0
- package/dist/plots/heatmap/Plot.svelte +27 -52
- package/dist/plots/heatmap/Plot.svelte.d.ts +4 -5
- package/dist/plots/heatmap/ValueLabels.svelte +5 -5
- package/dist/plots/heatmap/ValueLabels.svelte.d.ts +3 -3
- package/dist/plots/heatmap/buildCellMarkers.d.ts +21 -0
- package/dist/plots/heatmap/buildCellMarkers.js +25 -0
- package/dist/plots/line/Plot.svelte +73 -141
- package/dist/plots/line/Plot.svelte.d.ts +4 -4
- package/dist/plots/line/ValueLabels.svelte +84 -85
- package/dist/plots/line/ValueLabels.svelte.d.ts +10 -1
- package/dist/plots/line/buildLineMarkers.d.ts +15 -0
- package/dist/plots/line/buildLineMarkers.js +57 -0
- package/dist/plots/pyramid/Plot.svelte +80 -121
- package/dist/plots/pyramid/Plot.svelte.d.ts +4 -5
- package/dist/plots/pyramid/ValueLabels.svelte +71 -25
- package/dist/plots/pyramid/ValueLabels.svelte.d.ts +11 -2
- package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +19 -0
- package/dist/plots/pyramid/buildPyramidBarMarkers.js +32 -0
- package/dist/plots/scatter/Plot.svelte +242 -0
- package/dist/{layout/plot/GridLayout.svelte.d.ts → plots/scatter/Plot.svelte.d.ts} +9 -7
- package/dist/plots/scatter/ValueLabels.svelte +149 -0
- package/dist/plots/{bar/BarSegments.svelte.d.ts → scatter/ValueLabels.svelte.d.ts} +17 -15
- package/dist/plots/scatter/buildScatterMarkers.d.ts +11 -0
- package/dist/plots/scatter/buildScatterMarkers.js +37 -0
- package/dist/plots/scatter/resolveRadiusPaddedDomain.d.ts +10 -0
- package/dist/plots/scatter/resolveRadiusPaddedDomain.js +23 -0
- package/dist/plots/utils/declutter.d.ts +55 -37
- package/dist/plots/utils/declutter.js +79 -64
- package/dist/plots/utils/geoAccessors.d.ts +1 -1
- package/dist/plots/utils/geoAccessors.js +1 -1
- package/dist/plots/utils/labelOverflow.svelte.d.ts +51 -0
- package/dist/plots/utils/labelOverflow.svelte.js +116 -0
- package/dist/plots/utils/legendDisabled.d.ts +1 -1
- package/dist/plots/utils/segments.d.ts +17 -10
- package/dist/plots/utils/segments.js +26 -16
- package/dist/types/charts/common.d.ts +3 -50
- package/dist/types/charts/props.d.ts +8 -8
- package/dist/types/configuration/styling.d.ts +26 -2
- package/dist/types/{plots/scales/geo.d.ts → layout/coordinates.d.ts} +33 -1
- package/dist/types/layout/facet.d.ts +41 -0
- package/dist/types/layout/geometry.d.ts +17 -0
- package/dist/types/layout/legend.d.ts +65 -1
- package/dist/types/{plots/axis.d.ts → layout/scales.d.ts} +11 -0
- package/dist/types/layout/styles.d.ts +115 -0
- package/dist/types/layout/timeline.d.ts +32 -0
- package/dist/types/layout/tooltip.d.ts +20 -1
- package/dist/types/markers/all.d.ts +11 -0
- package/dist/types/markers/all.js +1 -0
- package/dist/types/markers/base.d.ts +45 -0
- package/dist/types/markers/base.js +1 -0
- package/dist/types/markers/common.d.ts +64 -16
- package/dist/types/markers/geo.d.ts +75 -100
- package/dist/types/markers/line.d.ts +34 -0
- package/dist/types/markers/line.js +1 -0
- package/dist/types/markers/props.d.ts +1 -1
- package/dist/types/plots/data/common.d.ts +1 -1
- package/dist/types/plots/data/scatter.d.ts +13 -0
- package/dist/types/plots/data/scatter.js +1 -0
- package/dist/types/plots/props.d.ts +46 -74
- package/dist/types/plots/segments/common.d.ts +6 -12
- package/dist/types/plots/segments/config.d.ts +1 -1
- package/dist/types/plots/styling.d.ts +10 -0
- package/dist/{plots/utils → utils}/delta.d.ts +2 -2
- package/dist/{plots/utils → utils}/delta.js +1 -1
- package/dist/utils/edgeAwareAnchor.d.ts +37 -0
- package/dist/utils/edgeAwareAnchor.js +65 -0
- package/dist/utils/grouping.d.ts +1 -1
- package/dist/utils/interpolate.d.ts +2 -2
- package/package.json +3 -1
- package/dist/layout/geo/GeoLayout.svelte +0 -51
- package/dist/layout/geo/GeoLayout.svelte.d.ts +0 -24
- package/dist/layout/geo/resolveProjection.js +0 -48
- package/dist/layout/plot/GridLayout.svelte +0 -30
- package/dist/layout/plot/RuleLayout.svelte +0 -111
- package/dist/plots/bar/BarSegments.svelte +0 -69
- package/dist/types/charts/legend.d.ts +0 -60
- package/dist/types/plots/delta.d.ts +0 -19
- package/dist/types/plots/styles/common.d.ts +0 -52
- package/dist/types/plots/styles/geo.d.ts +0 -42
- /package/dist/{plots/geo → layout/coordinates}/projections/argentina.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/projections/fit.d.ts +0 -0
- /package/dist/{plots/geo → layout/coordinates}/projections/fit.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/rotate.svelte.d.ts +0 -0
- /package/dist/{plots/geo → layout/coordinates}/rotate.svelte.js +0 -0
- /package/dist/{plots/geo → layout/coordinates}/zoom.svelte.js +0 -0
- /package/dist/types/{charts/legend.js → layout/coordinates.js} +0 -0
- /package/dist/types/{plots/axis.js → layout/facet.js} +0 -0
- /package/dist/types/{plots/delta.js → layout/geometry.js} +0 -0
- /package/dist/types/{plots/scales/geo.js → layout/scales.js} +0 -0
- /package/dist/types/{plots/styles/common.js → layout/styles.js} +0 -0
- /package/dist/types/{plots/styles/geo.js → layout/timeline.js} +0 -0
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import type { AxisValue } from '../
|
|
2
|
-
import type {
|
|
1
|
+
import type { AxisValue } from '../layout/scales';
|
|
2
|
+
import type { FontStyle, StrokeStyle, DotStyle, AreaStyle } from '../plots/styling';
|
|
3
3
|
import type { HoverStrategy, HoverDisplayPoint } from '../layout/tooltip';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
type: 'ruleY';
|
|
11
|
-
y: AxisValue;
|
|
4
|
+
import type { BaseMarkersConfig } from './base';
|
|
5
|
+
export type { DotMarkerConfig } from './base';
|
|
6
|
+
export type RuleMarkerConfig = {
|
|
7
|
+
type: 'rule';
|
|
8
|
+
axis: 'x' | 'y';
|
|
9
|
+
value: AxisValue;
|
|
12
10
|
style?: StrokeStyle;
|
|
13
11
|
};
|
|
14
12
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* one series follows the same targeting fields as {@link CustomComponentMarker}.
|
|
13
|
+
* In-SVG hover highlight (crosshair + dot + label). Omitting `series`
|
|
14
|
+
* applies it to all series; scoping follows the same fields as
|
|
15
|
+
* {@link CustomComponentMarkerConfig}.
|
|
19
16
|
*/
|
|
20
17
|
export type HoverMarkerConfig = {
|
|
21
18
|
type: 'hover';
|
|
@@ -31,7 +28,51 @@ export type HoverMarkerConfig = {
|
|
|
31
28
|
dotStyle?: DotStyle;
|
|
32
29
|
fontStyle?: FontStyle;
|
|
33
30
|
};
|
|
34
|
-
|
|
31
|
+
/** A single line-segment stroke. Endpoint dots are a separate `'dot'` marker rather than a field here. */
|
|
32
|
+
export type LineMarkerConfig = {
|
|
33
|
+
type: 'line';
|
|
34
|
+
data: Record<string, unknown>[];
|
|
35
|
+
x: (d: any) => AxisValue;
|
|
36
|
+
y: (d: any) => AxisValue;
|
|
37
|
+
style?: StrokeStyle;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* A single bar mark. `role: 'segment'` is a visible bar
|
|
41
|
+
* (`x`/`y`/`x1`/`x2`/`y1`/`y2` map to svelteplot's `<BarX>`/`<BarY>` per
|
|
42
|
+
* `isHorizontal`); `role: 'hitArea'` is an invisible per-category hit region
|
|
43
|
+
* for hover, resolved against the live scale at render time.
|
|
44
|
+
*/
|
|
45
|
+
export type BarMarkerConfig = {
|
|
46
|
+
type: 'bar';
|
|
47
|
+
role: 'segment' | 'hitArea';
|
|
48
|
+
isHorizontal: boolean;
|
|
49
|
+
data: Record<string, unknown>[];
|
|
50
|
+
x?: (d: any) => AxisValue;
|
|
51
|
+
y?: (d: any) => AxisValue;
|
|
52
|
+
x1?: number | ((d: any) => number);
|
|
53
|
+
x2?: number | ((d: any) => number);
|
|
54
|
+
y1?: number | ((d: any) => number);
|
|
55
|
+
y2?: number | ((d: any) => number);
|
|
56
|
+
insetTop?: number;
|
|
57
|
+
insetBottom?: number;
|
|
58
|
+
insetLeft?: number;
|
|
59
|
+
insetRight?: number;
|
|
60
|
+
style?: AreaStyle;
|
|
61
|
+
category?: AxisValue;
|
|
62
|
+
onpointerenter?: () => void;
|
|
63
|
+
onpointerleave?: () => void;
|
|
64
|
+
};
|
|
65
|
+
/** A single heatmap cell mark. `fill` stays a per-row accessor; the rest of the style is constant per call. */
|
|
66
|
+
export type CellMarkerConfig = {
|
|
67
|
+
type: 'cell';
|
|
68
|
+
data: Record<string, unknown>[];
|
|
69
|
+
x: (d: any) => AxisValue;
|
|
70
|
+
y: (d: any) => AxisValue;
|
|
71
|
+
fill: (d: any) => string;
|
|
72
|
+
style?: AreaStyle;
|
|
73
|
+
inset?: number;
|
|
74
|
+
};
|
|
75
|
+
export type CustomComponentMarkerConfig = {
|
|
35
76
|
type: 'component';
|
|
36
77
|
series?: string;
|
|
37
78
|
component: any;
|
|
@@ -39,4 +80,11 @@ export type CustomComponentMarker = {
|
|
|
39
80
|
data?: any[];
|
|
40
81
|
scope?: 'series' | 'segment';
|
|
41
82
|
};
|
|
42
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Every marker kind any axis-based plot can render: {@link BaseMarkersConfig}
|
|
85
|
+
* plus every axis-based-only kind. `BarPlot`/`HeatmapPlot`/`PyramidPlot` use
|
|
86
|
+
* this directly as their `markers` prop type; `LinePlot`'s own
|
|
87
|
+
* `LineMarkersConfig` (`types/markers/line.ts`) unions it with the line-only
|
|
88
|
+
* `delta` annotation instead.
|
|
89
|
+
*/
|
|
90
|
+
export type AxisBasedMarkersConfig = BaseMarkersConfig | RuleMarkerConfig | HoverMarkerConfig | LineMarkerConfig | BarMarkerConfig | CellMarkerConfig | CustomComponentMarkerConfig;
|
|
@@ -1,65 +1,36 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { Accessor } from '../plots/data/common';
|
|
3
|
-
import type {
|
|
4
|
-
import type { DotStyle, FontStyle, StrokeStyle } from '../plots/styling';
|
|
5
|
-
import type { HoverDisplayPoint } from '../layout/tooltip';
|
|
3
|
+
import type { AreaStyle, StrokeStyle } from '../plots/styling';
|
|
6
4
|
import type { GeoFeature, GeoJsonInput } from '../plots/data/geo';
|
|
7
5
|
import type { GeoSegmentStyle } from '../plots/segments/common';
|
|
8
|
-
import type { GeoProjectionName } from '../
|
|
6
|
+
import type { GeoProjectionName } from '../layout/coordinates';
|
|
7
|
+
import type { TooltipAnchorX, TooltipAnchorY } from '../layout/tooltip';
|
|
8
|
+
import type { BaseMarkersConfig } from './base';
|
|
9
9
|
/** Longitude/latitude gridlines — svelteplot's `Graticule`. */
|
|
10
|
-
export type
|
|
10
|
+
export type GeoGraticuleMarkerConfig = {
|
|
11
11
|
type: 'graticule';
|
|
12
12
|
step?: number;
|
|
13
13
|
stepX?: number;
|
|
14
14
|
stepY?: number;
|
|
15
15
|
style?: StrokeStyle;
|
|
16
|
-
/**
|
|
17
|
-
* Renders behind the base map's own fill/stroke instead of on top of it
|
|
18
|
-
* (markers otherwise always draw over the base map, regardless of their
|
|
19
|
-
* position in the `markers` array). Useful for a graticule meant to read
|
|
20
|
-
* as a faint background reference frame rather than an overlay obscuring
|
|
21
|
-
* the geometry above it.
|
|
22
|
-
*/
|
|
16
|
+
/** Renders behind the base map's own fill/stroke instead of on top of it (markers otherwise draw over the base map). */
|
|
23
17
|
behind?: boolean;
|
|
24
18
|
};
|
|
25
19
|
/** The outer globe outline (for orthographic-type projections) — svelteplot's `Sphere`. */
|
|
26
|
-
export type
|
|
20
|
+
export type GeoSphereMarkerConfig = {
|
|
27
21
|
type: 'sphere';
|
|
28
22
|
style?: StrokeStyle & {
|
|
29
23
|
fill?: string;
|
|
30
24
|
fillOpacity?: number;
|
|
31
25
|
};
|
|
32
|
-
/**
|
|
33
|
-
* Renders behind the base map's own fill/stroke instead of on top of it —
|
|
34
|
-
* needed any time `style.fill` is set, since a filled sphere otherwise
|
|
35
|
-
* covers every feature drawn under it (the sphere is the full globe
|
|
36
|
-
* outline, larger than any geometry on it). Off by default so an
|
|
37
|
-
* unfilled/stroke-only sphere (the common case, tracing just the globe's
|
|
38
|
-
* edge) keeps drawing on top where it stays visible over ocean fills.
|
|
39
|
-
*/
|
|
26
|
+
/** Renders behind the base map's own fill/stroke instead of on top of it — needed when `style.fill` is set. */
|
|
40
27
|
behind?: boolean;
|
|
41
28
|
};
|
|
42
|
-
/**
|
|
43
|
-
* Point markers by longitude/latitude, sized/colored by value —
|
|
44
|
-
* svelteplot's `Dot`. https://svelteplot.dev/examples/dot/weather
|
|
45
|
-
*/
|
|
46
|
-
export type GeoDotMarker<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
47
|
-
type: 'dot';
|
|
48
|
-
data: TRow[];
|
|
49
|
-
x: Accessor<TRow, number>;
|
|
50
|
-
y: Accessor<TRow, number>;
|
|
51
|
-
r?: Accessor<TRow, number> | number;
|
|
52
|
-
/** Continuous value used to color each dot through a ramp — see `style.colors`. */
|
|
53
|
-
value?: Accessor<TRow, number>;
|
|
54
|
-
style?: DotStyle & {
|
|
55
|
-
colors?: ColorsStyle;
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
29
|
/**
|
|
59
30
|
* Arrows/spikes at points — svelteplot's `Vector`.
|
|
60
31
|
* https://svelteplot.dev/examples/vector/shift-map
|
|
61
32
|
*/
|
|
62
|
-
export type
|
|
33
|
+
export type GeoVectorMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
63
34
|
type: 'vector';
|
|
64
35
|
data: TRow[];
|
|
65
36
|
x: Accessor<TRow, number>;
|
|
@@ -79,7 +50,7 @@ export type GeoVectorMarker<TRow extends Record<string, unknown> = Record<string
|
|
|
79
50
|
* `curve: 'auto'` traces a great-circle arc on a geographic projection).
|
|
80
51
|
* https://svelteplot.dev/examples/link/spherical-link
|
|
81
52
|
*/
|
|
82
|
-
export type
|
|
53
|
+
export type GeoLinkMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
83
54
|
type: 'link';
|
|
84
55
|
data: TRow[];
|
|
85
56
|
x1: Accessor<TRow, number>;
|
|
@@ -97,7 +68,7 @@ export type GeoLinkMarker<TRow extends Record<string, unknown> = Record<string,
|
|
|
97
68
|
* spatially interpolate a scatter of samples, or omit `data` and pass
|
|
98
69
|
* `value` as an `(x, y) => number` sampling function.
|
|
99
70
|
*/
|
|
100
|
-
export type
|
|
71
|
+
export type GeoContourMarkerConfig<TRow extends Record<string, unknown> = Record<string, unknown>> = {
|
|
101
72
|
type: 'contour';
|
|
102
73
|
data?: TRow[];
|
|
103
74
|
x?: Accessor<TRow, number>;
|
|
@@ -113,65 +84,48 @@ export type GeoContourMarker<TRow extends Record<string, unknown> = Record<strin
|
|
|
113
84
|
fillOpacity?: number;
|
|
114
85
|
strokeOpacity?: number;
|
|
115
86
|
};
|
|
116
|
-
/**
|
|
117
|
-
* Masks the contour to just the base map's landmass (`'land'`) or just
|
|
118
|
-
* its water (`'ocean'`) — e.g. a temperature contour that should only
|
|
119
|
-
* shade land, leaving the ocean bare (or the reverse).
|
|
120
|
-
*/
|
|
87
|
+
/** Masks the contour to just the base map's landmass (`'land'`) or water (`'ocean'`). */
|
|
121
88
|
clip?: 'land' | 'ocean';
|
|
122
|
-
/**
|
|
123
|
-
* Renders behind the base map's own fill/stroke instead of on top of it —
|
|
124
|
-
* lets a filled contour read as background shading with the base map's
|
|
125
|
-
* feature borders drawn crisply over it, rather than the contour
|
|
126
|
-
* obscuring them.
|
|
127
|
-
*/
|
|
89
|
+
/** Renders behind the base map's own fill/stroke instead of on top of it. */
|
|
128
90
|
behind?: boolean;
|
|
129
91
|
};
|
|
130
92
|
/**
|
|
131
|
-
* The in-map hover highlight
|
|
132
|
-
*
|
|
133
|
-
*
|
|
93
|
+
* The in-map hover highlight — restyles the hovered feature's own shape.
|
|
94
|
+
* Its own `type: 'geo-hover'` tag (rather than the axis-based `'hover'`)
|
|
95
|
+
* keeps it unambiguous: both configs are all-optional, so an author writing
|
|
96
|
+
* `{ type: 'hover' }` for a `GeoPlot` would otherwise be structurally
|
|
97
|
+
* indistinguishable from the axis-based marker.
|
|
134
98
|
*/
|
|
135
99
|
export type GeoHoverMarkerConfig = {
|
|
136
|
-
type: 'hover';
|
|
137
|
-
|
|
138
|
-
showLabels?: boolean;
|
|
139
|
-
format?: (point: HoverDisplayPoint) => string;
|
|
140
|
-
dotStyle?: DotStyle;
|
|
141
|
-
fontStyle?: FontStyle;
|
|
100
|
+
type: 'geo-hover';
|
|
101
|
+
style?: AreaStyle;
|
|
142
102
|
};
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
103
|
+
/**
|
|
104
|
+
* Mounts an arbitrary Svelte component as a mark — the geo analog of
|
|
105
|
+
* `CustomComponentMarkerConfig` (no `series` concept here). Its own
|
|
106
|
+
* `type: 'geo-component'` tag (rather than the axis-based `'component'`)
|
|
107
|
+
* keeps the two unambiguous at `GeometryLayout`'s dispatch — same reasoning
|
|
108
|
+
* as `GeoHoverMarkerConfig`'s `'geo-hover'` tag.
|
|
109
|
+
*/
|
|
110
|
+
export type GeoCustomComponentMarkerConfig = {
|
|
111
|
+
type: 'geo-component';
|
|
146
112
|
component: any;
|
|
147
113
|
props?: Record<string, unknown>;
|
|
148
114
|
data?: any[];
|
|
149
115
|
};
|
|
150
116
|
/**
|
|
151
|
-
* Which edge of the plot frame an inset is anchored to, and where along
|
|
152
|
-
*
|
|
153
|
-
* `'
|
|
154
|
-
*
|
|
155
|
-
* (e.g. `'right-middle'` centers the inset vertically along the right edge).
|
|
117
|
+
* Which edge of the plot frame an inset is anchored to, and where along it
|
|
118
|
+
* — a `side-anchor` pair in either word order (`'bottom-right'` ==
|
|
119
|
+
* `'right-bottom'`). `side` is `top`/`bottom`/`left`/`right`; `anchor` is
|
|
120
|
+
* the same four plus `middle`.
|
|
156
121
|
*/
|
|
157
122
|
export type GeoInsetLocation = 'top-left' | 'left-top' | 'top-middle' | 'middle-top' | 'top-right' | 'right-top' | 'middle-left' | 'left-middle' | 'middle-middle' | 'middle-right' | 'right-middle' | 'bottom-left' | 'left-bottom' | 'bottom-middle' | 'middle-bottom' | 'bottom-right' | 'right-bottom';
|
|
158
|
-
/**
|
|
159
|
-
* Named projections an `inset` marker can use for its own independently-fit
|
|
160
|
-
* mini-map — everything `GeoProjectionName` offers except `'identity'`/
|
|
161
|
-
* `'reflect-y'`, which have no scale/translate of their own to fit (see
|
|
162
|
-
* `GeoProjectionConfig.domain`'s doc comment) and so can't auto-fit the way
|
|
163
|
-
* every inset needs to.
|
|
164
|
-
*/
|
|
123
|
+
/** Named projections an `inset` marker can use, minus `'identity'`/`'reflect-y'`, which have no scale/translate to auto-fit. */
|
|
165
124
|
export type GeoInsetProjectionName = Exclude<GeoProjectionName, 'identity' | 'reflect-y'>;
|
|
166
125
|
/**
|
|
167
126
|
* Independent hover tooltip scoped to just one `inset` marker's own rendered
|
|
168
|
-
* features
|
|
169
|
-
* local mini-projection
|
|
170
|
-
* top-level `tooltip`, which only ever matches the main map's own features
|
|
171
|
-
* (an inset draws in its own coordinate space, at its own scale, so the
|
|
172
|
-
* main map's hover has no way to reach it). No `facetId`/`sync`/`strategy`
|
|
173
|
-
* here, unlike the top-level `TooltipConfig` — an inset never broadcasts
|
|
174
|
-
* its hover to other facets and always matches punctually.
|
|
127
|
+
* features, matched by nearest projected centroid within the inset's own
|
|
128
|
+
* local mini-projection. Decoupled from the plot's own top-level `tooltip`.
|
|
175
129
|
*/
|
|
176
130
|
export type GeoInsetTooltipConfig = {
|
|
177
131
|
/** Tooltip text for the nearest feature (by centroid) to the cursor, within this inset. */
|
|
@@ -180,6 +134,13 @@ export type GeoInsetTooltipConfig = {
|
|
|
180
134
|
content?: Snippet<[{
|
|
181
135
|
rows: GeoFeature<Record<string, unknown>>[];
|
|
182
136
|
}]>;
|
|
137
|
+
/**
|
|
138
|
+
* Preferred anchor for this inset's own tooltip. Unset falls back to the
|
|
139
|
+
* plot's own top-level `tooltip.anchorX`/`anchorY` when explicitly set
|
|
140
|
+
* there, then to the system default — see {@link TooltipAnchorX}.
|
|
141
|
+
*/
|
|
142
|
+
anchorX?: TooltipAnchorX;
|
|
143
|
+
anchorY?: TooltipAnchorY;
|
|
183
144
|
};
|
|
184
145
|
/** Projection config for an `inset` marker — like `GeoProjectionConfig`, minus `inset`/`domain` (insets always auto-fit to their own content) and custom factories (which can't guarantee `fitExtent`). */
|
|
185
146
|
export type GeoInsetProjectionConfig = GeoInsetProjectionName | {
|
|
@@ -191,29 +152,21 @@ export type GeoInsetProjectionConfig = GeoInsetProjectionName | {
|
|
|
191
152
|
};
|
|
192
153
|
/**
|
|
193
154
|
* A small, independently-projected map panel anchored to a corner/edge of
|
|
194
|
-
* the plot
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* What it shows is either a filtered subset of the plot's own `data` (via
|
|
199
|
-
* `features`, matched the same way `segments` keys are) or a wholly
|
|
200
|
-
* separate dataset (`data`, which takes precedence over `features` when
|
|
201
|
-
* both are given) — the inset's own mini-projection is fit to whichever one
|
|
202
|
-
* applies, independently of the main map's projection/zoom.
|
|
155
|
+
* the plot, showing a region at a different scale than the main map. Shows
|
|
156
|
+
* either a filtered subset of the plot's own `data` (via `features`) or a
|
|
157
|
+
* wholly separate dataset (`data`, which takes precedence when both are
|
|
158
|
+
* given).
|
|
203
159
|
*/
|
|
204
|
-
export type
|
|
160
|
+
export type GeoInsetMarkerConfig<TProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
205
161
|
type: 'inset';
|
|
206
162
|
location: GeoInsetLocation;
|
|
207
163
|
/** Feature ids (matching the plot's own `featureId`) to filter from the plot's own `data`. Ignored when `data` is set. */
|
|
208
164
|
features?: string[];
|
|
209
165
|
/**
|
|
210
|
-
* Narrows each `features`-matched feature
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
*
|
|
214
|
-
* to split one feature's geometry between the main map and this inset
|
|
215
|
-
* without preprocessing the source data. Omitted → every part of each
|
|
216
|
-
* matched feature renders, as before. Ignored when `data` is set.
|
|
166
|
+
* Narrows each `features`-matched feature to just the geometry parts that
|
|
167
|
+
* pass this predicate — same signature as `GeoDataProps.excludeParts`, so
|
|
168
|
+
* one feature's geometry can be split between the main map and this inset.
|
|
169
|
+
* Ignored when `data` is set.
|
|
217
170
|
*/
|
|
218
171
|
featurePartsFilter?: (part: {
|
|
219
172
|
centroid: [number, number];
|
|
@@ -234,4 +187,26 @@ export type GeoInsetMarker<TProps extends Record<string, unknown> = Record<strin
|
|
|
234
187
|
/** Independent hover tooltip for just this inset's own rendered features — see `GeoInsetTooltipConfig`. */
|
|
235
188
|
tooltip?: GeoInsetTooltipConfig;
|
|
236
189
|
};
|
|
237
|
-
|
|
190
|
+
/**
|
|
191
|
+
* `GeoPlot`'s own `markers` prop type — unions {@link BaseMarkersConfig} with
|
|
192
|
+
* every geo-only kind. Independent of `AxisBasedMarkersConfig`
|
|
193
|
+
* (`types/markers/common.ts`): geo has no axis to `rule` against, and its
|
|
194
|
+
* `hover`/`component` variants differ in shape from the axis-based kinds'.
|
|
195
|
+
*/
|
|
196
|
+
export type GeoMarkersConfig = BaseMarkersConfig | GeoGraticuleMarkerConfig | GeoSphereMarkerConfig | GeoVectorMarkerConfig | GeoLinkMarkerConfig | GeoContourMarkerConfig | GeoHoverMarkerConfig | GeoCustomComponentMarkerConfig | GeoInsetMarkerConfig;
|
|
197
|
+
/**
|
|
198
|
+
* The base choropleth/base-map mark — one per distinct resolved feature
|
|
199
|
+
* style. Never author-facing: `buildGeoMarkers` builds it from `GeoPlot`'s
|
|
200
|
+
* own `styleGroups`.
|
|
201
|
+
*/
|
|
202
|
+
export type GeoFeaturesMarkerConfig = {
|
|
203
|
+
type: 'geo';
|
|
204
|
+
data: Record<string, unknown>[];
|
|
205
|
+
fill: (d: any) => string;
|
|
206
|
+
fillOpacity?: number;
|
|
207
|
+
stroke?: string;
|
|
208
|
+
strokeWidth?: number;
|
|
209
|
+
onclick?: (e: Event, d: any) => void;
|
|
210
|
+
onpointerenter?: (e: Event, d: any) => void;
|
|
211
|
+
onpointerleave?: (e: Event) => void;
|
|
212
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AxisValue } from '../layout/scales';
|
|
2
|
+
import type { StrokeStyle, FontStyle, DotStyle } from '../plots/styling';
|
|
3
|
+
import type { AxisBasedMarkersConfig } from './common';
|
|
4
|
+
/** Which endpoint a delta measures from/to: a named series, or a fixed axis value (defaults to `0`). */
|
|
5
|
+
export type DeltaTarget = {
|
|
6
|
+
type: 'series';
|
|
7
|
+
series: string;
|
|
8
|
+
} | {
|
|
9
|
+
type: 'axis';
|
|
10
|
+
value?: number;
|
|
11
|
+
};
|
|
12
|
+
/** How far apart two points are on a line chart: a given x (or y), or a series' distance from a fixed axis value. */
|
|
13
|
+
export type DeltaConfig = {
|
|
14
|
+
axis: 'x' | 'y';
|
|
15
|
+
at: AxisValue;
|
|
16
|
+
from: DeltaTarget;
|
|
17
|
+
to?: DeltaTarget;
|
|
18
|
+
formatDiff?: (diff: number) => string;
|
|
19
|
+
strokeStyle?: StrokeStyle;
|
|
20
|
+
fontStyle?: FontStyle;
|
|
21
|
+
dotStyle?: DotStyle;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* A delta annotation between two points on a line chart, resolved against
|
|
25
|
+
* series data (`utils/delta.ts`). `xDomain`/`yDomain` optionally clamp
|
|
26
|
+
* the varying endpoint to the plot's own axis range.
|
|
27
|
+
*/
|
|
28
|
+
export type DeltaMarkerConfig = {
|
|
29
|
+
type: 'delta';
|
|
30
|
+
xDomain?: (number | string | Date)[];
|
|
31
|
+
yDomain?: (number | string | Date)[];
|
|
32
|
+
} & DeltaConfig;
|
|
33
|
+
/** `LinePlot`'s own `markers` prop type — every {@link AxisBasedMarkersConfig} kind plus the line-only `'delta'` annotation. */
|
|
34
|
+
export type LineMarkersConfig = AxisBasedMarkersConfig | DeltaMarkerConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Baseline props every marker component receives when mounted by a plot:
|
|
3
3
|
* `data` for the points/values it draws, plus `series`/`seriesColor` when
|
|
4
|
-
* mounted per-series via a `
|
|
4
|
+
* mounted per-series via a `CustomComponentMarkerConfig`. Marker components extend
|
|
5
5
|
* this with whatever else they need (e.g. PeakMarker's `mode`, `label`).
|
|
6
6
|
*/
|
|
7
7
|
export interface MarkerProps<TData = Record<string, unknown>> {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Accessor, SeriesProps, DataProps } from './common';
|
|
2
|
+
/**
|
|
3
|
+
* `SeriesProps`/`DataProps`, plus an optional per-row bubble radius —
|
|
4
|
+
* ScatterPlot's own data contract. A field key or accessor function is
|
|
5
|
+
* bound to svelteplot's own auto sqrt scale (mirroring how `x`/`y` are
|
|
6
|
+
* bound to their own scales), so bubble *area* — not radius — ends up
|
|
7
|
+
* proportional to the raw values with no manual scaling needed; feeding it
|
|
8
|
+
* an already-scaled value double-scales it. A literal number bypasses
|
|
9
|
+
* scaling entirely (a fixed pixel radius, same as the default dot size).
|
|
10
|
+
*/
|
|
11
|
+
export type ScatterDataProps<T extends Record<string, unknown>> = (SeriesProps<T> | DataProps<T>) & {
|
|
12
|
+
r?: Accessor<T, number> | number;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,41 +1,23 @@
|
|
|
1
|
-
import type { TooltipOptions } from '../layout/tooltip';
|
|
1
|
+
import type { HoverPoint, HoverStrategy, TooltipOptions } from '../layout/tooltip';
|
|
2
2
|
import type { Segment } from './segments/config';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { AxisBasedScalesConfig } from '../layout/scales';
|
|
4
|
+
import type { GeoScalesConfig } from '../layout/coordinates';
|
|
5
5
|
/** The `styles` prop accepted by every plot kind — its own
|
|
6
|
-
* styles shape ({@link
|
|
6
|
+
* styles shape ({@link BasePlotStylesConfig}, `GeoStylesConfig`, …). */
|
|
7
7
|
export type StylesConfig<TStyles extends object> = TStyles;
|
|
8
|
-
/** The `markers` prop accepted by every plot kind — a list of that
|
|
9
|
-
* kind's own marker union ({@link Marker}, `GeoMarker`, …). */
|
|
8
|
+
/** The `markers` prop accepted by every plot kind — a list of that kind's own marker union. */
|
|
10
9
|
export type MarkersConfig<TMarker> = TMarker[];
|
|
11
10
|
/**
|
|
12
|
-
* The `segments` prop accepted by every plot kind
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* segments under `'default'` apply to every series.
|
|
17
|
-
*
|
|
18
|
-
* ```ts
|
|
19
|
-
* segments: {
|
|
20
|
-
* female: [{ style: { stroke: { stroke: 'tomato' } } }], // catch-all for female
|
|
21
|
-
* male: [{ style: { stroke: { stroke: 'steelblue' } } }], // catch-all for male
|
|
22
|
-
* default: [{ areas: [{ x: { from: 2012, to: 2014 } }], style: { dots: { dotSymbol: 'circle' } } }],
|
|
23
|
-
* }
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* Within each resolved series list, catch-alls (no `areas`) are evaluated last
|
|
27
|
-
* so that area-specific segments always override them, regardless of position.
|
|
28
|
-
* Area-specific segments also inherit any style key absent from their own style
|
|
29
|
-
* by merging the catch-all as a baseline — the area's own style wins on conflict.
|
|
30
|
-
* This lets you set a series colour once in a catch-all and add per-range dots
|
|
31
|
-
* or dash patterns without repeating the colour on every area segment.
|
|
11
|
+
* The `segments` prop accepted by every plot kind — series name (or
|
|
12
|
+
* `'default'` for all series) to a list of {@link Segment}s. Within a
|
|
13
|
+
* series, catch-all segments (no `areas`) evaluate first as a baseline;
|
|
14
|
+
* area-specific segments merge on top and win on conflict.
|
|
32
15
|
*/
|
|
33
16
|
export type SegmentsConfig<TStyle> = Record<string, Segment<TStyle>[]>;
|
|
34
17
|
/**
|
|
35
|
-
* Partial margin override —
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* title, rotated ticks); a number pins it exactly.
|
|
18
|
+
* Partial margin override — unset sides fall back to the theme (itself
|
|
19
|
+
* `'auto'` by default). `'auto'` fits the side to its rendered content; a
|
|
20
|
+
* number pins it exactly.
|
|
39
21
|
*/
|
|
40
22
|
export type MarginConfig = Partial<{
|
|
41
23
|
top: number | 'auto';
|
|
@@ -44,69 +26,59 @@ export type MarginConfig = Partial<{
|
|
|
44
26
|
left: number | 'auto';
|
|
45
27
|
}>;
|
|
46
28
|
/**
|
|
47
|
-
* The `tooltip` prop a plot actually receives — the
|
|
48
|
-
*
|
|
49
|
-
* `
|
|
50
|
-
*
|
|
51
|
-
* (`''` when not faceted). Presence of this object on a plot is what turns
|
|
52
|
-
* hovering on.
|
|
29
|
+
* The `tooltip` prop a plot actually receives — the resolved form of the
|
|
30
|
+
* author-facing {@link TooltipOptions}. `format`/`sync` become required;
|
|
31
|
+
* `facetId` identifies the originating facet (`''` when not faceted).
|
|
32
|
+
* Presence of this object is what turns hovering on.
|
|
53
33
|
*/
|
|
54
34
|
export type TooltipConfig<TRow extends Record<string, unknown>> = Omit<TooltipOptions<TRow>, 'format' | 'sync'> & {
|
|
55
35
|
format: (row: TRow) => string;
|
|
56
36
|
sync: boolean;
|
|
57
37
|
facetId: string;
|
|
58
38
|
};
|
|
59
|
-
/**
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
|
|
80
|
-
domain?: [number, number];
|
|
81
|
-
};
|
|
39
|
+
/** How a pointer event resolves to a candidate point: `'nearest'` (closest within a distance threshold) or `'contains'` (whichever candidate's own rendered shape contains the cursor). */
|
|
40
|
+
export type PointMatchingStrategy = 'nearest' | 'contains';
|
|
41
|
+
/** `BasePlotLayout`'s single `hover` prop — every plot kind's own resolved hover/tooltip wiring. */
|
|
42
|
+
export type HoverConfig<TRow extends Record<string, unknown>> = {
|
|
43
|
+
/** Whether the pointer/hover/tooltip machinery should mount at all. */
|
|
44
|
+
active: boolean;
|
|
45
|
+
/** Candidate points hover matching searches against. */
|
|
46
|
+
points: HoverPoint<TRow>[];
|
|
47
|
+
/** Short label drawn next to the highlight dot (e.g. the value). */
|
|
48
|
+
label: (row: TRow) => string;
|
|
49
|
+
/** Resolved hover strategy for the *local* hover store (ignored once a shared store is in scope). */
|
|
50
|
+
strategy?: HoverStrategy;
|
|
51
|
+
/** Resolved sync flag for the *local* hover store (ignored once a shared store is in scope). */
|
|
52
|
+
sync?: boolean;
|
|
53
|
+
tooltip?: TooltipConfig<TRow>;
|
|
54
|
+
/** When it returns `true`, that pointer event is treated as a leave instead of a move — lets a nested layout opt part of the plot out of hover matching. */
|
|
55
|
+
exclude?: (e: PointerEvent) => boolean;
|
|
56
|
+
/** How to resolve a pointer event to a candidate point — see {@link PointMatchingStrategy}. Defaults to `'nearest'`. */
|
|
57
|
+
pointMatching?: PointMatchingStrategy;
|
|
58
|
+
/** Forces the crosshair rule(s) a `hover` marker draws off entirely, overriding whatever `strategy` implies. */
|
|
59
|
+
crosshair?: boolean;
|
|
82
60
|
};
|
|
83
61
|
/**
|
|
84
62
|
* The `scales` prop accepted by every plot kind — either flavor of scale
|
|
85
|
-
* config a plot kind can have
|
|
86
|
-
*
|
|
87
|
-
* `Plot.svelte` narrows `BasePlotProps`'s `TScales` to exactly the one
|
|
88
|
-
* that applies to it, rather than accepting this whole union.
|
|
63
|
+
* config a plot kind can have. Each concrete `Plot.svelte` narrows
|
|
64
|
+
* `BasePlotProps`'s `TScales` to exactly the one that applies to it.
|
|
89
65
|
*/
|
|
90
66
|
export type ScalesConfig<TData = Record<string, unknown>> = AxisBasedScalesConfig<TData> | GeoScalesConfig;
|
|
91
67
|
/**
|
|
92
|
-
* The shared
|
|
93
|
-
* everything that varies by plot kind: `TDataContract` is
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* own segment/style/marker/scale shapes. Each `Plot.svelte` instantiates
|
|
98
|
-
* this directly with its own concrete arguments rather than going through a
|
|
99
|
-
* shared per-kind alias — segments/styles/markers already diverge in shape
|
|
100
|
-
* across kinds today (or will soon), so a shared alias would just be an
|
|
101
|
-
* extra layer to keep in sync.
|
|
68
|
+
* The shared prop bag every plot component accepts, parameterized over
|
|
69
|
+
* everything that varies by plot kind: `TDataContract` is its own data
|
|
70
|
+
* shape, `TRow` is what `tooltip` resolves against, and the rest are its
|
|
71
|
+
* own segment/style/marker/scale/coordinate-system shapes. `TCoordinates`
|
|
72
|
+
* defaults to `undefined` — only `GeoPlot` instantiates it.
|
|
102
73
|
*/
|
|
103
|
-
export type BasePlotProps<TDataContract, TRow extends Record<string, unknown>, TStyles extends object, TSegmentStyle extends object, TMarker, TScales extends ScalesConfig<TRow
|
|
74
|
+
export type BasePlotProps<TDataContract, TRow extends Record<string, unknown>, TStyles extends object, TSegmentStyle extends object, TMarker, TScales extends ScalesConfig<TRow>, TCoordinates = undefined> = TDataContract & {
|
|
104
75
|
width: number;
|
|
105
76
|
height: number;
|
|
106
77
|
styles?: StylesConfig<TStyles>;
|
|
107
78
|
segments?: SegmentsConfig<TSegmentStyle>;
|
|
108
79
|
markers?: MarkersConfig<TMarker>;
|
|
109
80
|
scales?: TScales;
|
|
81
|
+
coordinates?: TCoordinates;
|
|
110
82
|
margins?: MarginConfig;
|
|
111
83
|
tooltip?: TooltipConfig<TRow>;
|
|
112
84
|
};
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import type { StrokeStyle, DotStyle } from '../styling';
|
|
1
|
+
import type { StrokeStyle, DotStyle, AreaStyle } from '../styling';
|
|
2
2
|
/** Per-segment styling for a line: its stroke and/or its endpoint dots. */
|
|
3
3
|
export type LineSegmentStyle = {
|
|
4
4
|
stroke?: StrokeStyle;
|
|
5
5
|
dots?: DotStyle;
|
|
6
6
|
};
|
|
7
|
-
/** Per-segment styling for a bar-shaped mark
|
|
8
|
-
export type BarSegmentStyle =
|
|
9
|
-
fill?: string;
|
|
10
|
-
fillOpacity?: number;
|
|
11
|
-
};
|
|
7
|
+
/** Per-segment styling for a bar-shaped mark. Shared by `BarPlot` and `PyramidPlot`. */
|
|
8
|
+
export type BarSegmentStyle = AreaStyle;
|
|
12
9
|
/** Per-cell styling override for a heatmap cell. */
|
|
13
|
-
export type CellSegmentStyle =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
stroke?: string;
|
|
17
|
-
strokeWidth?: number;
|
|
18
|
-
};
|
|
10
|
+
export type CellSegmentStyle = AreaStyle;
|
|
11
|
+
/** Per-segment styling for a scatter point cloud. */
|
|
12
|
+
export type ScatterSegmentStyle = DotStyle;
|
|
19
13
|
/** Per-feature styling override for `GeoPlot` — the geo analog of `CellSegmentStyle`. */
|
|
20
14
|
export type GeoSegmentStyle = {
|
|
21
15
|
fill?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AxisValue } from '
|
|
1
|
+
import type { AxisValue } from '../../layout/scales';
|
|
2
2
|
import type { Series } from '../data/common';
|
|
3
3
|
import type { LineSegmentStyle } from './common';
|
|
4
4
|
/** A half-open interval on one axis. Both bounds are inclusive; omit either to leave that end open. */
|