@fundar/data-chart-telling 0.0.14 → 0.0.16
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/README.md +121 -17
- package/dist/charts/{Chart.svelte → BaseChart.svelte} +2 -0
- package/dist/charts/{Chart.svelte.d.ts → BaseChart.svelte.d.ts} +3 -3
- package/dist/charts/bar/Chart.svelte +5 -5
- package/dist/charts/bar/Chart.svelte.d.ts +1 -2
- package/dist/charts/heatmap/Chart.svelte +8 -7
- package/dist/charts/heatmap/Chart.svelte.d.ts +2 -3
- package/dist/charts/line/Chart.svelte +5 -5
- package/dist/charts/line/Chart.svelte.d.ts +1 -2
- package/dist/charts/pyramid/Chart.svelte +7 -6
- package/dist/charts/pyramid/Chart.svelte.d.ts +2 -3
- package/dist/configuration/config.svelte.js +2 -1
- package/dist/configuration/themes/index.d.ts +60 -40
- package/dist/index.d.ts +27 -13
- package/dist/index.js +12 -7
- package/dist/layout/facet/FacetLayout.svelte +1 -1
- package/dist/layout/facet/FacetLayout.svelte.d.ts +1 -1
- package/dist/layout/geo/GeoLayout.svelte +47 -0
- package/dist/layout/geo/GeoLayout.svelte.d.ts +22 -0
- package/dist/layout/geo/resolveProjection.d.ts +10 -0
- package/dist/layout/geo/resolveProjection.js +48 -0
- package/dist/layout/legend/ContinuousSection.svelte +158 -17
- package/dist/layout/legend/DiscreteSection.svelte +56 -4
- package/dist/layout/legend/interaction.svelte.d.ts +7 -0
- package/dist/layout/legend/interaction.svelte.js +24 -0
- package/dist/layout/plot/AxisLayout.svelte +95 -0
- package/dist/layout/plot/AxisLayout.svelte.d.ts +39 -0
- package/dist/layout/plot/BasePlotLayout.svelte +302 -0
- package/dist/layout/plot/BasePlotLayout.svelte.d.ts +95 -0
- package/dist/layout/plot/GridLayout.svelte +30 -0
- package/dist/layout/plot/GridLayout.svelte.d.ts +27 -0
- package/dist/layout/plot/RuleLayout.svelte +111 -0
- package/dist/layout/plot/RuleLayout.svelte.d.ts +40 -0
- package/dist/layout/plot/margins.d.ts +34 -0
- package/dist/layout/plot/margins.js +26 -0
- package/dist/layout/timeline/TimelineLayout.svelte +1 -1
- package/dist/layout/timeline/TimelineLayout.svelte.d.ts +1 -1
- package/dist/layout/tooltip/Tooltip.svelte +15 -0
- package/dist/layout/tooltip/Tooltip.svelte.d.ts +7 -0
- package/dist/layout/tooltip/TooltipLayout.svelte +45 -0
- package/dist/layout/tooltip/TooltipLayout.svelte.d.ts +41 -0
- package/dist/layout/tooltip/controller.svelte.d.ts +4 -3
- package/dist/layout/tooltip/controller.svelte.js +5 -6
- package/dist/layout/tooltip/hover.svelte.d.ts +1 -1
- package/dist/layout/tooltip/hover.svelte.js +1 -1
- package/dist/layout/tooltip/utils.d.ts +2 -2
- package/dist/markers/ContourClipMarker.svelte +77 -0
- package/dist/markers/ContourClipMarker.svelte.d.ts +10 -0
- package/dist/{plots/markers → markers}/DeltaMarker.svelte +4 -4
- package/dist/{plots/markers → markers}/DeltaMarker.svelte.d.ts +3 -3
- package/dist/{plots/markers → markers}/DotMarker.svelte +3 -3
- package/dist/{plots/markers → markers}/DotMarker.svelte.d.ts +3 -3
- package/dist/markers/HoverMarker.svelte +136 -0
- package/dist/{plots/markers → markers}/HoverMarker.svelte.d.ts +4 -4
- package/dist/{plots/markers → markers}/PeakMarker.svelte +2 -2
- package/dist/{plots/markers → markers}/PeakMarker.svelte.d.ts +2 -2
- package/dist/{plots/markers → markers}/TextMarker.svelte +11 -4
- package/dist/{plots/markers → markers}/TextMarker.svelte.d.ts +3 -3
- package/dist/markers/inset/InsetMarker.svelte +170 -0
- package/dist/markers/inset/InsetMarker.svelte.d.ts +51 -0
- package/dist/markers/inset/insetLayout.d.ts +25 -0
- package/dist/markers/inset/insetLayout.js +39 -0
- package/dist/markers/inset/insetProjection.d.ts +8 -0
- package/dist/markers/inset/insetProjection.js +39 -0
- package/dist/plots/bar/BarSegments.svelte +69 -0
- package/dist/plots/bar/BarSegments.svelte.d.ts +40 -0
- package/dist/plots/bar/Plot.svelte +140 -74
- package/dist/plots/bar/Plot.svelte.d.ts +7 -3
- package/dist/plots/bar/ValueLabels.svelte +89 -0
- package/dist/plots/bar/ValueLabels.svelte.d.ts +39 -0
- package/dist/plots/bar/hoverPoints.d.ts +15 -0
- package/dist/plots/bar/hoverPoints.js +35 -0
- package/dist/plots/bar/layout.svelte.d.ts +37 -0
- package/dist/plots/bar/layout.svelte.js +132 -0
- package/dist/plots/geo/Plot.svelte +577 -0
- package/dist/plots/geo/Plot.svelte.d.ts +29 -0
- package/dist/plots/geo/TileLayer.svelte +77 -0
- package/dist/plots/geo/TileLayer.svelte.d.ts +11 -0
- package/dist/plots/geo/projections/argentina.d.ts +8 -0
- package/dist/plots/geo/projections/argentina.js +35 -0
- package/dist/plots/geo/projections/fit.d.ts +8 -0
- package/dist/plots/geo/projections/fit.js +14 -0
- package/dist/plots/geo/rotate.svelte.d.ts +26 -0
- package/dist/plots/geo/rotate.svelte.js +79 -0
- package/dist/plots/geo/zoom.svelte.d.ts +32 -0
- package/dist/plots/geo/zoom.svelte.js +50 -0
- package/dist/plots/heatmap/Plot.svelte +171 -58
- package/dist/plots/heatmap/Plot.svelte.d.ts +7 -3
- package/dist/plots/line/Plot.svelte +67 -30
- package/dist/plots/line/Plot.svelte.d.ts +7 -3
- package/dist/plots/pyramid/Plot.svelte +88 -35
- package/dist/plots/pyramid/Plot.svelte.d.ts +7 -3
- package/dist/plots/utils/delta.d.ts +1 -1
- package/dist/plots/utils/geoAccessors.d.ts +64 -0
- package/dist/plots/utils/geoAccessors.js +188 -0
- package/dist/plots/utils/geoSegments.d.ts +14 -0
- package/dist/plots/utils/geoSegments.js +17 -0
- package/dist/plots/utils/legendDisabled.d.ts +15 -0
- package/dist/plots/utils/legendDisabled.js +41 -0
- package/dist/plots/utils/segments.d.ts +14 -5
- package/dist/plots/utils/segments.js +25 -13
- package/dist/plots/utils/tiles.d.ts +89 -0
- package/dist/plots/utils/tiles.js +159 -0
- package/dist/plots/utils/topojson.d.ts +9 -0
- package/dist/plots/utils/topojson.js +30 -0
- package/dist/types/charts/common.d.ts +2 -1
- package/dist/types/charts/legend.d.ts +32 -1
- package/dist/types/charts/props.d.ts +9 -6
- package/dist/types/configuration/styling.d.ts +13 -5
- package/dist/types/layout/legend.d.ts +26 -0
- package/dist/types/layout/tooltip.d.ts +14 -21
- package/dist/types/{plots/markers.d.ts → markers/common.d.ts} +2 -18
- package/dist/types/markers/geo.d.ts +237 -0
- package/dist/types/markers/props.d.ts +11 -0
- package/dist/types/markers/props.js +1 -0
- package/dist/types/plots/axis.d.ts +55 -0
- package/dist/types/plots/axis.js +1 -0
- package/dist/types/plots/constants.d.ts +30 -0
- package/dist/types/plots/constants.js +1 -0
- package/dist/types/plots/data/common.d.ts +40 -0
- package/dist/types/plots/data/common.js +1 -0
- package/dist/types/plots/data/geo.d.ts +74 -0
- package/dist/types/plots/data/geo.js +1 -0
- package/dist/types/plots/delta.d.ts +2 -2
- package/dist/types/plots/props.d.ts +105 -16
- package/dist/types/plots/scales/geo.d.ts +44 -0
- package/dist/types/plots/scales/geo.js +1 -0
- package/dist/types/plots/segments/common.d.ts +25 -0
- package/dist/types/plots/segments/common.js +1 -0
- package/dist/types/plots/segments/config.d.ts +51 -0
- package/dist/types/plots/segments/config.js +1 -0
- package/dist/types/plots/styles/common.d.ts +37 -0
- package/dist/types/plots/styles/common.js +1 -0
- package/dist/types/plots/styles/geo.d.ts +42 -0
- package/dist/types/plots/styles/geo.js +1 -0
- package/dist/types/plots/styling.d.ts +45 -0
- package/dist/types/plots/styling.js +1 -0
- package/dist/utils/grouping.d.ts +2 -1
- package/dist/utils/interpolate.d.ts +2 -1
- package/package.json +27 -13
- package/dist/layout/plot/PlotLayout.svelte +0 -294
- package/dist/layout/plot/PlotLayout.svelte.d.ts +0 -70
- package/dist/plots/markers/HoverMarker.svelte +0 -98
- package/dist/types/plots/common.d.ts +0 -97
- package/dist/types/plots/styles.d.ts +0 -187
- /package/dist/types/{plots/common.js → layout/legend.js} +0 -0
- /package/dist/types/{plots/markers.js → markers/common.js} +0 -0
- /package/dist/types/{plots/styles.js → markers/geo.js} +0 -0
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import type { AxisValue, Series } from './common';
|
|
2
|
-
/**
|
|
3
|
-
* Unified positional anchor for value labels across all plot kinds.
|
|
4
|
-
*
|
|
5
|
-
* - `'outside'` — beyond the tip of the mark (above a vertical bar, to the
|
|
6
|
-
* far end of a horizontal bar or line). This is the only value with no
|
|
7
|
-
* direct svelteplot equivalent; the plot computes dx/dy internally.
|
|
8
|
-
* - `'start'` — at the tip of the mark, just inside (top of a bar, far end
|
|
9
|
-
* of a pyramid bar from zero, right of a line's last point).
|
|
10
|
-
* - `'middle'` — centred on the mark.
|
|
11
|
-
* - `'end'` — at the baseline/zero end of the mark.
|
|
12
|
-
*/
|
|
13
|
-
export type ValueAnchor = 'outside' | 'start' | 'middle' | 'end';
|
|
14
|
-
/**
|
|
15
|
-
* Controls if and how value labels are rendered on a plot. The high-level
|
|
16
|
-
* `anchor` sets sensible defaults for placement; the low-level svelteplot
|
|
17
|
-
* Text-mark fields (`dx`, `dy`, `textAnchor`, `lineAnchor`, `lineHeight`,
|
|
18
|
-
* `rotate`, `class`, `textClass`) override those defaults when provided.
|
|
19
|
-
*/
|
|
20
|
-
export type ValuesStyle = {
|
|
21
|
-
show?: boolean;
|
|
22
|
-
anchor?: ValueAnchor;
|
|
23
|
-
/** Called with the numeric value and the series name. Return a string to render. */
|
|
24
|
-
format?: (value: number, seriesName: string) => string;
|
|
25
|
-
dx?: number;
|
|
26
|
-
dy?: number;
|
|
27
|
-
textAnchor?: 'start' | 'end' | 'middle';
|
|
28
|
-
lineAnchor?: 'top' | 'bottom' | 'middle';
|
|
29
|
-
lineHeight?: number;
|
|
30
|
-
rotate?: number;
|
|
31
|
-
class?: string;
|
|
32
|
-
textClass?: string;
|
|
33
|
-
};
|
|
34
|
-
/**
|
|
35
|
-
* Color overrides for plots that derive their palette from data.
|
|
36
|
-
* Each plot uses only the fields relevant to its kind; unused fields are
|
|
37
|
-
* silently ignored.
|
|
38
|
-
*
|
|
39
|
-
* - `min` / `max` — sequential colour ramp endpoints (heatmap).
|
|
40
|
-
* - `left` / `right` — diverging bar sides (pyramid).
|
|
41
|
-
*/
|
|
42
|
-
export type ColorsStyle = {
|
|
43
|
-
min?: string;
|
|
44
|
-
max?: string;
|
|
45
|
-
left?: string;
|
|
46
|
-
right?: string;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Top-level rendering style overrides shared by all plot kinds. Passed as the
|
|
50
|
-
* `styles` prop. Each plot reads only the fields it cares about.
|
|
51
|
-
*/
|
|
52
|
-
export type PlotStyles = {
|
|
53
|
-
values?: ValuesStyle;
|
|
54
|
-
colors?: ColorsStyle;
|
|
55
|
-
};
|
|
56
|
-
export type SymbolType = 'circle' | 'square' | 'triangle' | 'line';
|
|
57
|
-
export type LineStyle = 'solid' | 'dashed' | 'dotted' | 'dashdot';
|
|
58
|
-
export type LineCap = 'butt' | 'round' | 'square';
|
|
59
|
-
export type LineJoin = 'arcs' | 'bevel' | 'miter' | 'miter-clip' | 'round';
|
|
60
|
-
/** Stroke styling for any line-ish mark — a line, a rule, a marker's connector. */
|
|
61
|
-
export type StrokeStyle = {
|
|
62
|
-
stroke?: string;
|
|
63
|
-
strokeWidth?: number;
|
|
64
|
-
strokeOpacity?: number;
|
|
65
|
-
strokeDasharray?: string | LineStyle;
|
|
66
|
-
strokeLinecap?: LineCap;
|
|
67
|
-
strokeLinejoin?: LineJoin;
|
|
68
|
-
};
|
|
69
|
-
/**
|
|
70
|
-
* Dot styling for any point mark — a line's endpoint dots, a marker's dot.
|
|
71
|
-
* Carries its own `dotStroke*` fields rather than nesting a {@link StrokeStyle},
|
|
72
|
-
* because a dot's outline is a distinct style from the stroke of the line (or
|
|
73
|
-
* other mark) it sits next to — e.g. a {@link LineSegmentStyle} styles its
|
|
74
|
-
* line's stroke and its dots' outline independently.
|
|
75
|
-
*/
|
|
76
|
-
export type DotStyle = {
|
|
77
|
-
dotRadius?: number;
|
|
78
|
-
dotFill?: string;
|
|
79
|
-
dotFillOpacity?: number;
|
|
80
|
-
dotSymbol?: SymbolType;
|
|
81
|
-
dotStroke?: string;
|
|
82
|
-
dotStrokeWidth?: number;
|
|
83
|
-
dotStrokeOpacity?: number;
|
|
84
|
-
dotStrokeDasharray?: string | LineStyle;
|
|
85
|
-
};
|
|
86
|
-
/** Text/label styling for any text mark — a marker's label, an annotation. */
|
|
87
|
-
export type FontStyle = {
|
|
88
|
-
fill?: string;
|
|
89
|
-
fontSize?: number;
|
|
90
|
-
fontWeight?: 'normal' | 'bold';
|
|
91
|
-
fontStyle?: 'normal' | 'italic';
|
|
92
|
-
textAnchor?: 'start' | 'middle' | 'end';
|
|
93
|
-
lineAnchor?: 'top' | 'middle' | 'bottom';
|
|
94
|
-
stroke?: string;
|
|
95
|
-
strokeWidth?: number;
|
|
96
|
-
paintOrder?: string;
|
|
97
|
-
dx?: number;
|
|
98
|
-
dy?: number;
|
|
99
|
-
};
|
|
100
|
-
/** Per-segment styling for a line: its stroke and/or its endpoint dots. */
|
|
101
|
-
export type LineSegmentStyle = {
|
|
102
|
-
stroke?: StrokeStyle;
|
|
103
|
-
dots?: DotStyle;
|
|
104
|
-
};
|
|
105
|
-
/** Per-segment styling for a bar: its fill. */
|
|
106
|
-
export type BarSegmentStyle = {
|
|
107
|
-
fill?: string;
|
|
108
|
-
fillOpacity?: number;
|
|
109
|
-
};
|
|
110
|
-
/** Per-cell styling override for a heatmap cell. */
|
|
111
|
-
export type CellSegmentStyle = {
|
|
112
|
-
fill?: string;
|
|
113
|
-
fillOpacity?: number;
|
|
114
|
-
stroke?: string;
|
|
115
|
-
strokeWidth?: number;
|
|
116
|
-
};
|
|
117
|
-
/** A half-open interval on one axis. Both bounds are inclusive; omit either to leave that end open. */
|
|
118
|
-
export type Range = {
|
|
119
|
-
from?: AxisValue;
|
|
120
|
-
to?: AxisValue;
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* A 2-D rectangular area on the plot, addressed by optional x and y intervals.
|
|
124
|
-
* Omitting an interval leaves that axis unrestricted (matches all values).
|
|
125
|
-
*
|
|
126
|
-
* - For line/bar/pyramid plots only the `x` interval is used (the series' primary
|
|
127
|
-
* axis); `y` is evaluated but filters by the series' value axis.
|
|
128
|
-
* - For heatmaps both `x` (column) and `y` (row) are used to address cells.
|
|
129
|
-
*/
|
|
130
|
-
export type Area = {
|
|
131
|
-
x?: Range;
|
|
132
|
-
y?: Range;
|
|
133
|
-
};
|
|
134
|
-
/**
|
|
135
|
-
* One styled rule for a plot. A data point (or cell) is styled when it falls
|
|
136
|
-
* inside **any** of the listed `areas`. Omitting `areas` (or passing an empty
|
|
137
|
-
* array) makes the segment a catch-all that matches every data point — useful
|
|
138
|
-
* as a baseline style. `TStyle` is the per-mark shape ({@link LineSegmentStyle},
|
|
139
|
-
* {@link BarSegmentStyle}, {@link CellSegmentStyle}, …).
|
|
140
|
-
*
|
|
141
|
-
* Catch-alls are evaluated last so that area-specific segments always take
|
|
142
|
-
* priority, regardless of their position in the list. A catch-all placed first
|
|
143
|
-
* therefore acts as a fallback baseline that area-specific segments override.
|
|
144
|
-
*/
|
|
145
|
-
export type Segment<TStyle> = {
|
|
146
|
-
areas?: Area[];
|
|
147
|
-
style?: TStyle;
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* The `segments` prop accepted by every plot kind.
|
|
151
|
-
*
|
|
152
|
-
* A record mapping series names (or `'default'` for all series) to lists of
|
|
153
|
-
* {@link Segment}s. Segments in a named key apply only to that series;
|
|
154
|
-
* segments under `'default'` apply to every series.
|
|
155
|
-
*
|
|
156
|
-
* ```ts
|
|
157
|
-
* segments: {
|
|
158
|
-
* female: [{ style: { stroke: { stroke: 'tomato' } } }], // catch-all for female
|
|
159
|
-
* male: [{ style: { stroke: { stroke: 'steelblue' } } }], // catch-all for male
|
|
160
|
-
* default: [{ areas: [{ x: { from: 2012, to: 2014 } }], style: { dots: { dotSymbol: 'circle' } } }],
|
|
161
|
-
* }
|
|
162
|
-
* ```
|
|
163
|
-
*
|
|
164
|
-
* Within each resolved series list, catch-alls (no `areas`) are evaluated last
|
|
165
|
-
* so that area-specific segments always override them, regardless of position.
|
|
166
|
-
* Area-specific segments also inherit any style key absent from their own style
|
|
167
|
-
* by merging the catch-all as a baseline — the area's own style wins on conflict.
|
|
168
|
-
* This lets you set a series colour once in a catch-all and add per-range dots
|
|
169
|
-
* or dash patterns without repeating the colour on every area segment.
|
|
170
|
-
*/
|
|
171
|
-
export type Segments<TStyle> = Record<string, Segment<TStyle>[]>;
|
|
172
|
-
/** One contiguous, styled slice of a series' data — ready to draw as its own mark. */
|
|
173
|
-
export type VisualSegment<T extends Record<string, unknown>, TStyle = LineSegmentStyle> = {
|
|
174
|
-
data: T[];
|
|
175
|
-
style: TStyle;
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* A series split into its styled visual segments. `S` is the full series
|
|
179
|
-
* type Series<T> — its row type is read off `S['data']`
|
|
180
|
-
* rather than taken as a separate parameter, since TypeScript can't reliably
|
|
181
|
-
* infer a type parameter that only appears inside another parameter's
|
|
182
|
-
* constraint.
|
|
183
|
-
*/
|
|
184
|
-
export type VisualGroup<S extends Series<any>, TStyle = LineSegmentStyle> = {
|
|
185
|
-
series: S;
|
|
186
|
-
visualSegments: VisualSegment<S['data'][number], TStyle>[];
|
|
187
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|