@classic-homes/charts-core 0.2.0 → 0.3.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 +43 -0
- package/dist/{chunk-JM72YHZD.js → chunk-WAHMKXRF.js} +13 -3
- package/dist/index.cjs +910 -35
- package/dist/index.d.cts +402 -6
- package/dist/index.d.ts +402 -6
- package/dist/index.js +853 -35
- package/dist/theme/index.cjs +12 -2
- package/dist/theme/index.d.cts +10 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.js +1 -1
- package/dist/types/index.d.cts +551 -23
- package/dist/types/index.d.ts +551 -23
- package/package.json +25 -10
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,27 @@
|
|
|
1
1
|
export { ChartSemanticColors, EChartsTheme, THEME_DARK, THEME_LIGHT, colorWithAlpha, darkChartColors, darkTheme, generateDarkTheme, generateLightTheme, getChartColors, lightChartColors, lightTheme } from './theme/index.js';
|
|
2
|
-
import { BarChartData, LineChartData, PieSliceData, ScatterChartData, ChartFormatter, LabelFormatterParams, TooltipFormatterParams, AxisConfig, ChartLegendConfig, LegendItem } from './types/index.js';
|
|
3
|
-
export { AreaChartData, AreaChartProps, AreaSeriesData, AxisChartProps, BarChartProps, BarSeriesData, BaseChartProps, BaseEventParams,
|
|
2
|
+
import { ValueFormat, CategoryChartData, BarChartData, BoxPlotStats, BulletItem, HistogramBucket, LineChartData, PieSliceData, ScatterChartData, WaterfallStep, ChartFormatter, LabelFormatterParams, TooltipFormatterParams, AxisConfig, ChartLegendConfig, ReferenceBand, ReferenceLine, LegendItem, HistogramBin, CategorySeriesData, ChartDataTable, CandlestickData, HeatmapData, RadarChartData, RadarIndicator, SankeyData, TreemapNode } from './types/index.js';
|
|
3
|
+
export { AreaChartData, AreaChartProps, AreaSeriesData, AxisChartProps, BarChartProps, BarSeriesData, BaseChartProps, BaseEventParams, BoxPlotChartProps, BoxPlotGroup, BulletChartProps, CandlestickChartProps, CandlestickEventParams, CandlestickItem, ChartEventHandlers, ChartExportConfig, ChartLegendPosition, ComboChartData, ComboChartProps, ComboSeriesData, DataPointEventParams, DonutChartProps, DotPlotChartData, DotPlotChartProps, DotPlotSeriesData, FunnelChartProps, FunnelSliceData, GaugeChartProps, HeatmapChartProps, HeatmapEventParams, HistogramChartProps, LabelChartProps, LegendChartProps, LegendRenderProps, LineChartProps, LineSeriesData, PieChartProps, RadarChartProps, RadarSeriesData, ReferenceChartProps, RowHeightProps, SankeyChartProps, SankeyEventParams, SankeyLink, SankeyNode, ScatterChartProps, ScatterSeriesData, SliceEventParams, SparklineProps, StatCardProps, StatDelta, TreemapChartProps, TreemapEventParams, TreemapLevel, ValueFormatPreset, WaterfallChartProps, ZoomChartProps } from './types/index.js';
|
|
4
4
|
import 'echarts';
|
|
5
|
+
import 'echarts/core';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Formatting utilities for chart values
|
|
8
9
|
*/
|
|
10
|
+
|
|
9
11
|
/**
|
|
10
12
|
* Format a number with thousand separators
|
|
11
13
|
*/
|
|
12
|
-
declare function formatNumber(value: number, options?: Intl.NumberFormatOptions): string;
|
|
14
|
+
declare function formatNumber(value: number, options?: Intl.NumberFormatOptions, locale?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Turn a `valueFormat` prop into a formatter function. Returns undefined when
|
|
17
|
+
* no format is set, so callers can fall back to ECharts' defaults.
|
|
18
|
+
*/
|
|
19
|
+
declare function resolveValueFormatter(format: ValueFormat | undefined, locale?: string): ((value: number) => string) | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Format a possibly-missing value: numbers through the formatter (or with
|
|
22
|
+
* thousand separators), null and non-finite values as `empty`
|
|
23
|
+
*/
|
|
24
|
+
declare function formatValue(value: number | string | null | undefined, formatter?: (value: number) => string, empty?: string): string;
|
|
13
25
|
/**
|
|
14
26
|
* Format a number as currency
|
|
15
27
|
*/
|
|
@@ -49,14 +61,27 @@ declare function createTooltipFormatter(options?: {
|
|
|
49
61
|
* Accessibility utilities for charts
|
|
50
62
|
*/
|
|
51
63
|
|
|
64
|
+
type Formatter = ((value: number) => string) | undefined;
|
|
52
65
|
/**
|
|
53
66
|
* Generate an accessible description for a line chart
|
|
54
67
|
*/
|
|
55
|
-
declare function generateLineChartDescription(title: string, data: LineChartData): string;
|
|
68
|
+
declare function generateLineChartDescription(title: string, data: LineChartData, format?: Formatter): string;
|
|
69
|
+
/**
|
|
70
|
+
* Generate an accessible description for an area chart
|
|
71
|
+
*/
|
|
72
|
+
declare function generateAreaChartDescription(title: string, data: CategoryChartData, format?: Formatter): string;
|
|
73
|
+
/**
|
|
74
|
+
* Generate an accessible description for a combo chart
|
|
75
|
+
*/
|
|
76
|
+
declare function generateComboChartDescription(title: string, data: CategoryChartData, format?: Formatter): string;
|
|
56
77
|
/**
|
|
57
78
|
* Generate an accessible description for a bar chart
|
|
58
79
|
*/
|
|
59
|
-
declare function generateBarChartDescription(title: string, data: BarChartData): string;
|
|
80
|
+
declare function generateBarChartDescription(title: string, data: BarChartData, format?: Formatter): string;
|
|
81
|
+
/**
|
|
82
|
+
* Generate an accessible description for a dot plot
|
|
83
|
+
*/
|
|
84
|
+
declare function generateDotPlotDescription(title: string, data: CategoryChartData, format?: Formatter): string;
|
|
60
85
|
/**
|
|
61
86
|
* Generate an accessible description for a pie/donut chart
|
|
62
87
|
*/
|
|
@@ -65,6 +90,25 @@ declare function generatePieChartDescription(title: string, data: PieSliceData[]
|
|
|
65
90
|
* Generate an accessible description for a scatter chart
|
|
66
91
|
*/
|
|
67
92
|
declare function generateScatterChartDescription(title: string, data: ScatterChartData): string;
|
|
93
|
+
/**
|
|
94
|
+
* Generate an accessible description for a histogram
|
|
95
|
+
*/
|
|
96
|
+
declare function generateHistogramDescription(title: string, buckets: HistogramBucket[], total: number): string;
|
|
97
|
+
/**
|
|
98
|
+
* Generate an accessible description for a box plot
|
|
99
|
+
*/
|
|
100
|
+
declare function generateBoxPlotDescription(title: string, groups: {
|
|
101
|
+
name: string;
|
|
102
|
+
stats: BoxPlotStats | null;
|
|
103
|
+
}[], format?: Formatter): string;
|
|
104
|
+
/**
|
|
105
|
+
* Generate an accessible description for a waterfall chart
|
|
106
|
+
*/
|
|
107
|
+
declare function generateWaterfallDescription(title: string, steps: WaterfallStep[], final: number, format?: Formatter): string;
|
|
108
|
+
/**
|
|
109
|
+
* Generate an accessible description for a bullet chart
|
|
110
|
+
*/
|
|
111
|
+
declare function generateBulletDescription(title: string, items: BulletItem[], format?: Formatter): string;
|
|
68
112
|
/**
|
|
69
113
|
* Generate a data table for screen readers (hidden visually)
|
|
70
114
|
*/
|
|
@@ -230,5 +274,357 @@ declare function buildTooltip(base: AnyObject, { show, formatter, valueFormatter
|
|
|
230
274
|
* tooltip is custom HTML (where ECharts' `valueFormatter` does not apply)
|
|
231
275
|
*/
|
|
232
276
|
declare function formatTooltipValue(value: unknown, valueFormatter: ((value: number) => string) | undefined): string;
|
|
277
|
+
/**
|
|
278
|
+
* A data label formatter that writes values with a value format, keeping any
|
|
279
|
+
* per-point label text
|
|
280
|
+
*/
|
|
281
|
+
declare function valueLabelFormatter(format: (value: number) => string): (params: LabelFormatterParams) => string;
|
|
282
|
+
/**
|
|
283
|
+
* Give a value axis tick formatter from a value format, unless the axis
|
|
284
|
+
* config sets its own
|
|
285
|
+
*/
|
|
286
|
+
declare function valueAxisConfig(config: AxisConfig | undefined, format: ((value: number) => string) | undefined): AxisConfig | undefined;
|
|
287
|
+
interface ChartFormatterOptions {
|
|
288
|
+
/** The `valueFormat` prop */
|
|
289
|
+
valueFormat?: ValueFormat;
|
|
290
|
+
/** The `locale` prop */
|
|
291
|
+
locale?: string;
|
|
292
|
+
/** The `tooltipValueFormatter` prop */
|
|
293
|
+
tooltipValueFormatter?: (value: number) => string;
|
|
294
|
+
/** The `labelFormatter` prop */
|
|
295
|
+
labelFormatter?: ChartFormatter<LabelFormatterParams>;
|
|
296
|
+
}
|
|
297
|
+
interface ChartFormatters {
|
|
298
|
+
/** The resolved value format, if any */
|
|
299
|
+
format: ((value: number) => string) | undefined;
|
|
300
|
+
/** Formatter for tooltip values */
|
|
301
|
+
tooltip: ((value: number) => string) | undefined;
|
|
302
|
+
/** Formatter for data labels */
|
|
303
|
+
label: ChartFormatter<LabelFormatterParams> | undefined;
|
|
304
|
+
/** Apply the value format to a value axis config */
|
|
305
|
+
axis: (config: AxisConfig | undefined) => AxisConfig | undefined;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Resolve `valueFormat` into the tooltip, label and axis formatters a chart
|
|
309
|
+
* uses; the explicit formatter props win over it
|
|
310
|
+
*/
|
|
311
|
+
declare function chartFormatters({ valueFormat, locale, tooltipValueFormatter, labelFormatter, }: ChartFormatterOptions): ChartFormatters;
|
|
312
|
+
interface ReferenceMarkOptions {
|
|
313
|
+
/** Which axis carries values: 'y' for vertical charts, 'x' for horizontal ones */
|
|
314
|
+
valueAxis: 'x' | 'y';
|
|
315
|
+
/** Formats the default line label */
|
|
316
|
+
format?: (value: number) => string;
|
|
317
|
+
/** Default line colour */
|
|
318
|
+
color: string;
|
|
319
|
+
/** Default band colour */
|
|
320
|
+
bandColor: string;
|
|
321
|
+
/**
|
|
322
|
+
* Whether the category axis runs top to bottom (horizontal bars, dot
|
|
323
|
+
* plots), so a vertical line's far end is at the bottom
|
|
324
|
+
*/
|
|
325
|
+
inverse?: boolean;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Build a series `markLine` for reference lines
|
|
329
|
+
*/
|
|
330
|
+
declare function buildMarkLine(lines: ReferenceLine[] | undefined, { valueAxis, format, color, inverse }: ReferenceMarkOptions): AnyObject | undefined;
|
|
331
|
+
/**
|
|
332
|
+
* Build a series `markArea` for reference bands
|
|
333
|
+
*/
|
|
334
|
+
declare function buildMarkArea(bands: ReferenceBand[] | undefined, { valueAxis, bandColor }: ReferenceMarkOptions): AnyObject | undefined;
|
|
335
|
+
/**
|
|
336
|
+
* Attach reference lines and bands to the series they name (the first series
|
|
337
|
+
* by default). Returns the series unchanged when there are none.
|
|
338
|
+
*/
|
|
339
|
+
declare function withReferenceMarks<S extends AnyObject>(series: S[], lines: ReferenceLine[] | undefined, bands: ReferenceBand[] | undefined, options: ReferenceMarkOptions): (S & {
|
|
340
|
+
markLine?: AnyObject;
|
|
341
|
+
markArea?: AnyObject;
|
|
342
|
+
})[];
|
|
343
|
+
/**
|
|
344
|
+
* Build `dataZoom` components for a category axis
|
|
345
|
+
*/
|
|
346
|
+
declare function buildDataZoom(mode: boolean | 'inside' | 'slider' | undefined, axis: 'x' | 'y',
|
|
347
|
+
/** Room taken by a bottom legend, so a slider sits above it */
|
|
348
|
+
bottomOffset?: number): AnyObject[] | undefined;
|
|
349
|
+
/**
|
|
350
|
+
* Grid room for a data zoom slider, added to a `gridInset` result
|
|
351
|
+
*/
|
|
352
|
+
declare function withZoomInset(inset: AnyObject | undefined, mode: boolean | 'inside' | 'slider' | undefined, axis: 'x' | 'y'): AnyObject | undefined;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Data preparation for distribution, waterfall and stacked charts, and
|
|
356
|
+
* chart sizing helpers
|
|
357
|
+
*/
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* A "nice" step (1, 2, 2.5 or 5 times a power of ten) at least `rough`
|
|
361
|
+
*/
|
|
362
|
+
declare function niceStep(rough: number): number;
|
|
363
|
+
interface BinValuesOptions {
|
|
364
|
+
/** A bucket count, or explicit buckets (defaults to Sturges' rule) */
|
|
365
|
+
bins?: number | HistogramBin[];
|
|
366
|
+
/** Width of equal buckets (takes precedence over a bucket count) */
|
|
367
|
+
binWidth?: number;
|
|
368
|
+
/** Formats bucket bounds in generated labels */
|
|
369
|
+
format?: (value: number) => string;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Count values into histogram buckets. Each bucket includes its start and
|
|
373
|
+
* excludes its end, except the last, which includes both. Non-finite values
|
|
374
|
+
* are ignored.
|
|
375
|
+
*/
|
|
376
|
+
declare function binValues(values: number[], options?: BinValuesOptions): HistogramBucket[];
|
|
377
|
+
/**
|
|
378
|
+
* Quantile of sorted values by linear interpolation (the method spreadsheets
|
|
379
|
+
* and NumPy use by default)
|
|
380
|
+
*/
|
|
381
|
+
declare function quantile(sorted: number[], q: number): number;
|
|
382
|
+
/**
|
|
383
|
+
* Five-number summary with Tukey whiskers (1.5 IQR) and outliers. Returns
|
|
384
|
+
* null when there are no finite values.
|
|
385
|
+
*/
|
|
386
|
+
declare function boxplotStats(values: number[]): BoxPlotStats | null;
|
|
387
|
+
/**
|
|
388
|
+
* Where one waterfall step's bar sits
|
|
389
|
+
*/
|
|
390
|
+
interface WaterfallBar {
|
|
391
|
+
/** Running total before the step (0 for totals) */
|
|
392
|
+
start: number;
|
|
393
|
+
/** Running total after the step */
|
|
394
|
+
end: number;
|
|
395
|
+
/** The step's change, or the total for total steps */
|
|
396
|
+
value: number;
|
|
397
|
+
/** How the bar is coloured */
|
|
398
|
+
kind: 'increase' | 'decrease' | 'total';
|
|
399
|
+
/**
|
|
400
|
+
* Stacking pieces: an invisible `base`, then the `positive` part (above
|
|
401
|
+
* zero) and `negative` part (below zero) of the visible bar. ECharts stacks
|
|
402
|
+
* positive and negative values separately, so bars that cross zero draw
|
|
403
|
+
* correctly.
|
|
404
|
+
*/
|
|
405
|
+
base: number;
|
|
406
|
+
positive: number;
|
|
407
|
+
negative: number;
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Lay out waterfall steps as stacked bar pieces
|
|
411
|
+
*/
|
|
412
|
+
declare function waterfallLayout(steps: WaterfallStep[]): WaterfallBar[];
|
|
413
|
+
/**
|
|
414
|
+
* Convert stacked series to each category's share of 100%. Missing values
|
|
415
|
+
* stay missing; a category whose values sum to zero gets zeros.
|
|
416
|
+
*/
|
|
417
|
+
declare function toPercentStack<S extends {
|
|
418
|
+
data: (number | null)[];
|
|
419
|
+
}>(series: S[]): S[];
|
|
420
|
+
/**
|
|
421
|
+
* Pair category labels with values for a time or value x-axis, which reads
|
|
422
|
+
* [x, y] points rather than values by category index
|
|
423
|
+
*/
|
|
424
|
+
declare function pairWithCategories<V>(categories: (string | number)[], values: V[], axisType: string | undefined): (V | [string | number, V])[];
|
|
425
|
+
interface AutoHeightOptions {
|
|
426
|
+
/** Height per row (defaults to 28) */
|
|
427
|
+
rowHeight?: number;
|
|
428
|
+
/** Fixed space for axes and padding (defaults to 56) */
|
|
429
|
+
chrome?: number;
|
|
430
|
+
/** Lower bound (defaults to 160) */
|
|
431
|
+
minHeight?: number;
|
|
432
|
+
/** Upper bound */
|
|
433
|
+
maxHeight?: number;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Resolve a chart height: 'auto' sizes to the row count within the min and
|
|
437
|
+
* max bounds; any other height is returned unchanged
|
|
438
|
+
*/
|
|
439
|
+
declare function resolveChartHeight(height: number | string | undefined, rows: number, { rowHeight, chrome, minHeight, maxHeight }?: AutoHeightOptions): number | string | undefined;
|
|
440
|
+
/**
|
|
441
|
+
* Whether every series is empty or holds only missing values
|
|
442
|
+
*/
|
|
443
|
+
declare function allSeriesEmpty(series: Pick<CategorySeriesData, 'data'>[] | undefined): boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Least-squares trend line through points, as its two end points. Returns
|
|
446
|
+
* null for fewer than two points or when every x is the same.
|
|
447
|
+
*/
|
|
448
|
+
declare function trendLine(points: [number, number][]): [[number, number], [number, number]] | null;
|
|
449
|
+
/**
|
|
450
|
+
* A change between two values
|
|
451
|
+
*/
|
|
452
|
+
interface Delta {
|
|
453
|
+
/** current - previous */
|
|
454
|
+
change: number;
|
|
455
|
+
/** The change relative to |previous|, or null when previous is 0 */
|
|
456
|
+
ratio: number | null;
|
|
457
|
+
/** Which way the value moved */
|
|
458
|
+
direction: 'up' | 'down' | 'flat';
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Compare a value with a previous one. Returns null when either is missing.
|
|
462
|
+
*/
|
|
463
|
+
declare function computeDelta(current: number | null | undefined, previous: number | null | undefined): Delta | null;
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* Adapters from arrays of records (rows from an API or query) to chart data
|
|
467
|
+
*/
|
|
468
|
+
|
|
469
|
+
/** A field name or a function reading a value from a record */
|
|
470
|
+
type Accessor<T, V> = keyof T | ((row: T) => V);
|
|
471
|
+
/** How values that share a category (and series) are combined */
|
|
472
|
+
type Aggregate = 'sum' | 'count' | 'avg' | 'min' | 'max' | 'first' | 'last';
|
|
473
|
+
interface FromRecordsOptions<T> {
|
|
474
|
+
/** Field (or function) giving each record's category */
|
|
475
|
+
category: Accessor<T, unknown>;
|
|
476
|
+
/** Field (or function) giving each record's value; omit with `aggregate: 'count'` */
|
|
477
|
+
value?: Accessor<T, unknown>;
|
|
478
|
+
/**
|
|
479
|
+
* Field (or function) splitting records into series (long data). Omit for a
|
|
480
|
+
* single series named by `seriesName`.
|
|
481
|
+
*/
|
|
482
|
+
series?: Accessor<T, unknown>;
|
|
483
|
+
/**
|
|
484
|
+
* Several value fields, each becoming a series (wide data), as
|
|
485
|
+
* `{ 'Series name': field }`. Replaces `value` and `series`.
|
|
486
|
+
*/
|
|
487
|
+
measures?: Record<string, Accessor<T, unknown>>;
|
|
488
|
+
/** Name of the single series when neither `series` nor `measures` is given */
|
|
489
|
+
seriesName?: string;
|
|
490
|
+
/** How records sharing a category and series combine (defaults to 'sum') */
|
|
491
|
+
aggregate?: Aggregate;
|
|
492
|
+
/**
|
|
493
|
+
* Category order: by total descending ('total'), ascending ('total-asc'),
|
|
494
|
+
* alphabetically ('category'), first appearance ('none', the default), or
|
|
495
|
+
* a comparator of category labels
|
|
496
|
+
*/
|
|
497
|
+
sort?: 'total' | 'total-asc' | 'category' | 'none' | ((a: string, b: string) => number);
|
|
498
|
+
/** Explicit category order; listed categories come first, the rest follow */
|
|
499
|
+
categoryOrder?: string[];
|
|
500
|
+
/** Keep only the first N categories after sorting (sorts by total when `sort` is unset) */
|
|
501
|
+
topN?: number;
|
|
502
|
+
/**
|
|
503
|
+
* Fold the categories beyond `topN` into one with this label (only for
|
|
504
|
+
* 'sum' and 'count', where folding is meaningful). Omit to drop them.
|
|
505
|
+
*/
|
|
506
|
+
otherLabel?: string;
|
|
507
|
+
/** Explicit series order; listed series come first, the rest follow in first-appearance order */
|
|
508
|
+
seriesOrder?: string[];
|
|
509
|
+
/** Label for missing categories and series (defaults to 'Unknown') */
|
|
510
|
+
nullLabel?: string;
|
|
511
|
+
/** Value for category and series combinations with no records (defaults to null, a gap) */
|
|
512
|
+
fill?: number | null;
|
|
513
|
+
/** Series colours by series name */
|
|
514
|
+
colors?: Record<string, string>;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Pivot records into the categories x series shape used by line, bar, area,
|
|
518
|
+
* combo and dot plot charts
|
|
519
|
+
*
|
|
520
|
+
* ```ts
|
|
521
|
+
* fromRecords(rows, { category: 'builder', series: 'status', value: 'homes', sort: 'total', topN: 10 })
|
|
522
|
+
* fromRecords(rows, { category: 'month', measures: { Started: 'starts', Closed: 'closings' } })
|
|
523
|
+
* ```
|
|
524
|
+
*/
|
|
525
|
+
declare function fromRecords<T>(rows: T[], options: FromRecordsOptions<T>): CategoryChartData;
|
|
526
|
+
interface ToSliceDataOptions<T> {
|
|
527
|
+
/** Field (or function) giving each slice's name */
|
|
528
|
+
name: Accessor<T, unknown>;
|
|
529
|
+
/** Field (or function) giving each slice's value; omit to count records */
|
|
530
|
+
value?: Accessor<T, unknown>;
|
|
531
|
+
/** How records sharing a name combine (defaults to 'sum') */
|
|
532
|
+
aggregate?: Aggregate;
|
|
533
|
+
/** Drop slices whose value is zero or missing (defaults to true) */
|
|
534
|
+
dropZero?: boolean;
|
|
535
|
+
/** Slice order (defaults to 'desc', largest first) */
|
|
536
|
+
sort?: 'desc' | 'asc' | 'none';
|
|
537
|
+
/** Keep only the largest N slices */
|
|
538
|
+
topN?: number;
|
|
539
|
+
/** Fold slices beyond `topN` into one with this label; omit to drop them */
|
|
540
|
+
otherLabel?: string;
|
|
541
|
+
/** Label for a missing name (defaults to 'Unknown') */
|
|
542
|
+
nullLabel?: string;
|
|
543
|
+
/** Slice colours by name */
|
|
544
|
+
colors?: Record<string, string>;
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Aggregate records into pie, donut or funnel slices
|
|
548
|
+
*/
|
|
549
|
+
declare function toSliceData<T>(rows: T[], options: ToSliceDataOptions<T>): PieSliceData[];
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Chart data as tables, for the accessible data table and CSV export
|
|
553
|
+
*/
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Categories x series as a table: one row per category, one column per series
|
|
557
|
+
*/
|
|
558
|
+
declare function categoryTable(data: CategoryChartData, categoryHeader?: string): ChartDataTable;
|
|
559
|
+
/**
|
|
560
|
+
* Slices as a table with each slice's share of the total
|
|
561
|
+
*/
|
|
562
|
+
declare function sliceTable(slices: PieSliceData[], nameHeader?: string): ChartDataTable;
|
|
563
|
+
/**
|
|
564
|
+
* Scatter points as a table
|
|
565
|
+
*/
|
|
566
|
+
declare function scatterTable(data: ScatterChartData, xHeader?: string, yHeader?: string): ChartDataTable;
|
|
567
|
+
/**
|
|
568
|
+
* Radar series as a table: one row per indicator
|
|
569
|
+
*/
|
|
570
|
+
declare function radarTable(data: RadarChartData, indicators: RadarIndicator[]): ChartDataTable;
|
|
571
|
+
/**
|
|
572
|
+
* Heatmap cells as a grid: one row per y label, one column per x label
|
|
573
|
+
*/
|
|
574
|
+
declare function heatmapTable(data: HeatmapData, xAxis: string[], yAxis: string[]): ChartDataTable;
|
|
575
|
+
/**
|
|
576
|
+
* Treemap leaves as a table with their full path
|
|
577
|
+
*/
|
|
578
|
+
declare function treemapTable(nodes: TreemapNode[]): ChartDataTable;
|
|
579
|
+
/**
|
|
580
|
+
* Sankey links as a table
|
|
581
|
+
*/
|
|
582
|
+
declare function sankeyTable(data: SankeyData): ChartDataTable;
|
|
583
|
+
/**
|
|
584
|
+
* Candlestick prices as a table
|
|
585
|
+
*/
|
|
586
|
+
declare function candlestickTable(data: CandlestickData): ChartDataTable;
|
|
587
|
+
/**
|
|
588
|
+
* Histogram buckets as a table
|
|
589
|
+
*/
|
|
590
|
+
declare function histogramTable(buckets: HistogramBucket[]): ChartDataTable;
|
|
591
|
+
/**
|
|
592
|
+
* Box plot summaries as a table
|
|
593
|
+
*/
|
|
594
|
+
declare function boxPlotTable(groups: {
|
|
595
|
+
name: string;
|
|
596
|
+
stats: BoxPlotStats | null;
|
|
597
|
+
}[]): ChartDataTable;
|
|
598
|
+
/**
|
|
599
|
+
* Waterfall steps as a table with the running total
|
|
600
|
+
*/
|
|
601
|
+
declare function waterfallTable(steps: WaterfallStep[], bars: WaterfallBar[]): ChartDataTable;
|
|
602
|
+
/**
|
|
603
|
+
* Bullet rows as a table
|
|
604
|
+
*/
|
|
605
|
+
declare function bulletTable(items: BulletItem[]): ChartDataTable;
|
|
606
|
+
/**
|
|
607
|
+
* Format a table cell for display
|
|
608
|
+
*/
|
|
609
|
+
declare function formatTableCell(table: ChartDataTable, cell: string | number | null, column: number, format?: (value: number) => string): string;
|
|
610
|
+
/**
|
|
611
|
+
* Serialise a table as CSV (RFC 4180). Numbers stay raw so spreadsheets can
|
|
612
|
+
* work with them; pass `format` to write formatted values instead.
|
|
613
|
+
*/
|
|
614
|
+
declare function tableToCsv(table: ChartDataTable, format?: (value: number) => string): string;
|
|
615
|
+
/**
|
|
616
|
+
* A file name from a chart title: lowercase words joined by hyphens
|
|
617
|
+
*/
|
|
618
|
+
declare function chartFilename(title: string): string;
|
|
619
|
+
/**
|
|
620
|
+
* Trigger a browser download of text or a data URL. Does nothing outside a
|
|
621
|
+
* browser.
|
|
622
|
+
*/
|
|
623
|
+
declare function downloadFile(content: string, filename: string, mimeType?: string): void;
|
|
624
|
+
/**
|
|
625
|
+
* Download a table as a CSV file. A byte order mark makes Excel read it as
|
|
626
|
+
* UTF-8.
|
|
627
|
+
*/
|
|
628
|
+
declare function downloadCsv(table: ChartDataTable, filename: string): void;
|
|
233
629
|
|
|
234
|
-
export { AxisConfig, BarChartData, type BuildDataLabelOptions, type BuildLegendOptions, type BuildTooltipOptions, ChartFormatter, ChartLegendConfig, LabelFormatterParams, LegendItem, LineChartData, PieSliceData, type PointLabelLookup, ScatterChartData, TooltipFormatterParams, abbreviateNumber, anchorCenterGraphic, buildAxis, buildDataLabel, buildLegend, buildTooltip, createTooltipFormatter, escapeHtml, formatCurrency, formatDate, formatNumber, formatPercent, formatTooltipValue, generateBarChartDescription, generateDataTable, generateLineChartDescription, generatePieChartDescription, generateScatterChartDescription, getLegendItems, getReplaceMerge, gridInset, hasPointLabels, itemLabelLookup, legendCenter, mergeChartOption, nameLabelLookup, pointLabel, seriesLabelLookup, withPointLabels };
|
|
630
|
+
export { type Accessor, type Aggregate, type AutoHeightOptions, AxisConfig, BarChartData, type BinValuesOptions, BoxPlotStats, type BuildDataLabelOptions, type BuildLegendOptions, type BuildTooltipOptions, BulletItem, CandlestickData, CategoryChartData, CategorySeriesData, ChartDataTable, ChartFormatter, type ChartFormatterOptions, type ChartFormatters, ChartLegendConfig, type Delta, type FromRecordsOptions, HeatmapData, HistogramBin, HistogramBucket, LabelFormatterParams, LegendItem, LineChartData, PieSliceData, type PointLabelLookup, RadarChartData, RadarIndicator, ReferenceBand, ReferenceLine, type ReferenceMarkOptions, SankeyData, ScatterChartData, type ToSliceDataOptions, TooltipFormatterParams, TreemapNode, ValueFormat, type WaterfallBar, WaterfallStep, abbreviateNumber, allSeriesEmpty, anchorCenterGraphic, binValues, boxPlotTable, boxplotStats, buildAxis, buildDataLabel, buildDataZoom, buildLegend, buildMarkArea, buildMarkLine, buildTooltip, bulletTable, candlestickTable, categoryTable, chartFilename, chartFormatters, computeDelta, createTooltipFormatter, downloadCsv, downloadFile, escapeHtml, formatCurrency, formatDate, formatNumber, formatPercent, formatTableCell, formatTooltipValue, formatValue, fromRecords, generateAreaChartDescription, generateBarChartDescription, generateBoxPlotDescription, generateBulletDescription, generateComboChartDescription, generateDataTable, generateDotPlotDescription, generateHistogramDescription, generateLineChartDescription, generatePieChartDescription, generateScatterChartDescription, generateWaterfallDescription, getLegendItems, getReplaceMerge, gridInset, hasPointLabels, heatmapTable, histogramTable, itemLabelLookup, legendCenter, mergeChartOption, nameLabelLookup, niceStep, pairWithCategories, pointLabel, quantile, radarTable, resolveChartHeight, resolveValueFormatter, sankeyTable, scatterTable, seriesLabelLookup, sliceTable, tableToCsv, toPercentStack, toSliceData, treemapTable, trendLine, valueAxisConfig, valueLabelFormatter, waterfallLayout, waterfallTable, withPointLabels, withReferenceMarks, withZoomInset };
|