@graphysdk/viz-engine 0.0.1-alpha.1 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +96 -1167
- package/dist/index.mjs +2031 -4596
- package/package.json +1 -6
package/dist/index.d.ts
CHANGED
|
@@ -17,11 +17,8 @@ export declare type AestheticKey = keyof AesMapping;
|
|
|
17
17
|
* Aesthetic value can be:
|
|
18
18
|
* - string (shorthand for { variable: string })
|
|
19
19
|
* - { variable: string } (explicit variable mapping)
|
|
20
|
-
* - { value: DataValue } (constant value applied to every observation)
|
|
21
20
|
*/
|
|
22
|
-
declare type AestheticValue = string | VariableMapping
|
|
23
|
-
|
|
24
|
-
declare function aggregate(options: AggregateOptions): AggregateTransformInput;
|
|
21
|
+
declare type AestheticValue = string | VariableMapping;
|
|
25
22
|
|
|
26
23
|
/***************************************************************
|
|
27
24
|
* Aggregate Transform
|
|
@@ -57,56 +54,6 @@ declare type AggregationInput = Record<VariableName, {
|
|
|
57
54
|
aggregation: AggregationFunction;
|
|
58
55
|
}>;
|
|
59
56
|
|
|
60
|
-
export declare interface AngleExtent {
|
|
61
|
-
startAngle: NumericDataValue;
|
|
62
|
-
endAngle: NumericDataValue;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
declare interface AnnotationDataPoint {
|
|
66
|
-
rowIndex?: number;
|
|
67
|
-
columnKey?: string;
|
|
68
|
-
rowValue?: DataValue;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
declare interface Appearance {
|
|
72
|
-
paletteId?: string;
|
|
73
|
-
seriesStyles?: Record<string, SeriesStyle>;
|
|
74
|
-
useSingleColorForBars?: boolean;
|
|
75
|
-
background?: string;
|
|
76
|
-
backgroundModifier?: 'none' | 'tint';
|
|
77
|
-
border?: Partial<{
|
|
78
|
-
style: 'none' | 'custom' | 'tinted' | 'gradient' | 'preset' | 'grey';
|
|
79
|
-
color: string;
|
|
80
|
-
width: number;
|
|
81
|
-
}>;
|
|
82
|
-
hasRoundedCorners?: boolean;
|
|
83
|
-
textStyle?: Partial<{
|
|
84
|
-
heading: GraphTextStyle;
|
|
85
|
-
body: GraphTextStyle;
|
|
86
|
-
}>;
|
|
87
|
-
textScale?: number;
|
|
88
|
-
highlightStyle?: 'grey' | 'fade-color';
|
|
89
|
-
isLogoHidden?: boolean;
|
|
90
|
-
numberFormat?: Partial<{
|
|
91
|
-
decimalPlaces: 'auto' | number;
|
|
92
|
-
abbreviation: 'none' | 'auto' | 'k' | 'm' | 'b';
|
|
93
|
-
}>;
|
|
94
|
-
showTooltips?: boolean;
|
|
95
|
-
animateTransitions?: boolean;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* Appearance configuration (after defaults applied)
|
|
100
|
-
*/
|
|
101
|
-
declare interface AppearanceConfig {
|
|
102
|
-
/**
|
|
103
|
-
* Background color for the chart canvas.
|
|
104
|
-
* null means inherit from the renderer/theme default.
|
|
105
|
-
* @default null
|
|
106
|
-
*/
|
|
107
|
-
background: string | null;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
57
|
declare function area(options?: GeomOptions<'area'>): LayerInputOf<'area'>;
|
|
111
58
|
|
|
112
59
|
/**
|
|
@@ -119,19 +66,6 @@ export declare interface AreaGeomParams {
|
|
|
119
66
|
missingValues: MissingValuesType;
|
|
120
67
|
}
|
|
121
68
|
|
|
122
|
-
declare interface AverageLine {
|
|
123
|
-
columnKey: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Configuration for the axes (if the graph supports them). */
|
|
127
|
-
declare interface Axes {
|
|
128
|
-
x?: AxisOptions;
|
|
129
|
-
y?: AxisOptions;
|
|
130
|
-
y2?: Pick<AxisOptions, 'label'>;
|
|
131
|
-
hasDualYAxis?: boolean;
|
|
132
|
-
showGridLines?: boolean;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
69
|
/**
|
|
136
70
|
* Axes configuration (after defaults applied)
|
|
137
71
|
* Groups all axis-related settings per axis.
|
|
@@ -178,38 +112,19 @@ declare interface AxisMapping {
|
|
|
178
112
|
};
|
|
179
113
|
}
|
|
180
114
|
|
|
181
|
-
declare interface AxisOptions {
|
|
182
|
-
label?: string;
|
|
183
|
-
isHidden?: boolean;
|
|
184
|
-
isReversed?: boolean;
|
|
185
|
-
scaleType?: 'linear' | 'logarithmic';
|
|
186
|
-
min?: number;
|
|
187
|
-
max?: number;
|
|
188
|
-
tickDisplayMode?: 'auto' | 'edges';
|
|
189
|
-
}
|
|
190
|
-
|
|
191
115
|
declare type AxisPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
192
116
|
|
|
193
117
|
/**
|
|
194
|
-
* A single axis tick with its raw value and normalized position.
|
|
195
|
-
* `
|
|
118
|
+
* A single axis tick with its raw value and normalized position.
|
|
119
|
+
* The renderer uses `position` for placement and `value` for label formatting.
|
|
196
120
|
*/
|
|
197
121
|
export declare interface AxisTick {
|
|
198
|
-
/** Raw value in data space (number, Date, or string) */
|
|
122
|
+
/** Raw value in data space (number, Date, or string) — used for label formatting */
|
|
199
123
|
value: DataValue;
|
|
200
124
|
/** Normalized position in [0,1] space — used for placement */
|
|
201
125
|
position: number;
|
|
202
126
|
}
|
|
203
127
|
|
|
204
|
-
/**
|
|
205
|
-
* A tick-set candidate for an axis. The runtime picks the densest one whose labels fit. Datetime candidates
|
|
206
|
-
* may carry a `valueFormat` matched to their interval's granularity, overriding the axis-level format.
|
|
207
|
-
*/
|
|
208
|
-
export declare interface AxisTickCandidate {
|
|
209
|
-
ticks: AxisTick[];
|
|
210
|
-
valueFormat?: ValueFormat;
|
|
211
|
-
}
|
|
212
|
-
|
|
213
128
|
/**
|
|
214
129
|
* Configuration for a single axis's ticks
|
|
215
130
|
*/
|
|
@@ -225,10 +140,6 @@ declare function bar(options?: GeomOptions<'bar'>): LayerInputOf<'bar'>;
|
|
|
225
140
|
*/
|
|
226
141
|
declare type BarGeomParams = Record<string, never>;
|
|
227
142
|
|
|
228
|
-
declare interface BarOptions {
|
|
229
|
-
sortBars?: boolean;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
143
|
/**
|
|
233
144
|
* Base params shared by all coordinate systems
|
|
234
145
|
*/
|
|
@@ -249,8 +160,6 @@ declare interface BaseGeomOptions<T extends GeomParams> {
|
|
|
249
160
|
position?: PositionType;
|
|
250
161
|
yScaleType?: YScaleType;
|
|
251
162
|
params?: Partial<T>;
|
|
252
|
-
transforms?: TransformInput[];
|
|
253
|
-
interactive?: boolean;
|
|
254
163
|
}
|
|
255
164
|
|
|
256
165
|
export declare type BoxSize = {
|
|
@@ -258,21 +167,6 @@ export declare type BoxSize = {
|
|
|
258
167
|
height: number;
|
|
259
168
|
};
|
|
260
169
|
|
|
261
|
-
/**
|
|
262
|
-
* Pure projection of `(compiled, hover)` into the tooltip's `{ header, rows }`.
|
|
263
|
-
*
|
|
264
|
-
* Row order is layer-declaration order across layers, color-scale domain order within a layer
|
|
265
|
-
* (= the legend's display order). The primary hit is emphasized in place — never reordered to
|
|
266
|
-
* the top — so the visual position stays anchored to the legend.
|
|
267
|
-
*/
|
|
268
|
-
export declare const buildTooltipContent: ({ compiled, hover, formattingLocale, }: BuildTooltipContentInput) => TooltipContent | null;
|
|
269
|
-
|
|
270
|
-
declare interface BuildTooltipContentInput {
|
|
271
|
-
compiled: CompiledSpec;
|
|
272
|
-
hover: HoverState;
|
|
273
|
-
formattingLocale?: Locale;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
170
|
/**
|
|
277
171
|
* Caching decorator for any TextMeasurer implementation.
|
|
278
172
|
*
|
|
@@ -305,28 +199,18 @@ declare interface CartesianCoordSpec {
|
|
|
305
199
|
}
|
|
306
200
|
|
|
307
201
|
/**
|
|
308
|
-
* Cartesian coordinate system - standard x/y plot.
|
|
309
|
-
* an axis-assignment variant,
|
|
202
|
+
* Cartesian coordinate system - standard x/y plot.
|
|
203
|
+
* Also used for flipped coordinates (flip is an axis-assignment variant,
|
|
204
|
+
* not a different geometric paradigm — the axisMapping encodes the flip).
|
|
310
205
|
*/
|
|
311
206
|
export declare interface CartesianCoordSystem {
|
|
312
207
|
type: 'cartesian';
|
|
313
|
-
/**
|
|
314
|
-
* The data-space axis that is the main (independent) one. `'x'` for standard cartesian (bars
|
|
315
|
-
* rise, X ticks on the horizontal axis); `'y'` for `coord.flip()` (bars extend, Y ticks on the
|
|
316
|
-
* horizontal axis). Consumers that need to branch on flip read this; the runtime `coord/axes`
|
|
317
|
-
* helpers turn it into main/cross accessors so the branch lives in one place.
|
|
318
|
-
*/
|
|
319
|
-
mainAxis: MainAxis;
|
|
320
208
|
/** Axis orientation metadata for the guide compiler */
|
|
321
209
|
axisMapping: AxisMapping;
|
|
322
210
|
}
|
|
323
211
|
|
|
324
212
|
declare type CategoricalDataValue = string | null;
|
|
325
213
|
|
|
326
|
-
declare interface CategoricalValueFormat {
|
|
327
|
-
type: 'text';
|
|
328
|
-
}
|
|
329
|
-
|
|
330
214
|
/**
|
|
331
215
|
* Chart display and interaction mode.
|
|
332
216
|
* - 'readonly': Normal chart display with full interactivity but no editing (default)
|
|
@@ -352,197 +236,17 @@ declare interface ColorScaleMethods {
|
|
|
352
236
|
palette: (options?: PaletteScaleOptions) => PaletteScaleInput;
|
|
353
237
|
}
|
|
354
238
|
|
|
355
|
-
declare type ColumnMetadata = Record<string, {
|
|
356
|
-
type: DataType;
|
|
357
|
-
valueFormat: ValueFormat;
|
|
358
|
-
label?: string;
|
|
359
|
-
}>;
|
|
360
|
-
|
|
361
|
-
declare interface ComboOptions {
|
|
362
|
-
comboType?: 'grouped-bars' | 'stacked-bars' | 'lines';
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
export declare interface Command<TParams extends Record<string, unknown> = Record<string, unknown>> {
|
|
366
|
-
/**
|
|
367
|
-
* Command type discriminator for type guards
|
|
368
|
-
*/
|
|
369
|
-
readonly type: string;
|
|
370
|
-
/**
|
|
371
|
-
* Metadata for tracking
|
|
372
|
-
*/
|
|
373
|
-
readonly metadata: CommandMetadata;
|
|
374
|
-
/**
|
|
375
|
-
* Serializable parameters for this command.
|
|
376
|
-
*/
|
|
377
|
-
readonly params: TParams;
|
|
378
|
-
/**
|
|
379
|
-
* Execute the command against a spec.
|
|
380
|
-
* Returns the new spec and a revert command that can undo this change.
|
|
381
|
-
*/
|
|
382
|
-
apply: (spec: Spec) => CommandApplyResult | null;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Result of executing a command.
|
|
387
|
-
* Contains the new spec and a revert command that can undo the change.
|
|
388
|
-
*/
|
|
389
|
-
export declare interface CommandApplyResult {
|
|
390
|
-
/** The spec after applying the command */
|
|
391
|
-
readonly spec: Spec;
|
|
392
|
-
/** A standalone command that reverses this execution */
|
|
393
|
-
readonly revert: Command;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
/**
|
|
397
|
-
* Unique identifier for commands.
|
|
398
|
-
*/
|
|
399
|
-
declare type CommandId = string;
|
|
400
|
-
|
|
401
|
-
/**
|
|
402
|
-
* Metadata attached to every command for tracking.
|
|
403
|
-
*/
|
|
404
|
-
export declare interface CommandMetadata {
|
|
405
|
-
/** Unique identifier for this command */
|
|
406
|
-
readonly id: CommandId;
|
|
407
|
-
/** When the command was executed */
|
|
408
|
-
readonly timestamp: number;
|
|
409
|
-
/** Human-readable description for UI display */
|
|
410
|
-
readonly description: string;
|
|
411
|
-
/** Author of the command */
|
|
412
|
-
readonly author: string;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Event types emitted by CommandStackManager.
|
|
417
|
-
*/
|
|
418
|
-
export declare type CommandStackEvent = {
|
|
419
|
-
type: 'apply';
|
|
420
|
-
command: Command;
|
|
421
|
-
spec: Spec;
|
|
422
|
-
} | {
|
|
423
|
-
type: 'undo';
|
|
424
|
-
command: Command;
|
|
425
|
-
spec: Spec;
|
|
426
|
-
} | {
|
|
427
|
-
type: 'redo';
|
|
428
|
-
command: Command;
|
|
429
|
-
spec: Spec;
|
|
430
|
-
} | {
|
|
431
|
-
type: 'clear';
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Listener for command stack events.
|
|
436
|
-
*/
|
|
437
|
-
export declare type CommandStackListener = (event: CommandStackEvent) => void;
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Manages command execution with undo/redo support using revert commands.
|
|
441
|
-
*
|
|
442
|
-
* Commands are stateless — executing a command returns the new spec and a
|
|
443
|
-
* standalone revert command. The manager stores these revert commands on
|
|
444
|
-
* the undo stack. Undo executes the revert (producing a new forward command
|
|
445
|
-
* for redo), and redo executes that forward command (producing a new revert
|
|
446
|
-
* for undo again).
|
|
447
|
-
*
|
|
448
|
-
* @example
|
|
449
|
-
* ```typescript
|
|
450
|
-
* const manager = new CommandStackManager();
|
|
451
|
-
*
|
|
452
|
-
* // Execute a command
|
|
453
|
-
* let spec = manager.apply(command, spec);
|
|
454
|
-
*
|
|
455
|
-
* // Undo the last command
|
|
456
|
-
* const undoResult = manager.undo(spec);
|
|
457
|
-
* if (undoResult) {
|
|
458
|
-
* spec = undoResult.spec;
|
|
459
|
-
* }
|
|
460
|
-
*
|
|
461
|
-
* // Redo the undone command
|
|
462
|
-
* const redoResult = manager.redo(spec);
|
|
463
|
-
* if (redoResult) {
|
|
464
|
-
* spec = redoResult.spec;
|
|
465
|
-
* }
|
|
466
|
-
* ```
|
|
467
|
-
*/
|
|
468
|
-
export declare class CommandStackManager {
|
|
469
|
-
private undoStack;
|
|
470
|
-
private redoStack;
|
|
471
|
-
private listeners;
|
|
472
|
-
private readonly maxHistorySize;
|
|
473
|
-
private isEmitting;
|
|
474
|
-
private cachedSnapshot;
|
|
475
|
-
constructor(options?: CommandStackOptions);
|
|
476
|
-
/**
|
|
477
|
-
* Execute a command and add it to the undo stack.
|
|
478
|
-
* Clears the redo stack (standard undo/redo behavior).
|
|
479
|
-
*/
|
|
480
|
-
apply(command: Command, spec: Spec): Spec;
|
|
481
|
-
/**
|
|
482
|
-
* Undo the most recent command.
|
|
483
|
-
* Executes the revert command and moves the entry to the redo stack.
|
|
484
|
-
* Returns the result with new spec and the original command, or null if nothing to undo.
|
|
485
|
-
*/
|
|
486
|
-
undo(spec: Spec): UndoRedoResult | null;
|
|
487
|
-
/**
|
|
488
|
-
* Redo the most recently undone command.
|
|
489
|
-
* Executes the redo action and moves the entry back to the undo stack.
|
|
490
|
-
* Returns the result with new spec and the original command, or null if nothing to redo.
|
|
491
|
-
*/
|
|
492
|
-
redo(spec: Spec): UndoRedoResult | null;
|
|
493
|
-
/**
|
|
494
|
-
* Clear all history (both undo and redo stacks).
|
|
495
|
-
*/
|
|
496
|
-
clear(): void;
|
|
497
|
-
/**
|
|
498
|
-
* Get an immutable snapshot of the command stack state.
|
|
499
|
-
* Returns a cached object with referential stability.
|
|
500
|
-
*/
|
|
501
|
-
getSnapshot(): CommandStackSnapshot;
|
|
502
|
-
/**
|
|
503
|
-
* Subscribe to command stack events.
|
|
504
|
-
* @returns Unsubscribe function
|
|
505
|
-
*/
|
|
506
|
-
subscribe(listener: CommandStackListener): () => void;
|
|
507
|
-
private withReentrancyGuard;
|
|
508
|
-
private emit;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
/**
|
|
512
|
-
* Options for CommandStackManager.
|
|
513
|
-
*/
|
|
514
|
-
declare interface CommandStackOptions {
|
|
515
|
-
/** Maximum number of commands to keep in history (default: 100) */
|
|
516
|
-
maxHistorySize?: number;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
/**
|
|
520
|
-
* Immutable snapshot of command stack state.
|
|
521
|
-
* Designed for use with React's `useSyncExternalStore(manager.subscribe, manager.getSnapshot)`.
|
|
522
|
-
*/
|
|
523
|
-
export declare interface CommandStackSnapshot {
|
|
524
|
-
readonly canUndo: boolean;
|
|
525
|
-
readonly canRedo: boolean;
|
|
526
|
-
readonly undoDescription: string | null;
|
|
527
|
-
readonly redoDescription: string | null;
|
|
528
|
-
}
|
|
529
|
-
|
|
530
239
|
/** Comparison operators for declarative filtering. */
|
|
531
240
|
declare type ComparisonOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
532
241
|
|
|
533
242
|
/**
|
|
534
243
|
* Convenience entry point to create a fully wired {@link Compiler} and compile a spec.
|
|
535
|
-
*
|
|
536
|
-
* Accepts either a low-level {@link SpecInput} (constructed via `createSpec`/`pipe`)
|
|
537
|
-
* or a high-level {@link GraphConfig}. When given a `GraphConfig`, it parses the raw
|
|
538
|
-
* data and converts it to a `SpecInput` before running the pipeline.
|
|
539
244
|
*/
|
|
540
|
-
export declare const compile: (
|
|
245
|
+
export declare const compile: (spec: SpecInput) => CompiledSpec;
|
|
541
246
|
|
|
542
247
|
/**
|
|
543
248
|
* Axis guide produced from a position scale (x, y, ySecondary).
|
|
544
|
-
*
|
|
545
|
-
* happens at layout time).
|
|
249
|
+
* Ticks carry their normalized positions so the renderer needs no scale logic.
|
|
546
250
|
*/
|
|
547
251
|
export declare interface CompiledAxisGuide {
|
|
548
252
|
/** Which scale this axis represents */
|
|
@@ -555,10 +259,8 @@ export declare interface CompiledAxisGuide {
|
|
|
555
259
|
label: string | null;
|
|
556
260
|
/** Whether the axis (line + ticks + labels) is visible */
|
|
557
261
|
isVisible: boolean;
|
|
558
|
-
/**
|
|
559
|
-
|
|
560
|
-
/** Resolved format descriptor shared by all ticks on this axis */
|
|
561
|
-
valueFormat: ValueFormat;
|
|
262
|
+
/** Ticks with raw values and normalized positions */
|
|
263
|
+
ticks: AxisTick[];
|
|
562
264
|
/** Tick mode from config */
|
|
563
265
|
tickMode: AxisLabelMode;
|
|
564
266
|
/** Whether tick marks are visible */
|
|
@@ -567,8 +269,6 @@ export declare interface CompiledAxisGuide {
|
|
|
567
269
|
gridVisible: boolean;
|
|
568
270
|
/** Scale type — the renderer uses this to select a formatting strategy */
|
|
569
271
|
scaleType: ScaleType;
|
|
570
|
-
/** Band width in [0, 1] space for discrete position scales. Undefined otherwise. */
|
|
571
|
-
bandwidth?: number;
|
|
572
272
|
}
|
|
573
273
|
|
|
574
274
|
declare interface CompiledGeom {
|
|
@@ -588,7 +288,6 @@ declare interface CompiledGroup {
|
|
|
588
288
|
export declare interface CompiledGuides {
|
|
589
289
|
axes: CompiledAxisGuide[];
|
|
590
290
|
legends: CompiledLegendGuide[];
|
|
591
|
-
panel: CompiledPanel;
|
|
592
291
|
}
|
|
593
292
|
|
|
594
293
|
/**
|
|
@@ -604,8 +303,7 @@ export declare interface CompiledIdentityScale extends CompiledScaleBase {
|
|
|
604
303
|
* Render-ready layer with resolved mappings and transformed data.
|
|
605
304
|
*/
|
|
606
305
|
export declare interface CompiledLayer {
|
|
607
|
-
|
|
608
|
-
id: string;
|
|
306
|
+
index: number;
|
|
609
307
|
data: Dataset;
|
|
610
308
|
geom: GeomName;
|
|
611
309
|
/** Final mapping after merging root + layer + stat + geom overrides */
|
|
@@ -613,26 +311,8 @@ export declare interface CompiledLayer {
|
|
|
613
311
|
position: PositionType;
|
|
614
312
|
yScaleType: YScaleType;
|
|
615
313
|
params: LayerSpec['params'];
|
|
616
|
-
/**
|
|
617
|
-
* When `false`, the runtime hover engine excludes this layer from primary hit-detection — a
|
|
618
|
-
* colocated interactive layer (line/area/bar) wins instead. The layer can still be surfaced as
|
|
619
|
-
* a related companion when another layer is primary.
|
|
620
|
-
*/
|
|
621
|
-
interactive: boolean;
|
|
622
314
|
}
|
|
623
315
|
|
|
624
|
-
/**
|
|
625
|
-
* `CompiledLayer` narrowed to a specific `geom`. Lets call sites that already know the geom
|
|
626
|
-
* (geom renderers dispatched off `layer.geom`) take a typed `params` directly, eliminating the
|
|
627
|
-
* `as ...GeomParams` cast that was needed when `params` was the full param union.
|
|
628
|
-
*/
|
|
629
|
-
export declare type CompiledLayerFor<G extends GeomName> = Omit<CompiledLayer, 'geom' | 'params'> & {
|
|
630
|
-
geom: G;
|
|
631
|
-
params: Extract<LayerSpec, {
|
|
632
|
-
geom: G;
|
|
633
|
-
}>['params'];
|
|
634
|
-
};
|
|
635
|
-
|
|
636
316
|
export declare interface CompiledLegendGuide {
|
|
637
317
|
/** Which aesthetics this legend represents (may be merged) */
|
|
638
318
|
aesthetics: AestheticKey[];
|
|
@@ -644,14 +324,6 @@ export declare interface CompiledLegendGuide {
|
|
|
644
324
|
display: ResolvedLegendDisplay;
|
|
645
325
|
/** Legend entries in domain order */
|
|
646
326
|
items: LegendItem[];
|
|
647
|
-
/** Resolved format descriptor shared by all items in this legend */
|
|
648
|
-
valueFormat: ValueFormat;
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export declare interface CompiledPanel {
|
|
652
|
-
border: {
|
|
653
|
-
isVisible: boolean;
|
|
654
|
-
};
|
|
655
327
|
}
|
|
656
328
|
|
|
657
329
|
declare interface CompiledPositionAdjuster {
|
|
@@ -680,7 +352,7 @@ declare interface CompiledScaleBase<Input = DataValue> {
|
|
|
680
352
|
aesthetic: AestheticKey;
|
|
681
353
|
domain: Input[];
|
|
682
354
|
spec: ScaleSpec;
|
|
683
|
-
generateTicks: (
|
|
355
|
+
generateTicks: () => Input[];
|
|
684
356
|
}
|
|
685
357
|
|
|
686
358
|
export declare type CompiledScales = Partial<Record<ScaledAestheticKey, CompiledScale>>;
|
|
@@ -689,7 +361,6 @@ export declare type CompiledScales = Partial<Record<ScaledAestheticKey, Compiled
|
|
|
689
361
|
* Fully compiled spec, ready for the renderer.
|
|
690
362
|
*/
|
|
691
363
|
export declare interface CompiledSpec {
|
|
692
|
-
spec: Spec;
|
|
693
364
|
coordSystem: CoordSystem;
|
|
694
365
|
layers: CompiledLayer[];
|
|
695
366
|
scales: CompiledScales;
|
|
@@ -722,7 +393,7 @@ declare type CompiledVisualScaleOptions<Input = DataValue> = Omit<CompiledVisual
|
|
|
722
393
|
* the entire plot.
|
|
723
394
|
*/
|
|
724
395
|
export declare class Compiler {
|
|
725
|
-
private readonly
|
|
396
|
+
private readonly specValidator;
|
|
726
397
|
private readonly transformCompiler;
|
|
727
398
|
private readonly layerCompiler;
|
|
728
399
|
private readonly scaleCompiler;
|
|
@@ -730,22 +401,16 @@ export declare class Compiler {
|
|
|
730
401
|
private readonly positionMapperCompiler;
|
|
731
402
|
private readonly visualMapperCompiler;
|
|
732
403
|
private readonly guideCompiler;
|
|
733
|
-
constructor(
|
|
734
|
-
compile(
|
|
404
|
+
constructor(specValidator: SpecValidator, transformCompiler: TransformCompiler, layerCompiler: LayerCompiler, scaleCompiler: ScaleCompiler, coordCompiler: CoordCompiler, positionMapperCompiler: PositionMapperCompiler, visualMapperCompiler: VisualMapperCompiler, guideCompiler: GuideCompiler);
|
|
405
|
+
compile(specInput: SpecInput): CompiledSpec;
|
|
735
406
|
}
|
|
736
407
|
|
|
737
|
-
/**
|
|
738
|
-
* Any value accepted by {@link Compiler.compile}: a low-level {@link SpecInput}, a high-level {@link GraphConfig}
|
|
739
|
-
* or an already-resolved {@link Spec}.
|
|
740
|
-
*/
|
|
741
|
-
export declare type CompilerInput = SpecInput | GraphConfig | Spec;
|
|
742
|
-
|
|
743
408
|
/**
|
|
744
409
|
* Create a custom configuration
|
|
745
410
|
*/
|
|
746
411
|
export declare function config(options: ConfigInput): ConfigItem;
|
|
747
412
|
|
|
748
|
-
|
|
413
|
+
declare type ConfigInput = DeepPartial<ConfigSpec> & {
|
|
749
414
|
legend?: LegendConfigInput;
|
|
750
415
|
content?: ContentInput;
|
|
751
416
|
};
|
|
@@ -764,54 +429,17 @@ declare interface ConfigItem {
|
|
|
764
429
|
*/
|
|
765
430
|
export declare interface ConfigSpec {
|
|
766
431
|
mode: ChartMode;
|
|
767
|
-
parsingLocale:
|
|
432
|
+
parsingLocale: string;
|
|
768
433
|
legend: LegendConfig;
|
|
769
434
|
axes: AxesConfig;
|
|
770
435
|
panel: PanelConfig;
|
|
771
436
|
headline: HeadlineConfig;
|
|
772
437
|
numberFormat: NumberFormatConfig;
|
|
773
438
|
content: ContentConfig;
|
|
774
|
-
appearance: AppearanceConfig;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
declare function constant(options: ConstantOptions): ConstantTransformInput;
|
|
778
|
-
|
|
779
|
-
/***************************************************************
|
|
780
|
-
* Constant Transform
|
|
781
|
-
***************************************************************/
|
|
782
|
-
declare interface ConstantOptions {
|
|
783
|
-
/** The name of the new variable. */
|
|
784
|
-
variableName: VariableName;
|
|
785
|
-
/** The type of the new variable. */
|
|
786
|
-
type: DataType;
|
|
787
|
-
/** The constant value to assign to every observation. */
|
|
788
|
-
value: DataValue;
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
declare interface ConstantTransformInput {
|
|
792
|
-
type: 'transform';
|
|
793
|
-
transformType: 'constant';
|
|
794
|
-
options: ConstantOptions;
|
|
795
|
-
}
|
|
796
|
-
|
|
797
|
-
/** Text content in the graph. */
|
|
798
|
-
declare interface Content {
|
|
799
|
-
title?: string | unknown;
|
|
800
|
-
isTitleHidden?: boolean;
|
|
801
|
-
subtitle?: string | unknown;
|
|
802
|
-
isSubtitleHidden?: boolean;
|
|
803
|
-
caption?: string | unknown;
|
|
804
|
-
isCaptionHidden?: boolean;
|
|
805
|
-
source?: Partial<{
|
|
806
|
-
label: string;
|
|
807
|
-
url: string;
|
|
808
|
-
}>;
|
|
809
|
-
isSourceHidden?: boolean;
|
|
810
439
|
}
|
|
811
440
|
|
|
812
441
|
/** Resolved content configuration (all fields populated). */
|
|
813
442
|
export declare interface ContentConfig {
|
|
814
|
-
isVisible: boolean;
|
|
815
443
|
title: TextContent | null;
|
|
816
444
|
subtitle: TextContent | null;
|
|
817
445
|
caption: TextContent | null;
|
|
@@ -1016,7 +644,7 @@ export declare const createSizeValueReader: (data: Dataset, mapping: AesMapping)
|
|
|
1016
644
|
* scale.x(),
|
|
1017
645
|
* )
|
|
1018
646
|
*/
|
|
1019
|
-
export declare function createSpec(data:
|
|
647
|
+
export declare function createSpec(data: Dataset, ...items: Array<AesMapping | SpecItem>): SpecInput;
|
|
1020
648
|
|
|
1021
649
|
export declare const createStrokeWidthValueReader: (data: Dataset, mapping: AesMapping) => (observation: Observation) => DataValue;
|
|
1022
650
|
|
|
@@ -1024,47 +652,6 @@ export declare const createXValueReader: (data: Dataset, mapping: AesMapping) =>
|
|
|
1024
652
|
|
|
1025
653
|
export declare const createYValueReader: (data: Dataset, mapping: AesMapping) => (observation: Observation) => DataValue;
|
|
1026
654
|
|
|
1027
|
-
/** Three letter ISO string representing the currency */
|
|
1028
|
-
declare type CurrencyIso = 'aed' | 'aud' | 'bdt' | 'bhd' | 'brl' | 'cad' | 'chf' | 'clp' | 'cny' | 'cop' | 'czk' | 'dkk' | 'egp' | 'eur' | 'gbp' | 'hkd' | 'huf' | 'idr' | 'ils' | 'inr' | 'jpy' | 'krw' | 'kwd' | 'mxn' | 'myr' | 'ngn' | 'nok' | 'nzd' | 'php' | 'pkr' | 'pln' | 'qar' | 'ron' | 'rub' | 'sar' | 'sek' | 'sgd' | 'thb' | 'try' | 'twd' | 'usd' | 'vnd' | 'zar';
|
|
1029
|
-
|
|
1030
|
-
declare interface CurrencyValueFormat {
|
|
1031
|
-
type: 'currency';
|
|
1032
|
-
iso: CurrencyIso;
|
|
1033
|
-
}
|
|
1034
|
-
|
|
1035
|
-
/**
|
|
1036
|
-
* Data to visualize. Structured as a table.
|
|
1037
|
-
*
|
|
1038
|
-
* The public-API contract. Row values must be {@link DataValue} (string, number,
|
|
1039
|
-
* Date, or null). Internal entry points (e.g. the dataset parser) accept a
|
|
1040
|
-
* looser row type — see {@link RawData} — because they must defensively handle
|
|
1041
|
-
* malformed input.
|
|
1042
|
-
*/
|
|
1043
|
-
export declare interface Data {
|
|
1044
|
-
/**
|
|
1045
|
-
* 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.
|
|
1046
|
-
*/
|
|
1047
|
-
columns: Array<{
|
|
1048
|
-
/** Unique, stable identifier. */
|
|
1049
|
-
key: string;
|
|
1050
|
-
/** Friendly label for the column. */
|
|
1051
|
-
label?: string;
|
|
1052
|
-
/* Excluded from this release type: _metadata */
|
|
1053
|
-
}>;
|
|
1054
|
-
/**
|
|
1055
|
-
* Data rows. Each row object must contain keys that match `columns[i].key`.
|
|
1056
|
-
*/
|
|
1057
|
-
rows: Array<Record<string, DataValue>>;
|
|
1058
|
-
/* Excluded from this release type: _metadata */
|
|
1059
|
-
}
|
|
1060
|
-
|
|
1061
|
-
declare interface DataLabels {
|
|
1062
|
-
showDataLabels?: boolean;
|
|
1063
|
-
dataLabelFormat?: 'absolute' | 'percentage';
|
|
1064
|
-
showStackTotals?: boolean;
|
|
1065
|
-
showCategoryLabels?: boolean;
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
655
|
/**
|
|
1069
656
|
* An immutable, columnar dataset. Uses Arquero internally for filtering, grouping and aggregation.
|
|
1070
657
|
*
|
|
@@ -1111,12 +698,6 @@ export declare class Dataset {
|
|
|
1111
698
|
* Returns true if the dataset has the given variable.
|
|
1112
699
|
*/
|
|
1113
700
|
hasVariable(variable: VariableName): boolean;
|
|
1114
|
-
/**
|
|
1115
|
-
* Returns a JSON-serialisable {@link Data} representation of this dataset. Inverse of
|
|
1116
|
-
* {@link parseDataset}: feeding the result back through the parser reconstructs an
|
|
1117
|
-
* equivalent dataset.
|
|
1118
|
-
*/
|
|
1119
|
-
toData(): Data;
|
|
1120
701
|
/**
|
|
1121
702
|
* Adds a new variable to the dataset.
|
|
1122
703
|
*/
|
|
@@ -1234,19 +815,14 @@ export declare class Dataset {
|
|
|
1234
815
|
* @throws If any variable in `reshape` is not numeric.
|
|
1235
816
|
*
|
|
1236
817
|
* @example
|
|
1237
|
-
* const reshaped = data.reshapeFromWideToLong(
|
|
1238
|
-
*
|
|
1239
|
-
*
|
|
1240
|
-
*
|
|
1241
|
-
*
|
|
1242
|
-
*
|
|
818
|
+
* const reshaped = data.reshapeFromWideToLong(
|
|
819
|
+
* ['country'], // keep
|
|
820
|
+
* ['2020', '2021'], // reshape
|
|
821
|
+
* 'year', // keyName
|
|
822
|
+
* 'gdp', // valueName
|
|
823
|
+
* );
|
|
1243
824
|
*/
|
|
1244
|
-
reshapeFromWideToLong(
|
|
1245
|
-
keep?: VariableName[];
|
|
1246
|
-
reshape?: VariableName[];
|
|
1247
|
-
keyName?: VariableName;
|
|
1248
|
-
valueName?: VariableName;
|
|
1249
|
-
}): Dataset;
|
|
825
|
+
reshapeFromWideToLong(keep?: VariableName[], reshape?: VariableName[], keyName?: VariableName, valueName?: VariableName): Dataset;
|
|
1250
826
|
/**
|
|
1251
827
|
* Prints the dataset to the console.
|
|
1252
828
|
*/
|
|
@@ -1273,17 +849,6 @@ export declare class Dataset {
|
|
|
1273
849
|
private getDistinctValues;
|
|
1274
850
|
}
|
|
1275
851
|
|
|
1276
|
-
/**
|
|
1277
|
-
* Metadata about the dataset (before we reshape it from wide to long format).
|
|
1278
|
-
*/
|
|
1279
|
-
declare interface DatasetMetadata {
|
|
1280
|
-
/**
|
|
1281
|
-
* Column metadata, keyed by column key. For each column,
|
|
1282
|
-
* we store the inferred value format and a function to get the default label.
|
|
1283
|
-
*/
|
|
1284
|
-
columns: ColumnMetadata;
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1287
852
|
/** The type of a variable's values. Internally, numeric values are stored as numbers, dates as Date objects and categorical values as strings. */
|
|
1288
853
|
export declare type DataType = 'numeric' | 'categorical' | 'temporal';
|
|
1289
854
|
|
|
@@ -1329,13 +894,6 @@ declare type DatetimeScaleOptions = {
|
|
|
1329
894
|
|
|
1330
895
|
declare type DatetimeScaleSpec = Required<DatetimeScaleInput>;
|
|
1331
896
|
|
|
1332
|
-
declare interface DatetimeTickInterval {
|
|
1333
|
-
unit: DatetimeTickIntervalUnit;
|
|
1334
|
-
step: number;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
declare type DatetimeTickIntervalUnit = 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
|
|
1338
|
-
|
|
1339
897
|
/**
|
|
1340
898
|
* Recursively makes every property of `T` optional.
|
|
1341
899
|
* Unlike the built-in `Partial`, this applies to nested objects as well.
|
|
@@ -1362,8 +920,6 @@ export declare const DEFAULT_FONT_STYLE = "normal";
|
|
|
1362
920
|
*/
|
|
1363
921
|
export declare const DEFAULT_FONT_WEIGHT = 500;
|
|
1364
922
|
|
|
1365
|
-
export declare const DEFAULT_LOCALE: Locale;
|
|
1366
|
-
|
|
1367
923
|
export declare const DEFAULT_PALETTE_NAME = "default";
|
|
1368
924
|
|
|
1369
925
|
declare interface DiscreteScaleInput {
|
|
@@ -1403,14 +959,12 @@ declare type DiscreteScaleSpec = Required<DiscreteScaleInput>;
|
|
|
1403
959
|
|
|
1404
960
|
declare type DiscreteSort = 'ascending' | 'descending' | 'none';
|
|
1405
961
|
|
|
1406
|
-
/** Measured heights of content regions (
|
|
962
|
+
/** Measured heights of content regions (title+subtitle, caption). */
|
|
1407
963
|
export declare interface ExternalMeasurements {
|
|
1408
|
-
|
|
1409
|
-
|
|
964
|
+
titleSize: BoxSize;
|
|
965
|
+
captionSize: BoxSize;
|
|
1410
966
|
}
|
|
1411
967
|
|
|
1412
|
-
declare function filter(options: FilterOptions): FilterTransformInput;
|
|
1413
|
-
|
|
1414
968
|
/***************************************************************
|
|
1415
969
|
* Filter Transform
|
|
1416
970
|
***************************************************************/
|
|
@@ -1450,45 +1004,6 @@ export declare interface FontSpec {
|
|
|
1450
1004
|
style?: 'normal' | 'italic' | 'oblique';
|
|
1451
1005
|
}
|
|
1452
1006
|
|
|
1453
|
-
/**
|
|
1454
|
-
* Formats all legend guides by attaching a `formattedLabel` to each item.
|
|
1455
|
-
*/
|
|
1456
|
-
export declare const formatLegends: (compiled: CompiledSpec, { formattingLocale }?: {
|
|
1457
|
-
formattingLocale?: Locale;
|
|
1458
|
-
}) => FormattedLegend[];
|
|
1459
|
-
|
|
1460
|
-
export declare interface FormattedAxis extends Omit<CompiledAxisGuide, 'tickCandidates'> {
|
|
1461
|
-
ticks: Array<AxisTick & {
|
|
1462
|
-
formattedLabel: string;
|
|
1463
|
-
}>;
|
|
1464
|
-
/** Rotation in degrees applied uniformly to all tick labels. 0 = no rotation. */
|
|
1465
|
-
labelRotation: number;
|
|
1466
|
-
/** Max label width in px before ellipsis truncation. null = no cap. */
|
|
1467
|
-
labelMaxWidthPx: number | null;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
export declare interface FormattedLegend extends Omit<CompiledLegendGuide, 'items'> {
|
|
1471
|
-
items: Array<LegendItem & {
|
|
1472
|
-
formattedLabel: string;
|
|
1473
|
-
}>;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
/**
|
|
1477
|
-
* Options for `generateTicks`:
|
|
1478
|
-
* - `{ count }` — approximate tick count (continuous, datetime).
|
|
1479
|
-
* - `{ interval }` — fixed time interval (datetime only).
|
|
1480
|
-
* - `{ atInputs: true }` — ticks at the deduped input values (datetime only).
|
|
1481
|
-
*
|
|
1482
|
-
* Discrete scales ignore options. Unsupported variants on a given scale fall back to defaults.
|
|
1483
|
-
*/
|
|
1484
|
-
declare type GenerateTicksOptions = {
|
|
1485
|
-
count: number;
|
|
1486
|
-
} | {
|
|
1487
|
-
interval: DatetimeTickInterval;
|
|
1488
|
-
} | {
|
|
1489
|
-
atInputs: true;
|
|
1490
|
-
};
|
|
1491
|
-
|
|
1492
1007
|
/**
|
|
1493
1008
|
* Base class for geoms that turn observations into visual marks (points, bars, lines etc).
|
|
1494
1009
|
*/
|
|
@@ -1557,24 +1072,22 @@ declare class GeomRegistry extends Registry<GeomName, Geom> {
|
|
|
1557
1072
|
/** Reads the resolved alpha (opacity) value from an observation. */
|
|
1558
1073
|
export declare function getAlpha(observation: Observation): NumericDataValue;
|
|
1559
1074
|
|
|
1560
|
-
export declare function getAngleExtent(observation: Observation): AngleExtent;
|
|
1561
|
-
|
|
1562
1075
|
/** Reads the resolved color string from an observation. */
|
|
1563
|
-
export declare function getColor(observation: Observation):
|
|
1076
|
+
export declare function getColor(observation: Observation): CategoricalDataValue;
|
|
1564
1077
|
|
|
1565
|
-
|
|
1566
|
-
export declare function getCrossAxisCoordinate(mainAxis: MainAxis, point: XYPoint): number;
|
|
1078
|
+
export declare function getEndAngle(observation: Observation): NumericDataValue;
|
|
1567
1079
|
|
|
1568
1080
|
export declare const getGroup: (observation: Observation) => CategoricalDataValue;
|
|
1569
1081
|
|
|
1570
|
-
|
|
1571
|
-
export declare function getMainAxisCoordinate(mainAxis: MainAxis, point: XYPoint): number;
|
|
1082
|
+
export declare function getInnerRadius(observation: Observation): NumericDataValue;
|
|
1572
1083
|
|
|
1573
|
-
export declare function
|
|
1084
|
+
export declare function getOuterRadius(observation: Observation): NumericDataValue;
|
|
1574
1085
|
|
|
1575
1086
|
/** Reads the resolved size value from an observation. */
|
|
1576
1087
|
export declare function getSize(observation: Observation): NumericDataValue;
|
|
1577
1088
|
|
|
1089
|
+
export declare function getStartAngle(observation: Observation): NumericDataValue;
|
|
1090
|
+
|
|
1578
1091
|
/** Reads the resolved stroke width value from an observation. */
|
|
1579
1092
|
export declare function getStrokeWidth(observation: Observation): NumericDataValue;
|
|
1580
1093
|
|
|
@@ -1605,65 +1118,9 @@ export declare function getYMax(observation: Observation): NumericDataValue;
|
|
|
1605
1118
|
/** Reads the normalized yMin (lower extent) from an observation. */
|
|
1606
1119
|
export declare function getYMin(observation: Observation): NumericDataValue;
|
|
1607
1120
|
|
|
1608
|
-
/** Goal line with a target value. */
|
|
1609
|
-
declare interface GoalLine {
|
|
1610
|
-
target: number;
|
|
1611
|
-
marker?: DataValue;
|
|
1612
|
-
label?: string;
|
|
1613
|
-
}
|
|
1614
|
-
|
|
1615
|
-
declare type GraphAnnotation = GraphStickerAnnotation | GraphTooltipAnnotation | GraphHighlightAnnotation | GraphTextAnnotation | GraphArrowAnnotation | GraphDifferenceArrowAnnotation | GraphShapeAnnotation;
|
|
1616
|
-
|
|
1617
|
-
declare interface GraphArrowAnnotation {
|
|
1618
|
-
id: string;
|
|
1619
|
-
type: 'arrow';
|
|
1620
|
-
startX: number;
|
|
1621
|
-
startY: number;
|
|
1622
|
-
endX: number;
|
|
1623
|
-
endY: number;
|
|
1624
|
-
color?: string;
|
|
1625
|
-
thickness: 'thin' | 'medium' | 'thick';
|
|
1626
|
-
startArrowheadStyle: 'none' | 'line-arrow';
|
|
1627
|
-
lineStyle: 'solid' | 'dashed';
|
|
1628
|
-
endArrowheadStyle: 'none' | 'line-arrow';
|
|
1629
|
-
hasStickerStyle: boolean;
|
|
1630
|
-
}
|
|
1631
|
-
|
|
1632
|
-
export declare interface GraphConfig {
|
|
1633
|
-
data: Data;
|
|
1634
|
-
type?: GraphType;
|
|
1635
|
-
options?: Options;
|
|
1636
|
-
axes?: Axes;
|
|
1637
|
-
legend?: Legend;
|
|
1638
|
-
appearance?: Appearance;
|
|
1639
|
-
themeOverrides?: unknown;
|
|
1640
|
-
content?: Content;
|
|
1641
|
-
headlineNumbers?: HeadlineNumbers;
|
|
1642
|
-
dataLabels?: DataLabels;
|
|
1643
|
-
annotations?: GraphAnnotation[];
|
|
1644
|
-
referenceLines?: ReferenceLines;
|
|
1645
|
-
}
|
|
1646
|
-
|
|
1647
|
-
declare interface GraphDifferenceArrowAnnotation {
|
|
1648
|
-
id: string;
|
|
1649
|
-
type: 'difference-arrow';
|
|
1650
|
-
show: 'absolute-difference' | 'relative-difference' | 'proportion';
|
|
1651
|
-
start: AnnotationDataPoint;
|
|
1652
|
-
end: AnnotationDataPoint;
|
|
1653
|
-
color?: string;
|
|
1654
|
-
size: 'medium' | 'small' | 'large';
|
|
1655
|
-
labelPosition?: number;
|
|
1656
|
-
}
|
|
1657
|
-
|
|
1658
|
-
declare type GraphHighlightAnnotation = {
|
|
1659
|
-
id: string;
|
|
1660
|
-
type: 'highlight';
|
|
1661
|
-
highlight: 'data-point' | 'series' | 'x-value';
|
|
1662
|
-
} & AnnotationDataPoint;
|
|
1663
|
-
|
|
1664
1121
|
/** Output of the layout computation. */
|
|
1665
1122
|
export declare interface GraphLayout {
|
|
1666
|
-
/** The full graphical area (axes + panel + axis labels), excluding
|
|
1123
|
+
/** The full graphical area (axes + panel + axis labels), excluding title and caption. */
|
|
1667
1124
|
plot: Rect;
|
|
1668
1125
|
/** The panel area where geom layers render i.e. the data rectangle inside the axes. */
|
|
1669
1126
|
panel: Rect;
|
|
@@ -1671,59 +1128,14 @@ export declare interface GraphLayout {
|
|
|
1671
1128
|
axes: Partial<Record<LayoutEdge, Rect>>;
|
|
1672
1129
|
/** Rects for axis title labels, keyed by edge. */
|
|
1673
1130
|
axisLabels: Partial<Record<LayoutEdge, Rect>>;
|
|
1674
|
-
/** Rect for the
|
|
1675
|
-
|
|
1676
|
-
/** Rect for the
|
|
1677
|
-
|
|
1131
|
+
/** Rect for the title + subtitle region (above the panel). */
|
|
1132
|
+
title: Rect;
|
|
1133
|
+
/** Rect for the caption region (below the panel). */
|
|
1134
|
+
caption: Rect;
|
|
1678
1135
|
/** Rects for the legend regions, keyed by edge. */
|
|
1679
1136
|
legends: Partial<Record<LayoutEdge, Rect>>;
|
|
1680
1137
|
}
|
|
1681
1138
|
|
|
1682
|
-
declare interface GraphShapeAnnotation {
|
|
1683
|
-
id: string;
|
|
1684
|
-
type: 'shape';
|
|
1685
|
-
shape: 'rectangle';
|
|
1686
|
-
layer: 'belowPlot' | 'abovePlot';
|
|
1687
|
-
x: number;
|
|
1688
|
-
y: number;
|
|
1689
|
-
width: number;
|
|
1690
|
-
height: number;
|
|
1691
|
-
fillColor: string;
|
|
1692
|
-
fillOpacity: number;
|
|
1693
|
-
strokeWidth: number;
|
|
1694
|
-
}
|
|
1695
|
-
|
|
1696
|
-
declare type GraphStickerAnnotation = {
|
|
1697
|
-
id: string;
|
|
1698
|
-
type: 'sticker';
|
|
1699
|
-
sticker: 'rocket' | 'clapping-hands' | 'thumbs-up' | 'thumbs-down' | 'grinning-face';
|
|
1700
|
-
} & AnnotationDataPoint;
|
|
1701
|
-
|
|
1702
|
-
declare interface GraphTextAnnotation {
|
|
1703
|
-
id: string;
|
|
1704
|
-
type: 'text';
|
|
1705
|
-
content: unknown;
|
|
1706
|
-
x: number;
|
|
1707
|
-
y: number;
|
|
1708
|
-
width: number;
|
|
1709
|
-
backgroundColor?: string;
|
|
1710
|
-
backgroundColorStyle?: 'fade' | 'opaque';
|
|
1711
|
-
}
|
|
1712
|
-
|
|
1713
|
-
declare interface GraphTextStyle {
|
|
1714
|
-
fontId?: string;
|
|
1715
|
-
color?: string;
|
|
1716
|
-
}
|
|
1717
|
-
|
|
1718
|
-
declare type GraphTooltipAnnotation = {
|
|
1719
|
-
id: string;
|
|
1720
|
-
type: 'tooltip';
|
|
1721
|
-
caption: unknown;
|
|
1722
|
-
} & AnnotationDataPoint;
|
|
1723
|
-
|
|
1724
|
-
/** Type of graph to use for the data. */
|
|
1725
|
-
export declare type GraphType = 'line' | 'areaStacked' | 'bar' | 'barStacked' | 'barStackedFill' | 'column' | 'columnStacked' | 'columnStackedFill' | 'combo' | 'pie' | 'donut' | 'funnel' | 'heatmap' | 'scatter' | 'bubble' | 'waterfall' | 'mekko' | 'table';
|
|
1726
|
-
|
|
1727
1139
|
export declare const GROUP_VARIABLES: {
|
|
1728
1140
|
readonly group: string;
|
|
1729
1141
|
};
|
|
@@ -1747,7 +1159,7 @@ declare class GroupBy {
|
|
|
1747
1159
|
/**
|
|
1748
1160
|
* Computes the group key based on the first value of the grouped variable. If multiple variables are grouped, returns a composite key.
|
|
1749
1161
|
*/
|
|
1750
|
-
private
|
|
1162
|
+
private getGroupKey;
|
|
1751
1163
|
}
|
|
1752
1164
|
|
|
1753
1165
|
/**
|
|
@@ -1788,7 +1200,6 @@ declare interface GuideCompilerInput {
|
|
|
1788
1200
|
config: ConfigSpec;
|
|
1789
1201
|
layers: CompiledLayer[];
|
|
1790
1202
|
coordSystem: CoordSystem;
|
|
1791
|
-
datasetMetadata: DatasetMetadata;
|
|
1792
1203
|
}
|
|
1793
1204
|
|
|
1794
1205
|
declare type GuideGeometry = 'linear' | 'circular' | 'radial';
|
|
@@ -1829,12 +1240,6 @@ declare interface HeadlineConfig {
|
|
|
1829
1240
|
position: HeadlinePosition;
|
|
1830
1241
|
}
|
|
1831
1242
|
|
|
1832
|
-
declare interface HeadlineNumbers {
|
|
1833
|
-
show?: 'current' | 'average' | 'total' | 'conversion' | 'none';
|
|
1834
|
-
compareWith?: 'previous' | 'first' | 'none';
|
|
1835
|
-
size?: 'auto' | 'small' | 'medium' | 'large';
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
1243
|
/**
|
|
1839
1244
|
* Placement of headline numbers
|
|
1840
1245
|
* - 'above': Display above the chart (default, in the header region)
|
|
@@ -1872,121 +1277,6 @@ export declare class HeuristicTextMeasurer implements TextMeasurer {
|
|
|
1872
1277
|
measureText(text: string, font: FontSpec): MeasuredText;
|
|
1873
1278
|
}
|
|
1874
1279
|
|
|
1875
|
-
/**
|
|
1876
|
-
* The mouse position captured alongside a hit. Present even when the cursor is over no geom.
|
|
1877
|
-
*
|
|
1878
|
-
* Both coordinates are normalized pane-local values in `[0, 1]`. `y` is data-space (0 at the
|
|
1879
|
-
* bottom of the plot, 1 at the top), matching the compiler's `POSITION_VARIABLES.y` convention
|
|
1880
|
-
* — so the tracker is responsible for flipping SVG's top-origin Y before calling `query()`.
|
|
1881
|
-
*/
|
|
1882
|
-
export declare interface HoverCursor {
|
|
1883
|
-
x: number;
|
|
1884
|
-
y: number;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
/**
|
|
1888
|
-
* The transferable hover core. Indexes a compiled spec, diffs on update, and produces a
|
|
1889
|
-
* `HoverState` for any cursor position. No DOM access, no framework coupling.
|
|
1890
|
-
*/
|
|
1891
|
-
export declare class HoverEngine {
|
|
1892
|
-
private layerIndexes;
|
|
1893
|
-
private layerRefs;
|
|
1894
|
-
private aspectRatio;
|
|
1895
|
-
private warmStarts;
|
|
1896
|
-
private cachedState;
|
|
1897
|
-
private cachedKey;
|
|
1898
|
-
/**
|
|
1899
|
-
* IDs of layers whose `CompiledLayer.interactive` is `false`. Recomputed on every `update()`
|
|
1900
|
-
* so toggling the flag does not force an index rebuild. Used to filter the layer list before
|
|
1901
|
-
* `hitTest` and `classify` see it — non-interactive layers participate in neither primary
|
|
1902
|
-
* detection nor group/related, so they are visual decoration only as far as hover is concerned.
|
|
1903
|
-
*/
|
|
1904
|
-
private nonInteractiveLayerIds;
|
|
1905
|
-
constructor(spec: CompiledSpec);
|
|
1906
|
-
/**
|
|
1907
|
-
* Diff-aware re-index. Layers whose `data`, `geom`, `position` or the graph's coord-system
|
|
1908
|
-
* reference changed are rebuilt; others are retained, including their warm-start seed. All
|
|
1909
|
-
* four references live in `LayerRefSnapshot`, so `areRefsEqual` is the single source of truth
|
|
1910
|
-
* for invalidation.
|
|
1911
|
-
*
|
|
1912
|
-
* Prev state is keyed by the stable `CompiledLayer.id` (== `LayerIndex.layerId`), not by array
|
|
1913
|
-
* position, so reordering, insertion or removal of layers does not spuriously invalidate
|
|
1914
|
-
* untouched layers' indexes or warm-starts.
|
|
1915
|
-
*/
|
|
1916
|
-
update(spec: CompiledSpec): void;
|
|
1917
|
-
/**
|
|
1918
|
-
* Renderers call this on mount and on resize. Viewport is set-once, not per-query.
|
|
1919
|
-
*
|
|
1920
|
-
* On every call, viewport-dependent indexes are asked to re-prep themselves for the new
|
|
1921
|
-
* viewport (`reindexPoints2DForAspect` is idempotent on aspect match, so unchanged-aspect
|
|
1922
|
-
* calls are cheap). The renderer is expected to debounce resize events so the underlying
|
|
1923
|
-
* Delaunay rebuild does not fire on every observed frame during a drag.
|
|
1924
|
-
*/
|
|
1925
|
-
setViewport(viewport: HoverViewport): void;
|
|
1926
|
-
/**
|
|
1927
|
-
* Synchronous query. Returns the same `HoverState` reference while the primary stays on the
|
|
1928
|
-
* same `(layerId, pointIndex)`, so subscribers using identity-based equality can short-circuit
|
|
1929
|
-
* intra-geom cursor moves without re-rendering. Cache invalidates on `update()`. Warm-start
|
|
1930
|
-
* seeds are written after every match so the next call walks a minimum number of Delaunay edges.
|
|
1931
|
-
*/
|
|
1932
|
-
query(cursor: HoverCursor): HoverState;
|
|
1933
|
-
private invalidateCache;
|
|
1934
|
-
}
|
|
1935
|
-
|
|
1936
|
-
/**
|
|
1937
|
-
* A single hit returned by the hover engine.
|
|
1938
|
-
*
|
|
1939
|
-
* `layerId` is the stable `CompiledLayer.id` — *not* an array position. The engine preserves it
|
|
1940
|
-
* across `update()` calls regardless of layer reordering or insertion, so callers must resolve a
|
|
1941
|
-
* layer by matching `layer.id === hit.layerId`, never by `layers[layerId]`.
|
|
1942
|
-
*
|
|
1943
|
-
* `pointIndex` is an opaque per-layer stable handle for the hit geom, used by the engine as a
|
|
1944
|
-
* warm-start seed for subsequent queries. The encoding is per index kind:
|
|
1945
|
-
* - `buckets` / `rects` / `arcs`: the dataset row inside the layer's observations.
|
|
1946
|
-
* - `points`: the entry's position inside the layer's `points[]` (i.e. the Delaunay's array
|
|
1947
|
-
* index). Diverges from the dataset row when the dataset has null x/y gaps, so callers must
|
|
1948
|
-
* read `observation` rather than indexing `data` by `pointIndex`.
|
|
1949
|
-
*
|
|
1950
|
-
* In every case the handle is stable across `update()` calls for layers whose `data`/`geom`/
|
|
1951
|
-
* `position` references were not replaced (the warm-start identity promised by the ADR), and
|
|
1952
|
-
* callers that need the observation row should read `observation` — never index into the dataset
|
|
1953
|
-
* by `pointIndex`.
|
|
1954
|
-
*/
|
|
1955
|
-
export declare interface HoverHit {
|
|
1956
|
-
layerId: string;
|
|
1957
|
-
pointIndex: number;
|
|
1958
|
-
/**
|
|
1959
|
-
* Normalized panel-local position. Cartesian: `[0, 1]²` in data-space (y=0 at the bottom,
|
|
1960
|
-
* y=1 at the top — matching the compiler's `POSITION_VARIABLES.y`). Polar: `(angle in radians
|
|
1961
|
-
* clockwise from 12 o'clock, radius in [0, 1])`.
|
|
1962
|
-
*/
|
|
1963
|
-
x: number;
|
|
1964
|
-
y: number;
|
|
1965
|
-
/** The observation being hovered over. Renderers read values from here; the engine does not format. */
|
|
1966
|
-
observation: Observation;
|
|
1967
|
-
}
|
|
1968
|
-
|
|
1969
|
-
/** Output of `HoverEngine.query()`. */
|
|
1970
|
-
export declare interface HoverState {
|
|
1971
|
-
primary: HoverHit | null;
|
|
1972
|
-
group: HoverHit[];
|
|
1973
|
-
/**
|
|
1974
|
-
* Cross-layer and same-layer companion hits, bucketed by `CompiledLayer.id` so a per-layer
|
|
1975
|
-
* consumer reads its own hits in O(1) (`related.get(layer.id) ?? []`) instead of filtering
|
|
1976
|
-
* a flat array on every render. Layers with no companions are absent from the map — callers
|
|
1977
|
-
* fall back to an empty array on miss.
|
|
1978
|
-
*/
|
|
1979
|
-
related: ReadonlyMap<string, HoverHit[]>;
|
|
1980
|
-
}
|
|
1981
|
-
|
|
1982
|
-
/** Viewport facts the engine needs for aspect-corrected hit testing. */
|
|
1983
|
-
export declare interface HoverViewport {
|
|
1984
|
-
/** Panel width in pixels. */
|
|
1985
|
-
width: number;
|
|
1986
|
-
/** Pane height in pixels. */
|
|
1987
|
-
height: number;
|
|
1988
|
-
}
|
|
1989
|
-
|
|
1990
1280
|
declare interface IdentityScaleInput {
|
|
1991
1281
|
type: 'scale';
|
|
1992
1282
|
scaledAesthetic: ScaledAestheticKey;
|
|
@@ -2014,46 +1304,16 @@ declare type InferredScaleOptions = ContinuousScaleOptions | DiscreteScaleOption
|
|
|
2014
1304
|
*/
|
|
2015
1305
|
export declare type InterpolateType = 'linear' | 'catmull-rom';
|
|
2016
1306
|
|
|
2017
|
-
/** Narrows a coord system to the cartesian variant. */
|
|
2018
|
-
export declare function isCartesian(coordSystem: CoordSystem): coordSystem is CartesianCoordSystem;
|
|
2019
|
-
|
|
2020
1307
|
/**
|
|
2021
|
-
*
|
|
2022
|
-
*/
|
|
2023
|
-
export declare function isDefined<T>(value: T | null | undefined): value is T;
|
|
2024
|
-
|
|
2025
|
-
/**
|
|
2026
|
-
* Type guard for narrowing a `CompiledLayer` to its per-geom flavour. Use at dispatch sites that
|
|
2027
|
-
* pick a renderer based on `layer.geom`:
|
|
2028
|
-
*
|
|
2029
|
-
* if (isLayerOf(layer, 'line')) renderLine(layer); // layer is CompiledLayerFor<'line'>
|
|
2030
|
-
*/
|
|
2031
|
-
export declare function isLayerOf<G extends GeomName>(layer: CompiledLayer, geom: G): layer is CompiledLayerFor<G>;
|
|
2032
|
-
|
|
2033
|
-
export declare function isStackedPosition(position: PositionType): boolean;
|
|
2034
|
-
|
|
2035
|
-
/**
|
|
2036
|
-
* Compiles each layer through the transforms → stat → group → geom → position adjusters pipeline.
|
|
1308
|
+
* Compiles each layer through the stat → group → geom → position adjusters pipeline.
|
|
2037
1309
|
*/
|
|
2038
1310
|
declare class LayerCompiler {
|
|
2039
|
-
private readonly transformCompiler;
|
|
2040
1311
|
private readonly statCompiler;
|
|
2041
1312
|
private readonly groupCompiler;
|
|
2042
1313
|
private readonly geomCompiler;
|
|
2043
1314
|
private readonly positionAdjusterCompiler;
|
|
2044
|
-
|
|
2045
|
-
constructor(transformCompiler: TransformCompiler, statCompiler: StatCompiler, groupCompiler: GroupCompiler, geomCompiler: GeomCompiler, positionAdjusterCompiler: PositionAdjusterCompiler, layerValidator: LayerValidator);
|
|
1315
|
+
constructor(statCompiler: StatCompiler, groupCompiler: GroupCompiler, geomCompiler: GeomCompiler, positionAdjusterCompiler: PositionAdjusterCompiler);
|
|
2046
1316
|
compile(input: LayerCompilerInput): CompiledLayer[];
|
|
2047
|
-
/**
|
|
2048
|
-
* Applies each layer's transforms once and computes its effective mapping.
|
|
2049
|
-
* The resulting data is used for both validation and the stat/group/geom pipeline.
|
|
2050
|
-
*/
|
|
2051
|
-
private prepareLayers;
|
|
2052
|
-
/**
|
|
2053
|
-
* Validates each layer against its post-transform dataset and effective mapping.
|
|
2054
|
-
*/
|
|
2055
|
-
private validateLayers;
|
|
2056
|
-
private compileLayer;
|
|
2057
1317
|
}
|
|
2058
1318
|
|
|
2059
1319
|
declare interface LayerCompilerInput {
|
|
@@ -2080,17 +1340,6 @@ declare interface LayerInputBase {
|
|
|
2080
1340
|
stat?: StatName;
|
|
2081
1341
|
position?: PositionType;
|
|
2082
1342
|
yScaleType?: YScaleType;
|
|
2083
|
-
/**
|
|
2084
|
-
* Ordered transforms applied to this layer's view of the data, on top of any
|
|
2085
|
-
* spec-level transforms. Use this when a geom needs a different shape of the
|
|
2086
|
-
* data than its siblings (e.g. a line overlay on top of reshaped stacked bars).
|
|
2087
|
-
*/
|
|
2088
|
-
transforms?: TransformInput[];
|
|
2089
|
-
/**
|
|
2090
|
-
* When `false`, the layer is skipped from main hover hit-detection.
|
|
2091
|
-
* @default true
|
|
2092
|
-
*/
|
|
2093
|
-
interactive?: boolean;
|
|
2094
1343
|
}
|
|
2095
1344
|
|
|
2096
1345
|
declare type LayerInputOf<G extends GeomName> = LayerInputBase & {
|
|
@@ -2113,8 +1362,6 @@ declare interface LayerSpecBase {
|
|
|
2113
1362
|
stat: StatName;
|
|
2114
1363
|
position: PositionType;
|
|
2115
1364
|
yScaleType: YScaleType;
|
|
2116
|
-
transforms: TransformInput[];
|
|
2117
|
-
interactive: boolean;
|
|
2118
1365
|
}
|
|
2119
1366
|
|
|
2120
1367
|
declare type LayerSpecOf<G extends GeomName> = LayerSpecBase & {
|
|
@@ -2122,113 +1369,45 @@ declare type LayerSpecOf<G extends GeomName> = LayerSpecBase & {
|
|
|
2122
1369
|
params: GeomParamsMap[G];
|
|
2123
1370
|
};
|
|
2124
1371
|
|
|
2125
|
-
declare interface LayerValidationInput {
|
|
2126
|
-
layerId: string;
|
|
2127
|
-
geom: GeomName;
|
|
2128
|
-
stat: StatName;
|
|
2129
|
-
/** `spec.mapping` merged with `layer.mapping` */
|
|
2130
|
-
effectiveMapping: AesMapping;
|
|
2131
|
-
/** Layer's dataset after its own transforms have been applied */
|
|
2132
|
-
data: Dataset;
|
|
2133
|
-
}
|
|
2134
|
-
|
|
2135
1372
|
/**
|
|
2136
|
-
*
|
|
1373
|
+
* Compiles layout geometry from compiled guides and available dimensions.
|
|
2137
1374
|
*
|
|
2138
|
-
*
|
|
2139
|
-
*
|
|
2140
|
-
* 2. All mapped variables exist in the layer's dataset (after transforms).
|
|
1375
|
+
* All output rects are in container coordinates (origin at the container's top-left).
|
|
1376
|
+
* The renderer converts to SVG-local coordinates where needed by subtracting the plot origin.
|
|
2141
1377
|
*
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2144
|
-
|
|
2145
|
-
declare class LayerValidator {
|
|
2146
|
-
private readonly geomRegistry;
|
|
2147
|
-
private readonly statRegistry;
|
|
2148
|
-
constructor(geomRegistry: GeomRegistry, statRegistry: StatRegistry);
|
|
2149
|
-
validate(input: LayerValidationInput): ValidationIssue[];
|
|
2150
|
-
/**
|
|
2151
|
-
* Checks that all aesthetics required by the geom are present (accounting for stat-computed variables).
|
|
2152
|
-
*/
|
|
2153
|
-
private validateRequiredAesthetics;
|
|
2154
|
-
/**
|
|
2155
|
-
* Checks that every mapped variable in the effective mapping exists in the layer's dataset (after
|
|
2156
|
-
* transforms). Skips aesthetics that will be computed by stats (e.g. `y` when `stat='count'`).
|
|
2157
|
-
*/
|
|
2158
|
-
private validateVariableExistence;
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
/** Outer padding around the whole chart, in pixels. */
|
|
2162
|
-
export declare const LAYOUT_PADDING = 24;
|
|
2163
|
-
|
|
2164
|
-
/**
|
|
2165
|
-
* Compiles layout geometry and final axis ticks. Output rects are in container coordinates.
|
|
2166
|
-
*
|
|
2167
|
-
* Horizontal axis edge height is candidate-independent (~line-height), so `panel.height` is
|
|
2168
|
-
* settled after the first resolve.
|
|
2169
|
-
*
|
|
2170
|
-
* Here's the pipeline:
|
|
2171
|
-
* 1. **Seed**: stamp each axis with a placeholder label so the grid has something to measure.
|
|
2172
|
-
* 2. **Resolve v1**: first grid pass; `panel.height` is now final.
|
|
2173
|
-
* 3. **Finalize vertical**: pick the densest candidate that fits `panel.height` for left/right
|
|
2174
|
-
* axes; horizontal axes keep their seed.
|
|
2175
|
-
* 4. **Resolve v2**: vertical edge widths now reflect final labels, so `panel.width` is final.
|
|
2176
|
-
* 5. **Finalize horizontal**: pick the densest candidate that fits `panel.width` for top/bottom
|
|
2177
|
-
* axes. Vertical axes carry over from step 3.
|
|
2178
|
-
* 6. **Resolve v3**: final grid pass with all axes finalized.
|
|
1378
|
+
* Uses a two-phase pipeline:
|
|
1379
|
+
* 1. **Measure** — extracts axis/legend/label sizes via the injected measurer.
|
|
1380
|
+
* 2. **Resolve** — builds a single grid and resolves all rects in container coordinates.
|
|
2179
1381
|
*/
|
|
2180
1382
|
export declare class LayoutCompiler {
|
|
2181
1383
|
private readonly measurer;
|
|
2182
1384
|
constructor(measurer: LayoutMeasurer);
|
|
2183
|
-
compile(input: LayoutCompilerInput):
|
|
2184
|
-
/**
|
|
2185
|
-
* Stamps each axis with a single hardcoded-label placeholder tick. This gives the grid something to measure in
|
|
2186
|
-
* the first pass. The finalize pass replaces it with the real candidate selected for the resolved panel size.
|
|
2187
|
-
*/
|
|
2188
|
-
private seedAxis;
|
|
2189
|
-
private finalizeAxis;
|
|
2190
|
-
private resolveLayout;
|
|
1385
|
+
compile(input: LayoutCompilerInput): GraphLayout;
|
|
2191
1386
|
/**
|
|
2192
|
-
* Measures all
|
|
2193
|
-
* Returns three EdgeSizes records
|
|
1387
|
+
* Measures all chart elements from the compiled guides.
|
|
1388
|
+
* Returns three EdgeSizes records — a size of 0 means the element is absent.
|
|
2194
1389
|
*/
|
|
2195
1390
|
private measureGuides;
|
|
2196
1391
|
}
|
|
2197
1392
|
|
|
2198
|
-
/**
|
|
2199
|
-
* Full output of {@link LayoutCompiler.compile} — the geometry plus the axes with their final formatted ticks.
|
|
2200
|
-
*/
|
|
2201
|
-
export declare interface LayoutCompileResult {
|
|
2202
|
-
layout: GraphLayout;
|
|
2203
|
-
formattedAxes: FormattedAxis[];
|
|
2204
|
-
}
|
|
2205
|
-
|
|
2206
1393
|
/** Input for the layout compiler. */
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
formattedLegends: FormattedLegend[];
|
|
1394
|
+
declare interface LayoutCompilerInput {
|
|
1395
|
+
guides: CompiledGuides;
|
|
2210
1396
|
containerSize: BoxSize;
|
|
2211
1397
|
externalMeasurements: ExternalMeasurements;
|
|
2212
|
-
formattingLocale?: Locale;
|
|
2213
1398
|
}
|
|
2214
1399
|
|
|
2215
1400
|
/** Positions where axes/labels/legends can be placed around the panel. */
|
|
2216
1401
|
export declare type LayoutEdge = 'top' | 'right' | 'bottom' | 'left';
|
|
2217
1402
|
|
|
2218
1403
|
/** Strategy for measuring chart element sizes in pixels. */
|
|
2219
|
-
|
|
1404
|
+
declare interface LayoutMeasurer {
|
|
2220
1405
|
/** Returns the pixel size for an axis (height for top/bottom, width for left/right). */
|
|
2221
|
-
measureAxis: (axis:
|
|
1406
|
+
measureAxis: (axis: CompiledAxisGuide) => number;
|
|
2222
1407
|
/** Returns the pixel height for an axis label row. */
|
|
2223
1408
|
measureAxisLabel: () => number;
|
|
2224
1409
|
/** Returns the pixel size for a legend (height for top/bottom, width for left/right). */
|
|
2225
|
-
measureLegend: (legend:
|
|
2226
|
-
/** Returns the size of a single tick label. */
|
|
2227
|
-
measureTickLabel: (label: string) => MeasuredText;
|
|
2228
|
-
}
|
|
2229
|
-
|
|
2230
|
-
declare interface Legend {
|
|
2231
|
-
position?: 'auto' | 'top' | 'right' | 'none';
|
|
1410
|
+
measureLegend: (legend: CompiledLegendGuide) => number;
|
|
2232
1411
|
}
|
|
2233
1412
|
|
|
2234
1413
|
/**
|
|
@@ -2267,17 +1446,13 @@ declare type LegendDisplay = 'pill' | 'direct' | 'auto';
|
|
|
2267
1446
|
export declare interface LegendItem {
|
|
2268
1447
|
/** Raw data value (e.g., "Apples") */
|
|
2269
1448
|
value: DataValue;
|
|
2270
|
-
/**
|
|
2271
|
-
|
|
2272
|
-
* An array signals multi-swatch rendering — used when a color scale is
|
|
2273
|
-
* collapsed into a single legend item.
|
|
2274
|
-
*/
|
|
2275
|
-
visual: Partial<Record<ScaledVisualAestheticKey, string | string[]>>;
|
|
1449
|
+
/** Mapped visual values per aesthetic (e.g., { color: '#ff0000', fill: '#ff0000' }) */
|
|
1450
|
+
visual: Partial<Record<ScaledVisualAestheticKey, string>>;
|
|
2276
1451
|
/** Normalized y position in [0,1]. Null when display is not 'direct' or no endpoint found. */
|
|
2277
1452
|
normalizedY: number | null;
|
|
2278
1453
|
}
|
|
2279
1454
|
|
|
2280
|
-
|
|
1455
|
+
declare type LegendPosition = 'auto' | 'right' | 'left' | 'top' | 'bottom' | 'none';
|
|
2281
1456
|
|
|
2282
1457
|
declare function line(options?: GeomOptions<'line'>): LayerInputOf<'line'>;
|
|
2283
1458
|
|
|
@@ -2299,13 +1474,6 @@ export declare interface LineGeomParams {
|
|
|
2299
1474
|
missingValues: MissingValuesType;
|
|
2300
1475
|
}
|
|
2301
1476
|
|
|
2302
|
-
declare interface LineOptions {
|
|
2303
|
-
isSmoothLine?: boolean;
|
|
2304
|
-
lineThickness?: number | 'auto';
|
|
2305
|
-
showPoints?: boolean;
|
|
2306
|
-
missingValues?: 'gap' | 'connect' | 'zero';
|
|
2307
|
-
}
|
|
2308
|
-
|
|
2309
1477
|
/**
|
|
2310
1478
|
* Stroke style for line rendering.
|
|
2311
1479
|
*
|
|
@@ -2315,27 +1483,6 @@ declare interface LineOptions {
|
|
|
2315
1483
|
*/
|
|
2316
1484
|
export declare type LineStyleType = 'solid' | 'dashed' | 'dotted';
|
|
2317
1485
|
|
|
2318
|
-
export declare type Locale = (typeof LOCALES)[number];
|
|
2319
|
-
|
|
2320
|
-
/** A BCP-47 string representing a supported locale. */
|
|
2321
|
-
declare const LOCALES: readonly ["en-GB", "en-US", "ar", "pt-PT"];
|
|
2322
|
-
|
|
2323
|
-
/** The data-space axis a `CartesianCoordSystem` uses as the main (independent) axis. */
|
|
2324
|
-
export declare type MainAxis = 'x' | 'y';
|
|
2325
|
-
|
|
2326
|
-
/**
|
|
2327
|
-
* Create a pipeable mapping spec item.
|
|
2328
|
-
*
|
|
2329
|
-
* @example
|
|
2330
|
-
* createSpec(
|
|
2331
|
-
* data,
|
|
2332
|
-
* transform.reshape({ reshape: ['revenue'], keyName: 'metric', valueName: 'amount' }),
|
|
2333
|
-
* mapping({ x: 'month', y: 'amount', color: 'metric' }),
|
|
2334
|
-
* geom.bar(),
|
|
2335
|
-
* )
|
|
2336
|
-
*/
|
|
2337
|
-
export declare function mapping(aes: AesMapping): MappingItem;
|
|
2338
|
-
|
|
2339
1486
|
/**
|
|
2340
1487
|
* A pipeable spec item that sets/merges the global aesthetic mapping.
|
|
2341
1488
|
*/
|
|
@@ -2429,15 +1576,9 @@ declare interface NumberFormatConfig {
|
|
|
2429
1576
|
|
|
2430
1577
|
declare type NumericDataValue = number | null;
|
|
2431
1578
|
|
|
2432
|
-
declare interface NumericValueFormat {
|
|
2433
|
-
type: 'decimal' | 'integer' | 'percentage' | 'duration';
|
|
2434
|
-
}
|
|
2435
|
-
|
|
2436
1579
|
/** A single row of data, mapping every variable name to the value in that row. */
|
|
2437
1580
|
export declare type Observation = Record<VariableName, DataValue>;
|
|
2438
1581
|
|
|
2439
|
-
declare type Options = Partial<LineOptions & BarOptions & ScatterOptions & ComboOptions & PieOptions & TableOptions>;
|
|
2440
|
-
|
|
2441
1582
|
/**
|
|
2442
1583
|
* A named store for color palettes used by scale compilation.
|
|
2443
1584
|
*
|
|
@@ -2488,10 +1629,6 @@ declare interface PanelConfig {
|
|
|
2488
1629
|
};
|
|
2489
1630
|
}
|
|
2490
1631
|
|
|
2491
|
-
declare interface PieOptions {
|
|
2492
|
-
pieTotalPosition?: 'center' | 'outside';
|
|
2493
|
-
}
|
|
2494
|
-
|
|
2495
1632
|
/**
|
|
2496
1633
|
* Pipe a spec through a series of spec items (left-to-right).
|
|
2497
1634
|
*/
|
|
@@ -2664,8 +1801,6 @@ declare interface PositionMapperInput {
|
|
|
2664
1801
|
*/
|
|
2665
1802
|
export declare type PositionType = 'stack' | 'dodge' | 'identity' | 'fill';
|
|
2666
1803
|
|
|
2667
|
-
export declare const prefixInternalVariable: (name: string) => string;
|
|
2668
|
-
|
|
2669
1804
|
declare interface QuantitativeScaleMethods {
|
|
2670
1805
|
/**
|
|
2671
1806
|
* Continuous (numeric) scale. Supports `transform`, `reverse`, `nice`, `zero`, `domainMin`, `domainMax`.
|
|
@@ -2684,11 +1819,6 @@ declare interface QuantitativeScaleMethods {
|
|
|
2684
1819
|
identity: (options?: IdentityScaleOptions) => IdentityScaleInput;
|
|
2685
1820
|
}
|
|
2686
1821
|
|
|
2687
|
-
export declare interface RadiusExtent {
|
|
2688
|
-
innerRadius: NumericDataValue;
|
|
2689
|
-
outerRadius: NumericDataValue;
|
|
2690
|
-
}
|
|
2691
|
-
|
|
2692
1822
|
/** A rectangle in pixel coordinates, origin at top-left. */
|
|
2693
1823
|
export declare interface Rect {
|
|
2694
1824
|
x: number;
|
|
@@ -2697,12 +1827,6 @@ export declare interface Rect {
|
|
|
2697
1827
|
height: number;
|
|
2698
1828
|
}
|
|
2699
1829
|
|
|
2700
|
-
declare interface ReferenceLines {
|
|
2701
|
-
goalLine?: GoalLine;
|
|
2702
|
-
trendline?: TrendlineType;
|
|
2703
|
-
averageLine?: AverageLine;
|
|
2704
|
-
}
|
|
2705
|
-
|
|
2706
1830
|
/**
|
|
2707
1831
|
* A typed key-value store for looking up registered implementations by name.
|
|
2708
1832
|
*
|
|
@@ -2731,11 +1855,6 @@ declare class Registry<K extends string, T> {
|
|
|
2731
1855
|
has(key: K): boolean;
|
|
2732
1856
|
}
|
|
2733
1857
|
|
|
2734
|
-
/***************************************************************
|
|
2735
|
-
* Builders
|
|
2736
|
-
***************************************************************/
|
|
2737
|
-
declare function reshape(options?: ReshapeOptions): ReshapeTransformInput;
|
|
2738
|
-
|
|
2739
1858
|
/***************************************************************
|
|
2740
1859
|
* Reshape Transform
|
|
2741
1860
|
***************************************************************/
|
|
@@ -2785,12 +1904,6 @@ export declare type ResolvedLegendDisplay = Exclude<LegendDisplay, 'auto'>;
|
|
|
2785
1904
|
*/
|
|
2786
1905
|
export declare type ResolvedLegendPosition = Exclude<LegendPosition, 'auto' | 'none'>;
|
|
2787
1906
|
|
|
2788
|
-
/**
|
|
2789
|
-
* Canonical resting `HoverState`. Exported so the renderer-side store can reuse this exact
|
|
2790
|
-
* reference instead of maintaining a parallel literal that could drift.
|
|
2791
|
-
*/
|
|
2792
|
-
export declare const RESTING_HOVER_STATE: HoverState;
|
|
2793
|
-
|
|
2794
1907
|
/** TipTap-compatible rich text node (no tiptap dependency). */
|
|
2795
1908
|
export declare interface RichTextContent {
|
|
2796
1909
|
type: string;
|
|
@@ -2870,10 +1983,6 @@ declare class ScaleCompiler {
|
|
|
2870
1983
|
private readonly registry;
|
|
2871
1984
|
constructor(registry: ScaleRegistry);
|
|
2872
1985
|
compile(input: ScaleCompilerInput): CompiledScales;
|
|
2873
|
-
/**
|
|
2874
|
-
* Pre-pass: each scale's source variable must have a data type the scale can handle.
|
|
2875
|
-
*/
|
|
2876
|
-
private validateScaleTypeCompatibility;
|
|
2877
1986
|
/**
|
|
2878
1987
|
* Walk all layers' mappings and collect data values per scale aesthetic key.
|
|
2879
1988
|
*
|
|
@@ -2947,116 +2056,6 @@ declare type ScaleTransformType = 'linear' | 'log' | 'sqrt';
|
|
|
2947
2056
|
*/
|
|
2948
2057
|
declare type ScaleType = 'continuous' | 'discrete' | 'datetime' | 'identity' | 'palette';
|
|
2949
2058
|
|
|
2950
|
-
declare interface ScatterOptions {
|
|
2951
|
-
pointSize?: number | 'auto';
|
|
2952
|
-
}
|
|
2953
|
-
|
|
2954
|
-
/**
|
|
2955
|
-
* Serialized representation of a command for wire transport and persistence.
|
|
2956
|
-
* Only forward commands are serialized — inverses are recomputed at execution time.
|
|
2957
|
-
*/
|
|
2958
|
-
export declare interface SerializedCommand {
|
|
2959
|
-
readonly type: string;
|
|
2960
|
-
readonly params: Record<string, unknown>;
|
|
2961
|
-
readonly metadata: CommandMetadata;
|
|
2962
|
-
}
|
|
2963
|
-
|
|
2964
|
-
/** Config for styling a specific series. */
|
|
2965
|
-
declare interface SeriesStyle {
|
|
2966
|
-
paletteColorId?: string;
|
|
2967
|
-
customColor?: string;
|
|
2968
|
-
fillStyle?: 'solid' | 'hatched';
|
|
2969
|
-
lineStyle?: 'solid' | 'dashed' | 'dotted';
|
|
2970
|
-
}
|
|
2971
|
-
|
|
2972
|
-
/**
|
|
2973
|
-
* Sets the chart background color.
|
|
2974
|
-
* When set to null, the renderer falls back to its theme default.
|
|
2975
|
-
*/
|
|
2976
|
-
export declare class SetAppearanceBackgroundCommand implements Command<SetAppearanceBackgroundParams> {
|
|
2977
|
-
readonly type: "set-appearance-background";
|
|
2978
|
-
readonly metadata: CommandMetadata;
|
|
2979
|
-
readonly params: SetAppearanceBackgroundParams;
|
|
2980
|
-
constructor(params: SetAppearanceBackgroundParams, metadata?: Partial<CommandMetadata>);
|
|
2981
|
-
apply(spec: Spec): CommandApplyResult | null;
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
export declare type SetAppearanceBackgroundParams = {
|
|
2985
|
-
background: string | null;
|
|
2986
|
-
};
|
|
2987
|
-
|
|
2988
|
-
/**
|
|
2989
|
-
* Toggles visibility of the chart's textual content (title, subtitle, caption) as a group.
|
|
2990
|
-
* Underlying text values are preserved so toggling back restores them.
|
|
2991
|
-
*/
|
|
2992
|
-
export declare class SetContentVisibilityCommand implements Command<SetContentVisibilityParams> {
|
|
2993
|
-
readonly type: "set-content-visibility";
|
|
2994
|
-
readonly metadata: CommandMetadata;
|
|
2995
|
-
readonly params: SetContentVisibilityParams;
|
|
2996
|
-
constructor(params: SetContentVisibilityParams, metadata?: Partial<CommandMetadata>);
|
|
2997
|
-
apply(spec: Spec): CommandApplyResult | null;
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3000
|
-
export declare type SetContentVisibilityParams = {
|
|
3001
|
-
isVisible: boolean;
|
|
3002
|
-
};
|
|
3003
|
-
|
|
3004
|
-
/**
|
|
3005
|
-
* Command that swaps the dataset on a spec while preserving layer identity and all other
|
|
3006
|
-
* configuration. Enables data-change transitions — existing layer ids are retained, so
|
|
3007
|
-
* renderers using id-based keys can morph geoms instead of unmounting them.
|
|
3008
|
-
*
|
|
3009
|
-
* Accepts either raw `Data` (parsed on apply) or a pre-parsed `Dataset` (used by the revert
|
|
3010
|
-
* command). Revert commands are not serialized, so carrying a `Dataset` is safe.
|
|
3011
|
-
*/
|
|
3012
|
-
export declare class SetDataCommand implements Command<SetDataParams> {
|
|
3013
|
-
readonly type: "set-data";
|
|
3014
|
-
readonly metadata: CommandMetadata;
|
|
3015
|
-
readonly params: SetDataParams;
|
|
3016
|
-
constructor(params: SetDataParams, metadata?: Partial<CommandMetadata>);
|
|
3017
|
-
apply(spec: Spec): CommandApplyResult | null;
|
|
3018
|
-
}
|
|
3019
|
-
|
|
3020
|
-
export declare type SetDataParams = {
|
|
3021
|
-
/** Raw data (will be parsed) or a pre-parsed `Dataset` (used for reverts). */
|
|
3022
|
-
data: Data | Dataset;
|
|
3023
|
-
};
|
|
3024
|
-
|
|
3025
|
-
/**
|
|
3026
|
-
* Controls grid line visibility for both axes simultaneously.
|
|
3027
|
-
* Takes independent x/y visibility flags to allow per-axis grid control and proper revert support.
|
|
3028
|
-
*/
|
|
3029
|
-
export declare class SetGridVisibilityCommand implements Command<SetGridVisibilityParams> {
|
|
3030
|
-
readonly type: "set-grid-visibility";
|
|
3031
|
-
readonly metadata: CommandMetadata;
|
|
3032
|
-
readonly params: SetGridVisibilityParams;
|
|
3033
|
-
constructor(params: SetGridVisibilityParams, metadata?: Partial<CommandMetadata>);
|
|
3034
|
-
apply(spec: Spec): CommandApplyResult | null;
|
|
3035
|
-
}
|
|
3036
|
-
|
|
3037
|
-
export declare type SetGridVisibilityParams = {
|
|
3038
|
-
xIsVisible: boolean | null;
|
|
3039
|
-
yIsVisible: boolean | null;
|
|
3040
|
-
};
|
|
3041
|
-
|
|
3042
|
-
/**
|
|
3043
|
-
* Sets the legend placement relative to the chart (e.g. auto, top, bottom, left, right, none).
|
|
3044
|
-
* 'auto' lets the renderer choose the best position; 'none' hides the legend entirely.
|
|
3045
|
-
*/
|
|
3046
|
-
export declare class SetLegendPositionCommand implements Command<SetLegendPositionParams> {
|
|
3047
|
-
readonly type: "set-legend-position";
|
|
3048
|
-
readonly metadata: CommandMetadata;
|
|
3049
|
-
readonly params: SetLegendPositionParams;
|
|
3050
|
-
constructor(params: SetLegendPositionParams, metadata?: Partial<CommandMetadata>);
|
|
3051
|
-
apply(spec: Spec): CommandApplyResult | null;
|
|
3052
|
-
}
|
|
3053
|
-
|
|
3054
|
-
export declare type SetLegendPositionParams = {
|
|
3055
|
-
position: LegendPosition;
|
|
3056
|
-
};
|
|
3057
|
-
|
|
3058
|
-
declare function sort(options: SortOptions): SortTransformInput;
|
|
3059
|
-
|
|
3060
2059
|
/***************************************************************
|
|
3061
2060
|
* Sort Transform
|
|
3062
2061
|
***************************************************************/
|
|
@@ -3091,19 +2090,15 @@ declare interface SortTransformInput {
|
|
|
3091
2090
|
* // resolved.config → axes, legend, headline, panel, numberFormat with defaults
|
|
3092
2091
|
* ```
|
|
3093
2092
|
*/
|
|
3094
|
-
|
|
2093
|
+
declare interface Spec {
|
|
3095
2094
|
/** The dataset backing the visualization. */
|
|
3096
2095
|
data: Dataset;
|
|
3097
|
-
/** Per-column metadata captured at parse time (inferred value formats). Used by guide compilation to format tick and legend labels. */
|
|
3098
|
-
datasetMetadata: DatasetMetadata;
|
|
3099
2096
|
/** Global aesthetic mappings (data columns → visual channels). */
|
|
3100
2097
|
mapping: AesMapping;
|
|
3101
2098
|
/** Geometry layers to render. Each layer has resolved geom, stat, position, and params. */
|
|
3102
2099
|
layers: LayerSpec[];
|
|
3103
2100
|
/** Resolved scale specs — one per aesthetic, all defaults filled, no 'inferred' types remaining. */
|
|
3104
2101
|
scales: ScaleSpec[];
|
|
3105
|
-
/** Data transforms applied to `data` before layer compilation. */
|
|
3106
|
-
transforms: TransformInput[];
|
|
3107
2102
|
/** Coordinate system (cartesian, flip, or polar) with fully defaulted params. */
|
|
3108
2103
|
coords: CoordSpec;
|
|
3109
2104
|
/** Chart configuration: axes, legend, headline, panel, number formatting. */
|
|
@@ -3115,7 +2110,7 @@ export declare interface Spec {
|
|
|
3115
2110
|
* This is what commands operate on and what gets stored in undo/redo snapshots.
|
|
3116
2111
|
*/
|
|
3117
2112
|
export declare interface SpecInput {
|
|
3118
|
-
data:
|
|
2113
|
+
data: Dataset;
|
|
3119
2114
|
mapping: AesMapping;
|
|
3120
2115
|
layers: LayerInput[];
|
|
3121
2116
|
scales: ScaleInput[];
|
|
@@ -3127,11 +2122,40 @@ export declare interface SpecInput {
|
|
|
3127
2122
|
declare type SpecItem = LayerInput | ScaleInput | CoordInput | ConfigItem | TransformInput | MappingItem;
|
|
3128
2123
|
|
|
3129
2124
|
/**
|
|
3130
|
-
*
|
|
2125
|
+
* Validates a resolved spec before compilation.
|
|
2126
|
+
*
|
|
2127
|
+
* Checks:
|
|
2128
|
+
* 1. All required aesthetics are present (accounting for stat-computed variables)
|
|
2129
|
+
* 2. All mapped variables exist in the dataset
|
|
2130
|
+
* 3. Variable data types are compatible with their assigned scale types
|
|
2131
|
+
*
|
|
2132
|
+
* Collects all issues and throws a single {@link SpecValidationError} if any are found.
|
|
3131
2133
|
*/
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
2134
|
+
declare class SpecValidator {
|
|
2135
|
+
private readonly statRegistry;
|
|
2136
|
+
private readonly scaleRegistry;
|
|
2137
|
+
private readonly geomRegistry;
|
|
2138
|
+
constructor(dependencies: {
|
|
2139
|
+
statRegistry: StatRegistry;
|
|
2140
|
+
scaleRegistry: ScaleRegistry;
|
|
2141
|
+
geomRegistry: GeomRegistry;
|
|
2142
|
+
});
|
|
2143
|
+
validate(spec: Spec): Spec;
|
|
2144
|
+
/**
|
|
2145
|
+
* Checks that all aesthetics required by the geom are present in the effective mapping,
|
|
2146
|
+
* accounting for aesthetics that the stat will produce.
|
|
2147
|
+
*/
|
|
2148
|
+
private validateRequiredAesthetics;
|
|
2149
|
+
/**
|
|
2150
|
+
* Checks that every mapped variable in the effective mapping exists in the dataset.
|
|
2151
|
+
* Skips aesthetics that will be computed by stats (e.g. y when stat='count').
|
|
2152
|
+
*/
|
|
2153
|
+
private validateVariableExistence;
|
|
2154
|
+
/**
|
|
2155
|
+
* Checks that each scale's data type is compatible with its assigned scale type.
|
|
2156
|
+
* Uses the global mapping to find the variable for each scale aesthetic.
|
|
2157
|
+
*/
|
|
2158
|
+
private validateScaleTypeCompatibility;
|
|
3135
2159
|
}
|
|
3136
2160
|
|
|
3137
2161
|
/**
|
|
@@ -3178,23 +2202,8 @@ declare class StatRegistry extends Registry<StatName, Stat> {
|
|
|
3178
2202
|
constructor();
|
|
3179
2203
|
}
|
|
3180
2204
|
|
|
3181
|
-
/**
|
|
3182
|
-
* Visual signature of the source geom.
|
|
3183
|
-
*/
|
|
3184
|
-
export declare type SwatchShape = 'square' | 'line' | 'circle' | 'area' | 'slice';
|
|
3185
|
-
|
|
3186
2205
|
declare type Table = internal.ColumnTable;
|
|
3187
2206
|
|
|
3188
|
-
declare interface TableOptions {
|
|
3189
|
-
tableColumnRatios?: Record<string, number>;
|
|
3190
|
-
}
|
|
3191
|
-
|
|
3192
|
-
declare interface TemporalValueFormat {
|
|
3193
|
-
type: 'datetime' | 'time' | 'date' | 'year' | 'quarter' | 'month_year' | 'month' | 'weekly_date_range_with_year' | 'weekly_date_range' | 'day_month';
|
|
3194
|
-
/** Template string representing how values of this type have been formatted. ie. dd-mm-yyyy */
|
|
3195
|
-
dateFormat?: string;
|
|
3196
|
-
}
|
|
3197
|
-
|
|
3198
2207
|
/** A text value — plain string or structured rich text. */
|
|
3199
2208
|
export declare type TextContent = string | RichTextContent;
|
|
3200
2209
|
|
|
@@ -3202,43 +2211,6 @@ export declare interface TextMeasurer {
|
|
|
3202
2211
|
measureText: (text: string, font: FontSpec) => MeasuredText;
|
|
3203
2212
|
}
|
|
3204
2213
|
|
|
3205
|
-
/** Fully-derived tooltip content. The popover renders directly from this. */
|
|
3206
|
-
export declare interface TooltipContent {
|
|
3207
|
-
/** Formatted main-axis value of the primary's observation. `null` for polar. */
|
|
3208
|
-
header: string | null;
|
|
3209
|
-
rows: TooltipRow[];
|
|
3210
|
-
}
|
|
3211
|
-
|
|
3212
|
-
/**
|
|
3213
|
-
* One row in the chart tooltip popover. Pure projection of a `HoverHit` against the layer's
|
|
3214
|
-
* compiled scales.
|
|
3215
|
-
*/
|
|
3216
|
-
export declare interface TooltipRow {
|
|
3217
|
-
/**
|
|
3218
|
-
* Resolved color string applied as the row's swatch fill/stroke. `null` only when the chart
|
|
3219
|
-
* has no color scale at all — the popover suppresses the swatch cell in that edge case.
|
|
3220
|
-
*/
|
|
3221
|
-
swatchColor: string | null;
|
|
3222
|
-
/** Visual signature of the row's source geom. Drives the swatch shape. */
|
|
3223
|
-
swatchShape: SwatchShape;
|
|
3224
|
-
/** Row label — color value (multi-series) or layer's Y-axis title (single-series). */
|
|
3225
|
-
label: string;
|
|
3226
|
-
/** Formatted Y reading for this hit. */
|
|
3227
|
-
value: string;
|
|
3228
|
-
/** Styling hint: the row whose hit `=== primary`. Never re-orders. */
|
|
3229
|
-
isPrimary: boolean;
|
|
3230
|
-
/** Stable key — `${layerId}:${pointIndex}`. */
|
|
3231
|
-
key: string;
|
|
3232
|
-
}
|
|
3233
|
-
|
|
3234
|
-
export declare const transform: {
|
|
3235
|
-
reshape: typeof reshape;
|
|
3236
|
-
filter: typeof filter;
|
|
3237
|
-
sort: typeof sort;
|
|
3238
|
-
aggregate: typeof aggregate;
|
|
3239
|
-
constant: typeof constant;
|
|
3240
|
-
};
|
|
3241
|
-
|
|
3242
2214
|
/**
|
|
3243
2215
|
* Applies spec-level transforms to a dataset by delegating to registered strategies.
|
|
3244
2216
|
*/
|
|
@@ -3251,7 +2223,7 @@ declare class TransformCompiler {
|
|
|
3251
2223
|
/***************************************************************
|
|
3252
2224
|
* Transform Input
|
|
3253
2225
|
***************************************************************/
|
|
3254
|
-
declare type TransformInput = ReshapeTransformInput | FilterTransformInput | SortTransformInput | AggregateTransformInput
|
|
2226
|
+
declare type TransformInput = ReshapeTransformInput | FilterTransformInput | SortTransformInput | AggregateTransformInput;
|
|
3255
2227
|
|
|
3256
2228
|
/**
|
|
3257
2229
|
* Built-in transform implementations keyed by transform type.
|
|
@@ -3270,43 +2242,6 @@ declare interface TransformStrategy {
|
|
|
3270
2242
|
|
|
3271
2243
|
declare type TransformType = TransformInput['transformType'];
|
|
3272
2244
|
|
|
3273
|
-
declare type TrendlineType = 'linear' | 'loess' | 'exponential' | 'logarithmic' | 'quadratic' | 'power' | 'polynomial';
|
|
3274
|
-
|
|
3275
|
-
/**
|
|
3276
|
-
* Result of an undo/redo operation.
|
|
3277
|
-
*/
|
|
3278
|
-
declare interface UndoRedoResult {
|
|
3279
|
-
/** The new spec after the operation */
|
|
3280
|
-
spec: Spec;
|
|
3281
|
-
/** The original command that was undone/redone */
|
|
3282
|
-
command: Command;
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
/**
|
|
3286
|
-
* Shared validation types used across compiler stages.
|
|
3287
|
-
*
|
|
3288
|
-
* Each validation stage (e.g. {@link LayerValidator}, the pre-pass in {@link ScaleCompiler}) collects
|
|
3289
|
-
* {@link ValidationIssue}s and throws a single {@link SpecValidationError} at the end of its stage.
|
|
3290
|
-
*/
|
|
3291
|
-
declare type ValidationCode = 'UNKNOWN_VARIABLE' | 'INCOMPATIBLE_TYPE' | 'MISSING_AESTHETIC';
|
|
3292
|
-
|
|
3293
|
-
declare interface ValidationIssue {
|
|
3294
|
-
code: ValidationCode;
|
|
3295
|
-
message: string;
|
|
3296
|
-
layerId?: string;
|
|
3297
|
-
aesthetic?: string;
|
|
3298
|
-
}
|
|
3299
|
-
|
|
3300
|
-
declare type ValueFormat = TemporalValueFormat | NumericValueFormat | CurrencyValueFormat | CategoricalValueFormat;
|
|
3301
|
-
|
|
3302
|
-
/**
|
|
3303
|
-
* Constant mapping - a literal value applied to every observation.
|
|
3304
|
-
* Analogous to Vega-Lite's `{datum: X}` / ggplot2's `aes(color = "literal")`.
|
|
3305
|
-
*/
|
|
3306
|
-
declare interface ValueMapping {
|
|
3307
|
-
value: DataValue;
|
|
3308
|
-
}
|
|
3309
|
-
|
|
3310
2245
|
/** A column of a variable in the dataset. */
|
|
3311
2246
|
declare type Variable = {
|
|
3312
2247
|
type: DataType;
|
|
@@ -3376,12 +2311,6 @@ declare interface XAxisConfig {
|
|
|
3376
2311
|
ticks: AxisTicksConfig;
|
|
3377
2312
|
}
|
|
3378
2313
|
|
|
3379
|
-
/** Minimal x/y shape — most runtime records satisfy this (HoverCursor, HoverHit, etc.). */
|
|
3380
|
-
export declare interface XYPoint {
|
|
3381
|
-
x: number;
|
|
3382
|
-
y: number;
|
|
3383
|
-
}
|
|
3384
|
-
|
|
3385
2314
|
/**
|
|
3386
2315
|
* Y-axis configuration (after defaults applied)
|
|
3387
2316
|
*/
|