@fundar/data-chart-telling 0.0.28 → 0.0.30
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 -2
- package/dist/charts/bar/Chart.svelte.d.ts +2 -2
- package/dist/charts/line/Chart.svelte +2 -2
- package/dist/charts/line/Chart.svelte.d.ts +2 -2
- package/dist/charts/pyramid/Chart.svelte +2 -2
- package/dist/charts/pyramid/Chart.svelte.d.ts +3 -2
- package/dist/configuration/config.svelte.js +6 -0
- package/dist/configuration/themes/index.d.ts +168 -0
- package/dist/index.d.ts +4 -3
- package/dist/layout/coordinates/CoordinatesLayout.svelte +10 -5
- package/dist/layout/coordinates/CoordinatesLayout.svelte.d.ts +2 -0
- package/dist/layout/facet/FacetLayout.svelte +77 -20
- package/dist/layout/facet/FacetLayout.svelte.d.ts +2 -1
- package/dist/layout/plot/BasePlotLayout.svelte +19 -0
- package/dist/layout/plot/BasePlotLayout.svelte.d.ts +17 -0
- package/dist/plots/bar/Plot.svelte +13 -2
- package/dist/plots/bar/Plot.svelte.d.ts +2 -2
- package/dist/plots/bar/ValueLabels.svelte +5 -1
- package/dist/plots/bar/buildBarMarkers.d.ts +10 -3
- package/dist/plots/bar/buildBarMarkers.js +86 -55
- package/dist/plots/bar/hoverPoints.js +2 -1
- package/dist/plots/bar/layout.svelte.d.ts +2 -0
- package/dist/plots/bar/layout.svelte.js +6 -1
- package/dist/plots/heatmap/Plot.svelte +2 -2
- package/dist/plots/heatmap/Plot.svelte.d.ts +2 -2
- package/dist/plots/line/Plot.svelte +39 -15
- package/dist/plots/line/Plot.svelte.d.ts +2 -2
- package/dist/plots/line/ValueLabels.svelte +17 -2
- package/dist/plots/line/buildGapMarkers.d.ts +21 -0
- package/dist/plots/line/buildGapMarkers.js +68 -0
- package/dist/plots/pyramid/Plot.svelte +39 -14
- package/dist/plots/pyramid/Plot.svelte.d.ts +2 -2
- package/dist/plots/pyramid/ValueLabels.svelte +5 -1
- package/dist/plots/pyramid/buildPyramidBarMarkers.d.ts +8 -1
- package/dist/plots/pyramid/buildPyramidBarMarkers.js +43 -3
- package/dist/plots/scatter/Plot.svelte +2 -2
- package/dist/plots/scatter/Plot.svelte.d.ts +2 -2
- package/dist/plots/utils/gaps.d.ts +52 -0
- package/dist/plots/utils/gaps.js +156 -0
- package/dist/plots/utils/labelOverflow.svelte.d.ts +9 -0
- package/dist/plots/utils/labelOverflow.svelte.js +11 -0
- package/dist/types/charts/props.d.ts +11 -2
- package/dist/types/configuration/styling.d.ts +19 -0
- package/dist/types/layout/facet.d.ts +2 -0
- package/dist/types/layout/styles.d.ts +29 -11
- package/dist/types/plots/gaps.d.ts +54 -0
- package/dist/types/plots/gaps.js +1 -0
- package/dist/types/plots/props.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ValueAnchor } from '../plots/constants';
|
|
2
2
|
import type { FontStyle, StrokeStyle, AreaStyle } from '../plots/styling';
|
|
3
3
|
import type { GeoFeature } from '../plots/data/geo';
|
|
4
|
+
import type { GapsConfig } from '../plots/gaps';
|
|
4
5
|
/**
|
|
5
6
|
* Controls if and how value labels are rendered on a plot. The high-level
|
|
6
7
|
* `anchor` sets sensible defaults for placement; `fontStyle` (`dx`, `dy`,
|
|
@@ -47,16 +48,34 @@ export type FrameStyle = AreaStyle & {
|
|
|
47
48
|
};
|
|
48
49
|
/** Author-facing `styles.frame` prop — see {@link FrameStyle}. */
|
|
49
50
|
export type FrameProp = boolean | FrameStyle;
|
|
51
|
+
/**
|
|
52
|
+
* The fields every plot kind's own `styles` shape shares, regardless of
|
|
53
|
+
* whether it's built on axes ({@link AxisBasedStylesConfig}) or geometry
|
|
54
|
+
* ({@link GeoStylesConfig}) — the true common parent of the two, unlike the
|
|
55
|
+
* name `AxisBasedStylesConfig` might suggest before this split existed.
|
|
56
|
+
*/
|
|
57
|
+
export type BasePlotStylesConfig = {
|
|
58
|
+
/** Decorative border around the plot's content box — see {@link FrameStyle}. Available on every plot kind. */
|
|
59
|
+
frame?: FrameProp;
|
|
60
|
+
};
|
|
50
61
|
/**
|
|
51
62
|
* Top-level rendering style overrides shared by the non-geo plot kinds.
|
|
52
63
|
* Passed as the `styles` prop. Each plot reads only the fields it cares
|
|
53
64
|
* about.
|
|
54
65
|
*/
|
|
55
|
-
export type
|
|
66
|
+
export type AxisBasedStylesConfig = BasePlotStylesConfig & {
|
|
56
67
|
values?: ValuesStyle;
|
|
57
68
|
colors?: ColorsStyle;
|
|
58
|
-
|
|
59
|
-
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* `AxisBasedStylesConfig` extended with `gaps` — the interpolated
|
|
72
|
+
* missing-data bridge fill available to plot kinds with an inherent
|
|
73
|
+
* category/sequence ordering (`LinePlot`, `BarPlot`, `PyramidPlot`).
|
|
74
|
+
* Resolved per series like `segments`, at zone granularity — see
|
|
75
|
+
* {@link GapsConfig}.
|
|
76
|
+
*/
|
|
77
|
+
export type GapsAwarePlotStylesConfig<TSegmentStyle extends object> = AxisBasedStylesConfig & {
|
|
78
|
+
gaps?: GapsConfig<TSegmentStyle>;
|
|
60
79
|
};
|
|
61
80
|
export type GeoTileLayerConfig = {
|
|
62
81
|
/** XYZ tile URL template, e.g. `'https://tile.openstreetmap.org/{z}/{x}/{y}.png'`. */
|
|
@@ -69,12 +88,13 @@ export type GeoTileLayerConfig = {
|
|
|
69
88
|
tileSize?: number;
|
|
70
89
|
};
|
|
71
90
|
/**
|
|
72
|
-
* `styles` prop for GeoPlot — the geo analog of `
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
91
|
+
* `styles` prop for GeoPlot — the geo analog of `AxisBasedStylesConfig`,
|
|
92
|
+
* sharing only {@link BasePlotStylesConfig}'s common ground with it. Unlike
|
|
93
|
+
* the other plot kinds, GeoPlot's styling needs (base map, choropleth ramp,
|
|
94
|
+
* tile background, click handling) are unlike anything x/y plots need, so
|
|
95
|
+
* this is its own type rather than a reuse of `AxisBasedStylesConfig`.
|
|
76
96
|
*/
|
|
77
|
-
export type GeoStylesConfig<TProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
97
|
+
export type GeoStylesConfig<TProps extends Record<string, unknown> = Record<string, unknown>> = BasePlotStylesConfig & {
|
|
78
98
|
/** Base map fill, used when a feature isn't styled by `segments` or the choropleth ramp. */
|
|
79
99
|
fill?: string;
|
|
80
100
|
fillOpacity?: number;
|
|
@@ -86,8 +106,6 @@ export type GeoStylesConfig<TProps extends Record<string, unknown> = Record<stri
|
|
|
86
106
|
tileLayer?: GeoTileLayerConfig;
|
|
87
107
|
/** Fired when a base-map feature is clicked. */
|
|
88
108
|
onFeatureClick?: (feature: GeoFeature<TProps>, event: Event) => void;
|
|
89
|
-
/** Decorative border around the plot's content box — see {@link FrameStyle}. Available on every plot kind. */
|
|
90
|
-
frame?: FrameProp;
|
|
91
109
|
};
|
|
92
110
|
/**
|
|
93
111
|
* `GeoTileLayerConfig`, plus `features` — never author-facing (the public
|
|
@@ -103,7 +121,7 @@ type GeoTileLayerConfigWithFeatures = GeoTileLayerConfig & {
|
|
|
103
121
|
};
|
|
104
122
|
/**
|
|
105
123
|
* The minimal slice of a plot kind's own `styles` prop `StylesLayout` reads —
|
|
106
|
-
* every concrete `styles` type ({@link
|
|
124
|
+
* every concrete `styles` type ({@link AxisBasedStylesConfig},
|
|
107
125
|
* {@link GeoStylesConfig}) structurally satisfies this whether or not it
|
|
108
126
|
* declares `tileLayer` at all (a missing optional field type-checks fine).
|
|
109
127
|
*/
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { EasingName } from '../charts/interpolate';
|
|
2
|
+
import type { AxisValue } from '../layout/scales';
|
|
3
|
+
/**
|
|
4
|
+
* How one gap zone bridges its hole: `interpolate` eases the synthetic
|
|
5
|
+
* segment's value between its two endpoints (defaults to `'linear'`, a
|
|
6
|
+
* straight line); `style` is the per-mark shape drawn for it
|
|
7
|
+
* ({@link LineSegmentStyle} for `LinePlot`), independent of that plot
|
|
8
|
+
* kind's own default marker style unless the caller repeats it.
|
|
9
|
+
*/
|
|
10
|
+
export type GapZoneConfig<TStyle> = {
|
|
11
|
+
interpolate?: EasingName;
|
|
12
|
+
style?: TStyle;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A leading/trailing gap has only one real boundary — `x` (required to opt
|
|
16
|
+
* in) is the domain value the synthetic segment extends to, and `y` is the
|
|
17
|
+
* value it reaches there (defaults to holding the nearest real point's
|
|
18
|
+
* value, i.e. a flat extrapolation). Omitting the zone entirely leaves that
|
|
19
|
+
* end of the series unfilled — extrapolating without an explicit target
|
|
20
|
+
* would imply data that doesn't exist.
|
|
21
|
+
*
|
|
22
|
+
* On `LinePlot`, `x`'s value is the actual spatial target the bridge draws
|
|
23
|
+
* out to (its axis is continuous). On `BarPlot`/`PyramidPlot`, each gap row
|
|
24
|
+
* already has its own real category, so `x`'s *presence* is only the opt-in
|
|
25
|
+
* gate — its value isn't read; `y` is what drives the fill.
|
|
26
|
+
*/
|
|
27
|
+
export type OpenGapZoneConfig<TStyle> = GapZoneConfig<TStyle> & {
|
|
28
|
+
x: AxisValue;
|
|
29
|
+
y?: AxisValue;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* One series' gap-fill config: `start` (before its first real point),
|
|
33
|
+
* `middle` (any internal run of missing rows, bounded by real data on both
|
|
34
|
+
* sides) and `end` (after its last real point). A row counts as missing
|
|
35
|
+
* when its resolved value is `null`, `undefined`, or `NaN` — the same
|
|
36
|
+
* convention svelteplot's own `Line` mark already uses to break the line
|
|
37
|
+
* there. See {@link GapsConfig} for how this is keyed per series on a
|
|
38
|
+
* gap-aware plot kind's `styles.gaps`.
|
|
39
|
+
*/
|
|
40
|
+
export type GapZonesConfig<TStyle> = {
|
|
41
|
+
start?: OpenGapZoneConfig<TStyle>;
|
|
42
|
+
middle?: GapZoneConfig<TStyle>;
|
|
43
|
+
end?: OpenGapZoneConfig<TStyle>;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The `gaps` field a gap-aware plot kind's `styles` accepts (see
|
|
47
|
+
* {@link GapsAwarePlotStylesConfig}, `types/layout/styles.ts`) — series name
|
|
48
|
+
* (or `'default'` for all series) to that series' {@link GapZonesConfig}.
|
|
49
|
+
* Mirrors `SegmentsConfig`'s series-keyed shape: a named entry applies only
|
|
50
|
+
* to that series; `'default'` fills in whichever of its zones
|
|
51
|
+
* (`start`/`middle`/`end`) the named entry itself leaves unset, at zone
|
|
52
|
+
* granularity rather than a merged style.
|
|
53
|
+
*/
|
|
54
|
+
export type GapsConfig<TStyle> = Record<string, GapZonesConfig<TStyle>>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,7 +3,7 @@ import type { Segment } from './segments/config';
|
|
|
3
3
|
import type { AxisBasedScalesConfig } from '../layout/scales';
|
|
4
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 AxisBasedStylesConfig}, `GeoStylesConfig`, …). */
|
|
7
7
|
export type StylesConfig<TStyles extends object> = TStyles;
|
|
8
8
|
/** The `markers` prop accepted by every plot kind — a list of that kind's own marker union. */
|
|
9
9
|
export type MarkersConfig<TMarker> = TMarker[];
|