@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
package/dist/index.d.ts
CHANGED
|
@@ -1,166 +1,274 @@
|
|
|
1
|
+
import { D as Datasets, C as ChartSpec, R as Row, S as StackMode, a as ChartModel, L as LayoutOptions, b as ChartLayout, c as ChartMessagesInput } from './echarts-option-DHFfEvN1.js';
|
|
2
|
+
export { A as AXIS_FONT_SIZE, d as Annotation, e as AnnotationLayout, f as AnnotationTone, g as AxisLayout, h as AxisMarginInput, i as AxisSpec, j as AxisTick, B as BandScale, k as BinSpec, l as Box, m as BuildModelOptions, n as ChartA11y, o as ChartData, p as ChartFormatters, q as ChartInteractions, r as ChartLabels, s as ChartMessages, t as ChartPointInfo, u as ChartThemeColors, v as ChartType, w as ColorScale, x as ContinuousKind, y as ContinuousScale, z as ContinuousScaleOptions, E as DEFAULT_LOCALE, F as DashStyle, G as DomainOptions, H as DonutSpec, I as EChartsOptionInput, J as EChartsOptionObject, K as Encoding, M as FieldType, N as FitLabelsOptions, O as FittedLabel, P as FocusShape, Q as Formatter, T as GaugeSpec, U as HistogramBin, V as HistogramOptions, W as HitStrategy, X as HitTarget, Y as LabelFit, Z as LayoutMark, _ as LegendEntry, $ as LegendSpec, a0 as MAX_HUES, a1 as Margin, a2 as MarkKind, a3 as MarkerShape, a4 as ModelGauge, a5 as ModelPoint, a6 as ModelSeries, a7 as ModelSlice, a8 as ModelStatus, a9 as NavKey, aa as NavigationMode, ab as NumberFormatOptions, ac as PointScale, ad as RenderTarget, ae as RendererChoice, af as ResolveRendererInput, ag as SVG_POINT_LIMIT, ah as ScaleSpec, ai as ScaleType, aj as SeriesMark, ak as SeriesPoint, al as SeriesSpec, am as SeriesStyle, an as SeriesTone, ao as TICK_PADDING, ap as TICK_SIZE, aq as TextLabel, ar as Threshold, as as TooltipContent, at as TooltipRow, au as Transform, av as TransformContext, aw as WaterfallSpec, ax as WaterfallStep, ay as XKind, az as annotationTone, aA as applyTransforms, aB as buildChartModel, aC as capitalize, aD as categoricalTones, aE as chartTypes, aF as computeAxisMargins, aG as countPoints, aH as createBandScale, aI as createContinuousScale, aJ as createDateFormatter, aK as createFormatters, aL as createNumberFormatter, aM as createPointScale, aN as createTimeTickFormatter, aO as dashArrays, aP as dashStyles, aQ as defaultMessages, aR as defineChartSpec, aS as describeTarget, aT as divergingColor, aU as dodgePositions, aV as effectiveStack, aW as estimateTextWidth, aX as fitTickLabels, aY as formatList, aZ as formatMessage, a_ as formatShare, a$ as fractionDigitsForStep, b0 as histogramBins, b1 as hitTest, b2 as isNavKey, b3 as isOpenMarker, b4 as isRtlLocale, b5 as isSupportedMark, b6 as markerPath, b7 as markerShapes, b8 as navKeys, b9 as navigate, ba as niceTicks, bb as pointInfo, bc as rampGradient, bd as readField, be as resolveMessages, bf as resolveRenderer, bg as resolveRows, bh as sequentialColor, bi as seriesStyle, bj as supportedMarks, bk as targetById, bl as themeColorsFromTokens, bm as toCategory, bn as toEChartsOption, bo as toNumber, bp as toTime, bq as toneCssVar, br as toneTokenPath, bs as toneVarName, bt as tooltipFor, bu as truncateLabel, bv as usesBandX, bw as valueDomain } from './echarts-option-DHFfEvN1.js';
|
|
3
|
+
import '@x12i/tokens';
|
|
4
|
+
|
|
1
5
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
type
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
interface Encoding {
|
|
17
|
-
field: string;
|
|
18
|
-
type: FieldType;
|
|
19
|
-
/** A named format such as `compact` or `percent`, or an ICU pattern. */
|
|
20
|
-
format?: string;
|
|
21
|
-
/** Axis or legend title. Axis titles carry units. */
|
|
22
|
-
title?: string;
|
|
6
|
+
* Spec validation. `validateChartSpec` accepts `unknown` so it can check JSON
|
|
7
|
+
* from files, databases or an AI, and returns a list of issues instead of
|
|
8
|
+
* throwing. Messages are for developers (English); the renderers never show
|
|
9
|
+
* them.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
type IssueSeverity = "error" | "warning";
|
|
13
|
+
interface ChartIssue {
|
|
14
|
+
severity: IssueSeverity;
|
|
15
|
+
/** Stable code, for example `title-missing`. */
|
|
16
|
+
code: string;
|
|
17
|
+
/** Where in the spec, for example `series[1].axis`. */
|
|
18
|
+
path: string;
|
|
19
|
+
message: string;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
21
|
+
interface ValidateOptions {
|
|
22
|
+
/** Datasets for `data.ref`. With them, missing refs are errors and fields are checked against rows. */
|
|
23
|
+
datasets?: Datasets | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Checks a spec and returns every problem found. An empty list means the spec is valid. */
|
|
26
|
+
declare function validateChartSpec(input: unknown, options?: ValidateOptions): ChartIssue[];
|
|
27
|
+
/** True when `validateChartSpec` finds no errors (warnings are allowed). */
|
|
28
|
+
declare function isValidChartSpec(input: unknown, options?: ValidateOptions): input is ChartSpec;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* A tiny, safe expression language for `highlight.where`, for example
|
|
32
|
+
* `week == 'W4'` or `revenue > 100 && region in ['EU', 'US']`.
|
|
33
|
+
*
|
|
34
|
+
* Grammar: literals (numbers, quoted strings, true, false, null), field names,
|
|
35
|
+
* `== != < <= > >=`, `in [..]`, `!`, `&&`, `||` and parentheses. It never calls
|
|
36
|
+
* `eval` or `Function`, so specs from untrusted sources are safe to evaluate.
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
declare class ExpressionError extends Error {
|
|
40
|
+
constructor(message: string);
|
|
41
|
+
}
|
|
42
|
+
/** Returns an error message when the expression does not parse, otherwise `null`. */
|
|
43
|
+
declare function checkWhere(expression: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Compiles an expression into a row predicate. An expression that does not
|
|
46
|
+
* parse matches nothing, so a typo never highlights the wrong marks; use
|
|
47
|
+
* `checkWhere` (or `validateChartSpec`) to report the problem.
|
|
48
|
+
*/
|
|
49
|
+
declare function compileWhere(expression: string): (row: Row) => boolean;
|
|
50
|
+
/** Evaluates `expression` against one row. */
|
|
51
|
+
declare function evaluateWhere(expression: string, row: Row): boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Downsampling for long series. Both methods keep the first and last point and
|
|
55
|
+
* return indices into the input, so callers can pick rows or points.
|
|
56
|
+
*/
|
|
57
|
+
interface XY {
|
|
58
|
+
x: number;
|
|
59
|
+
y: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Largest-Triangle-Three-Buckets (Steinarsson, 2013). Keeps the visual shape of
|
|
63
|
+
* a line while reducing it to `threshold` points. The input must be sorted by x.
|
|
64
|
+
* Returns the kept indices in ascending order. When `threshold` is at least the
|
|
65
|
+
* input length, or under 3, every index (or just the ends) is returned.
|
|
66
|
+
*/
|
|
67
|
+
declare function lttbIndices(points: ReadonlyArray<XY>, threshold: number): number[];
|
|
68
|
+
/** LTTB over any items, with accessors for x and y. Items with a non-finite x or y are dropped first. */
|
|
69
|
+
declare function lttb<T>(items: ReadonlyArray<T>, getX: (item: T) => number, getY: (item: T) => number, threshold: number): T[];
|
|
70
|
+
/**
|
|
71
|
+
* Min/max bucket downsampling. Splits the input into `buckets` equal runs and
|
|
72
|
+
* keeps the lowest and highest point of each, so spikes always survive. Output
|
|
73
|
+
* has at most `2 * buckets` points, in input order. The input must be sorted by x.
|
|
74
|
+
*/
|
|
75
|
+
declare function minMaxIndices(points: ReadonlyArray<XY>, buckets: number): number[];
|
|
76
|
+
declare function minMax<T>(items: ReadonlyArray<T>, getX: (item: T) => number, getY: (item: T) => number, buckets: number): T[];
|
|
77
|
+
|
|
78
|
+
interface StackedValue {
|
|
79
|
+
/** Lower edge of the segment. */
|
|
80
|
+
y0: number;
|
|
81
|
+
/** Upper edge of the segment. */
|
|
82
|
+
y1: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Stacks values per category. `values[s][c]` is series `s` at category `c`
|
|
86
|
+
* (`null` counts as zero). Returns the same shape with a `[y0, y1]` segment
|
|
87
|
+
* for each cell.
|
|
88
|
+
*
|
|
89
|
+
* - `none`: every segment starts at zero.
|
|
90
|
+
* - `stacked`: segments add up.
|
|
91
|
+
* - `normalized`: each category adds up to 1 (so format as percent).
|
|
92
|
+
* - `diverging`: positives stack above zero and negatives below it.
|
|
93
|
+
*/
|
|
94
|
+
declare function stackValues(values: ReadonlyArray<ReadonlyArray<number | null>>, mode: StackMode): StackedValue[][];
|
|
95
|
+
|
|
96
|
+
type MaybeNumber = number | null | undefined;
|
|
97
|
+
declare function sum(values: ReadonlyArray<MaybeNumber>): number;
|
|
98
|
+
/** Arithmetic mean, or `null` when there are no values. */
|
|
99
|
+
declare function mean(values: ReadonlyArray<MaybeNumber>): number | null;
|
|
100
|
+
/** Linear-interpolated quantile for `p` in [0, 1] (the R-7 method), or `null` when empty. */
|
|
101
|
+
declare function quantile(values: ReadonlyArray<MaybeNumber>, p: number): number | null;
|
|
102
|
+
declare function median(values: ReadonlyArray<MaybeNumber>): number | null;
|
|
103
|
+
/** Sample variance (n - 1 denominator), or `null` with fewer than two values. */
|
|
104
|
+
declare function variance(values: ReadonlyArray<MaybeNumber>): number | null;
|
|
105
|
+
declare function standardDeviation(values: ReadonlyArray<MaybeNumber>): number | null;
|
|
106
|
+
/** Smallest and largest finite value, or `null` when empty. */
|
|
107
|
+
declare function extent(values: ReadonlyArray<MaybeNumber>): [number, number] | null;
|
|
108
|
+
interface LinearRegression {
|
|
109
|
+
slope: number;
|
|
110
|
+
intercept: number;
|
|
111
|
+
/** Coefficient of determination, from 0 to 1. 1 when all y values are equal. */
|
|
112
|
+
r2: number;
|
|
113
|
+
/** Number of points used. */
|
|
114
|
+
count: number;
|
|
115
|
+
predict: (x: number) => number;
|
|
116
|
+
}
|
|
117
|
+
/** Ordinary least squares over `[x, y]` pairs. Returns `null` with fewer than two distinct x values. */
|
|
118
|
+
declare function linearRegression(points: ReadonlyArray<readonly [number, number]>): LinearRegression | null;
|
|
119
|
+
/** Pearson correlation of paired values, or `null` when it is undefined. */
|
|
120
|
+
declare function correlation(xs: ReadonlyArray<MaybeNumber>, ys: ReadonlyArray<MaybeNumber>): number | null;
|
|
121
|
+
interface MovingAverageOptions {
|
|
122
|
+
/** `trailing` averages the current and earlier values; `centered` looks both ways. Defaults to `trailing`. */
|
|
123
|
+
align?: "trailing" | "centered";
|
|
124
|
+
/**
|
|
125
|
+
* When true (default), the first `window - 1` outputs are `null` instead of
|
|
126
|
+
* partial averages, so the line never starts with a misleading short window.
|
|
127
|
+
*/
|
|
128
|
+
strict?: boolean;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Moving average over `window` values. The output has the same length as the
|
|
132
|
+
* input. Missing values inside a window are skipped; a window with no values
|
|
133
|
+
* gives `null`.
|
|
134
|
+
*/
|
|
135
|
+
declare function movingAverage(values: ReadonlyArray<MaybeNumber>, window: number, { align, strict }?: MovingAverageOptions): Array<number | null>;
|
|
136
|
+
/** Running total. Missing values add nothing and keep the previous total. */
|
|
137
|
+
declare function cumulativeSum(values: ReadonlyArray<MaybeNumber>): number[];
|
|
138
|
+
/**
|
|
139
|
+
* Change from `from` to `to` as a fraction (0.25 means +25%), or `null` when
|
|
140
|
+
* the starting value is zero or missing. Negative starting values use the
|
|
141
|
+
* absolute value so that an increase is always positive.
|
|
142
|
+
*/
|
|
143
|
+
declare function percentChange(from: MaybeNumber, to: MaybeNumber): number | null;
|
|
144
|
+
/** Period-over-period change as fractions. The first `periods` entries are `null`. */
|
|
145
|
+
declare function periodChange(values: ReadonlyArray<MaybeNumber>, periods?: number): Array<number | null>;
|
|
146
|
+
type Trend = "rising" | "falling" | "flat";
|
|
147
|
+
/**
|
|
148
|
+
* Overall direction of a series. Fits a line through the values; the trend is
|
|
149
|
+
* `flat` when the fitted change over the whole series is under `tolerance`
|
|
150
|
+
* (default 5%) of the value range.
|
|
151
|
+
*/
|
|
152
|
+
declare function trendDirection(values: ReadonlyArray<MaybeNumber>, tolerance?: number): Trend;
|
|
153
|
+
interface RegressionBand {
|
|
154
|
+
x: number;
|
|
155
|
+
y: number;
|
|
156
|
+
lower: number;
|
|
157
|
+
upper: number;
|
|
105
158
|
}
|
|
106
|
-
/**
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Confidence band around a linear fit, using the standard error of the
|
|
161
|
+
* estimate and a normal critical value (`z`, default 1.96 for about 95%).
|
|
162
|
+
* `at` lists the x values to evaluate, so the band can extend past the data
|
|
163
|
+
* for a forecast overlay.
|
|
164
|
+
*/
|
|
165
|
+
declare function regressionBand(points: ReadonlyArray<readonly [number, number]>, at: ReadonlyArray<number>, z?: number): RegressionBand[];
|
|
166
|
+
/**
|
|
167
|
+
* Linear forecast: continues the fitted line for `steps` more points spaced
|
|
168
|
+
* `step` apart, starting after the last x. Returns `[]` when no line can be fit.
|
|
169
|
+
*/
|
|
170
|
+
declare function forecastLinear(points: ReadonlyArray<readonly [number, number]>, steps: number, step?: number): Array<[number, number]>;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Hatch pattern for the series at `styleIndex`: none for the first series, then
|
|
174
|
+
* a different pattern for each further one (all of them with `all`, for print).
|
|
175
|
+
* The palette repeats its eight hues, so each pass shifts the patterns, which
|
|
176
|
+
* keeps every hue and pattern pair unique for up to 64 series.
|
|
177
|
+
*/
|
|
178
|
+
declare function patternIndex(styleIndex: number, all?: boolean): number;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Lays a model out in `width` by `height` pixels: axes with ticks, marks as
|
|
182
|
+
* plain geometry, text labels, annotations, legend entries and the keyboard and
|
|
183
|
+
* pointer targets. All coordinates are SVG user units. The result is plain
|
|
184
|
+
* data, so it can be rendered on a server, snapshot-tested, or drawn by
|
|
185
|
+
* something other than the bundled React renderer.
|
|
186
|
+
*/
|
|
187
|
+
declare function layoutChart(model: ChartModel, options: LayoutOptions): ChartLayout;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Generated text alternatives: an accessible name and a long description built
|
|
191
|
+
* from the data (type, series, ranges, extremes, overall trend, thresholds).
|
|
192
|
+
* Authors still write `a11y.description` (the finding); this adds the facts a
|
|
193
|
+
* screen reader user would otherwise read off the plot. Pure and server-safe.
|
|
194
|
+
*/
|
|
195
|
+
|
|
196
|
+
interface ChartDescription {
|
|
197
|
+
/** The accessible name: the title and the chart type, for example "Revenue (line chart)". */
|
|
198
|
+
name: string;
|
|
199
|
+
/** Type, series count and point count in one sentence. */
|
|
200
|
+
summary: string;
|
|
201
|
+
/** Sentences about axes, series extremes, trends, thresholds and breaches. */
|
|
202
|
+
details: string[];
|
|
203
|
+
/** The author's description, the summary and the details, in reading order. */
|
|
204
|
+
text: string;
|
|
112
205
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
|
|
121
|
-
/** Where the data came from. Required in reports. */
|
|
122
|
-
source?: string;
|
|
123
|
-
data: ChartData;
|
|
124
|
-
mark: ChartType;
|
|
125
|
-
x?: Encoding;
|
|
126
|
-
y?: Encoding;
|
|
127
|
-
/** Series that differ in kind use the categorical palette, capped at 8 hues. */
|
|
128
|
-
color?: Encoding;
|
|
129
|
-
size?: Encoding;
|
|
130
|
-
/** One accent on what the title is about, for example `week == 'W4'`. */
|
|
131
|
-
highlight?: {
|
|
132
|
-
where: string;
|
|
133
|
-
};
|
|
134
|
-
transforms?: Transform[];
|
|
135
|
-
annotations?: Annotation[];
|
|
136
|
-
interactions?: ChartInteractions;
|
|
137
|
-
/** Dual axes only behind an explicit flag, which adds a visible warning. */
|
|
138
|
-
dualAxis?: boolean;
|
|
139
|
-
renderer?: RendererChoice;
|
|
140
|
-
/** Whether axes mirror in right-to-left locales. */
|
|
141
|
-
direction?: "ltr" | "rtl" | "auto";
|
|
142
|
-
a11y: ChartA11y;
|
|
206
|
+
interface DescribeOptions {
|
|
207
|
+
datasets?: Datasets | undefined;
|
|
208
|
+
locale?: string | undefined;
|
|
209
|
+
messages?: ChartMessagesInput | undefined;
|
|
210
|
+
/** Ids of hidden series, which are mentioned but not described. */
|
|
211
|
+
hidden?: ReadonlySet<string> | undefined;
|
|
212
|
+
/** At most this many series get their own sentences. Defaults to 6. */
|
|
213
|
+
maxSeries?: number | undefined;
|
|
143
214
|
}
|
|
144
|
-
/**
|
|
145
|
-
declare function
|
|
215
|
+
/** Describes a built model. Prefer this when you already have one. */
|
|
216
|
+
declare function describeModel(model: ChartModel, options?: DescribeOptions): ChartDescription;
|
|
217
|
+
/**
|
|
218
|
+
* Builds the accessible name and long description of a chart from its spec.
|
|
219
|
+
* Combine with `spec.a11y.description`, which is placed first in `text`.
|
|
220
|
+
*/
|
|
221
|
+
declare function describeChart(spec: ChartSpec, options?: DescribeOptions): ChartDescription;
|
|
146
222
|
|
|
147
223
|
/**
|
|
148
|
-
* The
|
|
149
|
-
*
|
|
224
|
+
* The data table alternative and CSV export. Both read the model, so they show
|
|
225
|
+
* exactly the values the chart draws (after transforms), and work on the
|
|
226
|
+
* server. Pure.
|
|
150
227
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
228
|
+
|
|
229
|
+
interface TableColumn {
|
|
230
|
+
key: string;
|
|
231
|
+
label: string;
|
|
232
|
+
/** True for number columns, which right-align (inline-end) and use tabular figures. */
|
|
233
|
+
numeric: boolean;
|
|
234
|
+
}
|
|
235
|
+
interface TableCell {
|
|
236
|
+
/** Machine value: a number, an ISO date string for times, text, or null when missing. */
|
|
237
|
+
value: string | number | null;
|
|
238
|
+
/** Display text, formatted for the locale. */
|
|
239
|
+
text: string;
|
|
240
|
+
}
|
|
241
|
+
interface ChartTable {
|
|
242
|
+
caption: string;
|
|
243
|
+
columns: TableColumn[];
|
|
244
|
+
rows: TableCell[][];
|
|
245
|
+
}
|
|
246
|
+
interface TableOptions {
|
|
247
|
+
datasets?: Datasets | undefined;
|
|
248
|
+
locale?: string | undefined;
|
|
249
|
+
messages?: ChartMessagesInput | undefined;
|
|
250
|
+
}
|
|
251
|
+
/** The table behind a built model. */
|
|
252
|
+
declare function modelToTable(model: ChartModel, options?: TableOptions): ChartTable;
|
|
253
|
+
/** The data table for a spec: the same rows the chart draws, as columns and cells. */
|
|
254
|
+
declare function chartToTable(spec: ChartSpec, options?: TableOptions): ChartTable;
|
|
255
|
+
interface CsvOptions extends TableOptions {
|
|
256
|
+
/** Field separator. Defaults to a comma. */
|
|
257
|
+
delimiter?: string;
|
|
258
|
+
/** Prefix a byte order mark so Excel opens the file as UTF-8. Defaults to false. */
|
|
259
|
+
bom?: boolean;
|
|
260
|
+
/** Include the header row. Defaults to true. */
|
|
261
|
+
header?: boolean;
|
|
158
262
|
}
|
|
263
|
+
/** Quotes a field when needed and neutralizes spreadsheet formulas in text. */
|
|
264
|
+
declare function escapeCsvField(value: string | number | null, delimiter?: string): string;
|
|
265
|
+
/** CSV text (RFC 4180 quoting, CRLF line breaks) for a built table. Machine values: raw numbers, ISO dates. */
|
|
266
|
+
declare function tableToCsv(table: ChartTable, { delimiter, bom, header }?: CsvOptions): string;
|
|
159
267
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
268
|
+
* CSV export of a spec's data. Text cells that start with `=`, `+`, `-` or `@`
|
|
269
|
+
* are prefixed with an apostrophe so spreadsheets never run them as formulas.
|
|
162
270
|
*/
|
|
163
|
-
declare function
|
|
271
|
+
declare function chartToCsv(spec: ChartSpec, options?: CsvOptions): string;
|
|
164
272
|
|
|
165
|
-
export {
|
|
166
|
-
export type {
|
|
273
|
+
export { ChartLayout, ChartMessagesInput, ChartModel, ChartSpec, Datasets, ExpressionError, LayoutOptions, Row, StackMode, chartToCsv, chartToTable, checkWhere, compileWhere, correlation, cumulativeSum, describeChart, describeModel, escapeCsvField, evaluateWhere, extent, forecastLinear, isValidChartSpec, layoutChart, linearRegression, lttb, lttbIndices, mean, median, minMax, minMaxIndices, modelToTable, movingAverage, patternIndex, percentChange, periodChange, quantile, regressionBand, stackValues, standardDeviation, sum, tableToCsv, trendDirection, validateChartSpec, variance };
|
|
274
|
+
export type { ChartDescription, ChartIssue, ChartTable, CsvOptions, DescribeOptions, IssueSeverity, LinearRegression, MaybeNumber, MovingAverageOptions, RegressionBand, StackedValue, TableCell, TableColumn, TableOptions, Trend, ValidateOptions, XY };
|