@graphysdk/viz-engine 0.0.1-plugins.9 → 1.8.1-beta.1786024899180
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/LICENSE.md +17 -0
- package/README.md +25 -1
- package/dist/config.types-CQX-tSXl.cjs +1 -0
- package/dist/config.types-uM8CYfC1.js +1951 -0
- package/dist/graph-config.cjs +1 -0
- package/dist/graph-config.d.ts +2569 -0
- package/dist/graph-config.mjs +966 -0
- package/dist/index.cjs +22 -38
- package/dist/index.d.ts +6418 -2717
- package/dist/index.mjs +11358 -8471
- package/package.json +22 -5
|
@@ -0,0 +1,2569 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps each aesthetic to a variable or constant value. The built-in channels (x, y, color, …) keep
|
|
3
|
+
* exact types and autocomplete; the index signature also admits a geom's **custom positional
|
|
4
|
+
* aesthetics** — an OHLC candlestick's `open`/`high`/`low`/`close` — which the geom declares on its
|
|
5
|
+
* position contract and the engine then trains and scales like a built-in channel.
|
|
6
|
+
*/
|
|
7
|
+
declare interface AesMapping extends KnownAesthetics {
|
|
8
|
+
[aesthetic: string]: AestheticValue | undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Aesthetic value can be:
|
|
13
|
+
* - string (shorthand for { variable: string })
|
|
14
|
+
* - { variable: string } (explicit variable mapping)
|
|
15
|
+
* - { value: DataValue } (constant value applied to every observation)
|
|
16
|
+
*/
|
|
17
|
+
declare type AestheticValue = string | VariableMapping | ValueMapping;
|
|
18
|
+
|
|
19
|
+
/***************************************************************
|
|
20
|
+
* Aggregate Transform
|
|
21
|
+
***************************************************************/
|
|
22
|
+
declare interface AggregateOperation {
|
|
23
|
+
/** The aggregation function to apply. */
|
|
24
|
+
op: AggregationFunction;
|
|
25
|
+
/** The variable to aggregate. */
|
|
26
|
+
variableName: VariableName;
|
|
27
|
+
/** The name of the output variable. */
|
|
28
|
+
as: VariableName;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
declare interface AggregateOptions {
|
|
32
|
+
/** Variables to group by before aggregating. */
|
|
33
|
+
groupby: VariableName[];
|
|
34
|
+
/** Aggregation operations to apply per group. */
|
|
35
|
+
operations: AggregateOperation[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare interface AggregateTransformInput {
|
|
39
|
+
type: 'transform';
|
|
40
|
+
transformType: 'aggregate';
|
|
41
|
+
options: AggregateOptions;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A function that aggregates a variable's values. */
|
|
45
|
+
declare type AggregationFunction = 'count' | 'sum' | 'mean' | 'median' | 'mode' | 'min' | 'max';
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Which point of a target's box an anchor resolves to. Compass directions name the
|
|
49
|
+
* eight edge/corner points; `center` is the box centre. Omitted means the geom-natural
|
|
50
|
+
* point (e.g. a bar's top-edge midpoint).
|
|
51
|
+
*/
|
|
52
|
+
declare type AnchorAlign = 'center' | 'top' | 'right' | 'bottom' | 'left' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* A nudge applied after a target resolves. `unit` selects the frame: `'panel'` is a
|
|
56
|
+
* fraction of the plot rect, `'px'` is device pixels (resolved at runtime).
|
|
57
|
+
*/
|
|
58
|
+
declare interface AnchorOffset {
|
|
59
|
+
x?: number;
|
|
60
|
+
y?: number;
|
|
61
|
+
/** Defaults to `'panel'`. */
|
|
62
|
+
unit?: 'panel' | 'px';
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Anchors an annotation to a data point by row position, column, and/or category value. */
|
|
66
|
+
export declare interface AnnotationDataPoint {
|
|
67
|
+
rowIndex?: number;
|
|
68
|
+
columnKey?: string;
|
|
69
|
+
rowValue?: DataValue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* A point on the box of the annotation with id `ref`, reduced to the box-point named by `align`.
|
|
74
|
+
* Dropped on a missing ref or a reference cycle. Nothing to resolve, so the input and resolved unions
|
|
75
|
+
* share this type.
|
|
76
|
+
*/
|
|
77
|
+
declare interface AnnotationPointAnchor {
|
|
78
|
+
anchorType: 'annotation';
|
|
79
|
+
/** Explicit id of the target annotation. */
|
|
80
|
+
ref: string;
|
|
81
|
+
align?: AnchorAlign;
|
|
82
|
+
offset?: AnchorOffset;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Copies the box of the annotation with id `ref`. Dropped on a missing ref, a cycle, or a zero-area
|
|
87
|
+
* (point) target. Nothing to resolve, so the input and resolved unions share this type.
|
|
88
|
+
*/
|
|
89
|
+
declare interface AnnotationRegionAnchor {
|
|
90
|
+
anchorType: 'annotation';
|
|
91
|
+
/** Explicit id of the target annotation. */
|
|
92
|
+
ref: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** All annotations attached to a graph, as user-facing input. */
|
|
96
|
+
declare interface AnnotationsInput {
|
|
97
|
+
differenceArrows?: DifferenceArrowInput[];
|
|
98
|
+
shapes?: ShapeInput[];
|
|
99
|
+
arrows?: ArrowInput[];
|
|
100
|
+
textAnnotations?: TextAnnotationInput[];
|
|
101
|
+
images?: ImageAnnotationInput[];
|
|
102
|
+
stickers?: StickerAnnotationInput[];
|
|
103
|
+
pinnedNumbers?: PinnedNumberAnnotationInput[];
|
|
104
|
+
comments?: CommentAnnotationInput[];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Whether an annotation renders beneath the geoms (background) or on top (foreground).
|
|
109
|
+
*/
|
|
110
|
+
declare type AnnotationZOrder = 'background' | 'foreground';
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* A transform input that may be built-in or custom. Used at the spec-construction boundary
|
|
114
|
+
* (`pipe`/`createSpec` items, `SpecInput.transforms`) and the transform compile stage, so a custom
|
|
115
|
+
* transform pipes in and applies through the registry — while {@link TransformInput} stays the clean
|
|
116
|
+
* built-in union everywhere a `transformType` is narrowed.
|
|
117
|
+
*/
|
|
118
|
+
declare type AnyTransformInput = TransformInput | CustomTransformInput<string>;
|
|
119
|
+
|
|
120
|
+
export declare interface Appearance {
|
|
121
|
+
/** Id of the color palette to apply to all series. */
|
|
122
|
+
paletteId?: string;
|
|
123
|
+
/** Per-series style overrides, keyed by series id. */
|
|
124
|
+
seriesStyles?: Record<string, SeriesStyle>;
|
|
125
|
+
/** Colors all bars the same instead of giving each category its own palette color. */
|
|
126
|
+
useSingleColorForBars?: boolean;
|
|
127
|
+
/** Tints the graph background with the palette instead of leaving it plain. */
|
|
128
|
+
backgroundModifier?: 'none' | 'tint';
|
|
129
|
+
border?: Partial<{
|
|
130
|
+
style: 'none' | 'custom' | 'tinted' | 'gradient' | 'preset' | 'grey';
|
|
131
|
+
color: string;
|
|
132
|
+
width: number;
|
|
133
|
+
}>;
|
|
134
|
+
hasRoundedCorners?: boolean;
|
|
135
|
+
textStyle?: AppearanceTextStyle;
|
|
136
|
+
/** One of the {@link CHART_TEXT_SCALES} multipliers applied to all text sizes. */
|
|
137
|
+
textScale?: number;
|
|
138
|
+
/** How non-highlighted series are de-emphasized when one series is highlighted. */
|
|
139
|
+
highlightStyle?: 'grey' | 'fade-color';
|
|
140
|
+
isLogoHidden?: boolean;
|
|
141
|
+
numberFormat?: Partial<{
|
|
142
|
+
/** Fixed number of decimal places, or 'auto' to choose per value. */
|
|
143
|
+
decimalPlaces: 'auto' | number;
|
|
144
|
+
/** Large-number suffix: none, automatic, or a forced thousands/millions/billions unit. */
|
|
145
|
+
abbreviation: 'none' | 'auto' | 'k' | 'm' | 'b';
|
|
146
|
+
}>;
|
|
147
|
+
showTooltips?: boolean;
|
|
148
|
+
animateTransitions?: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Visual appearance settings that travel through the spec but only affect
|
|
153
|
+
* rendering (not data, scales, or layout math).
|
|
154
|
+
*/
|
|
155
|
+
declare interface AppearanceSpec {
|
|
156
|
+
/**
|
|
157
|
+
* Multiplier applied to every text element. The renderer sets a CSS
|
|
158
|
+
* variable; em-based theme tokens scale automatically.
|
|
159
|
+
*
|
|
160
|
+
* Renderer contract: apply this at both text measurement and CSS render time.
|
|
161
|
+
* The engine assumes the measured sizes it receives already include the
|
|
162
|
+
* multiplier, so layout will be wrong if it is applied to only one of the two.
|
|
163
|
+
* @default 1
|
|
164
|
+
*/
|
|
165
|
+
textScale: number;
|
|
166
|
+
/**
|
|
167
|
+
* Chart background fill. Defaults to the theme's `graphBackground` token.
|
|
168
|
+
* @default { type: 'theme' }
|
|
169
|
+
*/
|
|
170
|
+
background: BackgroundSpec;
|
|
171
|
+
/**
|
|
172
|
+
* Border ring painted inside the chart bounds. Defaults to no border.
|
|
173
|
+
* @default { type: 'none' }
|
|
174
|
+
*/
|
|
175
|
+
border: BorderSpec;
|
|
176
|
+
/**
|
|
177
|
+
* Corner radius (px) applied to both the chart frame and its inner content.
|
|
178
|
+
* Use `0` for square corners.
|
|
179
|
+
* @default 8
|
|
180
|
+
*/
|
|
181
|
+
cornerRadius: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Font and color overrides split by text role: `heading` covers titles, `body` covers all other chart text. */
|
|
185
|
+
export declare type AppearanceTextStyle = Partial<{
|
|
186
|
+
heading: GraphTextStyle;
|
|
187
|
+
body: GraphTextStyle;
|
|
188
|
+
}>;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Area-specific parameters.
|
|
192
|
+
*/
|
|
193
|
+
declare interface AreaGeomParams {
|
|
194
|
+
/**
|
|
195
|
+
* Interpolation method between points — a d3-shape curve family (`'linear'` ⇒
|
|
196
|
+
* `curveLinear`, `'catmull-rom'` ⇒ `curveCatmullRom`).
|
|
197
|
+
* @default 'linear'
|
|
198
|
+
*/
|
|
199
|
+
interpolate: InterpolateType;
|
|
200
|
+
/**
|
|
201
|
+
* How to handle missing (null/undefined) values. As for line:
|
|
202
|
+
* - `'zero'`: nulls arrive already substituted with zero by the compiler.
|
|
203
|
+
* - `'gap'`: break the path at a null.
|
|
204
|
+
* - `'connect'`: drop nulls before pathing so the line spans the gap.
|
|
205
|
+
* @default 'gap'
|
|
206
|
+
* */
|
|
207
|
+
missingValues: MissingValuesType;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* The paint vocabulary of the area geom — the shared paint plus the outline's width, dash, and
|
|
212
|
+
* opacity. `alpha` is the fill's opacity; `strokeAlpha` the outline's.
|
|
213
|
+
*/
|
|
214
|
+
declare type AreaStyleDeclarations = Pick<StyleDeclarations, 'color' | 'alpha' | 'saturation' | 'strokeWidth' | 'lineType' | 'strokeAlpha'>;
|
|
215
|
+
|
|
216
|
+
/** Whether an arrow end carries an arrowhead. */
|
|
217
|
+
declare type ArrowheadStyle = 'none' | 'line-arrow';
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Arrow annotation. Each endpoint is a {@link PointAnchorInput}, so it can float in
|
|
221
|
+
* panel fractions or pin to an observation. Distinct from {@link DifferenceArrowInput},
|
|
222
|
+
* which reads the measured gap between two observations.
|
|
223
|
+
*/
|
|
224
|
+
declare interface ArrowInput {
|
|
225
|
+
id?: string;
|
|
226
|
+
/** Tail endpoint. */
|
|
227
|
+
start: PointAnchorInput;
|
|
228
|
+
/** Head endpoint. */
|
|
229
|
+
end: PointAnchorInput;
|
|
230
|
+
/** null falls back to the theme `defaultAnnotationArrowStroke`. */
|
|
231
|
+
color?: string | null;
|
|
232
|
+
thickness?: ArrowThickness;
|
|
233
|
+
startArrowheadStyle?: ArrowheadStyle;
|
|
234
|
+
endArrowheadStyle?: ArrowheadStyle;
|
|
235
|
+
lineStyle?: ArrowLineStyle;
|
|
236
|
+
/** Render with a raised, outlined sticker-like appearance. */
|
|
237
|
+
hasStickerStyle?: boolean;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Whether an arrow's line is drawn solid or dashed. */
|
|
241
|
+
declare type ArrowLineStyle = 'solid' | 'dashed';
|
|
242
|
+
|
|
243
|
+
/** Preset stroke weight for an arrow annotation. */
|
|
244
|
+
declare type ArrowThickness = 'thin' | 'medium' | 'thick';
|
|
245
|
+
|
|
246
|
+
export declare interface AverageLine {
|
|
247
|
+
/** Column whose mean value the average line is drawn at. */
|
|
248
|
+
columnKey: string;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** Configuration for the axes (if the graph supports them). */
|
|
252
|
+
export declare interface Axes {
|
|
253
|
+
x?: AxisOptions;
|
|
254
|
+
y?: AxisOptions;
|
|
255
|
+
/** Secondary (right-hand) y-axis; only its label is configurable. */
|
|
256
|
+
y2?: Pick<AxisOptions, 'label'>;
|
|
257
|
+
/** Splits series across a primary and secondary y-axis. */
|
|
258
|
+
hasDualYAxis?: boolean;
|
|
259
|
+
showGridLines?: boolean;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Axes configuration (after defaults applied)
|
|
264
|
+
* Groups all axis-related settings per axis.
|
|
265
|
+
*/
|
|
266
|
+
declare interface AxesConfig {
|
|
267
|
+
x: XAxisConfig;
|
|
268
|
+
y: YAxisConfig;
|
|
269
|
+
ySecondary?: SecondaryAxisOverride;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* A point given as axis values, mapped through the position scales. Dropped when either coordinate
|
|
274
|
+
* fails to map: a value outside a discrete scale's domain, a missing scale, or a polar coord.
|
|
275
|
+
* Nothing to resolve, so the input and resolved unions share this type.
|
|
276
|
+
*/
|
|
277
|
+
declare interface AxisAnchor {
|
|
278
|
+
anchorType: 'axis';
|
|
279
|
+
x: DataValue;
|
|
280
|
+
y: DataValue;
|
|
281
|
+
align?: AnchorAlign;
|
|
282
|
+
offset?: AnchorOffset;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Configuration for a single axis's grid lines
|
|
287
|
+
*/
|
|
288
|
+
declare interface AxisGridConfig {
|
|
289
|
+
/**
|
|
290
|
+
* Whether grid lines are visible.
|
|
291
|
+
* - true/false: explicit visibility
|
|
292
|
+
* - null: let the compiler decide based on geom/coord policies
|
|
293
|
+
* (visible unless a geom policy hides it, e.g. bar charts hide the x grid)
|
|
294
|
+
*/
|
|
295
|
+
isVisible: boolean | null;
|
|
296
|
+
/**
|
|
297
|
+
* Line style of this axis's grid lines.
|
|
298
|
+
* @default 'dashed'
|
|
299
|
+
*/
|
|
300
|
+
lineStyle: LineStyleType;
|
|
301
|
+
/**
|
|
302
|
+
* Stroke width of this axis's grid lines in px. null inherits the theme's grid line width.
|
|
303
|
+
* @default null
|
|
304
|
+
*/
|
|
305
|
+
lineWidth: number | null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export declare interface AxisOptions {
|
|
309
|
+
label?: string;
|
|
310
|
+
isHidden?: boolean;
|
|
311
|
+
/** Flips the axis orientation (left↔right for y, top↔bottom for x); for combo graphs it swaps the two y-axes. */
|
|
312
|
+
isReversed?: boolean;
|
|
313
|
+
scaleType?: 'linear' | 'logarithmic';
|
|
314
|
+
/** Forces the lower bound of the axis domain instead of deriving it from the data. */
|
|
315
|
+
min?: number;
|
|
316
|
+
/** Forces the upper bound of the axis domain instead of deriving it from the data. */
|
|
317
|
+
max?: number;
|
|
318
|
+
/** Whether to show ticks at every step ('auto') or only at the domain edges ('edges'). */
|
|
319
|
+
tickDisplayMode?: 'auto' | 'edges';
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
declare type AxisPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
|
+
* Display mode for axis ticks
|
|
326
|
+
* - 'auto': Show all ticks (default behavior)
|
|
327
|
+
* - 'edges': Show only the first and last tick
|
|
328
|
+
*/
|
|
329
|
+
declare type AxisTickMode = 'auto' | 'edges';
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Configuration for a single axis's ticks
|
|
333
|
+
*/
|
|
334
|
+
declare interface AxisTicksConfig {
|
|
335
|
+
isVisible: boolean;
|
|
336
|
+
mode: AxisTickMode;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Background fill behind the chart.
|
|
341
|
+
* - 'theme': inherit the active theme's `graphBackground` token (default).
|
|
342
|
+
* - 'solid': override with an explicit CSS color string (use `'transparent'` for no fill).
|
|
343
|
+
* - 'tinted': mix the theme background with an anchor color. When `color` is
|
|
344
|
+
* omitted the compiler resolves it to the first color of the active palette.
|
|
345
|
+
*/
|
|
346
|
+
declare type BackgroundSpec = {
|
|
347
|
+
type: 'theme';
|
|
348
|
+
} | {
|
|
349
|
+
type: 'solid';
|
|
350
|
+
color: string;
|
|
351
|
+
} | {
|
|
352
|
+
type: 'tinted';
|
|
353
|
+
color?: string;
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Bar/Column-specific parameters. `width` is geometry — it sets the band envelope the compiler
|
|
358
|
+
* writes into the position variables. Paint (fill, border, corner rounding) is not a param: it
|
|
359
|
+
* lives in the stylesheet (`spec.styles`), resolved per observation by the style resolver.
|
|
360
|
+
*/
|
|
361
|
+
declare interface BarGeomParams {
|
|
362
|
+
/**
|
|
363
|
+
* Bar width as a fraction of the band the discrete scale allocates to the category, in `(0, 1]`.
|
|
364
|
+
* @default 0.7
|
|
365
|
+
*/
|
|
366
|
+
width: number;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
declare interface BarOptions {
|
|
370
|
+
sortBars?: boolean;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/** The paint vocabulary of the bar geom — the shared paint plus corner rounding and a border. */
|
|
374
|
+
declare type BarStyleDeclarations = Pick<StyleDeclarations, 'color' | 'alpha' | 'saturation' | 'borderRadius' | 'borderColor' | 'borderWidth'>;
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Base params shared by all coordinate systems
|
|
378
|
+
*/
|
|
379
|
+
declare interface BaseCoordParams {
|
|
380
|
+
/**
|
|
381
|
+
* Limits for x-axis [min, max]
|
|
382
|
+
*/
|
|
383
|
+
xLimits: [number, number] | null;
|
|
384
|
+
/**
|
|
385
|
+
* Limits for y-axis [min, max]
|
|
386
|
+
*/
|
|
387
|
+
yLimits: [number, number] | null;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
/** Named gradient presets available to `border.type === 'preset'`. */
|
|
391
|
+
declare const BORDER_PRESETS: readonly ["lilac", "neon_pink", "blackberry", "sun", "iceland", "sunset", "ultraviolet", "purple", "ice_cream", "mint", "cool", "fresh"];
|
|
392
|
+
|
|
393
|
+
/** Name of a built-in gradient available to `border.type === 'preset'`. */
|
|
394
|
+
declare type BorderPreset = (typeof BORDER_PRESETS)[number];
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Named corner-rounding scale for geoms that paint rect-like shapes. Semantic rather than a pixel
|
|
398
|
+
* value so each coordinate system renders it in its own frame. `'none'` is square; `'full'` rounds
|
|
399
|
+
* to half the shape's cross-axis thickness (a pill for bars).
|
|
400
|
+
*/
|
|
401
|
+
declare type BorderRadiusToken = 'none' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full';
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* Border ring painted around the chart. The ring is drawn INSIDE the
|
|
405
|
+
* configured chart dimensions — increasing `width` shrinks the plot/panel
|
|
406
|
+
* area accordingly.
|
|
407
|
+
*
|
|
408
|
+
* - 'none': no border.
|
|
409
|
+
* - 'solid': fill the ring with `color` as-is. Pass a theme token (e.g.
|
|
410
|
+
* `'var(--graphy-grey-70)'`) for a theme-aware grey ring.
|
|
411
|
+
* - 'tinted': fill the ring with `color` lightened/darkened by the active
|
|
412
|
+
* color scheme. When `color` is omitted the compiler resolves it to the
|
|
413
|
+
* first color of the active palette.
|
|
414
|
+
* - 'gradient': fill the ring with a linear gradient derived from `color`,
|
|
415
|
+
* adjusted for the active color scheme. When `color` is omitted the
|
|
416
|
+
* compiler resolves it to the first color of the active palette.
|
|
417
|
+
* - 'preset': fill the ring with a named gradient from `BORDER_PRESETS`.
|
|
418
|
+
*/
|
|
419
|
+
declare type BorderSpec = {
|
|
420
|
+
type: 'none';
|
|
421
|
+
} | {
|
|
422
|
+
type: 'solid';
|
|
423
|
+
color: string;
|
|
424
|
+
width: number;
|
|
425
|
+
} | {
|
|
426
|
+
type: 'tinted';
|
|
427
|
+
color?: string;
|
|
428
|
+
width: number;
|
|
429
|
+
} | {
|
|
430
|
+
type: 'gradient';
|
|
431
|
+
color?: string;
|
|
432
|
+
width: number;
|
|
433
|
+
} | {
|
|
434
|
+
type: 'preset';
|
|
435
|
+
preset: BorderPreset;
|
|
436
|
+
width: number;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* The "Made with Graphy" provenance badge. A discovery signal (not a lock) — distinct from
|
|
441
|
+
* `source`, which is the user's own attribution.
|
|
442
|
+
*/
|
|
443
|
+
declare interface BrandMarkConfig {
|
|
444
|
+
enabled: boolean;
|
|
445
|
+
placement: BrandMarkPlacement;
|
|
446
|
+
variant: BrandMarkVariant;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Where the Graphy provenance badge anchors on the chart frame. */
|
|
450
|
+
declare type BrandMarkPlacement = 'footer' | 'header';
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Visual treatment for the badge when the frame is large enough for the full pill.
|
|
454
|
+
* Below 200 px wide the renderer always collapses to the circular mini form regardless.
|
|
455
|
+
*/
|
|
456
|
+
declare type BrandMarkVariant = 'full' | 'mini';
|
|
457
|
+
|
|
458
|
+
declare interface CartesianCoordInput {
|
|
459
|
+
type: 'coord';
|
|
460
|
+
coordType: 'cartesian';
|
|
461
|
+
params?: Partial<BaseCoordParams>;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Discrete text-size multipliers exposed to consumers. The renderer multiplies
|
|
466
|
+
* its base font-size by this value, so all em-based theme tokens scale together.
|
|
467
|
+
* */
|
|
468
|
+
export declare const CHART_TEXT_SCALES: readonly [0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.5, 3, 4];
|
|
469
|
+
|
|
470
|
+
export declare type ChartTextScale = (typeof CHART_TEXT_SCALES)[number];
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Colour interpolation space for an explicit ramp's stops. `'lab'` (perceptually near-uniform) is the
|
|
474
|
+
* engine default; `'rgb'` reproduces d3's own default output; `'hcl'` matches Vega-Lite's. Named schemes
|
|
475
|
+
* carry their own baked-in interpolation, so this never applies to them.
|
|
476
|
+
*/
|
|
477
|
+
declare const COLOR_INTERPOLATION_SPACES: readonly ["rgb", "lab", "hcl", "hsl"];
|
|
478
|
+
|
|
479
|
+
declare type ColorInterpolationSpace = (typeof COLOR_INTERPOLATION_SPACES)[number];
|
|
480
|
+
|
|
481
|
+
/** The light/dark axis a {@link LightDarkColor} resolves against. */
|
|
482
|
+
declare type ColorScheme = 'light' | 'dark';
|
|
483
|
+
|
|
484
|
+
/** Any named colour scheme accepted by a continuous colour scale. */
|
|
485
|
+
declare type ColorSchemeName = SequentialSchemeName | DivergingSchemeName;
|
|
486
|
+
|
|
487
|
+
declare interface ComboOptions {
|
|
488
|
+
/** Geometry used for the bar-like series alongside line series in a combo graph. */
|
|
489
|
+
comboType?: 'grouped-bars' | 'stacked-bars' | 'lines';
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Comment annotation: a marker dot pinned to a single observation, carrying
|
|
494
|
+
* rich-text content. The renderer's mini view shows a truncated comment; hover
|
|
495
|
+
* reveals the full text.
|
|
496
|
+
*/
|
|
497
|
+
declare interface CommentAnnotationInput {
|
|
498
|
+
id?: string;
|
|
499
|
+
at: ObservationAnchorInput;
|
|
500
|
+
content: RichTextContent;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** Comparison operators for declarative filtering. */
|
|
504
|
+
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
505
|
+
|
|
506
|
+
declare type ConfigInput = Omit<DeepPartial<ConfigSpec>, 'legend' | 'content'> & {
|
|
507
|
+
legend?: LegendConfigInput;
|
|
508
|
+
content?: ContentInput;
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
|
+
* Feature configuration with resolved defaults.
|
|
513
|
+
* All fields are required and always populated after resolution.
|
|
514
|
+
*/
|
|
515
|
+
declare interface ConfigSpec {
|
|
516
|
+
/**
|
|
517
|
+
* Locale used to interpret source values and, by default, to format display
|
|
518
|
+
* output (axis labels, tooltips, numbers). Pass `formattingLocale` to a
|
|
519
|
+
* `format*` helper to override display only. It resolves to
|
|
520
|
+
* `formattingLocale ?? parsingLocale`. The `duration` format is always
|
|
521
|
+
* English regardless of locale.
|
|
522
|
+
*/
|
|
523
|
+
parsingLocale: Locale;
|
|
524
|
+
legend: LegendConfig;
|
|
525
|
+
axes: AxesConfig;
|
|
526
|
+
panel: PanelConfig;
|
|
527
|
+
headline: HeadlineConfig;
|
|
528
|
+
numberFormat: NumberFormatConfig;
|
|
529
|
+
content: ContentConfig;
|
|
530
|
+
appearance: AppearanceSpec;
|
|
531
|
+
layout: LayoutConfig;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
/***************************************************************
|
|
535
|
+
* Constant Transform
|
|
536
|
+
***************************************************************/
|
|
537
|
+
declare interface ConstantOptions {
|
|
538
|
+
/** The name of the new variable. */
|
|
539
|
+
variableName: VariableName;
|
|
540
|
+
/** The type of the new variable. */
|
|
541
|
+
type: DataType;
|
|
542
|
+
/** The constant value to assign to every observation. */
|
|
543
|
+
value: DataValue;
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
declare interface ConstantTransformInput {
|
|
547
|
+
type: 'transform';
|
|
548
|
+
transformType: 'constant';
|
|
549
|
+
options: ConstantOptions;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/** Text content in the graph. */
|
|
553
|
+
export declare interface Content {
|
|
554
|
+
title?: string | RichTextContent;
|
|
555
|
+
isTitleHidden?: boolean;
|
|
556
|
+
subtitle?: string | RichTextContent;
|
|
557
|
+
isSubtitleHidden?: boolean;
|
|
558
|
+
caption?: string | RichTextContent;
|
|
559
|
+
isCaptionHidden?: boolean;
|
|
560
|
+
/** Attribution shown in the footer; optional label text and link target. */
|
|
561
|
+
source?: Partial<{
|
|
562
|
+
label: string;
|
|
563
|
+
url: string;
|
|
564
|
+
}>;
|
|
565
|
+
isSourceHidden?: boolean;
|
|
566
|
+
/**
|
|
567
|
+
* Structured "Made with Graphy" provenance badge. Prefer this over {@link isBrandMarkHidden}.
|
|
568
|
+
* Defaults: disabled at the low-level renderer; `@graphysdk/react` seeds enabled on.
|
|
569
|
+
*/
|
|
570
|
+
brandMark?: Partial<{
|
|
571
|
+
enabled: boolean;
|
|
572
|
+
placement: 'footer' | 'header';
|
|
573
|
+
variant: 'full' | 'mini';
|
|
574
|
+
}>;
|
|
575
|
+
/**
|
|
576
|
+
* Legacy opt-out for the provenance badge (`true` = hide). Inverted to `brandMark.enabled` /
|
|
577
|
+
* `isBrandMarkVisible`. Ignored when `brandMark.enabled` is set explicitly.
|
|
578
|
+
*/
|
|
579
|
+
isBrandMarkHidden?: boolean;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Resolved content configuration (all fields populated).
|
|
584
|
+
*
|
|
585
|
+
* `null` on a text slot means "no content set". The matching `isXVisible` flag
|
|
586
|
+
* is a separate visibility toggle that lets a value be preserved across show /
|
|
587
|
+
* hide cycles without losing the text the user typed.
|
|
588
|
+
*/
|
|
589
|
+
declare interface ContentConfig {
|
|
590
|
+
title: TextContent | null;
|
|
591
|
+
isTitleVisible: boolean;
|
|
592
|
+
subtitle: TextContent | null;
|
|
593
|
+
isSubtitleVisible: boolean;
|
|
594
|
+
caption: TextContent | null;
|
|
595
|
+
isCaptionVisible: boolean;
|
|
596
|
+
source: SourceContent | null;
|
|
597
|
+
isSourceVisible: boolean;
|
|
598
|
+
/**
|
|
599
|
+
* Structured provenance-badge config. Canonical source of truth for enabled /
|
|
600
|
+
* placement / variant after {@link resolveConfig}.
|
|
601
|
+
*/
|
|
602
|
+
brandMark: BrandMarkConfig;
|
|
603
|
+
/**
|
|
604
|
+
* Legacy alias for {@link BrandMarkConfig.enabled}. Kept in sync by resolveConfig so
|
|
605
|
+
* existing callers and the node-renderer path keep working. Prefer `brandMark.enabled`.
|
|
606
|
+
*/
|
|
607
|
+
isBrandMarkVisible: boolean;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/** Content input — all fields optional. Partial brandMark merges onto defaults. */
|
|
611
|
+
declare type ContentInput = Partial<Omit<ContentConfig, 'brandMark'>> & {
|
|
612
|
+
brandMark?: Partial<BrandMarkConfig>;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
declare type ContinuousScaleInput = {
|
|
616
|
+
type: 'scale';
|
|
617
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
618
|
+
scaleType: 'continuous';
|
|
619
|
+
transform?: ScaleTransformType;
|
|
620
|
+
reverse?: boolean;
|
|
621
|
+
nice?: boolean;
|
|
622
|
+
zero?: boolean;
|
|
623
|
+
clamp?: boolean;
|
|
624
|
+
domainMin?: number | null;
|
|
625
|
+
domainMax?: number | null;
|
|
626
|
+
/**
|
|
627
|
+
* Output range. A numeric `[min, max]` for magnitude aesthetics (size, alpha, strokeWidth); a ramp of
|
|
628
|
+
* two-or-more colour strings for a continuous `color` scale, interpolated in the
|
|
629
|
+
* {@link ContinuousScaleInput.interpolate} space.
|
|
630
|
+
*/
|
|
631
|
+
range?: ReadonlyArray<number | string> | null;
|
|
632
|
+
/**
|
|
633
|
+
* Named colormap for a continuous `color` scale (e.g. `'viridis'`, `'RdBu'`). Superseded by an explicit
|
|
634
|
+
* `range`. Inert for non-colour aesthetics.
|
|
635
|
+
*/
|
|
636
|
+
scheme?: ColorSchemeName | null;
|
|
637
|
+
/** Interpolation space for a colour `range`'s stops. Ignored for `scheme`. Inert for non-colour aesthetics. */
|
|
638
|
+
interpolate?: ColorInterpolationSpace;
|
|
639
|
+
/** Diverging midpoint — pins a colour ramp's neutral stop to this value. Inert for non-colour aesthetics. */
|
|
640
|
+
domainMid?: number | null;
|
|
641
|
+
/** Symmetrise the domain about `domainMid`. Defaults to `true` when `domainMid` is set; inert otherwise. */
|
|
642
|
+
symmetric?: boolean;
|
|
643
|
+
};
|
|
644
|
+
|
|
645
|
+
declare type ContinuousScaleOptions = {
|
|
646
|
+
/**
|
|
647
|
+
* Mathematical transformation to apply.
|
|
648
|
+
* - 'linear': No transformation (default)
|
|
649
|
+
* - 'log': Base-10 logarithm
|
|
650
|
+
* - 'sqrt': Square root
|
|
651
|
+
*/
|
|
652
|
+
transform?: ScaleTransformType;
|
|
653
|
+
/**
|
|
654
|
+
* Reverse the scale direction.
|
|
655
|
+
* Can be combined with any transformation.
|
|
656
|
+
* @default false
|
|
657
|
+
* @example scale.y.continuous({ reverse: true }) // reversed continuous scale
|
|
658
|
+
*/
|
|
659
|
+
reverse?: boolean;
|
|
660
|
+
/**
|
|
661
|
+
* Extend domain to nice round values.
|
|
662
|
+
* @example nice: true // [3, 97] becomes [0, 100]
|
|
663
|
+
*/
|
|
664
|
+
nice?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Include zero in the domain.
|
|
667
|
+
* Default is true for y-axis, false for x-axis.
|
|
668
|
+
* @example zero: false // Allow axis to start above zero
|
|
669
|
+
*/
|
|
670
|
+
zero?: boolean;
|
|
671
|
+
/**
|
|
672
|
+
* Restrict output to the scale's range when input falls outside the domain.
|
|
673
|
+
* Without clamping, values extrapolate beyond the range boundaries.
|
|
674
|
+
* Default is false for position aesthetics (x, y), true for non-position (color, size, alpha, …).
|
|
675
|
+
* @example clamp: true // Pin out-of-domain values to range boundaries
|
|
676
|
+
*/
|
|
677
|
+
clamp?: boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Override the minimum domain value only.
|
|
680
|
+
* Maximum is still computed from data.
|
|
681
|
+
* @example domainMin: 0 // Ensure axis starts at 0
|
|
682
|
+
*/
|
|
683
|
+
domainMin?: number;
|
|
684
|
+
/**
|
|
685
|
+
* Override the maximum domain value only.
|
|
686
|
+
* Minimum is still computed from data.
|
|
687
|
+
* @example domainMax: 100 // Cap axis at 100
|
|
688
|
+
*/
|
|
689
|
+
domainMax?: number;
|
|
690
|
+
/**
|
|
691
|
+
* Output range for non-positional magnitude scales (size, alpha, strokeWidth). Ignored for position
|
|
692
|
+
* aesthetics (x, y). A numeric `[min, max]`; aesthetic-specific defaults apply when omitted
|
|
693
|
+
* (size `[4, 20]`, alpha `[0.1, 1]`, strokeWidth `[1, 4]`).
|
|
694
|
+
*
|
|
695
|
+
* A continuous `color` scale takes a colour ramp instead — see {@link ColorContinuousScaleOptions}.
|
|
696
|
+
* @example scale.size.continuous({ range: [2, 30] })
|
|
697
|
+
*/
|
|
698
|
+
range?: [number, number];
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
/**
|
|
702
|
+
* Convert a high-level {@link GraphConfig} into the low-level {@link SpecInput} the compiler takes.
|
|
703
|
+
*
|
|
704
|
+
* `data` is read for inference only — column types decide the x/y mapping, and any wide-to-long
|
|
705
|
+
* reshape the graph type needs is emitted as a spec transform rather than applied here. The same
|
|
706
|
+
* `data` value the caller passed goes on to `compile`/`<GraphProvider>` untouched.
|
|
707
|
+
*
|
|
708
|
+
* This is a one-way, lossy conversion. Features Spec has no equivalent for (series styles beyond
|
|
709
|
+
* line type, theme overrides, content) are silently dropped. `GraphConfig.themeOverrides` and
|
|
710
|
+
* `appearance.textStyle` are renderer concerns — see react-renderer's `convertGraphConfigTheme`.
|
|
711
|
+
*/
|
|
712
|
+
export declare function convertGraphConfig(graphConfig: GraphConfig, data: Data, ctx?: GraphConfigContext): SpecInput;
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* Discriminated union of all coordinate input specs (user-provided, optional params).
|
|
716
|
+
*/
|
|
717
|
+
declare type CoordInput = CartesianCoordInput | FlipCoordInput | PolarCoordInput;
|
|
718
|
+
|
|
719
|
+
/**
|
|
720
|
+
* Resolved count stat spec.
|
|
721
|
+
*/
|
|
722
|
+
declare interface CountStatSpec {
|
|
723
|
+
type: 'count';
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/**
|
|
727
|
+
* A layer for a custom (plugin-contributed) geom. Its `geom` is a name outside {@link GeomName},
|
|
728
|
+
* resolved downstream through the geom registry; `params` are validated at the typed builder call
|
|
729
|
+
* site, so the node itself carries them as an open record.
|
|
730
|
+
*/
|
|
731
|
+
declare interface CustomGeomLayerInput extends LayerInputBase {
|
|
732
|
+
geom: string;
|
|
733
|
+
params?: Record<string, unknown>;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/** A single named color slot within a custom palette supplied by the host. */
|
|
737
|
+
declare type CustomPaletteColor = {
|
|
738
|
+
id: string;
|
|
739
|
+
hex: string;
|
|
740
|
+
name?: string;
|
|
741
|
+
};
|
|
742
|
+
|
|
743
|
+
/** Reference to a user-registered custom palette by id, resolved against the palette registry. */
|
|
744
|
+
declare type CustomPaletteInput = {
|
|
745
|
+
type: 'custom';
|
|
746
|
+
id: string;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
/** Host-owned custom palettes, keyed by `paletteId`, that a `scale.color.palette` may reference by id. */
|
|
750
|
+
declare type CustomPalettesInput = Record<string, CustomPaletteColor[]>;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* The input node a custom (plugin-contributed) stat builder produces.
|
|
754
|
+
*/
|
|
755
|
+
declare interface CustomStatInput<Name extends string = string> {
|
|
756
|
+
type: Name;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
/***************************************************************
|
|
760
|
+
* Transform Input
|
|
761
|
+
***************************************************************/
|
|
762
|
+
/**
|
|
763
|
+
* The input node a custom (plugin-contributed) transform builder produces.
|
|
764
|
+
*/
|
|
765
|
+
declare interface CustomTransformInput<Name extends string = string> {
|
|
766
|
+
type: 'transform';
|
|
767
|
+
transformType: Name;
|
|
768
|
+
options?: Record<string, unknown>;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Data to visualize. Structured as a table.
|
|
773
|
+
*
|
|
774
|
+
* The public-API contract. Row values must be {@link DataValue} (string, number,
|
|
775
|
+
* Date, or null). Internal entry points (e.g. the dataset parser) accept a
|
|
776
|
+
* looser row type — see {@link RawData} — because they must defensively handle
|
|
777
|
+
* malformed input.
|
|
778
|
+
*/
|
|
779
|
+
declare interface Data {
|
|
780
|
+
/**
|
|
781
|
+
* Column definitions. Every column is an object with a stable `key` that matches the keys used in each row and an optional `label` to show in the UI.
|
|
782
|
+
*/
|
|
783
|
+
columns: Array<{
|
|
784
|
+
/** Unique, stable identifier. */
|
|
785
|
+
key: string;
|
|
786
|
+
/** Friendly label for the column. */
|
|
787
|
+
label?: string;
|
|
788
|
+
/* Excluded from this release type: _metadata */
|
|
789
|
+
}>;
|
|
790
|
+
/**
|
|
791
|
+
* Data rows. Each row object must contain keys that match `columns[i].key`.
|
|
792
|
+
*/
|
|
793
|
+
rows: Array<Record<string, DataValue>>;
|
|
794
|
+
/* Excluded from this release type: _metadata */
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Anchor along one axis of the geom's box, CSS-flexbox style. `justify` runs along the value
|
|
799
|
+
* axis — `'end'` is the value tip whatever the orientation or sign (e.g. the bottom of a negative
|
|
800
|
+
* column). `align` runs across it: bandwidth for bars, angular for pie wedges, x for
|
|
801
|
+
* point/line/area.
|
|
802
|
+
*/
|
|
803
|
+
declare type DataLabelAnchor = 'start' | 'center' | 'end';
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Value-axis anchors. `'panel-start'`/`'panel-end'` resolve against the panel instead of the
|
|
807
|
+
* geom's box, so labels sit flush at the chart edge regardless of the geom's length. They stay
|
|
808
|
+
* sign-aware like `'end'` and always inset inward, ignoring `position` on the value axis — past
|
|
809
|
+
* the panel edge is off-canvas.
|
|
810
|
+
*/
|
|
811
|
+
declare type DataLabelJustify = DataLabelAnchor | 'panel-start' | 'panel-end';
|
|
812
|
+
|
|
813
|
+
/**
|
|
814
|
+
* Where data labels sit relative to the geom they decorate.
|
|
815
|
+
* - `'auto'` — the engine chooses: fit inside, flip outside, drop or rotate as needed.
|
|
816
|
+
* `justify`/`align` are ignored.
|
|
817
|
+
* - `'inside'` — within the geom's box, hugging the `(justify, align)` anchor. Never dropped,
|
|
818
|
+
* flipped or rotated. On line/point geoms the label centres on the data point/marker.
|
|
819
|
+
* - `'outside'` — just past the value-axis edge selected by `justify`; `align` stays within the
|
|
820
|
+
* geom's width (line/point labels sit beside the geom). Never dropped. Stacked/filled cartesian
|
|
821
|
+
* bar segments coerce to `'inside'` — every segment edge borders a neighbour; use
|
|
822
|
+
* `showStackTotals` for stack-end totals. (Pie wedges keep `'outside'`.)
|
|
823
|
+
*
|
|
824
|
+
* Styling follows the label's effective position: over the geom → inside styling (white text,
|
|
825
|
+
* no plate); off it — by placement, offset, or not fitting — outside styling (dark text on a
|
|
826
|
+
* plate). Area labels always use the plated styling: the translucent fill can't back white text.
|
|
827
|
+
*/
|
|
828
|
+
declare type DataLabelPlacement = 'auto' | 'inside' | 'outside';
|
|
829
|
+
|
|
830
|
+
export declare interface DataLabels {
|
|
831
|
+
showDataLabels?: boolean;
|
|
832
|
+
/** Whether labels show raw values or each point's share of its stack/total. */
|
|
833
|
+
dataLabelFormat?: 'absolute' | 'percentage';
|
|
834
|
+
/** Shows the summed total above each stack in stacked graphs. */
|
|
835
|
+
showStackTotals?: boolean;
|
|
836
|
+
showCategoryLabels?: boolean;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Resolved data-labels config carried per-layer.
|
|
841
|
+
*/
|
|
842
|
+
declare interface DataLabelsConfig {
|
|
843
|
+
/**
|
|
844
|
+
* Whether to show data labels on the layer.
|
|
845
|
+
* @default false
|
|
846
|
+
*/
|
|
847
|
+
showDataLabels: boolean;
|
|
848
|
+
/**
|
|
849
|
+
* The format to use for the data labels.
|
|
850
|
+
* @default 'absolute'
|
|
851
|
+
*/
|
|
852
|
+
format: 'absolute' | 'percentage';
|
|
853
|
+
/**
|
|
854
|
+
* Whether to show stack totals on the layer.
|
|
855
|
+
* @default false
|
|
856
|
+
*/
|
|
857
|
+
showStackTotals: boolean;
|
|
858
|
+
/**
|
|
859
|
+
* Polar bars (pie/donut) prepend the category to the value label ("Europe · 35%"). Cartesian
|
|
860
|
+
* bars emit a second label per observation, placed by the `category*` fields independently of
|
|
861
|
+
* `showDataLabels`. Other geoms ignore it.
|
|
862
|
+
* @default false
|
|
863
|
+
*/
|
|
864
|
+
showCategoryLabels: boolean;
|
|
865
|
+
/**
|
|
866
|
+
* The source of the data labels.
|
|
867
|
+
* @default { variable: POSITION_VARIABLES.yRaw }
|
|
868
|
+
*/
|
|
869
|
+
labelSource: AestheticValue;
|
|
870
|
+
/**
|
|
871
|
+
* Where labels sit relative to the geom. Explicit values render exactly as asked; dropping,
|
|
872
|
+
* flipping and rotation happen only under `'auto'`.
|
|
873
|
+
* @default 'auto'
|
|
874
|
+
*/
|
|
875
|
+
position: DataLabelPlacement;
|
|
876
|
+
/**
|
|
877
|
+
* Anchor along the geom's value/growth axis. Only consulted when `position` is explicit.
|
|
878
|
+
* Panel anchors pin the label to the panel's edge instead of the geom's; see
|
|
879
|
+
* {@link DataLabelJustify}.
|
|
880
|
+
* @default 'end' ('center' for stacked/filled bars)
|
|
881
|
+
*/
|
|
882
|
+
justify: DataLabelJustify;
|
|
883
|
+
/**
|
|
884
|
+
* Anchor across the geom's secondary axis. Only consulted when `position` is explicit.
|
|
885
|
+
* @default 'center'
|
|
886
|
+
*/
|
|
887
|
+
align: DataLabelAnchor;
|
|
888
|
+
/**
|
|
889
|
+
* Gap in pixels between the geom's edge and the label box. Stack totals ignore it.
|
|
890
|
+
* @default 4 for bars and polar wedges, 12 for point/line/area
|
|
891
|
+
*/
|
|
892
|
+
offset: number;
|
|
893
|
+
/**
|
|
894
|
+
* Where the cartesian-bar category label sits relative to its bar. No `'auto'`: category labels
|
|
895
|
+
* have no fit heuristics and render exactly as asked. Stacked/filled segments coerce
|
|
896
|
+
* `'outside'` to `'inside'` — every segment edge borders a neighbour.
|
|
897
|
+
* @default 'inside'
|
|
898
|
+
*/
|
|
899
|
+
categoryPosition: Exclude<DataLabelPlacement, 'auto'>;
|
|
900
|
+
/**
|
|
901
|
+
* Category label's anchor along the bar's value axis; accepts panel anchors like `justify`.
|
|
902
|
+
* @default 'start'
|
|
903
|
+
*/
|
|
904
|
+
categoryJustify: DataLabelJustify;
|
|
905
|
+
/**
|
|
906
|
+
* Category label's anchor across the bar's bandwidth.
|
|
907
|
+
* @default 'center'
|
|
908
|
+
*/
|
|
909
|
+
categoryAlign: DataLabelAnchor;
|
|
910
|
+
/**
|
|
911
|
+
* Gap in pixels between the anchored edge and the category label box.
|
|
912
|
+
* @default 4
|
|
913
|
+
*/
|
|
914
|
+
categoryOffset: number;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
/** User-facing data-labels options; any omitted field falls back to its resolved default. */
|
|
918
|
+
declare type DataLabelsInput = DeepPartial<Omit<DataLabelsConfig, 'labelSource'>>;
|
|
919
|
+
|
|
920
|
+
/** The type of a variable's values. Internally, numeric values are stored as numbers, dates as Date objects and categorical values as strings. */
|
|
921
|
+
declare type DataType = 'numeric' | 'categorical' | 'temporal';
|
|
922
|
+
|
|
923
|
+
/** The smallest unit of data in the dataset. `null` represents a missing value. */
|
|
924
|
+
declare type DataValue = number | string | Date | null;
|
|
925
|
+
|
|
926
|
+
declare interface DatetimeScaleInput {
|
|
927
|
+
type: 'scale';
|
|
928
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
929
|
+
scaleType: 'datetime';
|
|
930
|
+
domainMin?: number | null;
|
|
931
|
+
domainMax?: number | null;
|
|
932
|
+
nice?: boolean;
|
|
933
|
+
reverse?: boolean;
|
|
934
|
+
clamp?: boolean;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
declare type DatetimeScaleOptions = {
|
|
938
|
+
/** Minimum domain override (milliseconds since epoch). */
|
|
939
|
+
domainMin?: number;
|
|
940
|
+
/** Maximum domain override (milliseconds since epoch). */
|
|
941
|
+
domainMax?: number;
|
|
942
|
+
/**
|
|
943
|
+
* Reverse the scale direction.
|
|
944
|
+
* Can be combined with any transformation.
|
|
945
|
+
* @default false
|
|
946
|
+
* @example scale.y.log({ reverse: true }) // reversed log scale
|
|
947
|
+
*/
|
|
948
|
+
reverse?: boolean;
|
|
949
|
+
/**
|
|
950
|
+
* Extend domain to nice round values.
|
|
951
|
+
* @example nice: true // [3, 97] becomes [0, 100]
|
|
952
|
+
*/
|
|
953
|
+
nice?: boolean;
|
|
954
|
+
/**
|
|
955
|
+
* Restrict output to the scale's range when input falls outside the domain.
|
|
956
|
+
* Without clamping, values extrapolate beyond the range boundaries.
|
|
957
|
+
* Defaults to false for datetime scales (always positional).
|
|
958
|
+
* @example clamp: true // Pin out-of-domain values to range boundaries
|
|
959
|
+
*/
|
|
960
|
+
clamp?: boolean;
|
|
961
|
+
};
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Recursively makes every property of `T` optional.
|
|
965
|
+
* Unlike the built-in `Partial`, this applies to nested objects as well.
|
|
966
|
+
*/
|
|
967
|
+
declare type DeepPartial<T> = {
|
|
968
|
+
[K in keyof T]?: T[K] extends Array<infer U> ? Array<DeepPartial<U>> : unknown extends T[K] ? T[K] : NonNullable<T[K]> extends object ? DeepPartial<NonNullable<T[K]>> : T[K];
|
|
969
|
+
};
|
|
970
|
+
|
|
971
|
+
declare type DefaultPaletteConfig = {
|
|
972
|
+
type: 'default';
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* User-facing difference-arrow input. `size`, `color` and `labelCrossPosition`
|
|
977
|
+
* are defaulted by the resolver.
|
|
978
|
+
*/
|
|
979
|
+
declare interface DifferenceArrowInput {
|
|
980
|
+
/** Stable id; generated by the resolver when omitted. */
|
|
981
|
+
id?: string;
|
|
982
|
+
/** Observation the arrow's tail points from. */
|
|
983
|
+
start: ObservationAnchorInput;
|
|
984
|
+
/** Observation the arrow's head points to. */
|
|
985
|
+
end: ObservationAnchorInput;
|
|
986
|
+
/** What the arrow's label measures (raw gap, relative change, or share). */
|
|
987
|
+
label: DifferenceArrowLabelKind;
|
|
988
|
+
/** null falls back to a theme default. */
|
|
989
|
+
color?: string | null;
|
|
990
|
+
size?: DifferenceArrowSize;
|
|
991
|
+
/** AnchorOffset of the label along the arrow, as a fraction of the arrow's length. */
|
|
992
|
+
labelCrossPosition?: number;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
/** What a difference arrow's label measures: the raw gap, the relative change, or one value as a share of the other. */
|
|
996
|
+
declare type DifferenceArrowLabelKind = 'absolute-difference' | 'relative-difference' | 'proportion';
|
|
997
|
+
|
|
998
|
+
/** Preset visual scale for a difference arrow. */
|
|
999
|
+
declare type DifferenceArrowSize = 'small' | 'medium' | 'large';
|
|
1000
|
+
|
|
1001
|
+
declare interface DiscreteScaleInput {
|
|
1002
|
+
type: 'scale';
|
|
1003
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
1004
|
+
scaleType: 'discrete';
|
|
1005
|
+
range?: Array<number | string> | null;
|
|
1006
|
+
domain?: Array<string | number> | null;
|
|
1007
|
+
padding?: number | null;
|
|
1008
|
+
reverse?: boolean;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
declare type DiscreteScaleOptions<RangeValue extends number | string = number | string> = {
|
|
1012
|
+
/**
|
|
1013
|
+
* Explicit output values mapped to domain categories in order.
|
|
1014
|
+
*/
|
|
1015
|
+
range?: RangeValue[];
|
|
1016
|
+
/**
|
|
1017
|
+
* Explicit domain values controlling category order and membership.
|
|
1018
|
+
* Only these values appear in the scale.
|
|
1019
|
+
*/
|
|
1020
|
+
domain?: Array<string | number>;
|
|
1021
|
+
/**
|
|
1022
|
+
* Padding between bands as a fraction of the band step (0–1).
|
|
1023
|
+
* Applied as `innerPadding = padding` and `outerPadding = padding / 2`.
|
|
1024
|
+
* @default 0.1
|
|
1025
|
+
*/
|
|
1026
|
+
padding?: number;
|
|
1027
|
+
/**
|
|
1028
|
+
* Reverse band order. First domain entry maps to the end of the range.
|
|
1029
|
+
* @default false
|
|
1030
|
+
*/
|
|
1031
|
+
reverse?: boolean;
|
|
1032
|
+
};
|
|
1033
|
+
|
|
1034
|
+
/**
|
|
1035
|
+
* Diverging colormap names from `d3-scale-chromatic`, in Brewer's capitalisation. `RdBu`, `BrBG` and
|
|
1036
|
+
* `PuOr` are colour-vision-deficiency safe; `Spectral` is offered for its familiar rainbow look but is not
|
|
1037
|
+
* CVD-safe. Red-green ramps are deliberately excluded.
|
|
1038
|
+
*/
|
|
1039
|
+
declare const DIVERGING_SCHEME_NAMES: readonly ["RdBu", "BrBG", "PuOr", "Spectral"];
|
|
1040
|
+
|
|
1041
|
+
/** A diverging colormap: its canonical ColorBrewer code or a friendly alias. */
|
|
1042
|
+
declare type DivergingSchemeName = (typeof DIVERGING_SCHEME_NAMES)[number] | SchemeAlias;
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Layout configuration.
|
|
1046
|
+
*
|
|
1047
|
+
* A general per-region map (rather than a theme token per gap) because the set of boundaries is
|
|
1048
|
+
* open-ended and reads naturally as part of the chart spec. Anything left unset keeps the engine
|
|
1049
|
+
* defaults.
|
|
1050
|
+
*/
|
|
1051
|
+
/**
|
|
1052
|
+
* Per-side outer padding, in pixels. Any side left unset falls back to the engine default padding
|
|
1053
|
+
* ({@link LAYOUT_PADDING}), so `{ top: 40 }` keeps the other three sides at the default. Use an
|
|
1054
|
+
* explicit `0` to remove a side's padding.
|
|
1055
|
+
*/
|
|
1056
|
+
declare type EdgePaddingConfig = {
|
|
1057
|
+
top?: number;
|
|
1058
|
+
right?: number;
|
|
1059
|
+
bottom?: number;
|
|
1060
|
+
left?: number;
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
/***************************************************************
|
|
1064
|
+
* Filter Transform
|
|
1065
|
+
***************************************************************/
|
|
1066
|
+
declare interface FilterOptions {
|
|
1067
|
+
/** The variable to filter on. */
|
|
1068
|
+
variableName: VariableName;
|
|
1069
|
+
/** The comparison operator. */
|
|
1070
|
+
operator: ComparisonOperator;
|
|
1071
|
+
/** The value to compare against. */
|
|
1072
|
+
value: DataValue;
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
declare interface FilterTransformInput {
|
|
1076
|
+
type: 'transform';
|
|
1077
|
+
transformType: 'filter';
|
|
1078
|
+
options: FilterOptions;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
declare interface FlipCoordInput {
|
|
1082
|
+
type: 'coord';
|
|
1083
|
+
coordType: 'flip';
|
|
1084
|
+
params?: Partial<BaseCoordParams>;
|
|
1085
|
+
}
|
|
1086
|
+
|
|
1087
|
+
/**
|
|
1088
|
+
* The type of geometric mark used to represent data in a layer.
|
|
1089
|
+
*
|
|
1090
|
+
* - `'point'` — Scatter-style dot marks
|
|
1091
|
+
* - `'line'` — Connected line marks
|
|
1092
|
+
* - `'area'` — Filled area marks
|
|
1093
|
+
* - `'bar'` — Rectangular bar marks (cartesian) or pie wedge (polar)
|
|
1094
|
+
* - `'rule'` — Horizontal or vertical reference line at a constant value
|
|
1095
|
+
*/
|
|
1096
|
+
declare type GeomName = 'point' | 'line' | 'area' | 'bar' | 'rule';
|
|
1097
|
+
|
|
1098
|
+
/**
|
|
1099
|
+
* Maps each geom type name to its resolved parameter type.
|
|
1100
|
+
*/
|
|
1101
|
+
declare interface GeomParamsMap {
|
|
1102
|
+
point: PointGeomParams;
|
|
1103
|
+
line: LineGeomParams;
|
|
1104
|
+
area: AreaGeomParams;
|
|
1105
|
+
bar: BarGeomParams;
|
|
1106
|
+
rule: RuleGeomParams;
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/** The paint declarations every geom kind shares. */
|
|
1110
|
+
declare type GeomStyleDeclarations = Pick<StyleDeclarations, 'color' | 'alpha' | 'saturation'>;
|
|
1111
|
+
|
|
1112
|
+
/** Goal line with a target value. */
|
|
1113
|
+
export declare interface GoalLine {
|
|
1114
|
+
/** Value on the measure axis where the line is drawn. */
|
|
1115
|
+
target: number;
|
|
1116
|
+
/** Category value at which to anchor an optional marker on the line. */
|
|
1117
|
+
marker?: DataValue;
|
|
1118
|
+
label?: string;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
declare type GraphAnnotation = GraphStickerAnnotation | GraphTooltipAnnotation | GraphHighlightAnnotation | GraphTextAnnotation | GraphArrowAnnotation | GraphDifferenceArrowAnnotation | GraphShapeAnnotation | GraphImageAnnotation;
|
|
1122
|
+
|
|
1123
|
+
export declare interface GraphArrowAnnotation {
|
|
1124
|
+
id: string;
|
|
1125
|
+
type: 'arrow';
|
|
1126
|
+
/** Tail position as fractions (0-1) of the plot width and height. */
|
|
1127
|
+
startX: number;
|
|
1128
|
+
startY: number;
|
|
1129
|
+
/** Head position as fractions (0-1) of the plot width and height. */
|
|
1130
|
+
endX: number;
|
|
1131
|
+
endY: number;
|
|
1132
|
+
color?: string;
|
|
1133
|
+
thickness: 'thin' | 'medium' | 'thick';
|
|
1134
|
+
startArrowheadStyle: 'none' | 'line-arrow';
|
|
1135
|
+
lineStyle: 'solid' | 'dashed';
|
|
1136
|
+
endArrowheadStyle: 'none' | 'line-arrow';
|
|
1137
|
+
/** Adds a white outline so the arrow reads as a sticker on top of the chart. */
|
|
1138
|
+
hasStickerStyle: boolean;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* The full set of options a consumer passes to configure a chart's type, styling, axes, and content.
|
|
1143
|
+
* Every field is optional, so omitted settings fall back to engine defaults.
|
|
1144
|
+
*/
|
|
1145
|
+
export declare interface GraphConfig {
|
|
1146
|
+
type?: GraphType;
|
|
1147
|
+
/** Geometry-specific settings, unioned across all graph types. */
|
|
1148
|
+
options?: Options;
|
|
1149
|
+
axes?: Axes;
|
|
1150
|
+
legend?: Legend;
|
|
1151
|
+
appearance?: Appearance;
|
|
1152
|
+
/** Ad-hoc overrides of individual theme tokens, plus a shortcut for the graph background. */
|
|
1153
|
+
themeOverrides?: {
|
|
1154
|
+
[key: string]: unknown;
|
|
1155
|
+
graphBackground?: string;
|
|
1156
|
+
};
|
|
1157
|
+
content?: Content;
|
|
1158
|
+
headlineNumbers?: HeadlineNumbers;
|
|
1159
|
+
dataLabels?: DataLabels;
|
|
1160
|
+
annotations?: GraphAnnotation[];
|
|
1161
|
+
referenceLines?: ReferenceLines;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
/**
|
|
1165
|
+
* Presentation context a {@link GraphConfig} conversion needs to resolve its opaque `paletteId` into
|
|
1166
|
+
* a structured palette: the color scheme picks the variant of scheme-dependent presets, and the
|
|
1167
|
+
* palette catalog says which ids name a host-registered custom palette.
|
|
1168
|
+
*/
|
|
1169
|
+
export declare interface GraphConfigContext {
|
|
1170
|
+
/** Color scheme used to resolve scheme-dependent palettes; defaults to light when omitted. */
|
|
1171
|
+
colorScheme?: ColorScheme;
|
|
1172
|
+
/** Renderer-owned palette catalog, keyed by `paletteId`. */
|
|
1173
|
+
customPalettes?: CustomPalettesInput;
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
export declare interface GraphDifferenceArrowAnnotation {
|
|
1177
|
+
id: string;
|
|
1178
|
+
type: 'difference-arrow';
|
|
1179
|
+
/** How the gap between the two points is expressed in the label. */
|
|
1180
|
+
show: 'absolute-difference' | 'relative-difference' | 'proportion';
|
|
1181
|
+
start: AnnotationDataPoint;
|
|
1182
|
+
end: AnnotationDataPoint;
|
|
1183
|
+
color?: string;
|
|
1184
|
+
size: 'medium' | 'small' | 'large';
|
|
1185
|
+
/** Position of the label along the arrow as a fraction (0-1) from start to end. */
|
|
1186
|
+
labelPosition?: number;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
declare type GraphHighlightAnnotation = {
|
|
1190
|
+
id: string;
|
|
1191
|
+
type: 'highlight';
|
|
1192
|
+
/** Scope of the emphasis: a single point, a whole series, or all points at one x value. */
|
|
1193
|
+
highlight: 'data-point' | 'series' | 'x-value';
|
|
1194
|
+
} & AnnotationDataPoint;
|
|
1195
|
+
|
|
1196
|
+
export declare interface GraphImageAnnotation {
|
|
1197
|
+
id: string;
|
|
1198
|
+
type: 'image';
|
|
1199
|
+
/** Image URL or data URI. */
|
|
1200
|
+
src: string;
|
|
1201
|
+
/** Whether the image is drawn behind or in front of the plotted data. */
|
|
1202
|
+
layer: 'belowPlot' | 'abovePlot';
|
|
1203
|
+
/** Top-left position as fractions (0-1) of the plot width and height. */
|
|
1204
|
+
x: number;
|
|
1205
|
+
y: number;
|
|
1206
|
+
/** Size as fractions (0-1) of the plot width and height. */
|
|
1207
|
+
width: number;
|
|
1208
|
+
height: number;
|
|
1209
|
+
/** How the image scales inside its box: stretch, letterbox, or crop-to-fill. */
|
|
1210
|
+
fit?: 'fill' | 'contain' | 'cover';
|
|
1211
|
+
/** Opacity from 0 (transparent) to 1 (opaque). */
|
|
1212
|
+
opacity?: number;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
export declare interface GraphShapeAnnotation {
|
|
1216
|
+
id: string;
|
|
1217
|
+
type: 'shape';
|
|
1218
|
+
shape: 'rectangle';
|
|
1219
|
+
/** Whether the shape is drawn behind or in front of the plotted data. */
|
|
1220
|
+
layer: 'belowPlot' | 'abovePlot';
|
|
1221
|
+
/** Top-left position as fractions (0-1) of the plot width and height. */
|
|
1222
|
+
x: number;
|
|
1223
|
+
y: number;
|
|
1224
|
+
/** Size as fractions (0-1) of the plot width and height. */
|
|
1225
|
+
width: number;
|
|
1226
|
+
height: number;
|
|
1227
|
+
fillColor: string;
|
|
1228
|
+
/** Fill opacity from 0 (transparent) to 1 (opaque). */
|
|
1229
|
+
fillOpacity: number;
|
|
1230
|
+
strokeWidth: number;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
export declare type GraphStickerAnnotation = {
|
|
1234
|
+
id: string;
|
|
1235
|
+
type: 'sticker';
|
|
1236
|
+
sticker: 'rocket' | 'clapping-hands' | 'thumbs-up' | 'thumbs-down' | 'grinning-face';
|
|
1237
|
+
} & AnnotationDataPoint;
|
|
1238
|
+
|
|
1239
|
+
export declare interface GraphTextAnnotation {
|
|
1240
|
+
id: string;
|
|
1241
|
+
type: 'text';
|
|
1242
|
+
content: RichTextContent;
|
|
1243
|
+
/** Left position as a fraction (0-1) of the plot width. */
|
|
1244
|
+
x: number;
|
|
1245
|
+
/** Top position as a fraction (0-1) of the plot height. */
|
|
1246
|
+
y: number;
|
|
1247
|
+
/** Box width as a fraction (0-1) of the plot width; text wraps within it. */
|
|
1248
|
+
width: number;
|
|
1249
|
+
backgroundColor?: string;
|
|
1250
|
+
/** Whether the background is semi-transparent ('fade') or fully opaque. */
|
|
1251
|
+
backgroundColorStyle?: 'fade' | 'opaque';
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
export declare interface GraphTextStyle {
|
|
1255
|
+
/** Id of a font registered with the engine; resolved to a concrete family at compile time. */
|
|
1256
|
+
fontId?: string;
|
|
1257
|
+
color?: string;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
export declare type GraphTooltipAnnotation = {
|
|
1261
|
+
id: string;
|
|
1262
|
+
type: 'tooltip';
|
|
1263
|
+
/** Tooltip body as TipTap rich-text content; omit or `null` for a pinned-number annotation (no caption). */
|
|
1264
|
+
caption?: RichTextContent | null;
|
|
1265
|
+
} & AnnotationDataPoint;
|
|
1266
|
+
|
|
1267
|
+
/** Type of graph to use for the data. */
|
|
1268
|
+
export declare type GraphType = 'line' | 'areaStacked' | 'bar' | 'barStacked' | 'barStackedFill' | 'column' | 'columnStacked' | 'columnStackedFill' | 'combo' | 'pie' | 'donut' | 'funnel' | 'heatmap' | 'scatter' | 'bubble' | 'waterfall' | 'mekko' | 'table';
|
|
1269
|
+
|
|
1270
|
+
declare type GraphyPaletteConfig = {
|
|
1271
|
+
type: 'graphy';
|
|
1272
|
+
variant?: GraphyPaletteVariant;
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
/** `waterfall` swaps in the positive/negative/total colors used by waterfall graphs. */
|
|
1276
|
+
declare type GraphyPaletteVariant = 'default' | 'waterfall';
|
|
1277
|
+
|
|
1278
|
+
/**
|
|
1279
|
+
* Comparison reference for trend indicator
|
|
1280
|
+
* - 'previous': Compare to preceding data point
|
|
1281
|
+
* - 'first': Compare to initial value in series
|
|
1282
|
+
* - 'none': No comparison indicator
|
|
1283
|
+
*/
|
|
1284
|
+
declare type HeadlineCompare = 'previous' | 'first' | 'none';
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Headline numbers configuration
|
|
1288
|
+
*/
|
|
1289
|
+
declare interface HeadlineConfig {
|
|
1290
|
+
/**
|
|
1291
|
+
* Which aggregate to display
|
|
1292
|
+
* @default 'none'
|
|
1293
|
+
*/
|
|
1294
|
+
show: HeadlineShow;
|
|
1295
|
+
/**
|
|
1296
|
+
* Reference point for trend comparison
|
|
1297
|
+
* @default 'none'
|
|
1298
|
+
*/
|
|
1299
|
+
compareWith: HeadlineCompare;
|
|
1300
|
+
/**
|
|
1301
|
+
* Visual size of the headline numbers
|
|
1302
|
+
* @default 'auto'
|
|
1303
|
+
*/
|
|
1304
|
+
size: HeadlineSize;
|
|
1305
|
+
/**
|
|
1306
|
+
* Where to display the headline
|
|
1307
|
+
* - 'above': In the header region above the chart (default)
|
|
1308
|
+
* - 'center': In the center of a donut chart hole (only valid for donut charts with inner radius)
|
|
1309
|
+
* @default 'above'
|
|
1310
|
+
*/
|
|
1311
|
+
position: HeadlinePosition;
|
|
1312
|
+
}
|
|
1313
|
+
|
|
1314
|
+
export declare interface HeadlineNumbers {
|
|
1315
|
+
/** Which aggregate to surface as the big headline figure. */
|
|
1316
|
+
show?: 'current' | 'average' | 'total' | 'conversion' | 'none';
|
|
1317
|
+
/** Baseline the headline is compared against to compute the change indicator. */
|
|
1318
|
+
compareWith?: 'previous' | 'first' | 'none';
|
|
1319
|
+
size?: 'auto' | 'small' | 'medium' | 'large';
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
/**
|
|
1323
|
+
* Placement of headline numbers
|
|
1324
|
+
* - 'above': Display above the chart (default, in the header region)
|
|
1325
|
+
* - 'center': Display in the center of a donut chart hole (only valid for donut charts)
|
|
1326
|
+
*/
|
|
1327
|
+
declare type HeadlinePosition = 'above' | 'center';
|
|
1328
|
+
|
|
1329
|
+
/**
|
|
1330
|
+
* Display mode for headline numbers
|
|
1331
|
+
* - 'total': Sum of all values
|
|
1332
|
+
* - 'average': Arithmetic mean
|
|
1333
|
+
* - 'current': Last value in series (for time series)
|
|
1334
|
+
* - 'conversion': Percentage change from first to last (not implemented yet — compiles to no headline)
|
|
1335
|
+
* - 'none': Disable headline numbers
|
|
1336
|
+
*/
|
|
1337
|
+
declare type HeadlineShow = 'total' | 'average' | 'current' | 'conversion' | 'none';
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* Size of headline numbers
|
|
1341
|
+
* - 'auto': Automatically scale based on available space and number of series
|
|
1342
|
+
* - 'small': Compact display
|
|
1343
|
+
* - 'medium': Standard display
|
|
1344
|
+
* - 'large': Prominent display
|
|
1345
|
+
*/
|
|
1346
|
+
declare type HeadlineSize = 'auto' | 'small' | 'medium' | 'large';
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* User-facing highlight definition. `id` is auto-assigned by the resolver when
|
|
1350
|
+
* omitted. Omit the layer scope to evaluate against every layer.
|
|
1351
|
+
*/
|
|
1352
|
+
declare interface HighlightInput {
|
|
1353
|
+
type: 'highlight';
|
|
1354
|
+
id?: string;
|
|
1355
|
+
predicate: Predicate;
|
|
1356
|
+
scope?: HighlightScope;
|
|
1357
|
+
layerId?: string;
|
|
1358
|
+
}
|
|
1359
|
+
|
|
1360
|
+
/**
|
|
1361
|
+
* Scope of a highlight match — what visual unit gets the matched treatment.
|
|
1362
|
+
*
|
|
1363
|
+
* - `data-point` (default): rows that satisfy the predicate are matched
|
|
1364
|
+
* individually; siblings in the same series stay un-matched.
|
|
1365
|
+
* - `series`: any row that satisfies the predicate expands to its whole series
|
|
1366
|
+
* (group). The entire series renders as matched; sibling rows in the series
|
|
1367
|
+
* are matched too. Use this to highlight a whole line / area / bar group.
|
|
1368
|
+
* - `x-value`: any row that satisfies the predicate expands to all rows
|
|
1369
|
+
* sharing the same x value. Use this to highlight a vertical slice across
|
|
1370
|
+
* series.
|
|
1371
|
+
*/
|
|
1372
|
+
declare type HighlightScope = 'data-point' | 'series' | 'x-value';
|
|
1373
|
+
|
|
1374
|
+
declare interface IdentityScaleInput {
|
|
1375
|
+
type: 'scale';
|
|
1376
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
1377
|
+
scaleType: 'identity';
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Resolved identity stat spec.
|
|
1382
|
+
*/
|
|
1383
|
+
declare interface IdentityStatSpec {
|
|
1384
|
+
type: 'identity';
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/** How an image annotation scales inside its box: stretch, letterbox, or crop-to-fill. */
|
|
1388
|
+
declare type ImageAnnotationFit = 'fill' | 'contain' | 'cover';
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Image annotation. Its area is positioned by a {@link RegionAnchorInput} so it
|
|
1392
|
+
* re-resolves each compile (re-flows on resize, tracks data when bound).
|
|
1393
|
+
*/
|
|
1394
|
+
declare interface ImageAnnotationInput {
|
|
1395
|
+
id?: string;
|
|
1396
|
+
/** Image URL or data URI. */
|
|
1397
|
+
src: string;
|
|
1398
|
+
/** Draw beneath the geoms (background) or on top (foreground). */
|
|
1399
|
+
zOrder?: AnnotationZOrder;
|
|
1400
|
+
/** The area the image fills. */
|
|
1401
|
+
region: RegionAnchorInput;
|
|
1402
|
+
/** How the image scales inside its box. */
|
|
1403
|
+
fit?: ImageAnnotationFit;
|
|
1404
|
+
/** Opacity, 0 (transparent) to 1 (opaque). */
|
|
1405
|
+
opacity?: number;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1408
|
+
declare interface InferredScaleInput {
|
|
1409
|
+
type: 'scale';
|
|
1410
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
1411
|
+
scaleType: 'inferred';
|
|
1412
|
+
options?: InferredScaleOptions;
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
declare type InferredScaleOptions = ContinuousScaleOptions | DiscreteScaleOptions | DatetimeScaleOptions;
|
|
1416
|
+
|
|
1417
|
+
/**
|
|
1418
|
+
* Curve interpolation method for lines and areas.
|
|
1419
|
+
*
|
|
1420
|
+
* - `'linear'` — Straight segments between points. Maps to d3-shape `curveLinear`.
|
|
1421
|
+
* - `'catmull-rom'` — Smooth spline through points. Maps to d3-shape `curveCatmullRom`.
|
|
1422
|
+
*/
|
|
1423
|
+
declare type InterpolateType = 'linear' | 'catmull-rom';
|
|
1424
|
+
|
|
1425
|
+
/**
|
|
1426
|
+
* Each geom kind's vocabulary, keyed by the kind name a `select.kind` can carry.
|
|
1427
|
+
*/
|
|
1428
|
+
declare interface KindStyleDeclarationsMap {
|
|
1429
|
+
bar: BarStyleDeclarations;
|
|
1430
|
+
line: LineStyleDeclarations;
|
|
1431
|
+
area: AreaStyleDeclarations;
|
|
1432
|
+
point: PointStyleDeclarations;
|
|
1433
|
+
rule: RuleStyleDeclarations;
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
/** The aesthetic channels with first-class engine support — the source of {@link AestheticKey}. */
|
|
1437
|
+
declare interface KnownAesthetics {
|
|
1438
|
+
x?: AestheticValue;
|
|
1439
|
+
y?: AestheticValue;
|
|
1440
|
+
label?: AestheticValue;
|
|
1441
|
+
color?: AestheticValue;
|
|
1442
|
+
size?: AestheticValue;
|
|
1443
|
+
/** Opacity (0–1). */
|
|
1444
|
+
alpha?: AestheticValue;
|
|
1445
|
+
/** Splits geoms into groups (separate lines/areas) without assigning a visual aesthetic. */
|
|
1446
|
+
group?: AestheticValue;
|
|
1447
|
+
strokeWidth?: AestheticValue;
|
|
1448
|
+
/** Dash-pattern aesthetic (solid, dashed, dotted, ...). */
|
|
1449
|
+
lineType?: AestheticValue;
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
/**
|
|
1453
|
+
* Discriminated union of all layer inputs, keyed on `geom`. The built-in arms stay exactly typed;
|
|
1454
|
+
* the {@link CustomGeomLayerInput} arm admits a plugin geom carrying a name outside {@link GeomName}.
|
|
1455
|
+
* This is the user-facing type — fields are optional and will be resolved with defaults.
|
|
1456
|
+
*/
|
|
1457
|
+
declare type LayerInput = {
|
|
1458
|
+
[G in GeomName]: LayerInputOf<G>;
|
|
1459
|
+
}[GeomName] | CustomGeomLayerInput;
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Fields shared by every layer input regardless of geom. All optional fields fall back to resolved
|
|
1463
|
+
* defaults; the geom-specific arms of {@link LayerInput} add `geom` and `params` on top.
|
|
1464
|
+
*/
|
|
1465
|
+
declare interface LayerInputBase {
|
|
1466
|
+
type: 'layer';
|
|
1467
|
+
/** Stable identifier; auto-assigned during resolution when omitted. */
|
|
1468
|
+
id?: string;
|
|
1469
|
+
/** Layer-local aesthetic mapping, merged over the spec-level mapping. */
|
|
1470
|
+
mapping?: AesMapping;
|
|
1471
|
+
/**
|
|
1472
|
+
* Statistical transform applied to this layer (e.g. count, mean, smooth), or a custom plugin stat.
|
|
1473
|
+
* @default 'identity'
|
|
1474
|
+
*/
|
|
1475
|
+
stat?: StatName | StatInput | CustomStatInput<string>;
|
|
1476
|
+
/** How overlapping geoms are arranged (stack, dodge, fill, identity). */
|
|
1477
|
+
position?: PositionType;
|
|
1478
|
+
/** Which y scale this layer binds to — the primary or secondary axis. */
|
|
1479
|
+
yScaleType?: YScaleType;
|
|
1480
|
+
dataLabels?: DataLabelsInput;
|
|
1481
|
+
/**
|
|
1482
|
+
* Ordered transforms applied to this layer's view of the data, on top of any
|
|
1483
|
+
* spec-level transforms. Use this when a geom needs a different shape of the
|
|
1484
|
+
* data than its siblings (e.g. a line overlay on top of reshaped stacked bars).
|
|
1485
|
+
*/
|
|
1486
|
+
transforms?: TransformInput[];
|
|
1487
|
+
/**
|
|
1488
|
+
* When `false`, the layer is skipped from main hover hit-detection.
|
|
1489
|
+
* @default true
|
|
1490
|
+
*/
|
|
1491
|
+
interactive?: boolean;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
declare type LayerInputOf<G extends GeomName> = LayerInputBase & {
|
|
1495
|
+
geom: G;
|
|
1496
|
+
params?: Partial<GeomParamsMap[G]>;
|
|
1497
|
+
};
|
|
1498
|
+
|
|
1499
|
+
/** Pixel gaps around each col. Same max(prev.after, next.before) rule as rows. */
|
|
1500
|
+
declare const LAYOUT_COL_GAPS: {
|
|
1501
|
+
readonly leftLegend: {
|
|
1502
|
+
readonly after: 10;
|
|
1503
|
+
readonly before: 0;
|
|
1504
|
+
};
|
|
1505
|
+
readonly leftAxis: {
|
|
1506
|
+
readonly after: 4;
|
|
1507
|
+
readonly before: 0;
|
|
1508
|
+
};
|
|
1509
|
+
readonly rightAxis: {
|
|
1510
|
+
readonly after: 10;
|
|
1511
|
+
readonly before: 4;
|
|
1512
|
+
};
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
/**
|
|
1516
|
+
* Pixel gaps around each row. The boundary between two present rows is sized
|
|
1517
|
+
* as max(prev.after, next.before), so either side can claim breathing room.
|
|
1518
|
+
* Spacers are only materialised when both neighbours resolve to non-zero size.
|
|
1519
|
+
*/
|
|
1520
|
+
declare const LAYOUT_ROW_GAPS: {
|
|
1521
|
+
readonly header: {
|
|
1522
|
+
readonly after: 10;
|
|
1523
|
+
readonly before: 0;
|
|
1524
|
+
};
|
|
1525
|
+
readonly headline: {
|
|
1526
|
+
readonly after: 4;
|
|
1527
|
+
readonly before: 0;
|
|
1528
|
+
};
|
|
1529
|
+
readonly topLegend: {
|
|
1530
|
+
readonly after: 8;
|
|
1531
|
+
readonly before: 0;
|
|
1532
|
+
};
|
|
1533
|
+
readonly topAxisLabel: {
|
|
1534
|
+
readonly after: 8;
|
|
1535
|
+
readonly before: 0;
|
|
1536
|
+
};
|
|
1537
|
+
readonly topAxis: {
|
|
1538
|
+
readonly after: 0;
|
|
1539
|
+
readonly before: 0;
|
|
1540
|
+
};
|
|
1541
|
+
readonly bottomAxis: {
|
|
1542
|
+
readonly after: 4;
|
|
1543
|
+
readonly before: 0;
|
|
1544
|
+
};
|
|
1545
|
+
readonly bottomAxisLabel: {
|
|
1546
|
+
readonly after: 16;
|
|
1547
|
+
readonly before: 0;
|
|
1548
|
+
};
|
|
1549
|
+
readonly bottomLegend: {
|
|
1550
|
+
readonly after: 10;
|
|
1551
|
+
readonly before: 16;
|
|
1552
|
+
};
|
|
1553
|
+
readonly footer: {
|
|
1554
|
+
readonly after: 0;
|
|
1555
|
+
readonly before: 16;
|
|
1556
|
+
};
|
|
1557
|
+
};
|
|
1558
|
+
|
|
1559
|
+
declare interface LayoutConfig {
|
|
1560
|
+
/**
|
|
1561
|
+
* Outer padding around the whole chart, in pixels. A number applies to all four sides; an
|
|
1562
|
+
* {@link EdgePaddingConfig} sets sides individually. `null` uses the engine default padding
|
|
1563
|
+
* ({@link LAYOUT_PADDING}) on every side.
|
|
1564
|
+
*/
|
|
1565
|
+
padding: number | EdgePaddingConfig | null;
|
|
1566
|
+
/** Per-region overrides for the grid spacing around each named region. */
|
|
1567
|
+
gaps: Partial<Record<LayoutGapName, LayoutGapOverride>>;
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
/**
|
|
1571
|
+
* Named regions in the chart's layout grid whose surrounding pixel gaps can be overridden via
|
|
1572
|
+
* {@link LayoutConfig.gaps}. Derived from the engine's default gap maps so the overridable set
|
|
1573
|
+
* cannot drift from the grid regions that actually consume the overrides.
|
|
1574
|
+
*/
|
|
1575
|
+
declare type LayoutGapName = keyof typeof LAYOUT_ROW_GAPS | keyof typeof LAYOUT_COL_GAPS;
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Override for a single named grid gap. A bare number sets the trailing (`after`) gap; the object
|
|
1579
|
+
* form sets either edge, and an omitted edge keeps the engine default for that side. Overrides feed
|
|
1580
|
+
* the `max(prev.after, next.before)` boundary rule described on {@link LayoutGapName}, so a lone
|
|
1581
|
+
* `after` cannot shrink a boundary below the following region's `before`.
|
|
1582
|
+
*/
|
|
1583
|
+
declare type LayoutGapOverride = number | {
|
|
1584
|
+
before?: number;
|
|
1585
|
+
after?: number;
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
export declare interface Legend {
|
|
1589
|
+
position?: 'auto' | 'top' | 'right' | 'none';
|
|
1590
|
+
}
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* Placement of the legend items along its flow.
|
|
1594
|
+
* - For a horizontal (`top`/`bottom`) legend this runs along the row: `start` = left, `end` = right.
|
|
1595
|
+
* - For a vertical (`left`/`right`) legend it runs down the column: `start` = top, `end` = bottom.
|
|
1596
|
+
* Vertical legends always pin to the plot border across the flow regardless of this value.
|
|
1597
|
+
* `'auto'` resolves during compilation to `start` for horizontal legends and `center` for vertical.
|
|
1598
|
+
*/
|
|
1599
|
+
declare type LegendAlign = 'auto' | 'start' | 'center' | 'end';
|
|
1600
|
+
|
|
1601
|
+
/**
|
|
1602
|
+
* Legend configuration (after defaults applied)
|
|
1603
|
+
*/
|
|
1604
|
+
declare interface LegendConfig {
|
|
1605
|
+
/**
|
|
1606
|
+
* Position of the legend
|
|
1607
|
+
* @default 'auto'
|
|
1608
|
+
*/
|
|
1609
|
+
position: LegendPosition;
|
|
1610
|
+
/**
|
|
1611
|
+
* Display mode for the legend.
|
|
1612
|
+
* - 'pill': Standard boxed legend with icons and labels
|
|
1613
|
+
* - 'direct': Labels rendered directly next to series endpoints
|
|
1614
|
+
* - 'auto': Resolved during compilation based on chart type and legend position
|
|
1615
|
+
*
|
|
1616
|
+
* @default 'auto'
|
|
1617
|
+
*/
|
|
1618
|
+
display: LegendDisplay;
|
|
1619
|
+
/**
|
|
1620
|
+
* Placement of the legend items along its flow.
|
|
1621
|
+
* - For a horizontal (`top`/`bottom`) legend this runs along the row: `start` = left, `end` = right.
|
|
1622
|
+
* - For a vertical (`left`/`right`) legend it runs down the column: `start` = top, `end` = bottom.
|
|
1623
|
+
* Vertical legends always pin to the plot border across the flow regardless of this value.
|
|
1624
|
+
* `'auto'` resolves to `start` for horizontal legends and `center` for vertical ones.
|
|
1625
|
+
*
|
|
1626
|
+
* @default 'auto'
|
|
1627
|
+
*/
|
|
1628
|
+
align: LegendAlign;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* Legend configuration input type (all fields optional)
|
|
1633
|
+
*/
|
|
1634
|
+
declare type LegendConfigInput = Partial<LegendConfig>;
|
|
1635
|
+
|
|
1636
|
+
/**
|
|
1637
|
+
* Legend display mode type
|
|
1638
|
+
* - 'pill': Standard boxed legend with icons and labels
|
|
1639
|
+
* - 'direct': Labels rendered directly next to series endpoints
|
|
1640
|
+
* - 'auto': Resolved during compilation based on chart type
|
|
1641
|
+
*/
|
|
1642
|
+
declare type LegendDisplay = 'pill' | 'direct' | 'auto';
|
|
1643
|
+
|
|
1644
|
+
declare type LegendPosition = 'auto' | 'right' | 'left' | 'top' | 'bottom' | 'none';
|
|
1645
|
+
|
|
1646
|
+
/** A color with one variant per {@link ColorScheme}, resolved against the active scheme at read time. */
|
|
1647
|
+
declare interface LightDarkColor {
|
|
1648
|
+
light: string;
|
|
1649
|
+
dark: string;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
/**
|
|
1653
|
+
* Line-specific parameters.
|
|
1654
|
+
*/
|
|
1655
|
+
declare interface LineGeomParams {
|
|
1656
|
+
/**
|
|
1657
|
+
* Interpolation method to use for the line. Names a d3-shape curve family:
|
|
1658
|
+
* `'linear'` ⇒ `curveLinear`, `'catmull-rom'` ⇒ `curveCatmullRom`.
|
|
1659
|
+
* @default 'linear'
|
|
1660
|
+
*/
|
|
1661
|
+
interpolate: InterpolateType;
|
|
1662
|
+
/**
|
|
1663
|
+
* How to handle missing (NULL/undefined) values:
|
|
1664
|
+
* - `'zero'`: nulls arrive already substituted with zero by the compiler —
|
|
1665
|
+
* render normally, no special handling.
|
|
1666
|
+
* - `'gap'`: break the path wherever x or y is null (d3 `defined()`).
|
|
1667
|
+
* - `'connect'`: drop null rows before pathing so the line spans the gap.
|
|
1668
|
+
* @default 'gap'
|
|
1669
|
+
*/
|
|
1670
|
+
missingValues: MissingValuesType;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
declare interface LineOptions {
|
|
1674
|
+
isSmoothLine?: boolean;
|
|
1675
|
+
lineThickness?: number | 'auto';
|
|
1676
|
+
showPoints?: boolean;
|
|
1677
|
+
/** How gaps in the data are drawn: leave a gap, connect across, or treat as zero. */
|
|
1678
|
+
missingValues?: 'gap' | 'connect' | 'zero';
|
|
1679
|
+
/** Draws a gradient fill beneath the line (single series only) */
|
|
1680
|
+
showFill?: boolean;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1683
|
+
/**
|
|
1684
|
+
* The paint vocabulary of the line geom — the shared paint plus the path's width, dash and the
|
|
1685
|
+
* gradient wash beneath it. `alpha` is the stroke's opacity; `fillAlpha` the wash's.
|
|
1686
|
+
*/
|
|
1687
|
+
declare type LineStyleDeclarations = Pick<StyleDeclarations, 'color' | 'alpha' | 'saturation' | 'strokeWidth' | 'lineType' | 'fillAlpha'>;
|
|
1688
|
+
|
|
1689
|
+
/**
|
|
1690
|
+
* Stroke style for line rendering.
|
|
1691
|
+
*
|
|
1692
|
+
* - `'solid'` — Continuous unbroken stroke
|
|
1693
|
+
* - `'dashed'` — Repeating dash pattern
|
|
1694
|
+
* - `'dotted'` — Repeating dot pattern
|
|
1695
|
+
*/
|
|
1696
|
+
declare type LineStyleType = 'solid' | 'dashed' | 'dotted';
|
|
1697
|
+
|
|
1698
|
+
/** One of the BCP-47 locale strings the engine supports for number and date formatting. */
|
|
1699
|
+
declare type Locale = (typeof LOCALES)[number];
|
|
1700
|
+
|
|
1701
|
+
/** The full set of supported BCP-47 locale strings. */
|
|
1702
|
+
declare const LOCALES: readonly ["en-GB", "en-US", "ar", "pt-PT"];
|
|
1703
|
+
|
|
1704
|
+
/** Logical composition of any predicate. */
|
|
1705
|
+
declare type LogicalPredicate = {
|
|
1706
|
+
and: Predicate[];
|
|
1707
|
+
} | {
|
|
1708
|
+
or: Predicate[];
|
|
1709
|
+
} | {
|
|
1710
|
+
not: Predicate;
|
|
1711
|
+
};
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* Resolved mean stat spec.
|
|
1715
|
+
*/
|
|
1716
|
+
declare interface MeanStatSpec {
|
|
1717
|
+
type: 'mean';
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
/**
|
|
1721
|
+
* Strategy for handling null/undefined values in lines and areas.
|
|
1722
|
+
*
|
|
1723
|
+
* - `'zero'` — Replace missing values with zero. Pre-substituted by the compiler, so the renderer
|
|
1724
|
+
* sees no nulls and paths normally.
|
|
1725
|
+
* - `'gap'` — Leave a visible gap where values are missing. The renderer breaks the path at any
|
|
1726
|
+
* null x / y (e.g. d3's `defined()`).
|
|
1727
|
+
* - `'connect'` — Skip missing values and connect adjacent valid points. The renderer drops nulls before pathing.
|
|
1728
|
+
*/
|
|
1729
|
+
declare type MissingValuesType = 'zero' | 'gap' | 'connect';
|
|
1730
|
+
|
|
1731
|
+
/** The hues available as a base for monochrome palettes, in pick order. */
|
|
1732
|
+
declare const MONO_BASES: readonly ["grey", "red", "orange", "yellow", "green", "cyan", "blue", "purple", "pink"];
|
|
1733
|
+
|
|
1734
|
+
/** One of the base hues a monochrome palette can be built from. */
|
|
1735
|
+
declare type MonoPaletteBase = (typeof MONO_BASES)[number];
|
|
1736
|
+
|
|
1737
|
+
declare type MonoPaletteConfig = {
|
|
1738
|
+
type: 'mono';
|
|
1739
|
+
base: MonoPaletteBase;
|
|
1740
|
+
variant?: MonoPaletteVariant;
|
|
1741
|
+
};
|
|
1742
|
+
|
|
1743
|
+
/** Tints the single-hue ramp for use on light vs dark backgrounds. */
|
|
1744
|
+
declare type MonoPaletteVariant = 'light' | 'dark';
|
|
1745
|
+
|
|
1746
|
+
/** The hues available as a base for neon palettes, in pick order. */
|
|
1747
|
+
declare const NEON_BASES: readonly ["cyan", "pink", "purple", "red", "orange", "yellow", "green", "blue"];
|
|
1748
|
+
|
|
1749
|
+
/** One of the base hues a neon palette can be built from. */
|
|
1750
|
+
declare type NeonPaletteBase = (typeof NEON_BASES)[number];
|
|
1751
|
+
|
|
1752
|
+
declare type NeonPaletteConfig = {
|
|
1753
|
+
type: 'neon';
|
|
1754
|
+
base: NeonPaletteBase;
|
|
1755
|
+
variant?: NeonPaletteVariant;
|
|
1756
|
+
};
|
|
1757
|
+
|
|
1758
|
+
/** `waterfall` swaps in the positive/negative/total colors used by waterfall graphs. */
|
|
1759
|
+
declare type NeonPaletteVariant = 'default' | 'waterfall';
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* Configuration for formatting a single number.
|
|
1763
|
+
* Defines how numeric values should be displayed in the chart.
|
|
1764
|
+
*/
|
|
1765
|
+
declare interface NumberFormatConfig {
|
|
1766
|
+
/**
|
|
1767
|
+
* Number of decimal places to display.
|
|
1768
|
+
* - number: Fixed decimal places (e.g., 2 → "1234.56")
|
|
1769
|
+
* - 'auto': Automatic based on value magnitude (default)
|
|
1770
|
+
*/
|
|
1771
|
+
decimals: number | 'auto';
|
|
1772
|
+
/**
|
|
1773
|
+
* Abbreviation style for large numbers.
|
|
1774
|
+
* - 'none': No abbreviation (1234567 → "1,234,567")
|
|
1775
|
+
* - 'auto': Automatic based on magnitude (1234567 → "1.2M")
|
|
1776
|
+
* - 'k': Force thousands (1234567 → "1,234.6K")
|
|
1777
|
+
* - 'm': Force millions (1234567 → "1.2M")
|
|
1778
|
+
* - 'b': Force billions (1234567890 → "1.2B")
|
|
1779
|
+
*/
|
|
1780
|
+
abbreviation: 'auto' | 'k' | 'm' | 'b' | 'none';
|
|
1781
|
+
/**
|
|
1782
|
+
* Thousands separator character.
|
|
1783
|
+
* Default: ',' (US) or locale-aware if locale is set
|
|
1784
|
+
*/
|
|
1785
|
+
thousandsSeparator?: string;
|
|
1786
|
+
/**
|
|
1787
|
+
* Decimal separator character.
|
|
1788
|
+
* Default: '.' (US) or locale-aware if locale is set
|
|
1789
|
+
*/
|
|
1790
|
+
decimalSeparator?: string;
|
|
1791
|
+
/**
|
|
1792
|
+
* Prefix to prepend (e.g., '$', '€').
|
|
1793
|
+
*/
|
|
1794
|
+
prefix?: string;
|
|
1795
|
+
/**
|
|
1796
|
+
* Suffix to append (e.g., '%', ' units').
|
|
1797
|
+
*/
|
|
1798
|
+
suffix?: string;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/** Points at a single observation by its anchor value and series. */
|
|
1802
|
+
declare interface ObservationAnchorInput {
|
|
1803
|
+
/** Stable id of a layer; picks one out when several share the same `(anchorValue, groupValue)` pair. */
|
|
1804
|
+
layerId?: string;
|
|
1805
|
+
/** Value on the main axis (x in cartesian, y in flipped). */
|
|
1806
|
+
anchorValue: DataValue;
|
|
1807
|
+
/** The group value to match if any, otherwise match any group. */
|
|
1808
|
+
groupValue?: DataValue;
|
|
1809
|
+
/** Which point of the matched geom's box to resolve to. Omitted means the geom-natural point. */
|
|
1810
|
+
align?: AnchorAlign;
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
export declare type Options = Partial<LineOptions & BarOptions & ScatterOptions & ComboOptions & PieOptions & TableOptions>;
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* Configure a different overflow strategy per direction.
|
|
1817
|
+
*/
|
|
1818
|
+
declare interface OverflowStrategyConfig {
|
|
1819
|
+
x: PanelOverflowStrategy;
|
|
1820
|
+
y: PanelOverflowStrategy;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
/** Palette selector accepted from users; a custom palette is referenced by `id` only. */
|
|
1824
|
+
declare type PaletteConfigInput = DefaultPaletteConfig | GraphyPaletteConfig | PastelPaletteConfig | NeonPaletteConfig | MonoPaletteConfig | CustomPaletteInput;
|
|
1825
|
+
|
|
1826
|
+
/**
|
|
1827
|
+
* Sparse override map. Keys are group numbers (1-indexed), values are either a raw
|
|
1828
|
+
* hex value, or a color id to look up in the active custom palette.
|
|
1829
|
+
*
|
|
1830
|
+
* Indexes that are not specified fallback to the palette default.
|
|
1831
|
+
*
|
|
1832
|
+
* If both are set, `hex` wins. If `id` is set but not found in the active custom palette,
|
|
1833
|
+
* the override is ignored.
|
|
1834
|
+
*/
|
|
1835
|
+
declare type PaletteOverridesInput = Record<number, {
|
|
1836
|
+
hex?: string;
|
|
1837
|
+
id?: string;
|
|
1838
|
+
}>;
|
|
1839
|
+
|
|
1840
|
+
/** User-facing palette color scale; defaults to the active theme palette when `palette` is omitted. */
|
|
1841
|
+
declare interface PaletteScaleInput {
|
|
1842
|
+
type: 'scale';
|
|
1843
|
+
/** Which aesthetic this scale drives — only color aesthetics accept palettes. */
|
|
1844
|
+
scaledAesthetic: ScaledAestheticKey;
|
|
1845
|
+
scaleType: 'palette';
|
|
1846
|
+
/** Named or custom palette to draw group colors from. */
|
|
1847
|
+
palette?: PaletteConfigInput;
|
|
1848
|
+
/** Per-group color overrides on top of the chosen palette. */
|
|
1849
|
+
overrides?: PaletteOverridesInput;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/** One side of the panel border. */
|
|
1853
|
+
declare type PanelBorderEdge = 'top' | 'right' | 'bottom' | 'left';
|
|
1854
|
+
|
|
1855
|
+
/**
|
|
1856
|
+
* Configuration for one edge of the panel border.
|
|
1857
|
+
*/
|
|
1858
|
+
declare interface PanelBorderEdgeConfig {
|
|
1859
|
+
/**
|
|
1860
|
+
* Whether this edge is drawn.
|
|
1861
|
+
* @default true
|
|
1862
|
+
*/
|
|
1863
|
+
isVisible: boolean;
|
|
1864
|
+
/**
|
|
1865
|
+
* Line style of this edge.
|
|
1866
|
+
* @default 'dashed'
|
|
1867
|
+
*/
|
|
1868
|
+
lineStyle: LineStyleType;
|
|
1869
|
+
/**
|
|
1870
|
+
* Stroke width of this edge in px. null inherits the theme's grid line width.
|
|
1871
|
+
* @default null
|
|
1872
|
+
*/
|
|
1873
|
+
lineWidth: number | null;
|
|
1874
|
+
/**
|
|
1875
|
+
* Stroke color of this edge. Accepts any CSS color, including theme tokens
|
|
1876
|
+
* (e.g. `'var(--graphy-grey-70)'`). null inherits the theme's grid line color.
|
|
1877
|
+
* @default null
|
|
1878
|
+
*/
|
|
1879
|
+
color: string | null;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
/**
|
|
1883
|
+
* Panel configuration. The border is configured per edge; a corner is rounded
|
|
1884
|
+
* only when both edges meeting at it are visible.
|
|
1885
|
+
*/
|
|
1886
|
+
declare interface PanelConfig {
|
|
1887
|
+
border: Record<PanelBorderEdge, PanelBorderEdgeConfig>;
|
|
1888
|
+
/**
|
|
1889
|
+
* Corner radius of the panel border in px. A corner is rounded only when both edges meeting
|
|
1890
|
+
* at it are visible.
|
|
1891
|
+
* @default 8
|
|
1892
|
+
*/
|
|
1893
|
+
cornerRadius: number;
|
|
1894
|
+
/** Per-source, per-axis strategy to use for content that overflows the panel edge. */
|
|
1895
|
+
overflow: {
|
|
1896
|
+
dataLabels: OverflowStrategyConfig;
|
|
1897
|
+
differenceArrows: OverflowStrategyConfig;
|
|
1898
|
+
};
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1901
|
+
/**
|
|
1902
|
+
* How the panel adapts to content that would otherwise overflow its edge.
|
|
1903
|
+
* - `outside`: the overflowing element lands outside the panel frame and the frame shrinks to
|
|
1904
|
+
* accomodate it.
|
|
1905
|
+
* - `inside`: the overflowing element stays inside the panel frame and the content inside the
|
|
1906
|
+
* frame shrinks to accomodate it.
|
|
1907
|
+
* - `none`: no accomodation, content may overflow and overlap with other elements
|
|
1908
|
+
*/
|
|
1909
|
+
declare type PanelOverflowStrategy = 'outside' | 'inside' | 'none';
|
|
1910
|
+
|
|
1911
|
+
declare type PastelPaletteConfig = {
|
|
1912
|
+
type: 'pastel';
|
|
1913
|
+
variant?: PastelPaletteVariant;
|
|
1914
|
+
};
|
|
1915
|
+
|
|
1916
|
+
/** `waterfall` swaps in the positive/negative/total colors used by waterfall graphs. */
|
|
1917
|
+
declare type PastelPaletteVariant = 'default' | 'waterfall';
|
|
1918
|
+
|
|
1919
|
+
declare interface PieOptions {
|
|
1920
|
+
/** Where the aggregate total is shown: inside the ring (donut) or outside the graph. */
|
|
1921
|
+
pieTotalPosition?: 'center' | 'outside';
|
|
1922
|
+
}
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Pinned-number annotation: a marker dot pinned to a single observation. The
|
|
1926
|
+
* renderer's mini view shows the observation's measurement value; hover reveals
|
|
1927
|
+
* the full tooltip (x + y + trend).
|
|
1928
|
+
*/
|
|
1929
|
+
declare interface PinnedNumberAnnotationInput {
|
|
1930
|
+
id?: string;
|
|
1931
|
+
at: ObservationAnchorInput;
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* A single position, expressed as a relationship to the graph that re-resolves each compile.
|
|
1936
|
+
*
|
|
1937
|
+
* - `panel`: a fraction of the plot rect (`[0,1]`), top-left origin. Does not snap to data.
|
|
1938
|
+
* - `observation`: pinned to one observation by its `(anchorValue, groupValue)` pair.
|
|
1939
|
+
* - `axis`: see {@link AxisAnchor}.
|
|
1940
|
+
* - `selection`: see {@link SelectionPointAnchor}.
|
|
1941
|
+
* - `annotation`: see {@link AnnotationPointAnchor}.
|
|
1942
|
+
*/
|
|
1943
|
+
declare type PointAnchorInput = {
|
|
1944
|
+
anchorType: 'panel';
|
|
1945
|
+
x: number;
|
|
1946
|
+
y: number;
|
|
1947
|
+
offset?: AnchorOffset;
|
|
1948
|
+
} | {
|
|
1949
|
+
anchorType: 'observation';
|
|
1950
|
+
/** Stable id of a layer; picks one out when several share the same `(anchorValue, groupValue)` pair. */
|
|
1951
|
+
layerId?: string;
|
|
1952
|
+
anchorValue: DataValue;
|
|
1953
|
+
groupValue?: DataValue;
|
|
1954
|
+
align?: AnchorAlign;
|
|
1955
|
+
offset?: AnchorOffset;
|
|
1956
|
+
} | AxisAnchor | SelectionPointAnchor | AnnotationPointAnchor;
|
|
1957
|
+
|
|
1958
|
+
/**
|
|
1959
|
+
* Point-specific parameters.
|
|
1960
|
+
*/
|
|
1961
|
+
declare interface PointGeomParams {
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
/** The paint vocabulary of the point geom — the shared paint plus marker diameter and border. */
|
|
1965
|
+
declare type PointStyleDeclarations = Pick<StyleDeclarations, 'color' | 'alpha' | 'saturation' | 'size' | 'borderColor' | 'borderWidth'>;
|
|
1966
|
+
|
|
1967
|
+
declare interface PolarCoordInput {
|
|
1968
|
+
type: 'coord';
|
|
1969
|
+
coordType: 'polar';
|
|
1970
|
+
params?: Partial<PolarCoordParams>;
|
|
1971
|
+
}
|
|
1972
|
+
|
|
1973
|
+
/**
|
|
1974
|
+
* Params for polar coordinate system
|
|
1975
|
+
*/
|
|
1976
|
+
declare interface PolarCoordParams extends BaseCoordParams {
|
|
1977
|
+
/**
|
|
1978
|
+
* Which aesthetic maps to theta (angle): 'x' or 'y'
|
|
1979
|
+
*/
|
|
1980
|
+
theta: 'x' | 'y';
|
|
1981
|
+
/**
|
|
1982
|
+
* Starting angle in degrees
|
|
1983
|
+
*/
|
|
1984
|
+
startAngle: number;
|
|
1985
|
+
/**
|
|
1986
|
+
* Inner radius as fraction 0-1 (for donut charts)
|
|
1987
|
+
*/
|
|
1988
|
+
innerRadius: number;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/**
|
|
1992
|
+
* Position adjustment for overlapping geometries.
|
|
1993
|
+
*
|
|
1994
|
+
* - `'stack'` — Stack geometries on top of each other (e.g. stacked bar chart)
|
|
1995
|
+
* - `'dodge'` — Place geometries side by side (e.g. grouped bar chart)
|
|
1996
|
+
* - `'identity'` — No adjustment, use raw positions (e.g. scatter plot, allows overlapping)
|
|
1997
|
+
* - `'fill'` — Normalize stacks to fill 100% of the axis (e.g. 100% stacked bar chart)
|
|
1998
|
+
*/
|
|
1999
|
+
declare type PositionType = 'stack' | 'dodge' | 'identity' | 'fill';
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* An observation match condition: a variable test or a logical combination of them.
|
|
2003
|
+
* Shared by every predicated spec feature (highlights, style rules).
|
|
2004
|
+
*/
|
|
2005
|
+
declare type Predicate = VariablePredicate | LogicalPredicate;
|
|
2006
|
+
|
|
2007
|
+
export declare interface ReferenceLines {
|
|
2008
|
+
goalLine?: GoalLine;
|
|
2009
|
+
trendline?: TrendlineType;
|
|
2010
|
+
averageLine?: AverageLine;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* An area, expressed as a relationship to the graph.
|
|
2015
|
+
*
|
|
2016
|
+
* - `panel`: a rectangle in panel-rect fractions (`[0,1]`), top-left origin.
|
|
2017
|
+
* - `selection`: see {@link SelectionRegionAnchor}.
|
|
2018
|
+
* - `annotation`: see {@link AnnotationRegionAnchor}.
|
|
2019
|
+
*/
|
|
2020
|
+
declare type RegionAnchorInput = {
|
|
2021
|
+
anchorType: 'panel';
|
|
2022
|
+
x: number;
|
|
2023
|
+
y: number;
|
|
2024
|
+
width: number;
|
|
2025
|
+
height: number;
|
|
2026
|
+
} | SelectionRegionAnchor | AnnotationRegionAnchor;
|
|
2027
|
+
|
|
2028
|
+
/***************************************************************
|
|
2029
|
+
* Reshape Transform
|
|
2030
|
+
***************************************************************/
|
|
2031
|
+
declare interface ReshapeOptions {
|
|
2032
|
+
/**
|
|
2033
|
+
* Numeric variables to collapse into rows.
|
|
2034
|
+
* Defaults to all numeric variables
|
|
2035
|
+
* */
|
|
2036
|
+
reshape?: VariableName[];
|
|
2037
|
+
/**
|
|
2038
|
+
* Variables to carry through unchanged.
|
|
2039
|
+
* Defaults to all categorical/temporal variables
|
|
2040
|
+
* */
|
|
2041
|
+
keep?: VariableName[];
|
|
2042
|
+
/**
|
|
2043
|
+
* Name of the output column containing the original variable names.
|
|
2044
|
+
* @default 'key'
|
|
2045
|
+
* */
|
|
2046
|
+
keyName?: VariableName;
|
|
2047
|
+
/**
|
|
2048
|
+
* Name of the output column containing the original values.
|
|
2049
|
+
* @default 'value'
|
|
2050
|
+
* */
|
|
2051
|
+
valueName?: VariableName;
|
|
2052
|
+
}
|
|
2053
|
+
|
|
2054
|
+
declare interface ReshapeTransformInput {
|
|
2055
|
+
type: 'transform';
|
|
2056
|
+
transformType: 'reshape';
|
|
2057
|
+
options: ReshapeOptions;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
/**
|
|
2061
|
+
* TipTap-compatible rich text node (no tiptap dependency).
|
|
2062
|
+
*/
|
|
2063
|
+
declare interface RichTextContent {
|
|
2064
|
+
type?: string;
|
|
2065
|
+
content?: RichTextContent[];
|
|
2066
|
+
text?: string;
|
|
2067
|
+
marks?: Array<{
|
|
2068
|
+
type: string;
|
|
2069
|
+
attrs?: Record<string, unknown>;
|
|
2070
|
+
}>;
|
|
2071
|
+
/**
|
|
2072
|
+
* Per-node attributes the renderer recognizes: `heading.level` (1–3),
|
|
2073
|
+
* `paragraph.textAlign`, and on the `textStyle` mark `color`, `font` (a font
|
|
2074
|
+
* id), and `fontSize` — a number read as `n/10` em. Unrecognized keys are
|
|
2075
|
+
* ignored.
|
|
2076
|
+
*/
|
|
2077
|
+
attrs?: Record<string, unknown>;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* Rule-specific parameters.
|
|
2082
|
+
*
|
|
2083
|
+
* A rule is a single reference line. The renderer reads one observation —
|
|
2084
|
+
* `data.getFirst()` — via `getX`/`getY`. Orientation: horizontal when the layer
|
|
2085
|
+
* maps `y` (a constant-y line spanning the panel width), vertical otherwise;
|
|
2086
|
+
* under a flipped coord system the orientation inverts with the axes.
|
|
2087
|
+
*/
|
|
2088
|
+
declare interface RuleGeomParams {
|
|
2089
|
+
/** Optional inline text label rendered alongside the line. */
|
|
2090
|
+
label?: string;
|
|
2091
|
+
labelPosition: RuleLabelPosition;
|
|
2092
|
+
}
|
|
2093
|
+
|
|
2094
|
+
/**
|
|
2095
|
+
* Where the optional inline label is anchored along a reference line.
|
|
2096
|
+
*/
|
|
2097
|
+
declare type RuleLabelPosition = 'start' | 'end';
|
|
2098
|
+
|
|
2099
|
+
/**
|
|
2100
|
+
* The paint vocabulary of the rule geom.
|
|
2101
|
+
*/
|
|
2102
|
+
declare type RuleStyleDeclarations = Pick<StyleDeclarations, 'color' | 'strokeWidth' | 'lineType'>;
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* Identifiers for scales. Superset of AestheticKey — includes `ySecondary`
|
|
2106
|
+
* which is a scale aesthetic key but NOT an aesthetic (layers still map to `y`).
|
|
2107
|
+
*/
|
|
2108
|
+
declare type ScaledAestheticKey = ScaledPositionAestheticKey | ScaledVisualAestheticKey;
|
|
2109
|
+
|
|
2110
|
+
/** Scale keys whose output is a spatial coordinate. `ySecondary` is the optional second y axis. */
|
|
2111
|
+
declare type ScaledPositionAestheticKey = 'x' | 'y' | 'ySecondary';
|
|
2112
|
+
|
|
2113
|
+
/** Scale keys whose output is a visual channel rather than a position. */
|
|
2114
|
+
declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth' | 'lineType';
|
|
2115
|
+
|
|
2116
|
+
/**
|
|
2117
|
+
* Union type for all possible scale specifications (including inferred, pre-resolution).
|
|
2118
|
+
*/
|
|
2119
|
+
declare type ScaleInput = ContinuousScaleInput | DiscreteScaleInput | PaletteScaleInput | DatetimeScaleInput | IdentityScaleInput | InferredScaleInput;
|
|
2120
|
+
|
|
2121
|
+
/**
|
|
2122
|
+
* Mathematical transformation for continuous scales.
|
|
2123
|
+
*
|
|
2124
|
+
* - `'linear'` — No transformation applied
|
|
2125
|
+
* - `'log'` — Base-10 logarithmic scale
|
|
2126
|
+
* - `'sqrt'` — Square root scale
|
|
2127
|
+
*/
|
|
2128
|
+
declare type ScaleTransformType = 'linear' | 'log' | 'sqrt';
|
|
2129
|
+
|
|
2130
|
+
declare interface ScatterOptions {
|
|
2131
|
+
pointSize?: number | 'auto';
|
|
2132
|
+
}
|
|
2133
|
+
|
|
2134
|
+
/** Friendly aliases for the ColorBrewer diverging codes: `'red-blue'` resolves to the same ramp as `'RdBu'`. */
|
|
2135
|
+
declare const SCHEME_ALIASES: {
|
|
2136
|
+
readonly 'red-blue': "RdBu";
|
|
2137
|
+
readonly 'brown-teal': "BrBG";
|
|
2138
|
+
readonly 'purple-orange': "PuOr";
|
|
2139
|
+
readonly spectral: "Spectral";
|
|
2140
|
+
};
|
|
2141
|
+
|
|
2142
|
+
/** A human-readable alias for a cryptic ColorBrewer diverging code (e.g. `'red-blue'` → `'RdBu'`). */
|
|
2143
|
+
declare type SchemeAlias = keyof typeof SCHEME_ALIASES;
|
|
2144
|
+
|
|
2145
|
+
/**
|
|
2146
|
+
* Overrides for the optional second y axis. Sparse where `x` and `y` are fully resolved: a field
|
|
2147
|
+
* left unset is inherited at compile time — `position` from the side opposite `y`, `isVisible`,
|
|
2148
|
+
* `grid` and `ticks` from `y` itself, and `label` from no label at all. An absent override
|
|
2149
|
+
* therefore means "mirror the primary axis", which stops being expressible once a field is pinned.
|
|
2150
|
+
*/
|
|
2151
|
+
declare type SecondaryAxisOverride = DeepPartial<YAxisConfig>;
|
|
2152
|
+
|
|
2153
|
+
/**
|
|
2154
|
+
* A point at the box of every observation matching `predicate` (a {@link Predicate} — the same
|
|
2155
|
+
* matcher language highlights use), reduced to the box-point named by `align`. Dropped when nothing
|
|
2156
|
+
* matches. Nothing to resolve, so the input and resolved unions share this type.
|
|
2157
|
+
*/
|
|
2158
|
+
declare interface SelectionPointAnchor {
|
|
2159
|
+
anchorType: 'selection';
|
|
2160
|
+
predicate: Predicate;
|
|
2161
|
+
align: AnchorAlign;
|
|
2162
|
+
offset?: AnchorOffset;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2165
|
+
/**
|
|
2166
|
+
* The tight bounding box of every observation matching `predicate` (a {@link Predicate} — the same
|
|
2167
|
+
* matcher language highlights use), grown by `padding`. Dropped when nothing matches. Nothing to
|
|
2168
|
+
* resolve, so the input and resolved unions share this type.
|
|
2169
|
+
*/
|
|
2170
|
+
declare interface SelectionRegionAnchor {
|
|
2171
|
+
anchorType: 'selection';
|
|
2172
|
+
predicate: Predicate;
|
|
2173
|
+
/**
|
|
2174
|
+
* Padding around the box: a number pads both axes in panel fractions, an {@link AnchorOffset} pads
|
|
2175
|
+
* each axis in its `unit` (`px` padding is applied by the runtime resolution pass).
|
|
2176
|
+
*/
|
|
2177
|
+
padding?: number | AnchorOffset;
|
|
2178
|
+
}
|
|
2179
|
+
|
|
2180
|
+
/**
|
|
2181
|
+
* Sequential colormap names from `d3-scale-chromatic`. Matplotlib schemes are lowercase (`viridis`),
|
|
2182
|
+
* ColorBrewer schemes keep Brewer's capitalisation (`Blues`) — lookup is case-insensitive, so casing only
|
|
2183
|
+
* drives autocomplete. `viridis`/`cividis` are perceptually uniform and colour-vision-deficiency safe.
|
|
2184
|
+
*/
|
|
2185
|
+
declare const SEQUENTIAL_SCHEME_NAMES: readonly ["viridis", "magma", "inferno", "plasma", "cividis", "turbo", "Blues", "Greens", "Greys", "Oranges", "Purples", "Reds"];
|
|
2186
|
+
|
|
2187
|
+
declare type SequentialSchemeName = (typeof SEQUENTIAL_SCHEME_NAMES)[number];
|
|
2188
|
+
|
|
2189
|
+
/** Config for styling a specific series. */
|
|
2190
|
+
export declare interface SeriesStyle {
|
|
2191
|
+
/** Id of a slot in the active palette; takes precedence over the palette's default assignment. */
|
|
2192
|
+
paletteColorId?: string;
|
|
2193
|
+
/** Explicit color that overrides any palette slot for this series. */
|
|
2194
|
+
customColor?: string;
|
|
2195
|
+
fillStyle?: 'solid' | 'hatched';
|
|
2196
|
+
lineStyle?: 'solid' | 'dashed' | 'dotted';
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/**
|
|
2200
|
+
* Rectangle annotation. Its area is positioned by a {@link RegionAnchorInput} so it
|
|
2201
|
+
* re-resolves each compile (re-flows on resize, tracks data when bound).
|
|
2202
|
+
*/
|
|
2203
|
+
declare interface ShapeInput {
|
|
2204
|
+
id?: string;
|
|
2205
|
+
kind?: ShapeKind;
|
|
2206
|
+
/** Draw beneath the geoms (background) or on top (foreground). */
|
|
2207
|
+
zOrder?: AnnotationZOrder;
|
|
2208
|
+
/** The area this shape fills. */
|
|
2209
|
+
region: RegionAnchorInput;
|
|
2210
|
+
fillColor?: string;
|
|
2211
|
+
/** Fill alpha, 0 (transparent) to 1 (opaque). */
|
|
2212
|
+
fillOpacity?: number;
|
|
2213
|
+
strokeWidth?: number;
|
|
2214
|
+
/** null falls back to the theme `defaultAnnotationShapeStroke`. */
|
|
2215
|
+
strokeColor?: string | null;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
/** The geometry a shape annotation draws. */
|
|
2219
|
+
declare type ShapeKind = 'rectangle';
|
|
2220
|
+
|
|
2221
|
+
/**
|
|
2222
|
+
* Regression methods supported by the `smooth` stat.
|
|
2223
|
+
*/
|
|
2224
|
+
declare type SmoothMethod = 'linear' | 'loess' | 'exponential' | 'logarithmic' | 'quadratic' | 'power' | 'polynomial';
|
|
2225
|
+
|
|
2226
|
+
/**
|
|
2227
|
+
* User-facing input for the `smooth` stat (params optional).
|
|
2228
|
+
*/
|
|
2229
|
+
declare interface SmoothStatInput {
|
|
2230
|
+
type: 'smooth';
|
|
2231
|
+
method: SmoothMethod;
|
|
2232
|
+
/** Polynomial order — only meaningful when `method: 'polynomial'`. */
|
|
2233
|
+
order?: number;
|
|
2234
|
+
/** LOESS bandwidth — only meaningful when `method: 'loess'`. */
|
|
2235
|
+
bandwidth?: number;
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
/***************************************************************
|
|
2239
|
+
* Sort Transform
|
|
2240
|
+
***************************************************************/
|
|
2241
|
+
declare interface SortOptions {
|
|
2242
|
+
/** The variable to sort by. */
|
|
2243
|
+
variableName: VariableName;
|
|
2244
|
+
/** Sort direction. @default 'asc' */
|
|
2245
|
+
direction?: 'asc' | 'desc';
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
declare interface SortTransformInput {
|
|
2249
|
+
type: 'transform';
|
|
2250
|
+
transformType: 'sort';
|
|
2251
|
+
options: SortOptions;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
/** Data-source attribution shown under the caption. */
|
|
2255
|
+
declare interface SourceContent {
|
|
2256
|
+
label?: string;
|
|
2257
|
+
url?: string;
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
/**
|
|
2261
|
+
* The canonical spec type — plain JSON, serializable. Data is provided separately
|
|
2262
|
+
* (as a `Data` value to {@link compile}, or as a prop to `<GraphProvider>`).
|
|
2263
|
+
*/
|
|
2264
|
+
declare interface SpecInput {
|
|
2265
|
+
mapping: AesMapping;
|
|
2266
|
+
layers: LayerInput[];
|
|
2267
|
+
scales: ScaleInput[];
|
|
2268
|
+
transforms: AnyTransformInput[];
|
|
2269
|
+
highlights: HighlightInput[];
|
|
2270
|
+
styles?: StylesheetInput;
|
|
2271
|
+
annotations?: AnnotationsInput;
|
|
2272
|
+
coords?: CoordInput;
|
|
2273
|
+
config: ConfigInput;
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
/**
|
|
2277
|
+
* User-facing stat input — either a {@link StatName} string shorthand or an object spec.
|
|
2278
|
+
*/
|
|
2279
|
+
declare type StatInput = IdentityStatSpec | CountStatSpec | SmoothStatInput | MeanStatSpec;
|
|
2280
|
+
|
|
2281
|
+
/**
|
|
2282
|
+
* Statistical transformation applied to data before rendering.
|
|
2283
|
+
*
|
|
2284
|
+
* - `'identity'` — No transformation, data passed through unchanged
|
|
2285
|
+
* - `'count'` — Count the number of observations per x-axis value
|
|
2286
|
+
* - `'smooth'` — Fit a regression curve through `(x, y)` and emit the fitted points
|
|
2287
|
+
* - `'mean'` — Reduce the dataset to a single observation holding the mean of `y`
|
|
2288
|
+
*/
|
|
2289
|
+
declare type StatName = 'identity' | 'count' | 'smooth' | 'mean';
|
|
2290
|
+
|
|
2291
|
+
/**
|
|
2292
|
+
* Sticker annotation: a built-in emoji-like image positioned by a {@link PointAnchorInput}.
|
|
2293
|
+
*/
|
|
2294
|
+
declare interface StickerAnnotationInput {
|
|
2295
|
+
id?: string;
|
|
2296
|
+
at: PointAnchorInput;
|
|
2297
|
+
sticker: StickerId;
|
|
2298
|
+
}
|
|
2299
|
+
|
|
2300
|
+
/** Identifier of a built-in sticker image, resolved by the renderer's sticker catalogue. */
|
|
2301
|
+
declare type StickerId = string;
|
|
2302
|
+
|
|
2303
|
+
/**
|
|
2304
|
+
* The runtime states a style entry can scope to. States are paint-only — they never feed layout.
|
|
2305
|
+
*
|
|
2306
|
+
* - `dimmed` — de-emphasized: a highlight matched elsewhere, or the pointer hovers another element.
|
|
2307
|
+
* - `hovered` — the pointer is on the element.
|
|
2308
|
+
*/
|
|
2309
|
+
declare const STYLE_STATES: readonly ["dimmed", "hovered"];
|
|
2310
|
+
|
|
2311
|
+
/**
|
|
2312
|
+
* A color-valued declaration in any of its authored forms: a CSS color literal, an inline
|
|
2313
|
+
* light-dark pair, or a reference into the stylesheet's token table.
|
|
2314
|
+
*/
|
|
2315
|
+
declare type StyleColorValue = string | LightDarkColor | StyleTokenRef;
|
|
2316
|
+
|
|
2317
|
+
/** The declarations an entry can author, color-valued properties in any {@link StyleColorValue} form. */
|
|
2318
|
+
declare type StyleDeclarations = StyleDeclarationsFor<StyleColorValue>;
|
|
2319
|
+
|
|
2320
|
+
/**
|
|
2321
|
+
* Every style property any geom kind understands, in one flat shape. Which subset a given entry may
|
|
2322
|
+
* declare is the kind's vocabulary — the per-kind `Pick` aliases below; the compile stage drops
|
|
2323
|
+
* declarations outside the entry's vocabulary. The parameter is the shape of the color-valued
|
|
2324
|
+
* properties: authored entries take a {@link StyleColorValue}, resolved reads yield a single string.
|
|
2325
|
+
*
|
|
2326
|
+
* - `color` — fill color.
|
|
2327
|
+
* - `alpha` — fill opacity, `0..1`.
|
|
2328
|
+
* - `saturation` — saturation multiplier, `0..1`; `0` is grey.
|
|
2329
|
+
* - `borderRadius` — corner rounding token, resolved to pixels by the bar recipes.
|
|
2330
|
+
* - `borderColor` — border stroke color. A bar draws a border only when this resolves; a point marker
|
|
2331
|
+
* always has one (built-in white).
|
|
2332
|
+
* - `borderWidth` — border stroke width in pixels; `0` is an explicit no-border.
|
|
2333
|
+
* - `strokeWidth` — path stroke width in pixels for line and area outlines.
|
|
2334
|
+
* - `lineType` — dash pattern of a line or area outline.
|
|
2335
|
+
* - `strokeAlpha` — area outline opacity, `0..1`, independent of the fill's `alpha`.
|
|
2336
|
+
* - `fillAlpha` — peak opacity of the gradient wash beneath a line, `0..1`. Undeclared draws no wash.
|
|
2337
|
+
* - `size` — point marker diameter in pixels.
|
|
2338
|
+
*/
|
|
2339
|
+
declare interface StyleDeclarationsFor<ColorValue> {
|
|
2340
|
+
color?: ColorValue;
|
|
2341
|
+
alpha?: number;
|
|
2342
|
+
saturation?: number;
|
|
2343
|
+
borderRadius?: BorderRadiusToken;
|
|
2344
|
+
borderColor?: ColorValue;
|
|
2345
|
+
borderWidth?: number;
|
|
2346
|
+
strokeWidth?: number;
|
|
2347
|
+
lineType?: LineStyleType;
|
|
2348
|
+
strokeAlpha?: number;
|
|
2349
|
+
fillAlpha?: number;
|
|
2350
|
+
size?: number;
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* One entry in a stylesheet list — the serialized shape the {@link style} builders emit. `select`
|
|
2355
|
+
* addresses what the entry styles, `when` holds the conditions under which it applies, and `id` is an
|
|
2356
|
+
* optional stable identity carried into diagnostics, so tooling can point at "that entry" across
|
|
2357
|
+
* edits. Within a list, order is specificity: the last matching entry that declares a property wins.
|
|
2358
|
+
*/
|
|
2359
|
+
declare type StyleRule = {
|
|
2360
|
+
id?: string;
|
|
2361
|
+
select: {
|
|
2362
|
+
target: 'geom';
|
|
2363
|
+
kind?: undefined;
|
|
2364
|
+
layer?: string;
|
|
2365
|
+
};
|
|
2366
|
+
declarations: GeomStyleDeclarations;
|
|
2367
|
+
when?: WhenClause;
|
|
2368
|
+
} | {
|
|
2369
|
+
[K in keyof KindStyleDeclarationsMap]: {
|
|
2370
|
+
id?: string;
|
|
2371
|
+
select: {
|
|
2372
|
+
target: 'geom';
|
|
2373
|
+
kind: K;
|
|
2374
|
+
layer?: string;
|
|
2375
|
+
};
|
|
2376
|
+
declarations: KindStyleDeclarationsMap[K];
|
|
2377
|
+
when?: WhenClause;
|
|
2378
|
+
};
|
|
2379
|
+
}[keyof KindStyleDeclarationsMap];
|
|
2380
|
+
|
|
2381
|
+
/**
|
|
2382
|
+
* A stylesheet — the reusable shape a preset or theme ships as, and the body of the pipeable
|
|
2383
|
+
* {@link StylesheetInput}. `defaults` apply only where no mapped aesthetic decided a value;
|
|
2384
|
+
* `overrides` replace what one decided. `tokens` names colors entries reference via {@link token}.
|
|
2385
|
+
* `extends` composes other stylesheets under this one: tokens merge name-by-name, lists
|
|
2386
|
+
* concatenate, later wins.
|
|
2387
|
+
*/
|
|
2388
|
+
declare interface Stylesheet {
|
|
2389
|
+
extends?: Stylesheet[];
|
|
2390
|
+
tokens?: StyleTokenTable;
|
|
2391
|
+
defaults?: StyleRule[];
|
|
2392
|
+
overrides?: StyleRule[];
|
|
2393
|
+
}
|
|
2394
|
+
|
|
2395
|
+
/** The pipeable stylesheet item: a {@link Stylesheet} tagged for `pipe`. */
|
|
2396
|
+
declare interface StylesheetInput extends Stylesheet {
|
|
2397
|
+
type: 'styles';
|
|
2398
|
+
}
|
|
2399
|
+
|
|
2400
|
+
declare type StyleState = (typeof STYLE_STATES)[number];
|
|
2401
|
+
|
|
2402
|
+
/** The serialized form of a {@link token} reference. */
|
|
2403
|
+
declare interface StyleTokenRef {
|
|
2404
|
+
token: string;
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
/** The stylesheet's token table, mapping the names {@link token} references to their colors. */
|
|
2408
|
+
declare type StyleTokenTable = Record<string, StyleTokenValue>;
|
|
2409
|
+
|
|
2410
|
+
/** A named color in the stylesheet's token table: one literal or a light-dark pair. */
|
|
2411
|
+
declare type StyleTokenValue = string | LightDarkColor;
|
|
2412
|
+
|
|
2413
|
+
declare interface TableOptions {
|
|
2414
|
+
/** Relative widths per column, keyed by column key; values are normalized into fractions. */
|
|
2415
|
+
tableColumnRatios?: Record<string, number>;
|
|
2416
|
+
}
|
|
2417
|
+
|
|
2418
|
+
/** How a text annotation's background fill is applied: faded into the plot or fully opaque. */
|
|
2419
|
+
declare type TextAnnotationBackgroundColorStyle = 'fade' | 'opaque';
|
|
2420
|
+
|
|
2421
|
+
/**
|
|
2422
|
+
* Rich-text annotation positioned by a {@link PointAnchorInput}; `width` is a fraction of the plot
|
|
2423
|
+
* rect and the height is intrinsic to the rendered content.
|
|
2424
|
+
*/
|
|
2425
|
+
declare interface TextAnnotationInput {
|
|
2426
|
+
id?: string;
|
|
2427
|
+
/** Rich-text body to render. */
|
|
2428
|
+
content: RichTextContent;
|
|
2429
|
+
/** The point the text is positioned at; `align` decides which point of the text's box sits here. */
|
|
2430
|
+
at: PointAnchorInput;
|
|
2431
|
+
/** 0..1 of plot width. */
|
|
2432
|
+
width: number;
|
|
2433
|
+
/** Which point of the text's own box sits at `at`. Defaults to `center`. */
|
|
2434
|
+
align?: AnchorAlign;
|
|
2435
|
+
/** null falls back to a transparent background. */
|
|
2436
|
+
backgroundColor?: string | null;
|
|
2437
|
+
/** Whether the background fill fades into the plot or is fully opaque. */
|
|
2438
|
+
backgroundColorStyle?: TextAnnotationBackgroundColorStyle;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
/** A text value — plain string or structured rich text. */
|
|
2442
|
+
declare type TextContent = string | RichTextContent;
|
|
2443
|
+
|
|
2444
|
+
/**
|
|
2445
|
+
* Discriminated union of the built-in transform inputs, keyed on `transformType`. Use
|
|
2446
|
+
* {@link AnyTransformInput} where a plugin-contributed transform may also appear.
|
|
2447
|
+
*/
|
|
2448
|
+
declare type TransformInput = ReshapeTransformInput | FilterTransformInput | SortTransformInput | AggregateTransformInput | ConstantTransformInput;
|
|
2449
|
+
|
|
2450
|
+
export declare type TrendlineType = 'linear' | 'loess' | 'exponential' | 'logarithmic' | 'quadratic' | 'power' | 'polynomial';
|
|
2451
|
+
|
|
2452
|
+
/**
|
|
2453
|
+
* Constant mapping - a literal value applied to every observation.
|
|
2454
|
+
* Analogous to Vega-Lite's `{datum: X}` / ggplot2's `aes(color = "literal")`.
|
|
2455
|
+
*/
|
|
2456
|
+
declare interface ValueMapping {
|
|
2457
|
+
value: DataValue;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
/**
|
|
2461
|
+
* Variable mapping - references a column in the data
|
|
2462
|
+
*/
|
|
2463
|
+
declare interface VariableMapping {
|
|
2464
|
+
variable: string;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
/** A type alias for variable names. */
|
|
2468
|
+
declare type VariableName = string;
|
|
2469
|
+
|
|
2470
|
+
/**
|
|
2471
|
+
* Predicates over the layer's post-transform variables.
|
|
2472
|
+
*
|
|
2473
|
+
* `lt`, `lte`, `gt`, `gte`, and `range` accept `DataValue`s and are coerced at
|
|
2474
|
+
* evaluation time by the referenced variable's `DataType`. Ordering operators
|
|
2475
|
+
* on a categorical variable are a resolve-time validation error.
|
|
2476
|
+
*/
|
|
2477
|
+
declare type VariablePredicate = {
|
|
2478
|
+
variable: VariableName;
|
|
2479
|
+
eq: DataValue;
|
|
2480
|
+
} | {
|
|
2481
|
+
variable: VariableName;
|
|
2482
|
+
oneOf: DataValue[];
|
|
2483
|
+
} | {
|
|
2484
|
+
variable: VariableName;
|
|
2485
|
+
lt: DataValue;
|
|
2486
|
+
} | {
|
|
2487
|
+
variable: VariableName;
|
|
2488
|
+
lte: DataValue;
|
|
2489
|
+
} | {
|
|
2490
|
+
variable: VariableName;
|
|
2491
|
+
gt: DataValue;
|
|
2492
|
+
} | {
|
|
2493
|
+
variable: VariableName;
|
|
2494
|
+
gte: DataValue;
|
|
2495
|
+
} | {
|
|
2496
|
+
variable: VariableName;
|
|
2497
|
+
range: [DataValue, DataValue];
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
/**
|
|
2501
|
+
* The conditions under which a style entry applies — facts that need data or runtime context, as
|
|
2502
|
+
* opposed to the structural address in {@link StyleSelect}.
|
|
2503
|
+
*
|
|
2504
|
+
* - `where` — match observations over the layer's post-transform variables. Absent, every observation
|
|
2505
|
+
* matches.
|
|
2506
|
+
* - `state` — apply only while the renderer reads with this {@link StyleState} active. Absent, the
|
|
2507
|
+
* entry is stateless.
|
|
2508
|
+
*/
|
|
2509
|
+
declare interface WhenClause {
|
|
2510
|
+
where?: Predicate;
|
|
2511
|
+
state?: StyleState;
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* X-axis configuration (after defaults applied)
|
|
2516
|
+
*/
|
|
2517
|
+
declare interface XAxisConfig {
|
|
2518
|
+
/**
|
|
2519
|
+
* Whether the x axis is visible.
|
|
2520
|
+
* @default true
|
|
2521
|
+
*/
|
|
2522
|
+
isVisible: boolean;
|
|
2523
|
+
/**
|
|
2524
|
+
* Axis title text. null means explicitly no label.
|
|
2525
|
+
* @default null
|
|
2526
|
+
*/
|
|
2527
|
+
label: string | null;
|
|
2528
|
+
/**
|
|
2529
|
+
* Position of the y axis.
|
|
2530
|
+
* @default 'bottom'
|
|
2531
|
+
*/
|
|
2532
|
+
position: AxisPosition;
|
|
2533
|
+
/** Grid lines for this axis */
|
|
2534
|
+
grid: AxisGridConfig;
|
|
2535
|
+
/** Tick marks for this axis */
|
|
2536
|
+
ticks: AxisTicksConfig;
|
|
2537
|
+
}
|
|
2538
|
+
|
|
2539
|
+
/**
|
|
2540
|
+
* Y-axis configuration (after defaults applied)
|
|
2541
|
+
*/
|
|
2542
|
+
declare interface YAxisConfig {
|
|
2543
|
+
/**
|
|
2544
|
+
* Whether the y axis is visible.
|
|
2545
|
+
* @default true
|
|
2546
|
+
*/
|
|
2547
|
+
isVisible: boolean;
|
|
2548
|
+
/**
|
|
2549
|
+
* Axis title text. null means explicitly no label.
|
|
2550
|
+
* @default null
|
|
2551
|
+
*/
|
|
2552
|
+
label: string | null;
|
|
2553
|
+
/**
|
|
2554
|
+
* Position of the y axis.
|
|
2555
|
+
* @default 'right'
|
|
2556
|
+
*/
|
|
2557
|
+
position: AxisPosition;
|
|
2558
|
+
/** Grid lines for this axis */
|
|
2559
|
+
grid: AxisGridConfig;
|
|
2560
|
+
/** Tick marks for this axis */
|
|
2561
|
+
ticks: AxisTicksConfig;
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Which Y axis a layer binds to.
|
|
2566
|
+
*/
|
|
2567
|
+
declare type YScaleType = 'primary' | 'secondary';
|
|
2568
|
+
|
|
2569
|
+
export { }
|