@fundar/data-chart-telling 0.0.25 → 0.0.26
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/bar/Chart.svelte +2 -0
- package/dist/charts/heatmap/Chart.svelte +3 -1
- package/dist/charts/heatmap/Chart.svelte.d.ts +1 -2
- package/dist/charts/line/Chart.svelte +2 -0
- package/dist/charts/pyramid/Chart.svelte +3 -1
- 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 +2 -0
- package/dist/configuration/themes/index.d.ts +48 -0
- package/dist/index.d.ts +20 -14
- package/dist/index.js +9 -3
- package/dist/layout/coordinates/CoordinatesLayout.svelte +95 -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/geometry/GeometryLayout.svelte +231 -0
- package/dist/layout/geometry/GeometryLayout.svelte.d.ts +62 -0
- 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/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 +28 -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 +32 -33
- 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 +54 -84
- package/dist/plots/bar/Plot.svelte.d.ts +4 -5
- package/dist/plots/bar/ValueLabels.svelte +1 -1
- package/dist/plots/bar/ValueLabels.svelte.d.ts +1 -1
- 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 +24 -49
- package/dist/plots/heatmap/Plot.svelte.d.ts +4 -5
- package/dist/plots/heatmap/ValueLabels.svelte +2 -2
- package/dist/plots/heatmap/ValueLabels.svelte.d.ts +2 -2
- package/dist/plots/heatmap/buildCellMarkers.d.ts +21 -0
- package/dist/plots/heatmap/buildCellMarkers.js +25 -0
- package/dist/plots/line/Plot.svelte +68 -141
- package/dist/plots/line/Plot.svelte.d.ts +4 -4
- package/dist/plots/line/ValueLabels.svelte +29 -52
- package/dist/plots/line/ValueLabels.svelte.d.ts +6 -1
- package/dist/plots/line/buildLineMarkers.d.ts +15 -0
- package/dist/plots/line/buildLineMarkers.js +57 -0
- package/dist/plots/pyramid/Plot.svelte +41 -117
- package/dist/plots/pyramid/Plot.svelte.d.ts +4 -5
- package/dist/plots/pyramid/ValueLabels.svelte +1 -1
- package/dist/plots/pyramid/ValueLabels.svelte.d.ts +1 -1
- package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +19 -0
- package/dist/plots/pyramid/buildPyramidBarMarkers.js +32 -0
- package/dist/plots/scatter/Plot.svelte +206 -0
- package/dist/plots/{bar/BarSegments.svelte.d.ts → scatter/Plot.svelte.d.ts} +9 -20
- package/dist/plots/scatter/ValueLabels.svelte +106 -0
- package/dist/{layout/plot/GridLayout.svelte.d.ts → plots/scatter/ValueLabels.svelte.d.ts} +11 -5
- 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/segments.d.ts +17 -10
- package/dist/plots/utils/segments.js +26 -16
- package/dist/types/charts/common.d.ts +1 -1
- package/dist/types/charts/props.d.ts +5 -6
- package/dist/types/configuration/styling.d.ts +7 -2
- package/dist/types/{plots/scales/geo.d.ts → layout/coordinates.d.ts} +33 -1
- package/dist/types/layout/geometry.d.ts +17 -0
- package/dist/types/{plots/axis.d.ts → layout/scales.d.ts} +11 -0
- package/dist/types/layout/styles.d.ts +126 -0
- package/dist/types/layout/tooltip.d.ts +20 -1
- package/dist/types/markers/all.d.ts +11 -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 +1 -1
- 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/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/{plots/axis.js → layout/coordinates.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 → markers/all.js} +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AxisValue } from '../layout/scales';
|
|
2
|
+
import type { DotStyle, FontStyle } from '../plots/styling';
|
|
3
|
+
import type { ColorsStyle } from '../layout/styles';
|
|
4
|
+
/**
|
|
5
|
+
* A set of point marks (svelteplot's `Dot`) — usable on any plot kind, axis-based or geo.
|
|
6
|
+
*
|
|
7
|
+
* `x`/`y`/`r`/`value` accept a field key or an accessor function, like `Series.x`/`y`.
|
|
8
|
+
* `GeometryLayout` resolves the shorthand before it reaches `DotMarker.svelte`, which only
|
|
9
|
+
* ever sees functions.
|
|
10
|
+
*/
|
|
11
|
+
export type DotMarkerConfig = {
|
|
12
|
+
type: 'dot';
|
|
13
|
+
data: Record<string, unknown>[];
|
|
14
|
+
x: string | ((d: any) => AxisValue);
|
|
15
|
+
y: string | ((d: any) => AxisValue);
|
|
16
|
+
/** Per-row radius, or a constant — overrides `style.dotRadius`. */
|
|
17
|
+
r?: number | string | ((d: any) => number);
|
|
18
|
+
/** Per-row fill, overriding `style.dotFill` — ignored when `value` is set. */
|
|
19
|
+
fill?: (d: any) => string;
|
|
20
|
+
/** Continuous value driving a per-dot color ramp through `style.colors`. */
|
|
21
|
+
value?: string | ((d: any) => number);
|
|
22
|
+
style?: DotStyle & {
|
|
23
|
+
colors?: ColorsStyle;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A text label per row (svelteplot's `Text`) — usable on any plot kind, axis-based or geo.
|
|
28
|
+
*
|
|
29
|
+
* `x`/`y` accept the same field-key-or-function shorthand as `DotMarkerConfig`. `text` is a
|
|
30
|
+
* constant or a per-row accessor.
|
|
31
|
+
*/
|
|
32
|
+
export type TextMarkerConfig = {
|
|
33
|
+
type: 'text';
|
|
34
|
+
data: Record<string, unknown>[];
|
|
35
|
+
x: string | ((d: any) => AxisValue);
|
|
36
|
+
y: string | ((d: any) => AxisValue);
|
|
37
|
+
text: string | ((d: any) => string);
|
|
38
|
+
style?: FontStyle;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Every marker kind usable on any plot, axis-based or geo. `AxisBasedMarkersConfig`
|
|
42
|
+
* (`types/markers/common.ts`) and `GeoMarkersConfig` (`types/markers/geo.ts`) both extend
|
|
43
|
+
* this, so `MarkerConfig` (`types/markers/all.ts`) can union the two without a shape collision.
|
|
44
|
+
*/
|
|
45
|
+
export type BaseMarkersConfig = DotMarkerConfig | TextMarkerConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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 {};
|