@x12i/charts 1.0.0 → 1.1.0
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 +514 -23
- package/dist/chunk-U3U6ZV7A.js +5040 -0
- package/dist/chunk-U3U6ZV7A.js.map +1 -0
- package/dist/echarts-option-DHFfEvN1.d.ts +1251 -0
- package/dist/index.d.ts +262 -154
- package/dist/index.js +537 -27
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +251 -0
- package/dist/react.js +1271 -0
- package/dist/react.js.map +1 -0
- package/dist/styles.css +821 -0
- package/package.json +64 -5
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
import { TokenPath, ThemeName } from '@x12i/tokens';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ChartSpec: a JSON-serializable description of one chart (spec section 8).
|
|
5
|
+
* The grammar is deliberately smaller than Vega-Lite. Renderers read a spec and
|
|
6
|
+
* draw it with kit tokens, so an engine can change without breaking apps.
|
|
7
|
+
*
|
|
8
|
+
* Everything added after the first release is optional, so specs written
|
|
9
|
+
* against the first release stay valid.
|
|
10
|
+
*/
|
|
11
|
+
/** Chart types by family. Entries marked 1.x in the spec are included so specs written today stay valid. */
|
|
12
|
+
declare const chartTypes: readonly ["bar", "lollipop", "dot-plot", "bullet", "slope", "dumbbell", "line", "area", "step", "sparkline", "range-band", "candlestick", "ohlc", "histogram", "box-plot", "density", "strip", "beeswarm", "violin", "ecdf", "donut", "pie", "treemap", "waterfall", "funnel", "waffle", "sunburst", "marimekko", "scatter", "bubble", "connected-scatter", "heatmap", "hexbin", "contour", "stat", "gauge", "progress-ring", "sankey", "chord", "alluvial", "choropleth", "point-map", "heat-layer", "flow-map", "gantt", "timeline", "burndown", "cumulative-flow", "calendar-heatmap", "combo"];
|
|
13
|
+
type ChartType = (typeof chartTypes)[number];
|
|
14
|
+
type FieldType = "category" | "number" | "time" | "boolean";
|
|
15
|
+
/** One data row. Values are looked up by field name. */
|
|
16
|
+
type Row = Record<string, unknown>;
|
|
17
|
+
/** Where the rows come from: a named dataset resolved by the app, or inline values. */
|
|
18
|
+
type ChartData = {
|
|
19
|
+
ref: string;
|
|
20
|
+
} | {
|
|
21
|
+
values: ReadonlyArray<Record<string, unknown>>;
|
|
22
|
+
};
|
|
23
|
+
interface Encoding {
|
|
24
|
+
field: string;
|
|
25
|
+
type: FieldType;
|
|
26
|
+
/**
|
|
27
|
+
* A named format (`compact`, `percent`, `integer`, `decimal`, `currency:USD`,
|
|
28
|
+
* `date`, `datetime`, `time`, `month`, `year`), a d3-format specifier such as
|
|
29
|
+
* `,.2f`, or a d3-time-format pattern such as `%b %Y`.
|
|
30
|
+
*/
|
|
31
|
+
format?: string;
|
|
32
|
+
/** Axis or legend title. Axis titles carry units. */
|
|
33
|
+
title?: string;
|
|
34
|
+
}
|
|
35
|
+
/** Transforms run in order before drawing. */
|
|
36
|
+
type Transform = {
|
|
37
|
+
type: "aggregate";
|
|
38
|
+
groupBy: string[];
|
|
39
|
+
op: "sum" | "mean" | "min" | "max" | "count";
|
|
40
|
+
field?: string;
|
|
41
|
+
as: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: "bin";
|
|
44
|
+
field: string;
|
|
45
|
+
maxBins?: number;
|
|
46
|
+
as: string;
|
|
47
|
+
} | {
|
|
48
|
+
type: "stack";
|
|
49
|
+
field: string;
|
|
50
|
+
groupBy?: string[];
|
|
51
|
+
offset?: "zero" | "normalize";
|
|
52
|
+
} | {
|
|
53
|
+
type: "percent-of-total";
|
|
54
|
+
field: string;
|
|
55
|
+
as: string;
|
|
56
|
+
} | {
|
|
57
|
+
type: "sort";
|
|
58
|
+
field: string;
|
|
59
|
+
order?: "asc" | "desc";
|
|
60
|
+
} | {
|
|
61
|
+
type: "top-n";
|
|
62
|
+
field: string;
|
|
63
|
+
n: number;
|
|
64
|
+
otherLabel?: string;
|
|
65
|
+
} | {
|
|
66
|
+
type: "rolling-average";
|
|
67
|
+
field: string;
|
|
68
|
+
window: number;
|
|
69
|
+
as: string;
|
|
70
|
+
} | {
|
|
71
|
+
type: "cumulative-sum";
|
|
72
|
+
field: string;
|
|
73
|
+
as: string;
|
|
74
|
+
} | {
|
|
75
|
+
type: "period-change";
|
|
76
|
+
field: string;
|
|
77
|
+
periods?: number;
|
|
78
|
+
as: string;
|
|
79
|
+
} | {
|
|
80
|
+
type: "downsample";
|
|
81
|
+
method: "lttb";
|
|
82
|
+
field: string;
|
|
83
|
+
threshold: number;
|
|
84
|
+
};
|
|
85
|
+
/** Meaning of a labeled mark. Status tones use muted status colors and a label, never color alone. */
|
|
86
|
+
type AnnotationTone = "neutral" | "good" | "warning" | "critical";
|
|
87
|
+
/** Targets, limits and forecasts are always labeled marks, never unlabeled lines. */
|
|
88
|
+
type Annotation = {
|
|
89
|
+
type: "reference-line";
|
|
90
|
+
x?: number | string;
|
|
91
|
+
y?: number | string;
|
|
92
|
+
label: string;
|
|
93
|
+
tone?: AnnotationTone;
|
|
94
|
+
axis?: "y" | "y2";
|
|
95
|
+
} | {
|
|
96
|
+
type: "reference-band";
|
|
97
|
+
from: number | string;
|
|
98
|
+
to: number | string;
|
|
99
|
+
axis: "x" | "y";
|
|
100
|
+
label: string;
|
|
101
|
+
tone?: AnnotationTone;
|
|
102
|
+
} | {
|
|
103
|
+
type: "text";
|
|
104
|
+
x: number | string;
|
|
105
|
+
y: number | string;
|
|
106
|
+
text: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: "forecast";
|
|
109
|
+
from: number | string;
|
|
110
|
+
label: string;
|
|
111
|
+
}
|
|
112
|
+
/** A labeled point on the plot, for example a peak or an incident. */
|
|
113
|
+
| {
|
|
114
|
+
type: "point";
|
|
115
|
+
x: number | string;
|
|
116
|
+
y: number | string;
|
|
117
|
+
label: string;
|
|
118
|
+
tone?: AnnotationTone;
|
|
119
|
+
};
|
|
120
|
+
interface ChartInteractions {
|
|
121
|
+
tooltip?: boolean;
|
|
122
|
+
/** Brush to filter other charts and grids through the shared filter store. */
|
|
123
|
+
brush?: boolean;
|
|
124
|
+
/** Click a legend entry to isolate a series. */
|
|
125
|
+
legendIsolate?: boolean;
|
|
126
|
+
zoom?: boolean;
|
|
127
|
+
/** Click to drill down through the shared filter store. */
|
|
128
|
+
drilldown?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/** Accessibility fields. Every chart has an accessible name, a description and a table view. */
|
|
131
|
+
interface ChartA11y {
|
|
132
|
+
/** The long description read to screen reader users. */
|
|
133
|
+
description: string;
|
|
134
|
+
/** Show the underlying data as a table behind a "View as table" toggle. Defaults to true. */
|
|
135
|
+
table?: boolean;
|
|
136
|
+
}
|
|
137
|
+
type RendererChoice = "svg" | "canvas" | "auto";
|
|
138
|
+
/**
|
|
139
|
+
* - `linear`, `log`, `sqrt`: quantitative.
|
|
140
|
+
* - `time`: a UTC time axis.
|
|
141
|
+
* - `band`: one slot per category, for bars.
|
|
142
|
+
* - `ordinal`: one position per category, for lines and points.
|
|
143
|
+
*/
|
|
144
|
+
type ScaleType = "linear" | "log" | "sqrt" | "time" | "band" | "ordinal";
|
|
145
|
+
interface ScaleSpec {
|
|
146
|
+
type?: ScaleType;
|
|
147
|
+
/**
|
|
148
|
+
* Quantitative and time scales: `[min, max]` (time values are ISO strings or
|
|
149
|
+
* epoch milliseconds). Band and ordinal scales: the category order.
|
|
150
|
+
*/
|
|
151
|
+
domain?: ReadonlyArray<number | string>;
|
|
152
|
+
/** Round the domain to nice values. Defaults to true for quantitative scales. */
|
|
153
|
+
nice?: boolean;
|
|
154
|
+
/** Force zero into a quantitative domain. Bars always include zero. */
|
|
155
|
+
zero?: boolean;
|
|
156
|
+
/** Log base. Defaults to 10. */
|
|
157
|
+
base?: number;
|
|
158
|
+
/** Flip the direction of the scale. */
|
|
159
|
+
reverse?: boolean;
|
|
160
|
+
/** Fraction of a band left empty between bands, from 0 to 0.9. */
|
|
161
|
+
padding?: number;
|
|
162
|
+
}
|
|
163
|
+
/** `stacked` adds up, `normalized` shows shares of 100%, `diverging` stacks negatives below zero. */
|
|
164
|
+
type StackMode = "none" | "stacked" | "normalized" | "diverging";
|
|
165
|
+
interface AxisSpec {
|
|
166
|
+
/** Hide the axis entirely. */
|
|
167
|
+
show?: boolean;
|
|
168
|
+
title?: string;
|
|
169
|
+
/** Draw gridlines for this axis. Defaults to true for the value axis only. */
|
|
170
|
+
grid?: boolean;
|
|
171
|
+
/** Approximate tick count; the scale picks nice values near it. */
|
|
172
|
+
ticks?: number;
|
|
173
|
+
/** Explicit tick values, which override `ticks`. */
|
|
174
|
+
tickValues?: ReadonlyArray<number | string>;
|
|
175
|
+
format?: string;
|
|
176
|
+
/** Label angle in degrees, or `auto` to rotate only when labels do not fit. */
|
|
177
|
+
labelAngle?: number | "auto";
|
|
178
|
+
/** Longest tick label in characters before it is shortened with an ellipsis. */
|
|
179
|
+
maxLabelLength?: number;
|
|
180
|
+
}
|
|
181
|
+
type MarkerShape = "circle" | "square" | "diamond" | "triangle" | "triangle-down" | "cross" | "plus";
|
|
182
|
+
type DashStyle = "solid" | "dashed" | "dotted" | "dash-dot";
|
|
183
|
+
/** Named series colors. Everything resolves to a kit token at render time. */
|
|
184
|
+
type SeriesTone = "accent" | "muted" | "reference" | "good" | "warning" | "critical" | "categorical-1" | "categorical-2" | "categorical-3" | "categorical-4" | "categorical-5" | "categorical-6" | "categorical-7" | "categorical-8";
|
|
185
|
+
/** Marks a single series can draw in a combo chart. */
|
|
186
|
+
type SeriesMark = "bar" | "line" | "area" | "step" | "scatter";
|
|
187
|
+
interface SeriesPoint {
|
|
188
|
+
/** Category label, number, epoch milliseconds, or an ISO date string. */
|
|
189
|
+
x: string | number;
|
|
190
|
+
y: number | null;
|
|
191
|
+
/** Bubble size. */
|
|
192
|
+
size?: number;
|
|
193
|
+
/** Overrides the x label in tooltips, tables and announcements. */
|
|
194
|
+
label?: string;
|
|
195
|
+
}
|
|
196
|
+
interface SeriesSpec {
|
|
197
|
+
/** Stable identifier used by legend toggles and callbacks. */
|
|
198
|
+
id: string;
|
|
199
|
+
/** Display name. Defaults to the id. */
|
|
200
|
+
label?: string;
|
|
201
|
+
/** In a combo chart, which mark this series draws. Defaults to `bar`. */
|
|
202
|
+
mark?: SeriesMark;
|
|
203
|
+
/** Wide format: read this column of the shared rows as the y value. */
|
|
204
|
+
field?: string;
|
|
205
|
+
/** Own points, instead of reading shared rows. */
|
|
206
|
+
points?: ReadonlyArray<SeriesPoint>;
|
|
207
|
+
/** Which value axis the series uses. `y2` needs `dualAxis: true`. */
|
|
208
|
+
axis?: "y" | "y2";
|
|
209
|
+
tone?: SeriesTone;
|
|
210
|
+
/** Point marker shape. Defaults to a different shape per series. */
|
|
211
|
+
marker?: MarkerShape;
|
|
212
|
+
/** Line dash pattern. Defaults to a different pattern per series. */
|
|
213
|
+
dash?: DashStyle;
|
|
214
|
+
/** Series with the same stack key stack together. */
|
|
215
|
+
stack?: string;
|
|
216
|
+
/** Start hidden. The legend can show it. */
|
|
217
|
+
hidden?: boolean;
|
|
218
|
+
/** Number format for this series in tooltips and tables. */
|
|
219
|
+
format?: string;
|
|
220
|
+
}
|
|
221
|
+
interface LegendSpec {
|
|
222
|
+
/** `auto` shows the legend when there is more than one series (or more than one slice). */
|
|
223
|
+
show?: boolean | "auto";
|
|
224
|
+
position?: "top" | "bottom";
|
|
225
|
+
}
|
|
226
|
+
/** A labeled limit or target. Breaching points get an extra mark and tooltip note, not only a color. */
|
|
227
|
+
interface Threshold {
|
|
228
|
+
value: number | string;
|
|
229
|
+
label: string;
|
|
230
|
+
axis?: "x" | "y" | "y2";
|
|
231
|
+
tone?: AnnotationTone;
|
|
232
|
+
/** `above` flags values over the threshold, `below` flags values under it. */
|
|
233
|
+
breach?: "above" | "below";
|
|
234
|
+
}
|
|
235
|
+
interface GaugeSpec {
|
|
236
|
+
/** A literal value. Without it, the first row of the `value` (or `y`) encoding is used. */
|
|
237
|
+
value?: number;
|
|
238
|
+
min?: number;
|
|
239
|
+
max?: number;
|
|
240
|
+
target?: number;
|
|
241
|
+
/** Ranges behind the value arc, for example good, warning and critical. */
|
|
242
|
+
bands?: ReadonlyArray<{
|
|
243
|
+
from: number;
|
|
244
|
+
to: number;
|
|
245
|
+
tone: AnnotationTone;
|
|
246
|
+
label?: string;
|
|
247
|
+
}>;
|
|
248
|
+
/**
|
|
249
|
+
* Number format for the value, minimum, maximum and target. `percent` shows
|
|
250
|
+
* the share of the min to max range: 64 of 100 and 0.64 of 1 both read 64%.
|
|
251
|
+
* When `max` is omitted, a percent gauge with a value from 0 to 1 ends at 1.
|
|
252
|
+
*/
|
|
253
|
+
format?: string;
|
|
254
|
+
}
|
|
255
|
+
interface DonutSpec {
|
|
256
|
+
/** Inner radius as a fraction of the outer radius, from 0 to 0.9. Defaults to 0.62 for `donut`, 0 for `pie`. */
|
|
257
|
+
innerRadius?: number;
|
|
258
|
+
/** Slices beyond this count merge into "Other". Defaults to 5, the spec's donut limit. */
|
|
259
|
+
maxSlices?: number;
|
|
260
|
+
/** Center label. Defaults to the total of all slices. */
|
|
261
|
+
centerLabel?: string;
|
|
262
|
+
/** Caption under the center value. */
|
|
263
|
+
centerCaption?: string;
|
|
264
|
+
}
|
|
265
|
+
interface WaterfallSpec {
|
|
266
|
+
/** Categories (x values) that are totals: their bars run from zero to the running sum. */
|
|
267
|
+
totals?: ReadonlyArray<string>;
|
|
268
|
+
}
|
|
269
|
+
interface ChartLabels {
|
|
270
|
+
/** Label line and area series at their last point instead of relying on the legend. `auto` does so for 2 to 5 series. */
|
|
271
|
+
direct?: boolean | "auto";
|
|
272
|
+
/** Print values on bars and slices. */
|
|
273
|
+
values?: boolean;
|
|
274
|
+
}
|
|
275
|
+
interface BinSpec {
|
|
276
|
+
/** Approximate number of bins. */
|
|
277
|
+
count?: number;
|
|
278
|
+
/** Explicit bin boundaries. */
|
|
279
|
+
thresholds?: ReadonlyArray<number>;
|
|
280
|
+
}
|
|
281
|
+
interface ChartSpec {
|
|
282
|
+
/** Schema version, so saved specs can be migrated. */
|
|
283
|
+
version?: 1;
|
|
284
|
+
/** The finding: a sentence that states what the chart shows. */
|
|
285
|
+
title: string;
|
|
286
|
+
/** Scope and units. */
|
|
287
|
+
subtitle?: string;
|
|
288
|
+
/** Where the data came from. Required in reports. */
|
|
289
|
+
source?: string;
|
|
290
|
+
data: ChartData;
|
|
291
|
+
mark: ChartType;
|
|
292
|
+
x?: Encoding;
|
|
293
|
+
y?: Encoding;
|
|
294
|
+
/** Series that differ in kind use the categorical palette, capped at 8 hues. */
|
|
295
|
+
color?: Encoding;
|
|
296
|
+
size?: Encoding;
|
|
297
|
+
/** The measure for heatmaps and gauges. Heatmaps fall back to `color`. */
|
|
298
|
+
value?: Encoding;
|
|
299
|
+
/** One accent on what the title is about, for example `week == 'W4'`. */
|
|
300
|
+
highlight?: {
|
|
301
|
+
where: string;
|
|
302
|
+
};
|
|
303
|
+
transforms?: Transform[];
|
|
304
|
+
annotations?: Annotation[];
|
|
305
|
+
interactions?: ChartInteractions;
|
|
306
|
+
/** Dual axes only behind an explicit flag, which adds a visible warning. */
|
|
307
|
+
dualAxis?: boolean;
|
|
308
|
+
renderer?: RendererChoice;
|
|
309
|
+
/** Whether axes mirror in right-to-left locales. */
|
|
310
|
+
direction?: "ltr" | "rtl" | "auto";
|
|
311
|
+
a11y: ChartA11y;
|
|
312
|
+
/** Explicit series. Without them, series come from `y`, or from the groups of `color`. */
|
|
313
|
+
series?: SeriesSpec[];
|
|
314
|
+
/** How series combine on one axis. Defaults to `none` (grouped bars, overlapping lines). */
|
|
315
|
+
stack?: StackMode;
|
|
316
|
+
/** `horizontal` bars put the categories on the vertical axis. */
|
|
317
|
+
orientation?: "vertical" | "horizontal";
|
|
318
|
+
scales?: {
|
|
319
|
+
x?: ScaleSpec;
|
|
320
|
+
y?: ScaleSpec;
|
|
321
|
+
y2?: ScaleSpec;
|
|
322
|
+
};
|
|
323
|
+
axes?: {
|
|
324
|
+
x?: AxisSpec;
|
|
325
|
+
y?: AxisSpec;
|
|
326
|
+
y2?: AxisSpec;
|
|
327
|
+
};
|
|
328
|
+
thresholds?: Threshold[];
|
|
329
|
+
legend?: LegendSpec;
|
|
330
|
+
labels?: ChartLabels;
|
|
331
|
+
/** Histogram bins. */
|
|
332
|
+
bins?: BinSpec;
|
|
333
|
+
gauge?: GaugeSpec;
|
|
334
|
+
donut?: DonutSpec;
|
|
335
|
+
waterfall?: WaterfallSpec;
|
|
336
|
+
/** IANA time zone used to format time values. Time axes are laid out in UTC. Defaults to `UTC`. */
|
|
337
|
+
timeZone?: string;
|
|
338
|
+
}
|
|
339
|
+
/** Identity helper that gives authoring-time type checking and autocomplete. */
|
|
340
|
+
declare function defineChartSpec(spec: ChartSpec): ChartSpec;
|
|
341
|
+
|
|
342
|
+
type Datasets = Readonly<Record<string, ReadonlyArray<Row>>>;
|
|
343
|
+
/** Rows for a spec: inline values, or the named dataset from `datasets`. `undefined` when a `ref` is not provided. */
|
|
344
|
+
declare function resolveRows(spec: ChartSpec, datasets?: Datasets): ReadonlyArray<Row> | undefined;
|
|
345
|
+
/** Total number of data points a spec would draw, for choosing a renderer. */
|
|
346
|
+
declare function countPoints(spec: ChartSpec, datasets?: Datasets): number;
|
|
347
|
+
/** Reads a field, allowing dotted paths into nested objects. */
|
|
348
|
+
declare function readField(row: Row, field: string): unknown;
|
|
349
|
+
/** A finite number, or `null`. Numeric strings are accepted; booleans and blanks are not. */
|
|
350
|
+
declare function toNumber(value: unknown): number | null;
|
|
351
|
+
/**
|
|
352
|
+
* Epoch milliseconds from a Date, a number (already milliseconds), or a date
|
|
353
|
+
* string. Date-only strings and strings with an offset parse as written;
|
|
354
|
+
* strings without an offset are read as UTC so output does not depend on the
|
|
355
|
+
* machine's time zone.
|
|
356
|
+
*/
|
|
357
|
+
declare function toTime(value: unknown): number | null;
|
|
358
|
+
/** Display key for a category value. Booleans and numbers become strings; blanks become an empty string. */
|
|
359
|
+
declare function toCategory(value: unknown): string;
|
|
360
|
+
interface TransformContext {
|
|
361
|
+
/** Field that names categories (the x field), used by `top-n` and `downsample`. */
|
|
362
|
+
categoryField?: string | undefined;
|
|
363
|
+
/** Field that splits rows into series (the color field); window transforms run per group. */
|
|
364
|
+
groupField?: string | undefined;
|
|
365
|
+
/** Whether x holds times or numbers (for sorting and downsampling). */
|
|
366
|
+
xKind?: "category" | "number" | "time" | undefined;
|
|
367
|
+
/** Label for the merged "Other" row of `top-n`. */
|
|
368
|
+
otherLabel?: string | undefined;
|
|
369
|
+
}
|
|
370
|
+
/** Runs transforms in order. Unknown or invalid parameters leave the rows unchanged. */
|
|
371
|
+
declare function applyTransforms(rows: ReadonlyArray<Row>, transforms: ReadonlyArray<Transform> | undefined, context?: TransformContext): Row[];
|
|
372
|
+
/** The stack mode a spec asks for: `spec.stack`, else implied by a `stack` transform, else `none`. */
|
|
373
|
+
declare function effectiveStack(spec: ChartSpec): StackMode;
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* The SVG renderer is comfortable up to roughly this many points per chart
|
|
377
|
+
* (spec section 8: about 1,000 to 5,000). Beyond it, auto mode uses canvas.
|
|
378
|
+
*/
|
|
379
|
+
declare const SVG_POINT_LIMIT = 5000;
|
|
380
|
+
type RenderTarget = "screen" | "print" | "report";
|
|
381
|
+
interface ResolveRendererInput {
|
|
382
|
+
renderer?: RendererChoice;
|
|
383
|
+
mark: ChartType;
|
|
384
|
+
pointCount: number;
|
|
385
|
+
target?: RenderTarget;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Picks a renderer for a chart. Reports and print always use SVG so the output
|
|
389
|
+
* stays vector; on screen, `auto` switches to canvas by point count and type.
|
|
390
|
+
*/
|
|
391
|
+
declare function resolveRenderer({ renderer, mark, pointCount, target, }: ResolveRendererInput): "svg" | "canvas";
|
|
392
|
+
|
|
393
|
+
interface HistogramBin {
|
|
394
|
+
/** Inclusive lower edge. */
|
|
395
|
+
x0: number;
|
|
396
|
+
/** Exclusive upper edge (inclusive for the last bin). */
|
|
397
|
+
x1: number;
|
|
398
|
+
count: number;
|
|
399
|
+
}
|
|
400
|
+
interface HistogramOptions {
|
|
401
|
+
/** Approximate number of bins; boundaries land on nice values. */
|
|
402
|
+
count?: number;
|
|
403
|
+
/** Explicit boundaries, which override `count`. */
|
|
404
|
+
thresholds?: ReadonlyArray<number>;
|
|
405
|
+
/** Fixed range. Defaults to the data extent. */
|
|
406
|
+
domain?: readonly [number, number];
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* Bins numbers for a histogram. Non-finite values are ignored. Boundaries come
|
|
410
|
+
* from d3-array: nice values near the requested count, or the explicit list.
|
|
411
|
+
* Returns `[]` for empty input.
|
|
412
|
+
*/
|
|
413
|
+
declare function histogramBins(values: ReadonlyArray<number | null | undefined>, options?: HistogramOptions): HistogramBin[];
|
|
414
|
+
|
|
415
|
+
interface ChartMessages {
|
|
416
|
+
loading: string;
|
|
417
|
+
empty: string;
|
|
418
|
+
error: string;
|
|
419
|
+
retry: string;
|
|
420
|
+
/** `{mark}` is the chart type name. */
|
|
421
|
+
unsupportedMark: string;
|
|
422
|
+
/** `{ref}` is the dataset name. */
|
|
423
|
+
missingDataset: string;
|
|
424
|
+
invalidSpec: string;
|
|
425
|
+
/** Shown when `echarts` cannot be loaded and the chart falls back to SVG. */
|
|
426
|
+
canvasMissing: string;
|
|
427
|
+
/** Shown when `echarts` loads but cannot draw this chart (for example a waterfall that crosses zero). */
|
|
428
|
+
canvasUnsupported: string;
|
|
429
|
+
canvasLoading: string;
|
|
430
|
+
allSeriesHidden: string;
|
|
431
|
+
/** Role description of the interactive plot, for example "chart". */
|
|
432
|
+
chartRoleDescription: string;
|
|
433
|
+
/** Accessible name. `{title}` and `{type}` (lower case, such as "bar chart"). */
|
|
434
|
+
chartName: string;
|
|
435
|
+
legend: string;
|
|
436
|
+
viewAsTable: string;
|
|
437
|
+
viewAsChart: string;
|
|
438
|
+
downloadCsv: string;
|
|
439
|
+
toolbar: string;
|
|
440
|
+
/** `{title}` is the chart title. */
|
|
441
|
+
tableCaption: string;
|
|
442
|
+
/** `{shown}` and `{total}` are row counts. */
|
|
443
|
+
tableTruncated: string;
|
|
444
|
+
dualAxisWarning: string;
|
|
445
|
+
other: string;
|
|
446
|
+
total: string;
|
|
447
|
+
noValue: string;
|
|
448
|
+
/** Waterfall legend keys. */
|
|
449
|
+
increase: string;
|
|
450
|
+
decrease: string;
|
|
451
|
+
axisX: string;
|
|
452
|
+
axisY: string;
|
|
453
|
+
axisY2: string;
|
|
454
|
+
/** `{axis}` and `{title}`. */
|
|
455
|
+
axisWithTitle: string;
|
|
456
|
+
columnSeries: string;
|
|
457
|
+
columnX: string;
|
|
458
|
+
columnY: string;
|
|
459
|
+
columnSize: string;
|
|
460
|
+
columnValue: string;
|
|
461
|
+
columnShare: string;
|
|
462
|
+
columnFrom: string;
|
|
463
|
+
columnTo: string;
|
|
464
|
+
columnCount: string;
|
|
465
|
+
columnChange: string;
|
|
466
|
+
columnRunningTotal: string;
|
|
467
|
+
columnMetric: string;
|
|
468
|
+
columnMinimum: string;
|
|
469
|
+
columnMaximum: string;
|
|
470
|
+
columnTarget: string;
|
|
471
|
+
columnCategory: string;
|
|
472
|
+
columnRow: string;
|
|
473
|
+
describeSummary: string;
|
|
474
|
+
describeCategories: string;
|
|
475
|
+
describeRange: string;
|
|
476
|
+
describeSeries: string;
|
|
477
|
+
trendRising: string;
|
|
478
|
+
trendFalling: string;
|
|
479
|
+
trendFlat: string;
|
|
480
|
+
trendRisingChange: string;
|
|
481
|
+
trendFallingChange: string;
|
|
482
|
+
describeSlices: string;
|
|
483
|
+
describeLargestSlice: string;
|
|
484
|
+
describeGauge: string;
|
|
485
|
+
describeGaugeTarget: string;
|
|
486
|
+
describeHeatmap: string;
|
|
487
|
+
describeHistogram: string;
|
|
488
|
+
describeThreshold: string;
|
|
489
|
+
describeBreaches: string;
|
|
490
|
+
describeHiddenSeries: string;
|
|
491
|
+
/** Pie and donut: `{type}`, `{count}`. */
|
|
492
|
+
describePieSummary: string;
|
|
493
|
+
/** `{start}`, `{end}`. */
|
|
494
|
+
describeWaterfall: string;
|
|
495
|
+
/** `{label}`, `{value}`. */
|
|
496
|
+
describeWaterfallUp: string;
|
|
497
|
+
describeWaterfallDown: string;
|
|
498
|
+
/** `{r}`: the correlation coefficient. */
|
|
499
|
+
describeCorrelationPositive: string;
|
|
500
|
+
describeCorrelationNegative: string;
|
|
501
|
+
describeCorrelationNone: string;
|
|
502
|
+
pointCategory: string;
|
|
503
|
+
pointSingle: string;
|
|
504
|
+
pointSlice: string;
|
|
505
|
+
pointXY: string;
|
|
506
|
+
pointBubble: string;
|
|
507
|
+
pointCell: string;
|
|
508
|
+
pointBin: string;
|
|
509
|
+
pointWaterfall: string;
|
|
510
|
+
pointWaterfallTotal: string;
|
|
511
|
+
/** `{text}`, `{index}`, `{count}`. */
|
|
512
|
+
pointPosition: string;
|
|
513
|
+
breachAbove: string;
|
|
514
|
+
breachBelow: string;
|
|
515
|
+
/** Text under a gauge value. `{min}` and `{max}`. */
|
|
516
|
+
gaugeRange: string;
|
|
517
|
+
/** Lower-case name of each chart type, for names and descriptions. */
|
|
518
|
+
markNames: Record<ChartType, string>;
|
|
519
|
+
}
|
|
520
|
+
type ChartMessagesInput = Partial<Omit<ChartMessages, "markNames">> & {
|
|
521
|
+
markNames?: Partial<Record<ChartType, string>>;
|
|
522
|
+
};
|
|
523
|
+
declare const defaultMessages: ChartMessages;
|
|
524
|
+
/** Merges partial messages over the English defaults. */
|
|
525
|
+
declare function resolveMessages(input?: ChartMessagesInput | undefined): ChartMessages;
|
|
526
|
+
/**
|
|
527
|
+
* Fills an ICU-subset template. Unknown arguments render as empty text.
|
|
528
|
+
* Numbers passed as `number` are used for plural rules; pass already formatted
|
|
529
|
+
* text as `string` for display.
|
|
530
|
+
*/
|
|
531
|
+
declare function formatMessage(template: string, values?: Record<string, string | number | undefined>, locale?: string): string;
|
|
532
|
+
|
|
533
|
+
/**
|
|
534
|
+
* Series styling: which tone, marker shape and dash pattern each series gets.
|
|
535
|
+
* Colors are never constants here; tones map to `--kit-*` variables, so charts
|
|
536
|
+
* theme through CSS (light, dark, high contrast) without any JavaScript.
|
|
537
|
+
*
|
|
538
|
+
* Color is never the only channel: every series also gets its own marker
|
|
539
|
+
* shape and dash pattern, so series stay distinguishable in grayscale and for
|
|
540
|
+
* color-blind readers.
|
|
541
|
+
*/
|
|
542
|
+
|
|
543
|
+
/** The categorical palette has eight hues; further series reuse them with new shapes and dashes. */
|
|
544
|
+
declare const MAX_HUES = 8;
|
|
545
|
+
declare const markerShapes: ReadonlyArray<MarkerShape>;
|
|
546
|
+
declare const dashStyles: ReadonlyArray<DashStyle>;
|
|
547
|
+
/** SVG `stroke-dasharray` for each dash style (undefined means a solid line). */
|
|
548
|
+
declare const dashArrays: Readonly<Record<DashStyle, string | undefined>>;
|
|
549
|
+
declare const categoricalTones: ReadonlyArray<SeriesTone>;
|
|
550
|
+
interface SeriesStyle {
|
|
551
|
+
/** Position in the series list, for hatch patterns and `data-series`. */
|
|
552
|
+
index: number;
|
|
553
|
+
tone: SeriesTone;
|
|
554
|
+
marker: MarkerShape;
|
|
555
|
+
dash: DashStyle;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* The style of series `index` out of `count`. A lone series uses the accent
|
|
559
|
+
* ("grey first, one accent"); several series use the categorical palette.
|
|
560
|
+
* Explicit `tone`, `marker` and `dash` on the series win.
|
|
561
|
+
*/
|
|
562
|
+
declare function seriesStyle(index: number, count: number, series?: Pick<SeriesSpec, "tone" | "marker" | "dash">): SeriesStyle;
|
|
563
|
+
/** Token path for a tone, such as `color.chart.categorical.3` or `color.accent.default`. */
|
|
564
|
+
declare function toneTokenPath(tone: SeriesTone): TokenPath;
|
|
565
|
+
/** `var(--kit-color-chart-categorical-3)` and friends. */
|
|
566
|
+
declare function toneCssVar(tone: SeriesTone): string;
|
|
567
|
+
/** The bare custom property name (`--kit-color-chart-good`), for runtime lookups. */
|
|
568
|
+
declare function toneVarName(tone: SeriesTone): string;
|
|
569
|
+
/** Maps an annotation tone to a series tone. Neutral annotations are grey reference marks. */
|
|
570
|
+
declare function annotationTone(tone: AnnotationTone | undefined): SeriesTone;
|
|
571
|
+
/** CSS color for a value `t` (0 to 1) along the sequential ramp, interpolated between ramp steps. */
|
|
572
|
+
declare function sequentialColor(t: number): string;
|
|
573
|
+
/** CSS color for `t` (0 to 1) along the diverging ramp; 0.5 is the neutral midpoint. */
|
|
574
|
+
declare function divergingColor(t: number): string;
|
|
575
|
+
/** CSS gradient covering a whole ramp, for color scale legends. */
|
|
576
|
+
declare function rampGradient(kind: "sequential" | "diverging"): string;
|
|
577
|
+
/** Marker shapes drawn as open strokes (an X and a plus) instead of filled areas. */
|
|
578
|
+
declare function isOpenMarker(shape: MarkerShape): boolean;
|
|
579
|
+
/**
|
|
580
|
+
* SVG path data for a marker centered on (cx, cy) with "radius" r. All shapes
|
|
581
|
+
* are paths so one element type renders every series marker.
|
|
582
|
+
*/
|
|
583
|
+
declare function markerPath(shape: MarkerShape, cx: number, cy: number, r: number): string;
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Turns a `ChartSpec` plus rows into a `ChartModel`: typed series and points,
|
|
587
|
+
* categories, slices, bins and gauge values. Pure and server-safe. Everything
|
|
588
|
+
* downstream (layout, descriptions, tables, the canvas mapping) reads the model.
|
|
589
|
+
*/
|
|
590
|
+
|
|
591
|
+
type XKind = "category" | "number" | "time";
|
|
592
|
+
/** Chart types the SVG renderer draws. */
|
|
593
|
+
declare const supportedMarks: ReadonlyArray<ChartType>;
|
|
594
|
+
declare function isSupportedMark(mark: ChartType): boolean;
|
|
595
|
+
interface ModelPoint {
|
|
596
|
+
/** Position within the series. */
|
|
597
|
+
index: number;
|
|
598
|
+
/** Position of this point's x among the model's categories. */
|
|
599
|
+
categoryIndex: number;
|
|
600
|
+
/** Stable key for x: the category text, or the number or timestamp as text. */
|
|
601
|
+
key: string;
|
|
602
|
+
/** The x value: a category label, a number, or epoch milliseconds. */
|
|
603
|
+
x: string | number;
|
|
604
|
+
/** Upper edge of a histogram bin. */
|
|
605
|
+
x1?: number;
|
|
606
|
+
/** Row category of a heatmap cell. */
|
|
607
|
+
group?: string;
|
|
608
|
+
y: number | null;
|
|
609
|
+
size: number | null;
|
|
610
|
+
/** Label from the data, which replaces the formatted x in tooltips and tables. */
|
|
611
|
+
label?: string;
|
|
612
|
+
row: Row;
|
|
613
|
+
highlighted: boolean;
|
|
614
|
+
}
|
|
615
|
+
interface ModelSeries {
|
|
616
|
+
id: string;
|
|
617
|
+
label: string;
|
|
618
|
+
mark: SeriesMark;
|
|
619
|
+
axis: "y" | "y2";
|
|
620
|
+
style: SeriesStyle;
|
|
621
|
+
stackKey: string;
|
|
622
|
+
format?: string;
|
|
623
|
+
/** Starts hidden. */
|
|
624
|
+
hidden: boolean;
|
|
625
|
+
points: ModelPoint[];
|
|
626
|
+
}
|
|
627
|
+
interface ModelSlice {
|
|
628
|
+
id: string;
|
|
629
|
+
label: string;
|
|
630
|
+
value: number;
|
|
631
|
+
/** Fraction of the total, 0 to 1. */
|
|
632
|
+
share: number;
|
|
633
|
+
style: SeriesStyle;
|
|
634
|
+
highlighted: boolean;
|
|
635
|
+
/** True for the merged "Other" slice. */
|
|
636
|
+
other?: boolean;
|
|
637
|
+
row: Row | null;
|
|
638
|
+
}
|
|
639
|
+
interface ModelGauge {
|
|
640
|
+
value: number;
|
|
641
|
+
min: number;
|
|
642
|
+
max: number;
|
|
643
|
+
target: number | undefined;
|
|
644
|
+
bands: ReadonlyArray<{
|
|
645
|
+
from: number;
|
|
646
|
+
to: number;
|
|
647
|
+
tone: AnnotationTone;
|
|
648
|
+
label?: string | undefined;
|
|
649
|
+
}>;
|
|
650
|
+
format: string | undefined;
|
|
651
|
+
}
|
|
652
|
+
interface WaterfallStep {
|
|
653
|
+
key: string;
|
|
654
|
+
label: string;
|
|
655
|
+
delta: number;
|
|
656
|
+
start: number;
|
|
657
|
+
end: number;
|
|
658
|
+
total: boolean;
|
|
659
|
+
}
|
|
660
|
+
type ModelStatus = "ok" | "empty" | "missing-data" | "unsupported";
|
|
661
|
+
interface ChartModel {
|
|
662
|
+
spec: ChartSpec;
|
|
663
|
+
mark: ChartType;
|
|
664
|
+
status: ModelStatus;
|
|
665
|
+
/** The dataset name that was not provided, when `status` is `missing-data`. */
|
|
666
|
+
missingRef?: string;
|
|
667
|
+
xKind: XKind;
|
|
668
|
+
/** Ordered union of x values across series, as keys. */
|
|
669
|
+
categories: string[];
|
|
670
|
+
/** Raw x value for each category key. */
|
|
671
|
+
categoryValues: Array<string | number>;
|
|
672
|
+
series: ModelSeries[];
|
|
673
|
+
/** Pie and donut slices; empty for other types. */
|
|
674
|
+
slices: ModelSlice[];
|
|
675
|
+
heatmap?: {
|
|
676
|
+
columns: string[];
|
|
677
|
+
rows: string[];
|
|
678
|
+
min: number;
|
|
679
|
+
max: number;
|
|
680
|
+
};
|
|
681
|
+
histogram?: {
|
|
682
|
+
bins: HistogramBin[];
|
|
683
|
+
};
|
|
684
|
+
gauge?: ModelGauge;
|
|
685
|
+
waterfall?: {
|
|
686
|
+
steps: WaterfallStep[];
|
|
687
|
+
};
|
|
688
|
+
stack: StackMode;
|
|
689
|
+
orientation: "vertical" | "horizontal";
|
|
690
|
+
/** True when the plot has a second value axis. */
|
|
691
|
+
dualAxis: boolean;
|
|
692
|
+
pointCount: number;
|
|
693
|
+
/** Rows dropped because x or y could not be read. */
|
|
694
|
+
droppedPoints: number;
|
|
695
|
+
xTitle: string | undefined;
|
|
696
|
+
yTitle: string | undefined;
|
|
697
|
+
y2Title: string | undefined;
|
|
698
|
+
timeZone: string;
|
|
699
|
+
/** True when time values carry a time of day. */
|
|
700
|
+
hasTimeOfDay: boolean;
|
|
701
|
+
hasHighlight: boolean;
|
|
702
|
+
}
|
|
703
|
+
interface BuildModelOptions {
|
|
704
|
+
datasets?: Datasets | undefined;
|
|
705
|
+
messages?: ChartMessagesInput | undefined;
|
|
706
|
+
}
|
|
707
|
+
/** True for chart types whose x axis has one slot per category. */
|
|
708
|
+
declare function usesBandX(mark: ChartType): boolean;
|
|
709
|
+
declare function buildChartModel(spec: ChartSpec, options?: BuildModelOptions): ChartModel;
|
|
710
|
+
|
|
711
|
+
/** Type size the layout assumes for axis text. It matches the caption token (12). */
|
|
712
|
+
declare const AXIS_FONT_SIZE = 12;
|
|
713
|
+
/** Length of a tick mark. */
|
|
714
|
+
declare const TICK_SIZE = 6;
|
|
715
|
+
/** Gap between a tick mark and its label. */
|
|
716
|
+
declare const TICK_PADDING = 4;
|
|
717
|
+
type ContinuousKind = "linear" | "log" | "sqrt" | "time";
|
|
718
|
+
interface ContinuousScale {
|
|
719
|
+
kind: ContinuousKind;
|
|
720
|
+
/** The final domain, after nice rounding. Time domains are epoch milliseconds. */
|
|
721
|
+
domain: [number, number];
|
|
722
|
+
range: [number, number];
|
|
723
|
+
(value: number): number;
|
|
724
|
+
/** About `count` tick values inside the domain. */
|
|
725
|
+
ticks(count: number): number[];
|
|
726
|
+
}
|
|
727
|
+
interface ContinuousScaleOptions {
|
|
728
|
+
kind: ContinuousKind;
|
|
729
|
+
domain: readonly [number, number];
|
|
730
|
+
range: readonly [number, number];
|
|
731
|
+
nice?: boolean;
|
|
732
|
+
/** Tick count that `nice` rounds towards. */
|
|
733
|
+
niceCount?: number;
|
|
734
|
+
base?: number;
|
|
735
|
+
}
|
|
736
|
+
/** A linear, log, square-root or UTC time scale as a plain function with a domain and ticks. */
|
|
737
|
+
declare function createContinuousScale({ kind, domain, range, nice, niceCount, base, }: ContinuousScaleOptions): ContinuousScale;
|
|
738
|
+
interface DomainOptions {
|
|
739
|
+
kind?: ContinuousKind | undefined;
|
|
740
|
+
/** Include zero (bars, areas and histograms always do). */
|
|
741
|
+
includeZero?: boolean | undefined;
|
|
742
|
+
/** Extra values the domain must cover, such as thresholds and reference lines. */
|
|
743
|
+
include?: ReadonlyArray<number> | undefined;
|
|
744
|
+
spec?: ScaleSpec | undefined;
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Picks a numeric domain from data. An explicit `scale.domain` wins. Otherwise
|
|
748
|
+
* the domain covers the data (plus `include` and zero when asked), is widened
|
|
749
|
+
* when it would be a single value, and for log scales stays positive.
|
|
750
|
+
*/
|
|
751
|
+
declare function valueDomain(data: readonly [number, number] | null, { kind, includeZero, include, spec }?: DomainOptions): [number, number];
|
|
752
|
+
interface BandScale {
|
|
753
|
+
(key: string): number | undefined;
|
|
754
|
+
bandwidth: number;
|
|
755
|
+
step: number;
|
|
756
|
+
domain: string[];
|
|
757
|
+
range: [number, number];
|
|
758
|
+
}
|
|
759
|
+
/** One slot per key. `padding` is the fraction of each step left empty (inner), with half of it outside. */
|
|
760
|
+
declare function createBandScale(keys: ReadonlyArray<string>, range: readonly [number, number], padding?: number): BandScale;
|
|
761
|
+
interface PointScale {
|
|
762
|
+
(key: string): number | undefined;
|
|
763
|
+
step: number;
|
|
764
|
+
domain: string[];
|
|
765
|
+
}
|
|
766
|
+
/** One position per key, with half a step of padding at each end. */
|
|
767
|
+
declare function createPointScale(keys: ReadonlyArray<string>, range: readonly [number, number]): PointScale;
|
|
768
|
+
/** Nice tick values for a numeric domain. */
|
|
769
|
+
declare function niceTicks(domain: readonly [number, number], count?: number): number[];
|
|
770
|
+
/** Rough width of text in pixels, from per-character class widths. Good enough to reserve margins and fit labels. */
|
|
771
|
+
declare function estimateTextWidth(text: string, fontSize?: number): number;
|
|
772
|
+
/** Shortens text to `maxLength` characters with an ellipsis. */
|
|
773
|
+
declare function truncateLabel(text: string, maxLength: number): string;
|
|
774
|
+
interface FittedLabel {
|
|
775
|
+
text: string;
|
|
776
|
+
/** The untruncated text, for titles and tooltips. */
|
|
777
|
+
full: string;
|
|
778
|
+
/** False when the label is skipped to avoid overlap. */
|
|
779
|
+
visible: boolean;
|
|
780
|
+
}
|
|
781
|
+
interface LabelFit {
|
|
782
|
+
labels: FittedLabel[];
|
|
783
|
+
/** Rotation in degrees (0, or negative in left-to-right layouts). */
|
|
784
|
+
angle: number;
|
|
785
|
+
anchor: "start" | "middle" | "end";
|
|
786
|
+
/** Height the labels need below the axis line, in pixels. */
|
|
787
|
+
height: number;
|
|
788
|
+
/** Every Nth label is shown. */
|
|
789
|
+
step: number;
|
|
790
|
+
}
|
|
791
|
+
interface FitLabelsOptions {
|
|
792
|
+
fontSize?: number;
|
|
793
|
+
/** A fixed angle in degrees, or `auto` to rotate only when needed. */
|
|
794
|
+
angle?: number | "auto" | undefined;
|
|
795
|
+
/** Longest label in characters before truncation. Defaults to 24 (16 when rotated). */
|
|
796
|
+
maxLength?: number | undefined;
|
|
797
|
+
/** Mirrored axes rotate the other way, so labels still end at their tick. */
|
|
798
|
+
rtl?: boolean | undefined;
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Decides how to draw category tick labels in `slotWidth` pixels each: flat if
|
|
802
|
+
* they fit, otherwise rotated 45 degrees, then 90 degrees, and finally skipping
|
|
803
|
+
* every Nth label. Long labels are truncated with an ellipsis.
|
|
804
|
+
*/
|
|
805
|
+
declare function fitTickLabels(texts: ReadonlyArray<string>, slotWidth: number, { fontSize, angle, maxLength, rtl }?: FitLabelsOptions): LabelFit;
|
|
806
|
+
interface Margin {
|
|
807
|
+
top: number;
|
|
808
|
+
right: number;
|
|
809
|
+
bottom: number;
|
|
810
|
+
left: number;
|
|
811
|
+
}
|
|
812
|
+
interface AxisMarginInput {
|
|
813
|
+
/** Width of the widest tick label on the vertical axis (zero when it has no axis). */
|
|
814
|
+
verticalTickWidth: number;
|
|
815
|
+
/** Height the horizontal axis labels need (from `fitTickLabels`). Zero when there is no axis. */
|
|
816
|
+
horizontalTickHeight: number;
|
|
817
|
+
verticalTitle: boolean;
|
|
818
|
+
horizontalTitle: boolean;
|
|
819
|
+
/** Side of the vertical axis. Mirrored (right-to-left) charts put it on the `right`. */
|
|
820
|
+
verticalAxisSide: "left" | "right";
|
|
821
|
+
/** Width of the tick labels of a second vertical axis, drawn on the opposite side. Zero for none. */
|
|
822
|
+
secondTickWidth?: number;
|
|
823
|
+
secondTitle?: boolean;
|
|
824
|
+
/** Space for direct labels past the end of lines, on the side opposite the vertical axis. */
|
|
825
|
+
directLabelWidth?: number;
|
|
826
|
+
fontSize?: number;
|
|
827
|
+
}
|
|
828
|
+
/**
|
|
829
|
+
* Space around the plot for axes, titles and direct labels. Every side keeps
|
|
830
|
+
* at least `EDGE_MARGIN` so marks and glyphs never touch the border.
|
|
831
|
+
*/
|
|
832
|
+
declare function computeAxisMargins({ verticalTickWidth, horizontalTickHeight, verticalTitle, horizontalTitle, verticalAxisSide, secondTickWidth, secondTitle, directLabelWidth, fontSize, }: AxisMarginInput): Margin;
|
|
833
|
+
/**
|
|
834
|
+
* Spreads label positions apart so they never overlap, keeping order and
|
|
835
|
+
* staying inside `[min, max]`. Used for direct labels at the end of lines.
|
|
836
|
+
*/
|
|
837
|
+
declare function dodgePositions(positions: ReadonlyArray<number>, gap: number, min: number, max: number): number[];
|
|
838
|
+
|
|
839
|
+
interface Box {
|
|
840
|
+
x: number;
|
|
841
|
+
y: number;
|
|
842
|
+
width: number;
|
|
843
|
+
height: number;
|
|
844
|
+
}
|
|
845
|
+
interface LayoutOptions {
|
|
846
|
+
width: number;
|
|
847
|
+
height: number;
|
|
848
|
+
/** Mirror horizontal time and category axes (right-to-left layouts). */
|
|
849
|
+
rtl?: boolean | undefined;
|
|
850
|
+
locale?: string | undefined;
|
|
851
|
+
messages?: ChartMessagesInput | undefined;
|
|
852
|
+
/** Ids of hidden series (or slices). */
|
|
853
|
+
hidden?: ReadonlySet<string> | undefined;
|
|
854
|
+
/** Show hatch patterns on filled marks even when there is only one series. */
|
|
855
|
+
patterns?: boolean | undefined;
|
|
856
|
+
}
|
|
857
|
+
type FocusShape = {
|
|
858
|
+
kind: "circle";
|
|
859
|
+
cx: number;
|
|
860
|
+
cy: number;
|
|
861
|
+
r: number;
|
|
862
|
+
} | {
|
|
863
|
+
kind: "rect";
|
|
864
|
+
x: number;
|
|
865
|
+
y: number;
|
|
866
|
+
width: number;
|
|
867
|
+
height: number;
|
|
868
|
+
} | {
|
|
869
|
+
kind: "path";
|
|
870
|
+
d: string;
|
|
871
|
+
tx?: number;
|
|
872
|
+
ty?: number;
|
|
873
|
+
};
|
|
874
|
+
interface HitTarget {
|
|
875
|
+
id: string;
|
|
876
|
+
/** Index into `model.series`; 0 for slices and gauges. */
|
|
877
|
+
series: number;
|
|
878
|
+
/** Index into the series' points; the slice index for pie and donut. */
|
|
879
|
+
point: number;
|
|
880
|
+
/** Position along the category axis, for navigation and shared tooltips. */
|
|
881
|
+
group: number;
|
|
882
|
+
/** Anchor for the tooltip and crosshair, in layout coordinates. */
|
|
883
|
+
x: number;
|
|
884
|
+
y: number;
|
|
885
|
+
focus: FocusShape;
|
|
886
|
+
kind: "point" | "slice" | "cell" | "gauge";
|
|
887
|
+
/** Row and column of a heatmap cell. */
|
|
888
|
+
row?: number;
|
|
889
|
+
column?: number;
|
|
890
|
+
/** A pie slice's angular extent in radians clockwise from twelve o'clock, with the ring radii. */
|
|
891
|
+
arc?: {
|
|
892
|
+
cx: number;
|
|
893
|
+
cy: number;
|
|
894
|
+
innerRadius: number;
|
|
895
|
+
outerRadius: number;
|
|
896
|
+
start: number;
|
|
897
|
+
end: number;
|
|
898
|
+
};
|
|
899
|
+
/** Rectangular hit region for bars and cells. */
|
|
900
|
+
bounds?: Box;
|
|
901
|
+
/** Index of the threshold this point breaches, if any. */
|
|
902
|
+
breach?: number;
|
|
903
|
+
}
|
|
904
|
+
interface AxisTick {
|
|
905
|
+
value: number | string;
|
|
906
|
+
/** Pixel position along the axis. */
|
|
907
|
+
position: number;
|
|
908
|
+
label: string;
|
|
909
|
+
/** Untruncated label, for tooltips. */
|
|
910
|
+
full: string;
|
|
911
|
+
visible: boolean;
|
|
912
|
+
}
|
|
913
|
+
interface AxisLayout {
|
|
914
|
+
/** Which encoding the axis carries, regardless of where it is drawn. */
|
|
915
|
+
id: "x" | "y" | "y2";
|
|
916
|
+
orient: "bottom" | "left" | "right" | "top";
|
|
917
|
+
/** Axis line from (x1, y1) to (x2, y2). */
|
|
918
|
+
line: {
|
|
919
|
+
x1: number;
|
|
920
|
+
y1: number;
|
|
921
|
+
x2: number;
|
|
922
|
+
y2: number;
|
|
923
|
+
};
|
|
924
|
+
title?: string;
|
|
925
|
+
/** Anchor of the axis title; `rotate` is degrees. */
|
|
926
|
+
titlePosition?: {
|
|
927
|
+
x: number;
|
|
928
|
+
y: number;
|
|
929
|
+
rotate: number;
|
|
930
|
+
};
|
|
931
|
+
ticks: AxisTick[];
|
|
932
|
+
labelAngle: number;
|
|
933
|
+
labelAnchor: "start" | "middle" | "end";
|
|
934
|
+
grid: boolean;
|
|
935
|
+
/** True when tick labels are numbers (drawn left to right even in right-to-left pages). */
|
|
936
|
+
numeric: boolean;
|
|
937
|
+
}
|
|
938
|
+
type MarkKind = "bar" | "line" | "area" | "point" | "arc" | "cell" | "stem" | "connector";
|
|
939
|
+
interface LayoutMark {
|
|
940
|
+
id: string;
|
|
941
|
+
kind: MarkKind;
|
|
942
|
+
/** Index into `model.series`; -1 for marks that belong to no series. */
|
|
943
|
+
series: number;
|
|
944
|
+
seriesId: string;
|
|
945
|
+
/** Index into the series' points; -1 for whole-series marks. */
|
|
946
|
+
point: number;
|
|
947
|
+
tone: SeriesTone;
|
|
948
|
+
/** Position in the series list, which picks a hatch pattern. */
|
|
949
|
+
styleIndex: number;
|
|
950
|
+
/** Hatch pattern index (0 to 7) drawn over the fill, or -1 for a solid fill. */
|
|
951
|
+
pattern: number;
|
|
952
|
+
x?: number;
|
|
953
|
+
y?: number;
|
|
954
|
+
width?: number;
|
|
955
|
+
height?: number;
|
|
956
|
+
cx?: number;
|
|
957
|
+
cy?: number;
|
|
958
|
+
r?: number;
|
|
959
|
+
shape?: MarkerShape;
|
|
960
|
+
/** Path data for lines, areas, arcs and point markers. */
|
|
961
|
+
d?: string;
|
|
962
|
+
x1?: number;
|
|
963
|
+
y1?: number;
|
|
964
|
+
x2?: number;
|
|
965
|
+
y2?: number;
|
|
966
|
+
/** `stroke-dasharray`, or undefined for solid. */
|
|
967
|
+
dash?: string;
|
|
968
|
+
muted?: boolean;
|
|
969
|
+
highlighted?: boolean;
|
|
970
|
+
breach?: boolean;
|
|
971
|
+
/** Value-axis side or mark role, such as `track` and `value` for gauges. */
|
|
972
|
+
role?: "track" | "band" | "value" | "target" | "ring";
|
|
973
|
+
/** Position on a color ramp (0 to 1), for heatmap cells. */
|
|
974
|
+
t?: number;
|
|
975
|
+
ramp?: "sequential" | "diverging";
|
|
976
|
+
/** Series mark kind, for combos. */
|
|
977
|
+
seriesMark?: SeriesMark;
|
|
978
|
+
}
|
|
979
|
+
interface TextLabel {
|
|
980
|
+
id: string;
|
|
981
|
+
text: string;
|
|
982
|
+
x: number;
|
|
983
|
+
y: number;
|
|
984
|
+
anchor: "start" | "middle" | "end";
|
|
985
|
+
kind: "value" | "direct" | "annotation" | "center" | "caption" | "cell";
|
|
986
|
+
/** Vertical alignment: `middle` centers on y, `above` sits over y, `below` hangs under y. */
|
|
987
|
+
baseline?: "middle" | "above" | "below";
|
|
988
|
+
tone?: SeriesTone;
|
|
989
|
+
series?: number;
|
|
990
|
+
/** Draw left to right regardless of page direction (numbers). */
|
|
991
|
+
numeric?: boolean;
|
|
992
|
+
}
|
|
993
|
+
interface AnnotationLayout {
|
|
994
|
+
id: string;
|
|
995
|
+
kind: "line" | "band" | "point" | "text" | "forecast";
|
|
996
|
+
tone: SeriesTone;
|
|
997
|
+
toneName: AnnotationTone | "neutral";
|
|
998
|
+
threshold: boolean;
|
|
999
|
+
/** Line endpoints. */
|
|
1000
|
+
x1?: number;
|
|
1001
|
+
y1?: number;
|
|
1002
|
+
x2?: number;
|
|
1003
|
+
y2?: number;
|
|
1004
|
+
/** Band rectangle. */
|
|
1005
|
+
box?: Box;
|
|
1006
|
+
/** Marker position for labeled points. */
|
|
1007
|
+
cx?: number;
|
|
1008
|
+
cy?: number;
|
|
1009
|
+
label?: TextLabel;
|
|
1010
|
+
}
|
|
1011
|
+
interface LegendEntry {
|
|
1012
|
+
id: string;
|
|
1013
|
+
label: string;
|
|
1014
|
+
/** Index into `model.series`, or null for slices and keys. */
|
|
1015
|
+
series: number | null;
|
|
1016
|
+
tone: SeriesTone;
|
|
1017
|
+
marker: MarkerShape;
|
|
1018
|
+
dash: string | undefined;
|
|
1019
|
+
/** What the series draws, so the legend glyph matches. */
|
|
1020
|
+
glyph: "line" | "area" | "bar" | "point" | "slice";
|
|
1021
|
+
pattern: number;
|
|
1022
|
+
visible: boolean;
|
|
1023
|
+
/** False for explanatory keys (a waterfall's increase and decrease) that cannot be toggled. */
|
|
1024
|
+
toggle: boolean;
|
|
1025
|
+
}
|
|
1026
|
+
type HitStrategy = "category-x" | "category-y" | "nearest" | "arc" | "cell" | "none";
|
|
1027
|
+
type NavigationMode = "category-x" | "category-y" | "sequence" | "grid" | "spatial" | "single" | "none";
|
|
1028
|
+
interface ColorScale {
|
|
1029
|
+
kind: "sequential" | "diverging";
|
|
1030
|
+
min: number;
|
|
1031
|
+
max: number;
|
|
1032
|
+
}
|
|
1033
|
+
interface ChartLayout {
|
|
1034
|
+
mark: ChartType;
|
|
1035
|
+
width: number;
|
|
1036
|
+
height: number;
|
|
1037
|
+
margin: Margin;
|
|
1038
|
+
plot: Box;
|
|
1039
|
+
orientation: "vertical" | "horizontal";
|
|
1040
|
+
/** True when the horizontal axis runs right to left. */
|
|
1041
|
+
mirrored: boolean;
|
|
1042
|
+
axes: AxisLayout[];
|
|
1043
|
+
marks: LayoutMark[];
|
|
1044
|
+
labels: TextLabel[];
|
|
1045
|
+
annotations: AnnotationLayout[];
|
|
1046
|
+
targets: HitTarget[];
|
|
1047
|
+
legend: LegendEntry[];
|
|
1048
|
+
hit: HitStrategy;
|
|
1049
|
+
navigation: NavigationMode;
|
|
1050
|
+
/** Draw a crosshair line along this axis at the active target. */
|
|
1051
|
+
crosshair: "x" | "y" | "none";
|
|
1052
|
+
/** Center and radii for pie, donut and gauge layouts. */
|
|
1053
|
+
radial?: {
|
|
1054
|
+
cx: number;
|
|
1055
|
+
cy: number;
|
|
1056
|
+
outerRadius: number;
|
|
1057
|
+
innerRadius: number;
|
|
1058
|
+
};
|
|
1059
|
+
colorScale?: ColorScale;
|
|
1060
|
+
/** True when every series is hidden. */
|
|
1061
|
+
allHidden: boolean;
|
|
1062
|
+
/** Hatch pattern indices in use, so the renderer defines only those. */
|
|
1063
|
+
patterns: number[];
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* The locale used when none is given. It is fixed rather than read from the
|
|
1068
|
+
* runtime, so a chart renders the same text on the server, in the browser and
|
|
1069
|
+
* in tests. The default messages are English, so English formats match them.
|
|
1070
|
+
*/
|
|
1071
|
+
declare const DEFAULT_LOCALE = "en";
|
|
1072
|
+
/** True when the locale's language is written right to left (Arabic, Hebrew, Persian, Urdu and others). */
|
|
1073
|
+
declare function isRtlLocale(locale: string | undefined): boolean;
|
|
1074
|
+
/** Upper-cases the first letter, using the locale's rules. */
|
|
1075
|
+
declare function capitalize(text: string, locale?: string): string;
|
|
1076
|
+
/** Joins items with the locale's list rules ("a, b, and c"). */
|
|
1077
|
+
declare function formatList(items: ReadonlyArray<string>, locale?: string): string;
|
|
1078
|
+
type Formatter<T> = (value: T) => string;
|
|
1079
|
+
/** Fraction digits needed to show a tick step without rounding it away (0.25 needs 2). */
|
|
1080
|
+
declare function fractionDigitsForStep(step: number | undefined, max?: number): number;
|
|
1081
|
+
interface NumberFormatOptions {
|
|
1082
|
+
/** Tick spacing, used to pick the fraction digits so ticks never repeat a label. */
|
|
1083
|
+
step?: number;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Builds a number formatter from a named format, a d3-format specifier, or
|
|
1087
|
+
* nothing (a sensible default). Named formats: `auto`, `compact`, `percent`
|
|
1088
|
+
* (the value is a fraction: 0.25 is 25%), `integer`, `decimal`,
|
|
1089
|
+
* `currency:USD`, `currency:USD:compact`, `unit:kilometer`.
|
|
1090
|
+
*/
|
|
1091
|
+
declare function createNumberFormatter(format: string | undefined, locale?: string, { step }?: NumberFormatOptions): Formatter<number>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Builds a date formatter for epoch milliseconds. `format` is a named format
|
|
1094
|
+
* (`date`, `datetime`, `time`, `month`, `year`, `day`, `weekday`, `iso`) or a
|
|
1095
|
+
* d3-time-format pattern starting with `%` (patterns are UTC). Without a
|
|
1096
|
+
* format, whole days print as dates and anything else as date and time.
|
|
1097
|
+
*/
|
|
1098
|
+
declare function createDateFormatter(format: string | undefined, locale?: string, timeZone?: string, hasTimeOfDay?: boolean): Formatter<number>;
|
|
1099
|
+
/**
|
|
1100
|
+
* Picks a compact label for a run of time ticks: years when ticks are a year
|
|
1101
|
+
* apart, short months, day and month, or clock times, depending on the spacing.
|
|
1102
|
+
*/
|
|
1103
|
+
declare function createTimeTickFormatter(ticks: ReadonlyArray<number>, locale?: string, timeZone?: string): Formatter<number>;
|
|
1104
|
+
/** Formats a share (0 to 1) as a percentage. */
|
|
1105
|
+
declare function formatShare(value: number, locale?: string): string;
|
|
1106
|
+
|
|
1107
|
+
interface ChartFormatters {
|
|
1108
|
+
locale: string | undefined;
|
|
1109
|
+
messages: ChartMessages;
|
|
1110
|
+
/** Label for an x value: category text, a date, or a number. */
|
|
1111
|
+
x: Formatter<string | number>;
|
|
1112
|
+
/** Label for a point: its own label, else the formatted x. */
|
|
1113
|
+
point: (point: ModelPoint) => string;
|
|
1114
|
+
/** Value formatter for series `index`. */
|
|
1115
|
+
value: (seriesIndex: number) => Formatter<number>;
|
|
1116
|
+
/** Value-axis formatters (for tooltips; axes build their own from tick steps). */
|
|
1117
|
+
y: Formatter<number>;
|
|
1118
|
+
/**
|
|
1119
|
+
* Formatter for gauge and progress ring values. `percent` shows the share of
|
|
1120
|
+
* the min to max range, so 64 of 100 and 0.64 of 1 both read "64%".
|
|
1121
|
+
*/
|
|
1122
|
+
gauge: Formatter<number>;
|
|
1123
|
+
size: Formatter<number>;
|
|
1124
|
+
share: Formatter<number>;
|
|
1125
|
+
noValue: string;
|
|
1126
|
+
}
|
|
1127
|
+
/** Formatters for a chart's values, shared by tooltips, descriptions and tables. */
|
|
1128
|
+
declare function createFormatters(model: ChartModel, { locale, messages }?: {
|
|
1129
|
+
locale?: string | undefined;
|
|
1130
|
+
messages?: ChartMessagesInput | undefined;
|
|
1131
|
+
}): ChartFormatters;
|
|
1132
|
+
|
|
1133
|
+
type NavKey = "ArrowLeft" | "ArrowRight" | "ArrowUp" | "ArrowDown" | "Home" | "End" | "PageUp" | "PageDown";
|
|
1134
|
+
declare const navKeys: ReadonlyArray<NavKey>;
|
|
1135
|
+
declare function isNavKey(key: string): key is NavKey;
|
|
1136
|
+
declare function targetById(layout: ChartLayout, id: string | null | undefined): HitTarget | undefined;
|
|
1137
|
+
/**
|
|
1138
|
+
* Finds the target under a pointer position (layout coordinates), using the
|
|
1139
|
+
* layout's strategy: nearest category along the category axis for most charts,
|
|
1140
|
+
* nearest mark for scatter plots, angle and radius for pies, containment for
|
|
1141
|
+
* heatmap cells. Returns `null` when the pointer is not over the plot.
|
|
1142
|
+
*/
|
|
1143
|
+
declare function hitTest(layout: ChartLayout, x: number, y: number): HitTarget | null;
|
|
1144
|
+
/**
|
|
1145
|
+
* The id of the target a navigation key moves to, or the current id when
|
|
1146
|
+
* there is nowhere to go. With no current target, keys enter the plot at the
|
|
1147
|
+
* first (or, for End, last) target.
|
|
1148
|
+
*
|
|
1149
|
+
* - Category charts: Left and Right move along the category axis (swapped when
|
|
1150
|
+
* the axis is mirrored), Up and Down move between series at the same category
|
|
1151
|
+
* in screen order. Home and End jump to the first and last category, and Page
|
|
1152
|
+
* Up and Page Down move ten categories.
|
|
1153
|
+
* - Scatter plots: arrows move to the nearest point in that direction.
|
|
1154
|
+
* - Heatmaps: arrows move by cell; Page Up and Page Down jump to the first and
|
|
1155
|
+
* last row.
|
|
1156
|
+
* - Pies: arrows step through slices.
|
|
1157
|
+
*/
|
|
1158
|
+
declare function navigate(layout: ChartLayout, currentId: string | null, key: NavKey): string | null;
|
|
1159
|
+
interface TooltipRow {
|
|
1160
|
+
id: string;
|
|
1161
|
+
label: string;
|
|
1162
|
+
value: string;
|
|
1163
|
+
tone: SeriesTone;
|
|
1164
|
+
glyph: "line" | "area" | "bar" | "point" | "slice";
|
|
1165
|
+
marker: string;
|
|
1166
|
+
pattern: number;
|
|
1167
|
+
dash: string | undefined;
|
|
1168
|
+
/** The row of the focused or hovered mark. */
|
|
1169
|
+
active: boolean;
|
|
1170
|
+
note?: string;
|
|
1171
|
+
}
|
|
1172
|
+
interface TooltipContent {
|
|
1173
|
+
title: string;
|
|
1174
|
+
rows: TooltipRow[];
|
|
1175
|
+
}
|
|
1176
|
+
/** What a tooltip shows for a target: the category title and one row per series at that category. */
|
|
1177
|
+
declare function tooltipFor(model: ChartModel, layout: ChartLayout, target: HitTarget, fmts: ChartFormatters): TooltipContent | null;
|
|
1178
|
+
/** The sentence a screen reader hears when a mark gets focus. */
|
|
1179
|
+
declare function describeTarget(model: ChartModel, layout: ChartLayout, target: HitTarget, fmts: ChartFormatters, { position }?: {
|
|
1180
|
+
position?: boolean;
|
|
1181
|
+
}): string;
|
|
1182
|
+
interface ChartPointInfo {
|
|
1183
|
+
/** Series id, or the slice id for pies and donuts. */
|
|
1184
|
+
seriesId: string;
|
|
1185
|
+
seriesLabel: string;
|
|
1186
|
+
/** Index into the model's series (0 for slices). */
|
|
1187
|
+
seriesIndex: number;
|
|
1188
|
+
/** Index of the point within its series (the slice index for pies). */
|
|
1189
|
+
pointIndex: number;
|
|
1190
|
+
/** The x value: category label, number, or epoch milliseconds. */
|
|
1191
|
+
x: string | number | null;
|
|
1192
|
+
/** The x value as text. */
|
|
1193
|
+
xLabel: string;
|
|
1194
|
+
y: number | null;
|
|
1195
|
+
size: number | null;
|
|
1196
|
+
/** The source row (or a synthetic one for series with own points). */
|
|
1197
|
+
row: Row | null;
|
|
1198
|
+
/** Share of the total for slices, from 0 to 1. */
|
|
1199
|
+
share?: number;
|
|
1200
|
+
/** Row category of a heatmap cell. */
|
|
1201
|
+
group?: string;
|
|
1202
|
+
}
|
|
1203
|
+
/** The payload of `onPointActivate` for a target. */
|
|
1204
|
+
declare function pointInfo(model: ChartModel, target: HitTarget, fmts: ChartFormatters): ChartPointInfo | null;
|
|
1205
|
+
|
|
1206
|
+
/**
|
|
1207
|
+
* Maps a chart model to an ECharts option object, for the canvas renderer.
|
|
1208
|
+
* Pure and server-safe: it never imports `echarts`, and colors come in as
|
|
1209
|
+
* resolved values (the React layer reads them from the `--kit-*` custom
|
|
1210
|
+
* properties at runtime, so themes work on canvas too).
|
|
1211
|
+
*
|
|
1212
|
+
* The option contains formatter functions, so it is not JSON-serializable.
|
|
1213
|
+
*/
|
|
1214
|
+
|
|
1215
|
+
/** Resolved colors for canvas drawing. */
|
|
1216
|
+
interface ChartThemeColors {
|
|
1217
|
+
tones: Readonly<Record<SeriesTone, string>>;
|
|
1218
|
+
text: string;
|
|
1219
|
+
textSecondary: string;
|
|
1220
|
+
axis: string;
|
|
1221
|
+
grid: string;
|
|
1222
|
+
surface: string;
|
|
1223
|
+
border: string;
|
|
1224
|
+
accent: string;
|
|
1225
|
+
/** Nine steps, light to dark. */
|
|
1226
|
+
sequential: ReadonlyArray<string>;
|
|
1227
|
+
/** Nine steps, one hue through a neutral midpoint to another. */
|
|
1228
|
+
diverging: ReadonlyArray<string>;
|
|
1229
|
+
fontFamily: string;
|
|
1230
|
+
}
|
|
1231
|
+
/** The theme constants from `@x12i/tokens`, for server rendering and as a runtime fallback. */
|
|
1232
|
+
declare function themeColorsFromTokens(theme?: ThemeName): ChartThemeColors;
|
|
1233
|
+
interface EChartsOptionInput {
|
|
1234
|
+
colors: ChartThemeColors;
|
|
1235
|
+
locale?: string | undefined;
|
|
1236
|
+
messages?: ChartMessagesInput | undefined;
|
|
1237
|
+
/** Ids of hidden series or slices. */
|
|
1238
|
+
hidden?: ReadonlySet<string> | undefined;
|
|
1239
|
+
/** Animate on first draw. Turn off for reduced motion. Defaults to false. */
|
|
1240
|
+
animate?: boolean | undefined;
|
|
1241
|
+
}
|
|
1242
|
+
type EChartsOptionObject = Record<string, unknown>;
|
|
1243
|
+
/**
|
|
1244
|
+
* The ECharts option for a model, or `null` when the canvas renderer cannot
|
|
1245
|
+
* draw it (no data, unsupported, or a waterfall that crosses zero), in which
|
|
1246
|
+
* case callers use the SVG renderer.
|
|
1247
|
+
*/
|
|
1248
|
+
declare function toEChartsOption(model: ChartModel, input: EChartsOptionInput): EChartsOptionObject | null;
|
|
1249
|
+
|
|
1250
|
+
export { AXIS_FONT_SIZE as A, DEFAULT_LOCALE as E, fractionDigitsForStep as a$, MAX_HUES as a0, applyTransforms as aA, buildChartModel as aB, capitalize as aC, categoricalTones as aD, chartTypes as aE, computeAxisMargins as aF, countPoints as aG, createBandScale as aH, createContinuousScale as aI, createDateFormatter as aJ, createFormatters as aK, createNumberFormatter as aL, createPointScale as aM, createTimeTickFormatter as aN, dashArrays as aO, dashStyles as aP, defaultMessages as aQ, defineChartSpec as aR, describeTarget as aS, divergingColor as aT, dodgePositions as aU, effectiveStack as aV, estimateTextWidth as aW, fitTickLabels as aX, formatList as aY, formatMessage as aZ, formatShare as a_, SVG_POINT_LIMIT as ag, TICK_PADDING as ao, TICK_SIZE as ap, annotationTone as az, histogramBins as b0, hitTest as b1, isNavKey as b2, isOpenMarker as b3, isRtlLocale as b4, isSupportedMark as b5, markerPath as b6, markerShapes as b7, navKeys as b8, navigate as b9, niceTicks as ba, pointInfo as bb, rampGradient as bc, readField as bd, resolveMessages as be, resolveRenderer as bf, resolveRows as bg, sequentialColor as bh, seriesStyle as bi, supportedMarks as bj, targetById as bk, themeColorsFromTokens as bl, toCategory as bm, toEChartsOption as bn, toNumber as bo, toTime as bp, toneCssVar as bq, toneTokenPath as br, toneVarName as bs, tooltipFor as bt, truncateLabel as bu, usesBandX as bv, valueDomain as bw };
|
|
1251
|
+
export type { LegendSpec as $, BandScale as B, ChartSpec as C, Datasets as D, DashStyle as F, DomainOptions as G, DonutSpec as H, EChartsOptionInput as I, EChartsOptionObject as J, Encoding as K, LayoutOptions as L, FieldType as M, FitLabelsOptions as N, FittedLabel as O, FocusShape as P, Formatter as Q, Row as R, StackMode as S, GaugeSpec as T, HistogramBin as U, HistogramOptions as V, HitStrategy as W, HitTarget as X, LabelFit as Y, LayoutMark as Z, LegendEntry as _, ChartModel as a, Margin as a1, MarkKind as a2, MarkerShape as a3, ModelGauge as a4, ModelPoint as a5, ModelSeries as a6, ModelSlice as a7, ModelStatus as a8, NavKey as a9, NavigationMode as aa, NumberFormatOptions as ab, PointScale as ac, RenderTarget as ad, RendererChoice as ae, ResolveRendererInput as af, ScaleSpec as ah, ScaleType as ai, SeriesMark as aj, SeriesPoint as ak, SeriesSpec as al, SeriesStyle as am, SeriesTone as an, TextLabel as aq, Threshold as ar, TooltipContent as as, TooltipRow as at, Transform as au, TransformContext as av, WaterfallSpec as aw, WaterfallStep as ax, XKind as ay, ChartLayout as b, ChartMessagesInput as c, Annotation as d, AnnotationLayout as e, AnnotationTone as f, AxisLayout as g, AxisMarginInput as h, AxisSpec as i, AxisTick as j, BinSpec as k, Box as l, BuildModelOptions as m, ChartA11y as n, ChartData as o, ChartFormatters as p, ChartInteractions as q, ChartLabels as r, ChartMessages as s, ChartPointInfo as t, ChartThemeColors as u, ChartType as v, ColorScale as w, ContinuousKind as x, ContinuousScale as y, ContinuousScaleOptions as z };
|