@ex-grid/chart 0.0.0-stage → 0.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +39 -2
- package/dist/index.d.ts +2358 -0
- package/dist/index.js +10048 -0
- package/dist/index.js.map +7 -0
- package/ex-chart.min.css +4 -0
- package/ex-chart.min.css.map +1 -0
- package/package.json +32 -4
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2358 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ExChart in TypeScript (ADR-0370): a chart's definition, checked when it is made, and the scene it is
|
|
3
|
+
* laid out as in CSS pixels — panels, axes, ticks, each series' lines, markers, candles and intervals —
|
|
4
|
+
* what its tooltip, its summary and its files say, the fits and interpolations a Consumer hands in, and a 3D
|
|
5
|
+
* surface as the mesh its entry draws and the 2D charts its slices are; the Chart Spec, a chart said in JSON as
|
|
6
|
+
* an AI writes it and a Board holds it, read against the tables its Data Handles name and answered as the tool an
|
|
7
|
+
* AI calls answers (ADR-0320); its Script
|
|
8
|
+
* Core, `createChart` and `createSurface`, which draw a chart as SVG into an element and hear the pointer, the
|
|
9
|
+
* legend and Chart Filters, free of any UI framework; and the selection bridge, `GridChartBridge`, which charts
|
|
10
|
+
* a grid's selection from its context menu and keeps the rows it was made from (ADR-0258). A Framework Adapter
|
|
11
|
+
* mounts it; the C# engine and this package are held to one another by the shared cases under
|
|
12
|
+
* `tests/cases/chart/`.
|
|
13
|
+
*
|
|
14
|
+
* @packageDocumentation
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import type { CellPosition } from '@ex-grid/core';
|
|
18
|
+
import type { GridColumn } from '@ex-grid/core';
|
|
19
|
+
import type { GridCommand } from '@ex-grid/core';
|
|
20
|
+
import type { GridContextMenuContext } from '@ex-grid/core';
|
|
21
|
+
import { GridDensity } from '@ex-grid/core';
|
|
22
|
+
import type { GridHeaderGroup } from '@ex-grid/core';
|
|
23
|
+
import type { GridSource } from '@ex-grid/core';
|
|
24
|
+
import type { RowKey } from '@ex-grid/core';
|
|
25
|
+
import type { RowKeyOf } from '@ex-grid/core';
|
|
26
|
+
import type { SelectionRange } from '@ex-grid/core';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Reads `text`, a Chart Spec, against `tables` and answers as the tool answers the AI: the refusal, or the
|
|
30
|
+
* chart said in words with how many pixels were thinned and how many points are missing, at `metrics`
|
|
31
|
+
* (800 by 400 CSS pixels by default). A surface is said as a screen reader hears it, with why a scale it
|
|
32
|
+
* asked for is not drawn. Anything thrown but a refusal of the spec or of the chart is thrown on.
|
|
33
|
+
*/
|
|
34
|
+
export declare function answerChartSpec(text: string, tables: (handle: string) => ChartData | undefined, metrics?: ChartMetrics): ChartSpecAnswer;
|
|
35
|
+
|
|
36
|
+
/** The keys a series' look is chosen by; the same key always takes the same look (ADR-0256). */
|
|
37
|
+
export declare interface AppearanceKeys {
|
|
38
|
+
/** The colour key. */
|
|
39
|
+
readonly colour: string;
|
|
40
|
+
/** The line-style key; absent for a solid line. */
|
|
41
|
+
readonly lineStyle?: string;
|
|
42
|
+
/** The marker key; absent for the first marker. */
|
|
43
|
+
readonly marker?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* How an axis places its positions (ADR-0251): in proportion, evenly as categories, or by their logarithm,
|
|
48
|
+
* all above zero (ADR-0290).
|
|
49
|
+
*/
|
|
50
|
+
export declare type AxisScale = 'proportional' | 'categories' | 'logarithmic';
|
|
51
|
+
|
|
52
|
+
/** The vertical axis a series reads on. */
|
|
53
|
+
export declare type AxisSide = 'left' | 'right';
|
|
54
|
+
|
|
55
|
+
/** How the horizontal axis is ticked and labelled: three independent choices. */
|
|
56
|
+
export declare interface AxisStyle {
|
|
57
|
+
/** Where the ticks go; `auto` by default. */
|
|
58
|
+
readonly placement?: TickPlacement;
|
|
59
|
+
/** How a date tick is labelled; `auto` by default. */
|
|
60
|
+
readonly label?: DateLabel;
|
|
61
|
+
/** The labels' angle: 0 (the default), 45 or 90 degrees, read upwards. */
|
|
62
|
+
readonly angle?: number;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** What the horizontal positions are: dates as day numbers, numbers, or labels by their index. */
|
|
66
|
+
export declare type AxisValues = 'dates' | 'numbers' | 'labels';
|
|
67
|
+
|
|
68
|
+
/** A lower and an upper bound. */
|
|
69
|
+
export declare type Bounds = readonly [lower: number, upper: number];
|
|
70
|
+
|
|
71
|
+
/** A rectangle in CSS pixels. */
|
|
72
|
+
export declare interface Box {
|
|
73
|
+
/** Its left. */
|
|
74
|
+
readonly x: number;
|
|
75
|
+
/** Its top. */
|
|
76
|
+
readonly y: number;
|
|
77
|
+
/** Its width. */
|
|
78
|
+
readonly width: number;
|
|
79
|
+
/** Its height. */
|
|
80
|
+
readonly height: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Lays `definition` out at `metrics`, narrowed by the options' view. `independentScales` lists the panels
|
|
85
|
+
* whose left and right axes the Consumer declared independent (ADR-0251); `legend` says where each panel's
|
|
86
|
+
* legend sits (ADR-0271).
|
|
87
|
+
*/
|
|
88
|
+
export declare function buildScene(definition: ChartDefinition, metrics: ChartMetrics, options?: SceneOptions): ChartScene;
|
|
89
|
+
|
|
90
|
+
/** The calendar period candles merge into past the plot's pixels (ADR-0302): each the market's own. */
|
|
91
|
+
export declare type CandlePeriod = 'row' | 'week' | 'month' | 'quarter' | 'year';
|
|
92
|
+
|
|
93
|
+
/** The horizontal axis, its defaults applied. */
|
|
94
|
+
export declare interface ChartAxis {
|
|
95
|
+
/** What the positions are. */
|
|
96
|
+
readonly values: AxisValues;
|
|
97
|
+
/** The axis' title. */
|
|
98
|
+
readonly title: string;
|
|
99
|
+
/** The scale declared, or absent for the default. */
|
|
100
|
+
readonly scale?: AxisScale;
|
|
101
|
+
/** The categories' labels. */
|
|
102
|
+
readonly labels: readonly string[];
|
|
103
|
+
/** The declared positions' labels. */
|
|
104
|
+
readonly named: readonly NamedPosition[];
|
|
105
|
+
/** Days in a year, for an Amount per period on dates. */
|
|
106
|
+
readonly daysPerYear: number;
|
|
107
|
+
/** Whether the sessions are packed. */
|
|
108
|
+
readonly packed: boolean;
|
|
109
|
+
/** The Consumer's writer of a position, if any. */
|
|
110
|
+
readonly format?: (position: number) => string;
|
|
111
|
+
/** The format code that writes its positions, if any (ADR-0420). */
|
|
112
|
+
readonly formatCode?: string;
|
|
113
|
+
/** The scale, defaults applied. */
|
|
114
|
+
readonly effectiveScale: AxisScale;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** The horizontal axis as a Consumer declares it (ADR-0251). */
|
|
118
|
+
export declare interface ChartAxisOptions {
|
|
119
|
+
/** What the positions are. */
|
|
120
|
+
readonly values: AxisValues;
|
|
121
|
+
/** The axis' title; empty by default. */
|
|
122
|
+
readonly title?: string;
|
|
123
|
+
/** How positions are placed; absent takes the default for `values`. */
|
|
124
|
+
readonly scale?: AxisScale;
|
|
125
|
+
/** The categories' labels in their order, for `labels`; position i is label i. */
|
|
126
|
+
readonly labels?: readonly string[];
|
|
127
|
+
/** Labels for declared positions, shown in place of the number. */
|
|
128
|
+
readonly named?: readonly NamedPosition[];
|
|
129
|
+
/** How many days a year has when an Amount per period on a Dates axis is drawn per year; 365.25 by default. */
|
|
130
|
+
readonly daysPerYear?: number;
|
|
131
|
+
/** The sessions packed (ADR-0301): each position a Price Range has one evenly spaced slot. */
|
|
132
|
+
readonly packed?: boolean;
|
|
133
|
+
/** Writes a position, as the column the positions came from writes it (ADR-0250). */
|
|
134
|
+
readonly format?: (position: number) => string;
|
|
135
|
+
/**
|
|
136
|
+
* An Excel number format code in the invariant spelling that writes every position (ADR-0420): a date code
|
|
137
|
+
* on a Dates axis, a number code on a Numbers axis, written invariantly. A code the reader does not read,
|
|
138
|
+
* one beside a `format`, and one on a Labels axis are refused.
|
|
139
|
+
*/
|
|
140
|
+
readonly formatCode?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/** The Chrome slots a chart takes: the parts a Wrapper draws, each in place of the built-in markup's. A slot not
|
|
144
|
+
* given is the built-in markup's. */
|
|
145
|
+
export declare interface ChartChrome {
|
|
146
|
+
/** The toolbar, with Chart Filters' range and the axis switch (ADR-0273, ADR-0281). */
|
|
147
|
+
readonly toolbar?: ChartChromeSlot<ChartToolbarSlotContext>;
|
|
148
|
+
/** The context menu's contents (ADR-0281). */
|
|
149
|
+
readonly menu?: ChartChromeSlot<ChartMenuSlotContext>;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* A Chrome slot's mount function (ADR-0350 section 9): it draws the part into `slot`, the element the chart made
|
|
154
|
+
* for it, from `context`, and answers the function that takes what it drew away. The chart calls that cleanup
|
|
155
|
+
* before the slot goes, and before it mounts again on the same slot with a new context.
|
|
156
|
+
*/
|
|
157
|
+
export declare type ChartChromeSlot<Context> = (slot: HTMLElement, context: Context) => () => void;
|
|
158
|
+
|
|
159
|
+
/** One command the chart decides (ADR-0281): what it is called, whether it is available, and what it does. */
|
|
160
|
+
export declare interface ChartCommand {
|
|
161
|
+
/** Stable, for an icon: one of `chartWordIds`' command ids. */
|
|
162
|
+
readonly id: string;
|
|
163
|
+
/** What it is called, in the chart's words. */
|
|
164
|
+
readonly label: string;
|
|
165
|
+
/** Whether it is available: Reset range is not while nothing is narrowed, CSV not on a chart its Chart Source thinned. */
|
|
166
|
+
readonly enabled: boolean;
|
|
167
|
+
/** For a toggle, Chart Filters and View as table, whether what it opens is open; absent on a plain command. */
|
|
168
|
+
readonly expanded?: boolean;
|
|
169
|
+
/** Why it is not available, where the chart says why (CSV on a thinned chart, ADR-0344); absent otherwise. */
|
|
170
|
+
readonly title?: string;
|
|
171
|
+
/** Runs it, as the built-in control's click does; from the context menu it closes the menu first. Nothing once
|
|
172
|
+
* the contents it was handed to are taken away or handed another context: what they drew is no longer the
|
|
173
|
+
* chart's (spine rule 6). */
|
|
174
|
+
readonly invoke: () => void;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* A row per point, after a byte-order mark: Series, the axis' title, Value, Kind (quoted, interpolated,
|
|
179
|
+
* extrapolated; a Price Range's columns are "price range", an Interval's bounds "interval") and Method (the
|
|
180
|
+
* Segment's). Its empty Value is only ever a missing one.
|
|
181
|
+
*/
|
|
182
|
+
export declare function chartCsvLong(definition: ChartDefinition, metrics: ChartMetrics, view?: ChartView): string;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A row per position, a column per series, after a byte-order mark — an Interpolated series' column says
|
|
186
|
+
* so, and a series with extrapolated points has a column of its own for them. An empty cell cannot tell a
|
|
187
|
+
* missing value from a position the series has no point at; the long form can.
|
|
188
|
+
*/
|
|
189
|
+
export declare function chartCsvWide(definition: ChartDefinition, metrics: ChartMetrics, view?: ChartView): string;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A table a chart reads by column name (ADR-0320, ADR-0322), as C#'s `IChartData` is read. A value is
|
|
193
|
+
* `null` where it is missing, and otherwise one of: a `number` (C#'s `double`), a `bigint` (a whole number,
|
|
194
|
+
* held exactly as C#'s `int` and `long` are), a Snapshot's decimal `{ mantissa, scale }` (C#'s `decimal`),
|
|
195
|
+
* a `string`, a `boolean`, a `Temporal.PlainDate` (C#'s `DateOnly`) or a `Temporal.PlainDateTime` (C#'s
|
|
196
|
+
* `DateTime`). A date is recognised by its own tag and read through its own members, never through the
|
|
197
|
+
* global `Temporal`, as `@ex-grid/data` reads one.
|
|
198
|
+
*/
|
|
199
|
+
export declare interface ChartData {
|
|
200
|
+
/** The columns' names, in the table's order. */
|
|
201
|
+
readonly columns: readonly string[];
|
|
202
|
+
/** How many rows it has. */
|
|
203
|
+
readonly rowCount: number;
|
|
204
|
+
/** The value in `column` at `row`, as the table holds it; `null` where it is missing. */
|
|
205
|
+
value(column: string, row: number): unknown;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* A table of columns held in memory, each `[name, values]`, all of one length: the reference implementation
|
|
210
|
+
* of {@link ChartData}, as C#'s `ChartData.Of` is. Two columns of one name, or columns of different lengths,
|
|
211
|
+
* are refused with a `TypeError`; reading a column it does not have, or a row past its last, with a
|
|
212
|
+
* `RangeError`.
|
|
213
|
+
*/
|
|
214
|
+
export declare function chartDataOf(columns: readonly (readonly [name: string, values: readonly unknown[]])[]): ChartData;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* What a chart is of, in the data's own terms (ADR-0251): its horizontal axis, its series and the
|
|
218
|
+
* Consumer's Notes. A definition that cannot be drawn honestly is refused when it is made, with a
|
|
219
|
+
* `ChartRefusedError` whose sentence says why.
|
|
220
|
+
*/
|
|
221
|
+
export declare class ChartDefinition {
|
|
222
|
+
#private;
|
|
223
|
+
/** A chart of the given series on the given axis; refused when it cannot be drawn as asked. */
|
|
224
|
+
constructor(options: ChartDefinitionOptions);
|
|
225
|
+
/** The horizontal axis. */
|
|
226
|
+
get axis(): ChartAxis;
|
|
227
|
+
/** The series, in the order the legend lists them. */
|
|
228
|
+
get series(): readonly ChartSeries[];
|
|
229
|
+
/** The Consumer's Notes. */
|
|
230
|
+
get notes(): readonly string[];
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** What a chart is of: its horizontal axis, its series, and the Consumer's Notes (ADR-0251, ADR-0257). */
|
|
234
|
+
export declare interface ChartDefinitionOptions {
|
|
235
|
+
/** The horizontal axis. */
|
|
236
|
+
readonly axis: ChartAxisOptions;
|
|
237
|
+
/** The series, in the order the legend lists them. */
|
|
238
|
+
readonly series: readonly ChartSeriesOptions[];
|
|
239
|
+
/** The Consumer's Notes: plain lines shown under the chart (ADR-0257). */
|
|
240
|
+
readonly notes?: readonly string[];
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/** An edge between two nodes of an Observation, each named by its point's `row` (ADR-0321). */
|
|
244
|
+
export declare interface ChartEdge {
|
|
245
|
+
/** The Row Key of the node it starts at. */
|
|
246
|
+
readonly from: unknown;
|
|
247
|
+
/** The Row Key of the node it ends at. */
|
|
248
|
+
readonly to: unknown;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/** An edge as the pointer finds it (ADR-0321). */
|
|
252
|
+
export declare interface ChartEdgeMark {
|
|
253
|
+
/** The series' identity. */
|
|
254
|
+
readonly seriesId: string;
|
|
255
|
+
/** The panel it is drawn in. */
|
|
256
|
+
readonly panel: number;
|
|
257
|
+
/** The edge as drawn, cut to the plot; its `index` names which of the series' edges it is. */
|
|
258
|
+
readonly edge: DrawnEdge;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/** The formats a chart saves as. */
|
|
262
|
+
export declare type ChartFileFormat = 'csv' | 'svg' | 'png';
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Chart Filters (ADR-0273): the range typed in the axis' own values, and the axis switch. The contents hold what is
|
|
266
|
+
* being typed; the chart reads it when it is applied, and says what it could not read rather than guess (spine
|
|
267
|
+
* rule 1).
|
|
268
|
+
*/
|
|
269
|
+
export declare interface ChartFiltersSlotContext {
|
|
270
|
+
/** What the axis holds: a date axis may take a date input, a category axis one of {@link ChartFiltersSlotContext.labels}. */
|
|
271
|
+
readonly values: AxisValues;
|
|
272
|
+
/** The categories of a category axis, in order; empty otherwise. */
|
|
273
|
+
readonly labels: readonly string[];
|
|
274
|
+
/** The range's start as the chart holds it, in the axis' text (a date as yyyy-MM-dd); `null` for the axis' own
|
|
275
|
+
* start. It changes when Chart Filters opens, a drag narrows the range, or Reset range returns it, and what the
|
|
276
|
+
* contents hold typed is then replaced by it. */
|
|
277
|
+
readonly from: string | null;
|
|
278
|
+
/** The range's end, likewise; `null` for the axis' own end. */
|
|
279
|
+
readonly to: string | null;
|
|
280
|
+
/** What a value looks like on this axis. */
|
|
281
|
+
readonly hint: string;
|
|
282
|
+
/** Why the last range applied was not taken; `null` when it was. */
|
|
283
|
+
readonly error: string | null;
|
|
284
|
+
/** Applies a typed range: an end empty or `null` is the axis' own end. Nothing once the contents are handed
|
|
285
|
+
* another context, as a command's `invoke`. */
|
|
286
|
+
readonly apply: (from: string | null, to: string | null) => void;
|
|
287
|
+
/** How positions are spaced, where the axis can be switched; absent where it cannot. */
|
|
288
|
+
readonly scale?: AxisScale;
|
|
289
|
+
/** Switches the axis; nothing once the contents are handed another context. */
|
|
290
|
+
readonly setScale: (scale: AxisScale) => void;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/** A chart drawn into an element, handed back by {@link createChart}. */
|
|
294
|
+
export declare interface ChartHandle {
|
|
295
|
+
/** Takes the options again, whole: what did not change costs nothing, and a part of the drawing that did
|
|
296
|
+
* not change is not touched (ADR-0252). */
|
|
297
|
+
update(options: ChartOptions): void;
|
|
298
|
+
/** Stops the chart: it hears nothing more and empties its element. */
|
|
299
|
+
destroy(): void;
|
|
300
|
+
/**
|
|
301
|
+
* Saves the chart as a file, as the user sees it (ADR-0282): `csv`, the visible series in the range shown;
|
|
302
|
+
* `svg`, the drawing; `png`, that drawing painted at the screen's Device Pixel. One call is one save. False
|
|
303
|
+
* for a CSV of a chart its Chart Source thinned (ADR-0344), and once the chart is destroyed.
|
|
304
|
+
*/
|
|
305
|
+
download(format: ChartFileFormat): Promise<boolean>;
|
|
306
|
+
/**
|
|
307
|
+
* Returns the range the user narrowed to the whole without raising `onRangeChanged`: for a Framework Adapter
|
|
308
|
+
* whose host learns only after the release that the data was replaced before it (ADR-0272, spine rule 6).
|
|
309
|
+
*/
|
|
310
|
+
dropRange(): void;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** The Consumer's word for an id, or `undefined` to keep the English. */
|
|
314
|
+
export declare type ChartLabel = (id: string) => string | undefined;
|
|
315
|
+
|
|
316
|
+
/** A marker of an Observation series as the pointer finds it (ADR-0290). */
|
|
317
|
+
export declare interface ChartMark {
|
|
318
|
+
/** The series' identity. */
|
|
319
|
+
readonly seriesId: string;
|
|
320
|
+
/** The panel it stands in. */
|
|
321
|
+
readonly panel: number;
|
|
322
|
+
/** Its centre across, in pixels. */
|
|
323
|
+
readonly x: number;
|
|
324
|
+
/** Its centre down, in pixels. */
|
|
325
|
+
readonly y: number;
|
|
326
|
+
/** The index of the series' point it stands for, the first where it stands for more than one. */
|
|
327
|
+
readonly point: number;
|
|
328
|
+
/** How many of the series' points it stands for. */
|
|
329
|
+
readonly count: number;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/** What the context menu's contents are handed (ADR-0281). The slot is the menu's frame (`role="menu"`, named by
|
|
333
|
+
* the chart), which opens where it was asked for and takes the keyboard; a click outside it, Escape on it or a
|
|
334
|
+
* command invoked closes it. The contents draw one item per command, in this order. */
|
|
335
|
+
export declare interface ChartMenuSlotContext {
|
|
336
|
+
/** The menu's accessible name. */
|
|
337
|
+
readonly name: string;
|
|
338
|
+
/** Reset range, View as table, then CSV, SVG and PNG. */
|
|
339
|
+
readonly commands: readonly ChartCommand[];
|
|
340
|
+
/** Closes the menu, for a dismissal of the contents' own; nothing once the menu has closed. */
|
|
341
|
+
readonly close: () => void;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** The geometry a chart is laid out with, in CSS pixels, resolved by the caller and never paired with a stylesheet literal. */
|
|
345
|
+
export declare interface ChartMetrics {
|
|
346
|
+
/** The chart's width. */
|
|
347
|
+
readonly width: number;
|
|
348
|
+
/** The chart's height. */
|
|
349
|
+
readonly height: number;
|
|
350
|
+
/** Device pixels per CSS pixel, which Thinning and sampling count in (ADR-0090); 1 by default. */
|
|
351
|
+
readonly devicePixelRatio?: number;
|
|
352
|
+
/** A label's height; 14 by default. */
|
|
353
|
+
readonly lineHeight?: number;
|
|
354
|
+
/** The space around the plots; 8 by default. */
|
|
355
|
+
readonly padding?: number;
|
|
356
|
+
/** The space between panels; 16 by default. */
|
|
357
|
+
readonly panelGap?: number;
|
|
358
|
+
/** A label's estimated width; text is never measured (ADR-0021). By default 0.6 of the line height a character. */
|
|
359
|
+
readonly textWidth?: (text: string) => number;
|
|
360
|
+
/** How many colour slots the stylesheet defines: ten, unless a theme declares more (ADR-0256). */
|
|
361
|
+
readonly colourSlots?: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** What a chart is drawn from, and what it tells. */
|
|
365
|
+
export declare interface ChartOptions {
|
|
366
|
+
/** The chart, in the data's terms. */
|
|
367
|
+
readonly definition: ChartDefinition;
|
|
368
|
+
/** The drawing's width in CSS pixels; geometry is an option, never only a stylesheet value (ADR-0027). 800 unless given. */
|
|
369
|
+
readonly width?: number;
|
|
370
|
+
/** The drawing's height in CSS pixels; 400 unless given. */
|
|
371
|
+
readonly height?: number;
|
|
372
|
+
/** The density whose font size and glyph widths lay out the labels, as a grid's (ADR-0016, ADR-0028); `standard` unless given. */
|
|
373
|
+
readonly density?: GridDensity;
|
|
374
|
+
/** The chart's name, which its accessible summary and its table's caption begin with (ADR-0275). */
|
|
375
|
+
readonly title?: string;
|
|
376
|
+
/** A description the Consumer adds after the generated summary. */
|
|
377
|
+
readonly description?: string;
|
|
378
|
+
/** Where the legend sits: top (the default), bottom, left or right, aligned, or none (ADR-0271). */
|
|
379
|
+
readonly legend?: LegendPlacement;
|
|
380
|
+
/** How the horizontal axis places and writes its ticks. */
|
|
381
|
+
readonly axisStyle?: AxisStyle;
|
|
382
|
+
/** The panels whose left and right axes the Consumer declared independent (ADR-0251). */
|
|
383
|
+
readonly independentScales?: ReadonlySet<string> | readonly string[];
|
|
384
|
+
/** How many colour slots the stylesheet defines: ten, unless a theme declares more (ADR-0256). */
|
|
385
|
+
readonly colourSlots?: number;
|
|
386
|
+
/** The keys of the series hidden, taken back from `onSeriesVisibilityChanged`. */
|
|
387
|
+
readonly hiddenSeries?: ReadonlySet<string> | readonly string[];
|
|
388
|
+
/** Hears the user hide or show a series from the legend. */
|
|
389
|
+
readonly onSeriesVisibilityChanged?: (change: SeriesVisibility) => void;
|
|
390
|
+
/** The range shown, taken back from `onRangeChanged`; absent or `null` for the whole range. */
|
|
391
|
+
readonly range?: ChartRange | null;
|
|
392
|
+
/** Hears the user narrow the range, or return it to the whole (`null`). */
|
|
393
|
+
readonly onRangeChanged?: (range: ChartRange | null) => void;
|
|
394
|
+
/** The scale the horizontal axis is switched to, taken back from `onScaleChanged`; absent for the declared one. */
|
|
395
|
+
readonly scale?: AxisScale;
|
|
396
|
+
/** Hears the user switch the horizontal axis under Chart Filters. */
|
|
397
|
+
readonly onScaleChanged?: (scale: AxisScale) => void;
|
|
398
|
+
/** The vertical axes' scale: `logarithmic`, or absent for proportional (ADR-0290). A value at or below zero keeps them proportional, with a Note naming it. */
|
|
399
|
+
readonly yScale?: AxisScale;
|
|
400
|
+
/** Hears a click on a point: pressed and released at one position, on the series nearest the pointer that has a value there (ADR-0258). */
|
|
401
|
+
readonly onPointClick?: (click: ChartPointClick) => void;
|
|
402
|
+
/** The name a saved file takes, without its extension; the title's when absent, else `chart` (ADR-0282). */
|
|
403
|
+
readonly fileName?: string;
|
|
404
|
+
/** The words of the built-in markup by id (ADR-0370 section 10): the Consumer's, `japaneseChartWords`, or the English. */
|
|
405
|
+
readonly label?: ChartLabel;
|
|
406
|
+
/** The parts a Wrapper's Chrome draws in place of the built-in markup: the toolbar and the context menu's
|
|
407
|
+
* contents (ADR-0281, ADR-0390). */
|
|
408
|
+
readonly chrome?: ChartChrome;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Whether a selection's series run down its columns or along its rows (ADR-0258). It comes from the grid's
|
|
413
|
+
* declarations, never from the selection's shape: `seriesInColumns` is a history, each column a series along
|
|
414
|
+
* an axis column (dates or numbers); `seriesInRows` is a curve, each row a series across columns at declared
|
|
415
|
+
* positions (tenors).
|
|
416
|
+
*/
|
|
417
|
+
export declare type ChartOrientation = 'seriesInColumns' | 'seriesInRows';
|
|
418
|
+
|
|
419
|
+
/** A point of a series: its position across and its value, or `null` where it is missing — a gap, never a zero. */
|
|
420
|
+
export declare interface ChartPoint {
|
|
421
|
+
/** The position: a day number, a number, or a category's index. */
|
|
422
|
+
readonly x: number;
|
|
423
|
+
/** The value, or `null` where it is missing. */
|
|
424
|
+
readonly y: ChartValue | null;
|
|
425
|
+
/** What the point is, such as a name, which an Observation's tooltip says (ADR-0290). */
|
|
426
|
+
readonly name?: string;
|
|
427
|
+
/** The Row Key of the row the point was read from, raised when it is clicked (ADR-0290). */
|
|
428
|
+
readonly row?: unknown;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/** A click on a point of a chart (ADR-0258): the series nearest the pointer, at the position clicked. */
|
|
432
|
+
export declare interface ChartPointClick {
|
|
433
|
+
/** The series' identity, as the Chart Definition gives it. */
|
|
434
|
+
readonly seriesId: string;
|
|
435
|
+
/** The position clicked, in the axis' own values. */
|
|
436
|
+
readonly position: number;
|
|
437
|
+
/** The Row Key of an Observation's point clicked, as its point gives it (ADR-0290); absent otherwise. */
|
|
438
|
+
readonly row?: unknown;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* The range of the horizontal axis the user narrowed the chart to (ADR-0273), in the axis' own values — a
|
|
443
|
+
* date's day number, a number, a category's index — never in pixels (ADR-0272). An end left out is the
|
|
444
|
+
* data's own.
|
|
445
|
+
*/
|
|
446
|
+
export declare interface ChartRange {
|
|
447
|
+
/** The first position shown; absent for the data's first. */
|
|
448
|
+
readonly from?: number;
|
|
449
|
+
/** The last position shown; absent for the data's last. */
|
|
450
|
+
readonly to?: number;
|
|
451
|
+
/** The lowest value the left axis shows, which a rectangle dragged across a scatter narrows (ADR-0290); absent for the data's. */
|
|
452
|
+
readonly yFrom?: number;
|
|
453
|
+
/** The highest; absent for the data's. */
|
|
454
|
+
readonly yTo?: number;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
/** What the tooltip says at one position in one panel, over a mark or over an edge (ADR-0270). */
|
|
458
|
+
export declare interface ChartReading {
|
|
459
|
+
/** The position, written as the axis writes it, or what the mark or the edge is named by. */
|
|
460
|
+
readonly position: string;
|
|
461
|
+
/** The lines shown, top to bottom: the nearest to the pointer's height, as many as fit the plot. */
|
|
462
|
+
readonly lines: readonly ReadingLine[];
|
|
463
|
+
/** How many series are not listed, which the tooltip says as "and M more series"; never a silent cut. */
|
|
464
|
+
readonly more: number;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
/** A chart that cannot be drawn as it was asked for, said by name (spine rule 1). */
|
|
468
|
+
export declare class ChartRefusedError extends Error {
|
|
469
|
+
/** A refusal saying why. */
|
|
470
|
+
constructor(message: string);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/** A chart laid out in CSS pixels as immutable pieces (ADR-0252). */
|
|
474
|
+
export declare interface ChartScene {
|
|
475
|
+
/** The panels, top to bottom. */
|
|
476
|
+
readonly panels: readonly PanelScene[];
|
|
477
|
+
/** The horizontal axis' ticks, each with its pixel position. */
|
|
478
|
+
readonly xTicks: readonly HorizontalTick[];
|
|
479
|
+
/** The first position shown. */
|
|
480
|
+
readonly xFrom: number;
|
|
481
|
+
/** The last. */
|
|
482
|
+
readonly xTo: number;
|
|
483
|
+
/** The lines said under the chart: the Consumer's Notes, each Segment's method, and what the scene itself must say. */
|
|
484
|
+
readonly notes: readonly string[];
|
|
485
|
+
/** The positions the pointer can be over, each with its pixel position, left to right (ADR-0255). */
|
|
486
|
+
readonly positions: readonly PointerPosition[];
|
|
487
|
+
/** Whether a visible series is an Observation: the pointer then finds the nearest mark (ADR-0290). */
|
|
488
|
+
readonly scatter: boolean;
|
|
489
|
+
/** The Observation series' marks, in drawing order (ADR-0290). */
|
|
490
|
+
readonly marks: readonly ChartMark[];
|
|
491
|
+
/** The edges drawn, which the pointer finds the nearest of where no mark is within reach (ADR-0321). */
|
|
492
|
+
readonly edgeMarks: readonly ChartEdgeMark[];
|
|
493
|
+
/** Whether the axis across is logarithmic as drawn (ADR-0290). */
|
|
494
|
+
readonly logarithmicX: boolean;
|
|
495
|
+
/** The colour bars of the visible series that take their colour from a column (ADR-0320). */
|
|
496
|
+
readonly colourKeys: readonly ColourKey[];
|
|
497
|
+
/** The size keys of the visible series that take their size from a column (ADR-0320). */
|
|
498
|
+
readonly sizeKeys: readonly SizeKey[];
|
|
499
|
+
/** The horizontal axis' title as drawn, with what the scene must add to it (ADR-0301, ADR-0302). */
|
|
500
|
+
readonly xTitle: string;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** One series, its defaults applied. */
|
|
504
|
+
export declare interface ChartSeries {
|
|
505
|
+
/** Its identity. */
|
|
506
|
+
readonly id: string;
|
|
507
|
+
/** Its name. */
|
|
508
|
+
readonly name: string;
|
|
509
|
+
/** Its Series Kind. */
|
|
510
|
+
readonly kind: SeriesKind;
|
|
511
|
+
/** Which interval a step's point stands for. */
|
|
512
|
+
readonly step: StepSide;
|
|
513
|
+
/** The vertical axis it reads on. */
|
|
514
|
+
readonly axis: AxisSide;
|
|
515
|
+
/** Its panel. */
|
|
516
|
+
readonly panel: string;
|
|
517
|
+
/** The keys declared, if any. */
|
|
518
|
+
readonly keys?: AppearanceKeys;
|
|
519
|
+
/** Whether it said it reaches zero, if it said. */
|
|
520
|
+
readonly fromZero?: boolean;
|
|
521
|
+
/** Whether it is the Consumer's interpolation. */
|
|
522
|
+
readonly interpolated: boolean;
|
|
523
|
+
/** Its Segments. */
|
|
524
|
+
readonly segments: readonly Segment[];
|
|
525
|
+
/** Its points; a Price Range's are its closes. */
|
|
526
|
+
readonly points: readonly ChartPoint[];
|
|
527
|
+
/** Its colour scale, if any. */
|
|
528
|
+
readonly colourBy?: PointColour;
|
|
529
|
+
/** Its size scale, if any. */
|
|
530
|
+
readonly sizeBy?: PointSize;
|
|
531
|
+
/** Its tooltip's columns. */
|
|
532
|
+
readonly details: readonly PointDetail[];
|
|
533
|
+
/** Its edges. */
|
|
534
|
+
readonly edges: readonly ChartEdge[];
|
|
535
|
+
/** A Price Range's rows. */
|
|
536
|
+
readonly bars: readonly PriceBar[];
|
|
537
|
+
/** A Price Range's fixed period, if any. */
|
|
538
|
+
readonly mergeTo?: CandlePeriod;
|
|
539
|
+
/** Its vertical Interval, if any. */
|
|
540
|
+
readonly interval?: SeriesInterval;
|
|
541
|
+
/** Its horizontal Interval, if any. */
|
|
542
|
+
readonly xInterval?: SeriesInterval;
|
|
543
|
+
/** What its source's thinned pixels held. */
|
|
544
|
+
readonly thinned: readonly PixelSummary[];
|
|
545
|
+
/** Its function, if it is sampled. */
|
|
546
|
+
readonly sampler?: SeriesSampler;
|
|
547
|
+
/** Its writer of values, if any. */
|
|
548
|
+
readonly format?: (value: ChartValue) => string;
|
|
549
|
+
/** The format code that writes its values, if any (ADR-0420). */
|
|
550
|
+
readonly formatCode?: string;
|
|
551
|
+
/** The keys its look is chosen by, its id standing for a colour key it does not set. */
|
|
552
|
+
readonly effectiveKeys: AppearanceKeys;
|
|
553
|
+
/** Whether its axis reaches zero, defaults applied. */
|
|
554
|
+
readonly reachesZero: boolean;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
/** One series as a Consumer declares it, in the data's own terms (ADR-0251). */
|
|
558
|
+
export declare interface ChartSeriesOptions {
|
|
559
|
+
/** The series' identity in the chart: unique, and stable through a sort or a recalculation. */
|
|
560
|
+
readonly id: string;
|
|
561
|
+
/** Its name in the legend and the tooltip. */
|
|
562
|
+
readonly name: string;
|
|
563
|
+
/** What its numbers are; a series that declares none is refused (ADR-0253). */
|
|
564
|
+
readonly kind: SeriesKind;
|
|
565
|
+
/** Which interval a step's point stands for; `preceding` by default. */
|
|
566
|
+
readonly step?: StepSide;
|
|
567
|
+
/** The vertical axis it reads on; `left` by default. */
|
|
568
|
+
readonly axis?: AxisSide;
|
|
569
|
+
/** The panel it is drawn in; series naming the same panel share it. Empty by default. */
|
|
570
|
+
readonly panel?: string;
|
|
571
|
+
/** The keys its look is chosen by (ADR-0256); by default its colour key is its id. */
|
|
572
|
+
readonly keys?: AppearanceKeys;
|
|
573
|
+
/** Whether its axis reaches zero; absent takes the default for its kind (ADR-0253, ADR-0290). */
|
|
574
|
+
readonly fromZero?: boolean;
|
|
575
|
+
/** Whether it is values the Consumer computed between quotes (ADR-0257). */
|
|
576
|
+
readonly interpolated?: boolean;
|
|
577
|
+
/** The ranges of an Interpolated series and each one's method (ADR-0257). */
|
|
578
|
+
readonly segments?: readonly Segment[];
|
|
579
|
+
/** Its points, in increasing position (an Observation's in any order). */
|
|
580
|
+
readonly points?: readonly ChartPoint[];
|
|
581
|
+
/** An Observation's colour read from a column (ADR-0320). */
|
|
582
|
+
readonly colourBy?: PointColour;
|
|
583
|
+
/** An Observation's size read from a column (ADR-0320). */
|
|
584
|
+
readonly sizeBy?: PointSize;
|
|
585
|
+
/** An Observation's columns its tooltip says (ADR-0321). */
|
|
586
|
+
readonly details?: readonly PointDetail[];
|
|
587
|
+
/** An Observation's edges between its nodes (ADR-0321). */
|
|
588
|
+
readonly edges?: readonly ChartEdge[];
|
|
589
|
+
/** A Price Range's rows (ADR-0300); its points are then each row's close, or a gap. */
|
|
590
|
+
readonly bars?: readonly PriceBar[];
|
|
591
|
+
/** A Price Range's period fixed by the Consumer (ADR-0302). */
|
|
592
|
+
readonly mergeTo?: CandlePeriod;
|
|
593
|
+
/** The vertical Interval (ADR-0303, ADR-0304). */
|
|
594
|
+
readonly interval?: SeriesInterval;
|
|
595
|
+
/** An Observation's horizontal Interval (ADR-0304). */
|
|
596
|
+
readonly xInterval?: SeriesInterval;
|
|
597
|
+
/** What each pixel its Chart Source thinned held (ADR-0344). */
|
|
598
|
+
readonly thinned?: readonly PixelSummary[];
|
|
599
|
+
/** The function it is sampled from, in place of points. */
|
|
600
|
+
readonly sampler?: SeriesSampler;
|
|
601
|
+
/** Writes one of its values, as its column does (ADR-0250, ADR-0251). */
|
|
602
|
+
readonly format?: (value: ChartValue) => string;
|
|
603
|
+
/**
|
|
604
|
+
* An Excel number format code in the invariant spelling that writes every value, held or computed (ADR-0420),
|
|
605
|
+
* written invariantly. A code the reader does not read, a date code, and one beside a `format` are refused.
|
|
606
|
+
*/
|
|
607
|
+
readonly formatCode?: string;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Where a chart reads a series' points (ADR-0322): thinned where the data lives. The counterpart of C#'s
|
|
612
|
+
* `IChartSource`.
|
|
613
|
+
*/
|
|
614
|
+
export declare interface ChartSource {
|
|
615
|
+
/** Answers `query` with the points the chart draws; `signal` is aborted when the chart no longer waits for it. */
|
|
616
|
+
thin(query: ChartSourceQuery, signal: AbortSignal): Promise<ChartSourceAnswer>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
/**
|
|
620
|
+
* A {@link ChartSource}'s answer (ADR-0344): the rows kept, in order across, as a table with the query's `x` and
|
|
621
|
+
* `y` columns, what each thinned pixel held, and the version of the data it was read from. The counterpart of C#'s
|
|
622
|
+
* `ChartSourceAnswer`.
|
|
623
|
+
*/
|
|
624
|
+
export declare interface ChartSourceAnswer {
|
|
625
|
+
/** The version of the data the answer was read from, as a Snapshot names its own; an answer for an older one is never
|
|
626
|
+
* drawn over a newer one. */
|
|
627
|
+
readonly version: bigint;
|
|
628
|
+
/** The rows kept, in order across. */
|
|
629
|
+
readonly points: ChartData;
|
|
630
|
+
/** What each pixel that held more than one row held, in the data's positions; empty when nothing was thinned. */
|
|
631
|
+
readonly thinned: readonly PixelSummary[];
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/** A Chart Source over a table held in the page, thinning it as it is asked, its answers naming `version`; a refusal is
|
|
635
|
+
* its promise's. */
|
|
636
|
+
export declare function chartSourceOver(data: ChartData, version?: bigint): ChartSource;
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* What a chart asks a {@link ChartSource} (ADR-0322, ADR-0344): one column of values, read across another, from
|
|
640
|
+
* `from` to `to`, at `pixels` columns. The counterpart of C#'s `ChartSourceQuery`.
|
|
641
|
+
*/
|
|
642
|
+
export declare interface ChartSourceQuery {
|
|
643
|
+
/** The Data Handle the series reads. */
|
|
644
|
+
readonly data: string;
|
|
645
|
+
/** The column across. */
|
|
646
|
+
readonly x: string;
|
|
647
|
+
/** The column of values. */
|
|
648
|
+
readonly y: string;
|
|
649
|
+
/** What the axis places: dates, as their day numbers, or numbers. A labels axis is never asked of a source. */
|
|
650
|
+
readonly values: AxisValues;
|
|
651
|
+
/** The first position asked for, in the axis' own values; `null` for the data's first. */
|
|
652
|
+
readonly from: number | null;
|
|
653
|
+
/** The last, or `null` for the data's last. */
|
|
654
|
+
readonly to: number | null;
|
|
655
|
+
/** How many columns the range is cut into, each keeping its first, last, lowest and highest point. */
|
|
656
|
+
readonly pixels: number;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/** A Chart Spec read through Chart Sources (ADR-0344): its reading, and the version each Data Handle was read at. */
|
|
660
|
+
export declare interface ChartSourceReading {
|
|
661
|
+
/** The title and the definition. */
|
|
662
|
+
readonly reading: ChartSpecReading;
|
|
663
|
+
/** The version each Data Handle's answers named. */
|
|
664
|
+
readonly versions: ReadonlyMap<string, bigint>;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
/** What the tool answers the AI: the counterpart of C#'s `ChartSpecAnswer`. */
|
|
668
|
+
export declare type ChartSpecAnswer = {
|
|
669
|
+
/** The chart can be drawn. */
|
|
670
|
+
readonly accepted: true;
|
|
671
|
+
/** The chart said in words, to check against what was meant. */
|
|
672
|
+
readonly text: string;
|
|
673
|
+
/** The spec read. */
|
|
674
|
+
readonly reading: ChartSpecReading;
|
|
675
|
+
} | {
|
|
676
|
+
/** The chart cannot be drawn. */
|
|
677
|
+
readonly accepted: false;
|
|
678
|
+
/** The refusal, which names the path and the reason, for the AI to act on. */
|
|
679
|
+
readonly text: string;
|
|
680
|
+
/** No reading: nothing was drawn. */
|
|
681
|
+
readonly reading: undefined;
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
/** A Chart Spec read: its title, and the Chart Definition or the 3D surface it describes. */
|
|
685
|
+
export declare class ChartSpecReading {
|
|
686
|
+
#private;
|
|
687
|
+
/** A spec of series, or of a 3D surface, read. */
|
|
688
|
+
constructor(options: ChartSpecReadingOptions);
|
|
689
|
+
/** The chart's title, or empty when the spec gives none. */
|
|
690
|
+
get title(): string;
|
|
691
|
+
/**
|
|
692
|
+
* The chart of series, its points read from the tables the spec names. A spec of a 3D surface, which
|
|
693
|
+
* {@link ChartSpecReading.surface} holds, throws an `Error`: a chart of series read from it would be no
|
|
694
|
+
* chart at all (spine rule 1).
|
|
695
|
+
*/
|
|
696
|
+
get definition(): ChartDefinition;
|
|
697
|
+
/** The 3D surface a spec of one describes (ADR-0274); `undefined` for a spec of series. */
|
|
698
|
+
get surface(): SurfaceDefinition | undefined;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/** A Chart Spec read: its title, and the Chart Definition or the 3D surface it describes. */
|
|
702
|
+
export declare type ChartSpecReadingOptions = {
|
|
703
|
+
/** The chart's title, or empty when the spec gives none. */
|
|
704
|
+
readonly title: string;
|
|
705
|
+
/** The chart, its points read from the tables the spec names. */
|
|
706
|
+
readonly definition: ChartDefinition;
|
|
707
|
+
} | {
|
|
708
|
+
/** The surface's title, or empty when the spec gives none. */
|
|
709
|
+
readonly title: string;
|
|
710
|
+
/** The surface, its points read from the tables the spec names (ADR-0274). */
|
|
711
|
+
readonly surface: SurfaceDefinition;
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
/**
|
|
715
|
+
* A Chart Spec that cannot be drawn (ADR-0320): its message names the path in the spec and the reason, in
|
|
716
|
+
* one sentence a host returns to the AI that wrote it, so the AI can correct the spec. The counterpart of
|
|
717
|
+
* C#'s `ChartSpecRefusedException`.
|
|
718
|
+
*/
|
|
719
|
+
export declare class ChartSpecRefusedError extends Error {
|
|
720
|
+
/** Where in the spec it was refused, such as `series[1].kind`; empty for the spec as a whole. */
|
|
721
|
+
readonly path: string;
|
|
722
|
+
/** A refusal at `path`, said by `message`. */
|
|
723
|
+
constructor(path: string, message: string);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
/** The version of the Chart Spec this reader reads. */
|
|
727
|
+
export declare const chartSpecVersion = 1;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* The chart's name, the horizontal axis with its range, each panel's vertical axes with theirs, and each
|
|
731
|
+
* visible series with its maximum, written through its format, then the Consumer's description. The view
|
|
732
|
+
* is the scene's own: what it hides and the range it shows are already laid out in it.
|
|
733
|
+
*/
|
|
734
|
+
export declare function chartSummary(definition: ChartDefinition, scene: ChartScene, title?: string, description?: string): string;
|
|
735
|
+
|
|
736
|
+
/** A table of what the chart shows: a header and rows of invariant text. */
|
|
737
|
+
export declare interface ChartTable {
|
|
738
|
+
/** The column headers: the axis' title, then a column per series. */
|
|
739
|
+
readonly header: readonly string[];
|
|
740
|
+
/** A row per position. */
|
|
741
|
+
readonly rows: readonly (readonly string[])[];
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
/** The wide form's header and rows, unquoted: what "View as table" shows (ADR-0275), the same content as {@link chartCsvWide}. */
|
|
745
|
+
export declare function chartTable(definition: ChartDefinition, metrics: ChartMetrics, view?: ChartView): ChartTable;
|
|
746
|
+
|
|
747
|
+
/** A chart the user registered as a target of "Add to chart" (ADR-0258, U7). */
|
|
748
|
+
export declare interface ChartTarget {
|
|
749
|
+
/** The chart's name, as the menu item says it. */
|
|
750
|
+
readonly name: string;
|
|
751
|
+
/** The chart as it stands. */
|
|
752
|
+
readonly chart: GridChart;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/** What the toolbar's contents are handed (ADR-0281). The slot stands above the plot; the contents draw the toolbar
|
|
756
|
+
* (`role="toolbar"`, named {@link ChartToolbarSlotContext.name}) and, while {@link ChartToolbarSlotContext.filters} is
|
|
757
|
+
* given, Chart Filters below it. */
|
|
758
|
+
export declare interface ChartToolbarSlotContext {
|
|
759
|
+
/** The toolbar's accessible name: the chart's title, or its word for a chart. */
|
|
760
|
+
readonly name: string;
|
|
761
|
+
/** Chart Filters' toggle, Reset range, View as table, then CSV, SVG and PNG, in that order. */
|
|
762
|
+
readonly commands: readonly ChartCommand[];
|
|
763
|
+
/** Chart Filters while it is open; absent while it is closed. */
|
|
764
|
+
readonly filters?: ChartFiltersSlotContext;
|
|
765
|
+
/** One of the chart's words by its id (`chartWordIds`): the Consumer's `label`, else the built-in English. */
|
|
766
|
+
readonly label: (id: string) => string;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* A series' value: a number, or a whole number held exactly as a bigint, so the tooltip and the files
|
|
771
|
+
* write the digits the cell holds (ADR-0251). It becomes a number only where a position is computed.
|
|
772
|
+
*/
|
|
773
|
+
export declare type ChartValue = number | bigint;
|
|
774
|
+
|
|
775
|
+
/** What the viewer narrowed a chart to — its Chart Filters — which narrow the drawing, never the definition. */
|
|
776
|
+
export declare interface ChartView {
|
|
777
|
+
/** The identities of the series hidden. */
|
|
778
|
+
readonly hidden?: ReadonlySet<string> | readonly string[];
|
|
779
|
+
/** The first position shown; absent for the data's first. */
|
|
780
|
+
readonly from?: number;
|
|
781
|
+
/** The last position shown; absent for the data's last. */
|
|
782
|
+
readonly to?: number;
|
|
783
|
+
/** The scale the viewer switched the axis to; absent for the declared one (ADR-0251). */
|
|
784
|
+
readonly scale?: AxisScale;
|
|
785
|
+
/** The lowest value the left axis shows; absent for the data's (ADR-0290). */
|
|
786
|
+
readonly yFrom?: number;
|
|
787
|
+
/** The highest; absent for the data's. */
|
|
788
|
+
readonly yTo?: number;
|
|
789
|
+
/** The vertical axes' scale: `logarithmic`, or absent or `proportional` (ADR-0290). */
|
|
790
|
+
readonly yScale?: AxisScale;
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
/** Every id of ExChart's words, in no particular order. */
|
|
794
|
+
export declare const chartWordIdList: readonly string[];
|
|
795
|
+
|
|
796
|
+
/** The ids of the words ExChart's built-in markup shows. A command's id is its command id (`chartCommandIds`). */
|
|
797
|
+
export declare const chartWordIds: Readonly<{
|
|
798
|
+
/** Opens or closes Chart Filters (ADR-0273): `Chart Filters`. */
|
|
799
|
+
filters: "exchart.filters";
|
|
800
|
+
/** Returns the range to the whole axis: `Reset range`. */
|
|
801
|
+
resetRange: "exchart.reset-range";
|
|
802
|
+
/** Shows the chart's data as a table (ADR-0275): `View as table`. */
|
|
803
|
+
table: "exchart.table";
|
|
804
|
+
/** The menu's word for the table while it is shown: `Hide table`. */
|
|
805
|
+
hideTable: "exchart.table.hide";
|
|
806
|
+
/** The toolbar's CSV button (ADR-0282): `CSV`. */
|
|
807
|
+
downloadCsv: "exchart.download.csv";
|
|
808
|
+
/** The toolbar's SVG button: `SVG`. */
|
|
809
|
+
downloadSvg: "exchart.download.svg";
|
|
810
|
+
/** The toolbar's PNG button: `PNG`. */
|
|
811
|
+
downloadPng: "exchart.download.png";
|
|
812
|
+
/** The menu's CSV command: `Download CSV`. */
|
|
813
|
+
menuDownloadCsv: "exchart.menu.download.csv";
|
|
814
|
+
/** The menu's SVG command: `Download SVG`. */
|
|
815
|
+
menuDownloadSvg: "exchart.menu.download.svg";
|
|
816
|
+
/** The menu's PNG command: `Download PNG`. */
|
|
817
|
+
menuDownloadPng: "exchart.menu.download.png";
|
|
818
|
+
/** The downloads' group name: `Download`. */
|
|
819
|
+
downloads: "exchart.downloads";
|
|
820
|
+
/** The chart's name where it has no title: `Chart`. */
|
|
821
|
+
chart: "exchart.chart";
|
|
822
|
+
/** The table's caption where the chart has no title: `Chart data`. */
|
|
823
|
+
chartData: "exchart.chart-data";
|
|
824
|
+
/** Chart Filters' start: `From`. */
|
|
825
|
+
from: "exchart.filters.from";
|
|
826
|
+
/** Chart Filters' end: `To`. */
|
|
827
|
+
to: "exchart.filters.to";
|
|
828
|
+
/** Applies the typed range: `Apply`. */
|
|
829
|
+
apply: "exchart.filters.apply";
|
|
830
|
+
/** The axis switch: `Axis`. */
|
|
831
|
+
axis: "exchart.filters.axis";
|
|
832
|
+
/** A proportional axis: `Proportional`. */
|
|
833
|
+
proportional: "exchart.filters.proportional";
|
|
834
|
+
/** An axis of categories: `Categories`. */
|
|
835
|
+
categories: "exchart.filters.categories";
|
|
836
|
+
/** What a value on a date axis looks like: `yyyy-MM-dd`. */
|
|
837
|
+
dateHint: "exchart.filters.hint.date";
|
|
838
|
+
/** On a category axis: `category`. */
|
|
839
|
+
categoryHint: "exchart.filters.hint.category";
|
|
840
|
+
/** On a number axis: `number`. */
|
|
841
|
+
numberHint: "exchart.filters.hint.number";
|
|
842
|
+
/** A typed value the axis does not hold, `{0}` the text and `{1}` what the axis holds: `“{0}” is not {1} on this axis.` */
|
|
843
|
+
notOnAxis: "exchart.filters.not-on-axis";
|
|
844
|
+
/** What a date axis holds: `a date (yyyy-MM-dd)`. */
|
|
845
|
+
aDate: "exchart.filters.a-date";
|
|
846
|
+
/** What a category axis holds: `a category`. */
|
|
847
|
+
aCategory: "exchart.filters.a-category";
|
|
848
|
+
/** What a number axis holds: `a number`. */
|
|
849
|
+
aNumber: "exchart.filters.a-number";
|
|
850
|
+
/** A typed range backwards: `From is after To.` */
|
|
851
|
+
fromAfterTo: "exchart.filters.from-after-to";
|
|
852
|
+
/** Why a chart its Chart Source thinned saves no CSV and shows no table (ADR-0344). */
|
|
853
|
+
thinnedAtSource: "exchart.thinned-at-source";
|
|
854
|
+
/** The tooltip's count of the series it does not list, one: `and 1 more series`. */
|
|
855
|
+
oneMoreSeries: "exchart.tooltip.one-more";
|
|
856
|
+
/** The same for more than one, `{0}` the count: `and {0} more series`. */
|
|
857
|
+
moreSeries: "exchart.tooltip.more";
|
|
858
|
+
/** The notice of a stylesheet of another version (ADR-0123). */
|
|
859
|
+
stylesheetNotice: "exchart.notice.stylesheet";
|
|
860
|
+
/** A 3D surface's button that returns its view (ADR-0274): `Reset view`. */
|
|
861
|
+
resetView: "exchart.surface.reset-view";
|
|
862
|
+
/** A surface's name where it has no title: `Surface`. */
|
|
863
|
+
surface: "exchart.surface";
|
|
864
|
+
/** A surface's table's caption where it has no title: `Surface data`. */
|
|
865
|
+
surfaceData: "exchart.surface.data";
|
|
866
|
+
/** What a surface's box is announced as: `3D surface`. */
|
|
867
|
+
surfaceRole: "exchart.surface.role";
|
|
868
|
+
/** The values' name where the surface gives none: `Value`. */
|
|
869
|
+
surfaceValue: "exchart.surface.value";
|
|
870
|
+
/** The tooltip's note on a value the data holds, on a surface the Consumer interpolated (ADR-0257): `quoted`. */
|
|
871
|
+
quoted: "exchart.surface.quoted";
|
|
872
|
+
/** The note on an interpolated value, `{0}` the method: `interpolated, {0}`. */
|
|
873
|
+
interpolated: "exchart.surface.interpolated";
|
|
874
|
+
/** A slice a grid does not hold, `{0}` the axis and `{1}` the value: `No slice at {0} {1}: this surface has no such value.` */
|
|
875
|
+
noSliceOnGrid: "exchart.surface.no-slice.grid";
|
|
876
|
+
/** A slice no triangle of a mesh crosses: `No slice at {0} {1}: no triangle of the mesh crosses there.` */
|
|
877
|
+
noSliceOnMesh: "exchart.surface.no-slice.mesh";
|
|
878
|
+
}>;
|
|
879
|
+
|
|
880
|
+
/** The colour bar a series' colour is read on (ADR-0320). */
|
|
881
|
+
export declare interface ColourKey {
|
|
882
|
+
/** The series it belongs to. */
|
|
883
|
+
readonly seriesId: string;
|
|
884
|
+
/** What the colours are. */
|
|
885
|
+
readonly title: string;
|
|
886
|
+
/** The value at the foot of the lowest band. */
|
|
887
|
+
readonly from: number;
|
|
888
|
+
/** The value at the head of the highest band. */
|
|
889
|
+
readonly to: number;
|
|
890
|
+
/** Its ticks, the centre always among them when it diverges. */
|
|
891
|
+
readonly ticks: readonly KeyTick[];
|
|
892
|
+
/** Whether the bands diverge from a centre, which the middle band holds. */
|
|
893
|
+
readonly diverging: boolean;
|
|
894
|
+
/** The bar's box in CSS pixels; its title stands above it. */
|
|
895
|
+
readonly box: Box;
|
|
896
|
+
/** How many bands it is drawn in, low to high. */
|
|
897
|
+
readonly bands: number;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
/** A column, by its name, at the rows it was made from (series in columns). */
|
|
901
|
+
export declare interface ColumnSeries {
|
|
902
|
+
/** Says the series is a column. */
|
|
903
|
+
readonly type: 'column';
|
|
904
|
+
/** The series' identity in the Chart Definition: the column's name. */
|
|
905
|
+
readonly id: string;
|
|
906
|
+
/** The panel it was given when it was made: its Header Group, or a panel of its own for a Diff (ADR-0251). */
|
|
907
|
+
readonly panel: string;
|
|
908
|
+
/** The column's name. */
|
|
909
|
+
readonly column: string;
|
|
910
|
+
/** The rows it is charted at, by Row Key: its own, as every Excel series has its own ranges (U8). */
|
|
911
|
+
readonly rows: readonly KeyedPosition[];
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
|
+
* Draws a chart into `element`, which becomes its instance root (ADR-0370 section 1): the chart owns
|
|
916
|
+
* everything inside it, and the element's own class and style it writes. A Framework Adapter renders the
|
|
917
|
+
* element and hands the chart its props; nothing here assumes React's lifecycle or Blazor's.
|
|
918
|
+
*/
|
|
919
|
+
export declare function createChart(element: HTMLElement, options: ChartOptions): ChartHandle;
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* Draws a 3D surface into `element`, which becomes its instance root (ADR-0274, ADR-0370 section 1): the
|
|
923
|
+
* surface owns everything inside it. A Framework Adapter renders the element and hands the surface its props.
|
|
924
|
+
*/
|
|
925
|
+
export declare function createSurface(element: HTMLElement, options: SurfaceOptions): SurfaceHandle;
|
|
926
|
+
|
|
927
|
+
/** How a date tick is labelled: the finest format the ticks need, 2026, 2026-10, 2026-10-19, Oct 2026, or a tenor. */
|
|
928
|
+
export declare type DateLabel = 'auto' | 'year' | 'yearMonth' | 'date' | 'monthYear' | 'tenor';
|
|
929
|
+
|
|
930
|
+
/** The view a surface is first drawn at. */
|
|
931
|
+
export declare const defaultSurfaceView: SurfaceView;
|
|
932
|
+
|
|
933
|
+
/** An edge in CSS pixels, cut at the plot's edges. */
|
|
934
|
+
export declare interface DrawnEdge {
|
|
935
|
+
/** Where it starts across. */
|
|
936
|
+
readonly x1: number;
|
|
937
|
+
/** Where it starts down. */
|
|
938
|
+
readonly y1: number;
|
|
939
|
+
/** Where it ends across. */
|
|
940
|
+
readonly x2: number;
|
|
941
|
+
/** Where it ends down. */
|
|
942
|
+
readonly y2: number;
|
|
943
|
+
/** Which of its series' edges it is. */
|
|
944
|
+
readonly index: number;
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
/** A marker: where it stands, and whether it is filled — the function takes the value there — or an outline (ADR-0253). */
|
|
948
|
+
export declare interface DrawnMarker {
|
|
949
|
+
/** The horizontal position. */
|
|
950
|
+
readonly x: number;
|
|
951
|
+
/** The height. */
|
|
952
|
+
readonly y: number;
|
|
953
|
+
/** Filled where the function takes the value; an outline where it does not. */
|
|
954
|
+
readonly filled: boolean;
|
|
955
|
+
/** The index of the series' point the marker stands for, or -1 when it stands for none. */
|
|
956
|
+
readonly point: number;
|
|
957
|
+
/** How many of the series' points it stands for: more than one where markers on one device pixel were merged (ADR-0290). */
|
|
958
|
+
readonly count: number;
|
|
959
|
+
/** An Observation's vertical interval at the marker; where marks merged, the union of theirs (ADR-0304). */
|
|
960
|
+
readonly yBounds?: Bounds;
|
|
961
|
+
/** An Observation's horizontal interval at the marker (ADR-0304). */
|
|
962
|
+
readonly xBounds?: Bounds;
|
|
963
|
+
/** Its colour band from the series' colour scale; absent for the series' own colour (ADR-0320). */
|
|
964
|
+
readonly band?: number;
|
|
965
|
+
/** Its radius from the series' size scale: a share of the largest in a drawing, CSS pixels in a scene (ADR-0320). */
|
|
966
|
+
readonly radius?: number;
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
/** A point of a drawn line, in the axes' own units: the horizontal position and the height. */
|
|
970
|
+
export declare interface DrawnPoint {
|
|
971
|
+
/** The horizontal position. */
|
|
972
|
+
readonly x: number;
|
|
973
|
+
/** The height, in the vertical axis' units. */
|
|
974
|
+
readonly y: number;
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/** A whisker as drawn: a point's interval. */
|
|
978
|
+
export declare interface DrawnWhisker {
|
|
979
|
+
/** The point's position. */
|
|
980
|
+
readonly x: number;
|
|
981
|
+
/** Its lower bound. */
|
|
982
|
+
readonly lower: number;
|
|
983
|
+
/** Its upper bound. */
|
|
984
|
+
readonly upper: number;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* Ordinary least squares (ADR-0291): the line that minimises the squared vertical distances, in `space`. A
|
|
989
|
+
* point whose x or y is not a finite number, or whose logarithm the space cannot take, is refused.
|
|
990
|
+
*/
|
|
991
|
+
export declare function fitLeastSquares(xs: readonly number[], ys: readonly number[], space?: FitSpace): FittedCurve;
|
|
992
|
+
|
|
993
|
+
/** Least squares of a polynomial of `degree` (ADR-0291), solved by Householder QR; degree 1 is `fitLeastSquares`. */
|
|
994
|
+
export declare function fitPolynomial(xs: readonly number[], ys: readonly number[], degree: number, space?: FitSpace): FittedCurve;
|
|
995
|
+
|
|
996
|
+
/** The space a fit is made in (ADR-0291): y against x, ln y against x (an exponential), or ln y against ln x (a power law). */
|
|
997
|
+
export declare type FitSpace = 'linear' | 'logY' | 'logLog';
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* A curve fitted by one of the fits (`fitLeastSquares`, `fitTheilSen`, `fitPolynomial`): its method, its
|
|
1001
|
+
* coefficients in the space it was fitted in, R² there, how many points it was fitted on, and the range of x
|
|
1002
|
+
* they span (ADR-0291).
|
|
1003
|
+
*/
|
|
1004
|
+
export declare class FittedCurve {
|
|
1005
|
+
#private;
|
|
1006
|
+
/** A curve of the given coefficients; refused when it has none, since a polynomial has a constant at least. */
|
|
1007
|
+
constructor(options: FittedCurveOptions);
|
|
1008
|
+
/** The method's name, such as `OLS` or `Theil–Sen`. */
|
|
1009
|
+
get method(): string;
|
|
1010
|
+
/** The polynomial's coefficients from the constant up: for a line, the intercept then the slope. */
|
|
1011
|
+
get coefficients(): readonly number[];
|
|
1012
|
+
/** The share of the variance it explains, in the space it was fitted in; never below zero for least squares, and below
|
|
1013
|
+
* zero for Theil–Sen where it does worse than the mean. */
|
|
1014
|
+
get rSquared(): number;
|
|
1015
|
+
/** How many points it was fitted on. */
|
|
1016
|
+
get count(): number;
|
|
1017
|
+
/** The smallest x it was fitted on. */
|
|
1018
|
+
get from(): number;
|
|
1019
|
+
/** The largest x it was fitted on. */
|
|
1020
|
+
get to(): number;
|
|
1021
|
+
/** The space it was fitted in. */
|
|
1022
|
+
get space(): FitSpace;
|
|
1023
|
+
/** The intercept: the constant coefficient. */
|
|
1024
|
+
get intercept(): number;
|
|
1025
|
+
/** The slope: the first-degree coefficient, or zero for a constant. */
|
|
1026
|
+
get slope(): number;
|
|
1027
|
+
/** The polynomial's degree. */
|
|
1028
|
+
get degree(): number;
|
|
1029
|
+
/**
|
|
1030
|
+
* Its Note: one line naming the method and the space, the equation for a line or the degree for a higher
|
|
1031
|
+
* polynomial, R² and n (ADR-0291), such as `OLS: y = 41.2x + 88.5, R² = 0.63, n = 212`.
|
|
1032
|
+
*/
|
|
1033
|
+
get note(): string;
|
|
1034
|
+
/** The fitted value at `x`, back in y, or `null` outside the range it was fitted over or where it is not a finite number. */
|
|
1035
|
+
valueAt(x: number): number | null;
|
|
1036
|
+
/**
|
|
1037
|
+
* The curve as a Level series over the range it was fitted on, sampled by the chart as it draws, read away
|
|
1038
|
+
* from zero, with one Segment named by its Note, so the Notes say it (ADR-0291).
|
|
1039
|
+
*/
|
|
1040
|
+
series(id: string, name: string): ChartSeriesOptions;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/** What a fitted curve is made of: the C# record's members. */
|
|
1044
|
+
export declare interface FittedCurveOptions {
|
|
1045
|
+
/** The method's name, such as `OLS` or `Theil–Sen`. */
|
|
1046
|
+
readonly method: string;
|
|
1047
|
+
/** The polynomial's coefficients from the constant up: for a line, the intercept then the slope. */
|
|
1048
|
+
readonly coefficients: readonly number[];
|
|
1049
|
+
/** The share of the variance it explains, in the space it was fitted in; never below zero for least squares, and below
|
|
1050
|
+
* zero for Theil–Sen where it does worse than the mean. */
|
|
1051
|
+
readonly rSquared: number;
|
|
1052
|
+
/** How many points it was fitted on. */
|
|
1053
|
+
readonly count: number;
|
|
1054
|
+
/** The smallest x it was fitted on. */
|
|
1055
|
+
readonly from: number;
|
|
1056
|
+
/** The largest. */
|
|
1057
|
+
readonly to: number;
|
|
1058
|
+
/** The space it was fitted in; `linear` where absent. */
|
|
1059
|
+
readonly space?: FitSpace;
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Theil–Sen (ADR-0291): the median of the slopes between every pair of points with different x, and the
|
|
1064
|
+
* median of yᵢ − slope·xᵢ as the intercept. A single point far off does not drag it. More than
|
|
1065
|
+
* `theilSenLimit` points are refused.
|
|
1066
|
+
*/
|
|
1067
|
+
export declare function fitTheilSen(xs: readonly number[], ys: readonly number[], space?: FitSpace): FittedCurve;
|
|
1068
|
+
|
|
1069
|
+
/** Where a click on a chart's point lands in the grid (ADR-0258, M3-Q6). */
|
|
1070
|
+
export declare interface GridCell {
|
|
1071
|
+
/** The point's row, by its Row Key. */
|
|
1072
|
+
readonly rowKey: RowKey;
|
|
1073
|
+
/** The point's column, by its name. */
|
|
1074
|
+
readonly column: string;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
/**
|
|
1078
|
+
* A chart made from a grid selection: the set of Row Keys and columns it was made from, never the positions
|
|
1079
|
+
* it was painted at (ADR-0258). A recalculated value is redrawn, a row that no longer exists becomes a gap,
|
|
1080
|
+
* and a new row is never added. Hold it as it was handed over: the bridge knows a chart it drew before by
|
|
1081
|
+
* its identity.
|
|
1082
|
+
*/
|
|
1083
|
+
export declare interface GridChart {
|
|
1084
|
+
/** Whether its series are columns or rows. */
|
|
1085
|
+
readonly orientation: ChartOrientation;
|
|
1086
|
+
/** The axis column of a chart of series in columns; absent for series in rows, whose axis is the declared positions. */
|
|
1087
|
+
readonly axisColumn?: string;
|
|
1088
|
+
/** Its series, in the order they were made and added. */
|
|
1089
|
+
readonly series: readonly GridChartSeries[];
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
/**
|
|
1093
|
+
* The grid's side of a chart, ready-made (ADR-0258): context-menu commands a Consumer adds to a grid in one
|
|
1094
|
+
* line, which turn the selection into a {@link GridChart}, and the reading of that chart, by Row Key from the
|
|
1095
|
+
* Consumer's data, into the Chart Definition an ExChart draws. The grid does not know it exists; where the
|
|
1096
|
+
* chart is shown is the Consumer's.
|
|
1097
|
+
*/
|
|
1098
|
+
export declare class GridChartBridge<Row> {
|
|
1099
|
+
#private;
|
|
1100
|
+
/** A bridge that reads selections by `options.declarations`. */
|
|
1101
|
+
constructor(options: GridChartBridgeOptions<Row>);
|
|
1102
|
+
/** What the Consumer declared for the grid's selections. */
|
|
1103
|
+
get declarations(): GridChartDeclarations<Row>;
|
|
1104
|
+
/**
|
|
1105
|
+
* The commands for the grid's `contextCommands`, worded by {@link gridChartCommandLabel}: "Chart", or "Series
|
|
1106
|
+
* in columns" and "Series in rows" when the selection declares both, and "Add to chart" for each target. It is
|
|
1107
|
+
* one function for the bridge's life, so it can be handed to the grid as it is on every render (ADR-0003).
|
|
1108
|
+
*/
|
|
1109
|
+
readonly commands: (context: GridContextMenuContext<Row>) => readonly GridCommand[];
|
|
1110
|
+
/**
|
|
1111
|
+
* The Chart Definition `chart` stands for now, read by Row Key from the declarations' `rowOf`: a recalculated
|
|
1112
|
+
* value is redrawn, and a row that no longer exists is a gap with a Note (ADR-0258). While nothing it reads
|
|
1113
|
+
* has changed, the definition last returned for the same chart is returned again, so the chart skips its
|
|
1114
|
+
* render (ADR-0252). A chart that can no longer be drawn, such as one whose axis column left the grid, is
|
|
1115
|
+
* refused with a `ChartRefusedError`.
|
|
1116
|
+
*/
|
|
1117
|
+
draw(chart: GridChart): ChartDefinition;
|
|
1118
|
+
/** The grid cell a click on a point of `chart` stands for, or `undefined` when its row no longer exists. */
|
|
1119
|
+
cellOf(chart: GridChart, click: ChartPointClick): GridCell | undefined;
|
|
1120
|
+
/**
|
|
1121
|
+
* Scrolls the grid to the cell a click on a point stands for and puts the Focus on it (ADR-0258, M3-Q6),
|
|
1122
|
+
* through the Consumer's `placeSelection`. Answers whether the Focus was placed; false where the point's row
|
|
1123
|
+
* no longer exists.
|
|
1124
|
+
*/
|
|
1125
|
+
showInGrid(chart: GridChart, click: ChartPointClick): Promise<boolean>;
|
|
1126
|
+
/**
|
|
1127
|
+
* Scrolls the grid to `cell` and puts the Focus on it, as a click on a point does (ADR-0258): for a chart the
|
|
1128
|
+
* Consumer built by hand, such as a scatter whose points carry their Row Keys, whose click names the row
|
|
1129
|
+
* (ADR-0290). Answers whether the Focus was placed; when the row is not among the rows the grid shows,
|
|
1130
|
+
* `onRefused` says so.
|
|
1131
|
+
*/
|
|
1132
|
+
showCellInGrid(cell: GridCell): Promise<boolean>;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
/** What a {@link GridChartBridge} is made with. */
|
|
1136
|
+
export declare interface GridChartBridgeOptions<Row> {
|
|
1137
|
+
/** What the Consumer declared for the grid's selections. */
|
|
1138
|
+
readonly declarations: GridChartDeclarations<Row>;
|
|
1139
|
+
/** The grid whose selections are charted, read each time it is needed; `undefined` while there is none. */
|
|
1140
|
+
readonly grid: () => GridChartGrid<Row> | undefined;
|
|
1141
|
+
/** The open charts the menu offers "Add to chart" for (ADR-0258, U7), in the menu's order, read each time the
|
|
1142
|
+
* menu opens; none unless given. */
|
|
1143
|
+
readonly targets?: () => readonly ChartTarget[];
|
|
1144
|
+
/** Hears a chart made from the selection; the Consumer decides where it is shown. */
|
|
1145
|
+
readonly onChart?: (chart: GridChart) => void;
|
|
1146
|
+
/** Hears a target and the chart it becomes with the selection's series added. */
|
|
1147
|
+
readonly onAdded?: (target: ChartTarget, chart: GridChart) => void;
|
|
1148
|
+
/** Hears the sentence that says why a selection was not charted, or a point not shown in the grid. */
|
|
1149
|
+
readonly onRefused?: (why: string) => void;
|
|
1150
|
+
/**
|
|
1151
|
+
* Places the Selection and the Focus on a cell and scrolls the grid to it, as C#'s `PlaceSelectionAsync`
|
|
1152
|
+
* does, answering whether it was placed: the grid's `placeSelection`, reached through its handle (or
|
|
1153
|
+
* `ExGridApi` under React), which the bridge does not hold. Without it `showInGrid` refuses to be asked.
|
|
1154
|
+
*/
|
|
1155
|
+
readonly placeSelection?: (placement: GridSelectionPlacement) => boolean | Promise<boolean>;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
/** The stable identities of the commands a {@link GridChartBridge} adds to a grid's menu (ADR-0036). */
|
|
1159
|
+
export declare const gridChartCommandIds: Readonly<{
|
|
1160
|
+
/** "Chart": the selection in the one orientation its columns declare. */
|
|
1161
|
+
readonly chart: 'exchart.chart';
|
|
1162
|
+
/** "Series in columns", offered beside `inRows` only when a selection declares both. */
|
|
1163
|
+
readonly inColumns: 'exchart.chart.columns';
|
|
1164
|
+
/** "Series in rows", offered beside `inColumns` only when a selection declares both. */
|
|
1165
|
+
readonly inRows: 'exchart.chart.rows';
|
|
1166
|
+
/** The prefix of "Add to chart: <name>"; the target's name follows it. */
|
|
1167
|
+
readonly addPrefix: "exchart.add:";
|
|
1168
|
+
}>;
|
|
1169
|
+
|
|
1170
|
+
/** The wording of one of the bridge's commands, for the grid's `commandLabel`; `undefined` for any other. */
|
|
1171
|
+
export declare function gridChartCommandLabel(id: string): string | undefined;
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* What the Consumer declares for a grid's selections to be charted (ADR-0251, ADR-0258). Nothing here is read
|
|
1175
|
+
* off a header or guessed from a selection's shape: "6m" is a header's text, 0.5 years is what the Consumer
|
|
1176
|
+
* says it stands for.
|
|
1177
|
+
*/
|
|
1178
|
+
export declare interface GridChartDeclarations<Row> {
|
|
1179
|
+
/** A row's identity (ADR-0140), which a chart follows through a sort, a filter and a recalculation. */
|
|
1180
|
+
readonly rowKey: RowKeyOf<Row>;
|
|
1181
|
+
/**
|
|
1182
|
+
* The row a Row Key names in the Consumer's data now, or `undefined` once it no longer exists. A chart reads
|
|
1183
|
+
* its values here, never from the grid's Window, so a row only filtered out of the grid is not reported as
|
|
1184
|
+
* gone (ADR-0258, M3-Q7).
|
|
1185
|
+
*/
|
|
1186
|
+
readonly rowOf: (key: RowKey) => Row | undefined;
|
|
1187
|
+
/** Each column's Series Kind by its name (ADR-0253); `undefined` for none. A column with none declared is
|
|
1188
|
+
* refused when it is charted. */
|
|
1189
|
+
readonly kindOf?: (column: string) => SeriesKind | undefined;
|
|
1190
|
+
/**
|
|
1191
|
+
* Whether each column's values are read from zero, by its name (ADR-0253, ADR-0258): false for a level read
|
|
1192
|
+
* away from zero, such as rates between 3.0% and 3.6%; `undefined`, or no function, leaves the Series Kind's
|
|
1193
|
+
* default. A series in rows takes its columns' declaration; they must read zero alike once each is resolved
|
|
1194
|
+
* by its Series Kind's default (`undefined` beside true is alike for a Level), or the curve is refused by
|
|
1195
|
+
* name.
|
|
1196
|
+
*/
|
|
1197
|
+
readonly fromZeroOf?: (column: string) => boolean | undefined;
|
|
1198
|
+
/** The number columns that are an axis, by name. A date column is always one; a number column is one only
|
|
1199
|
+
* when it is named here. None unless given. */
|
|
1200
|
+
readonly axisColumns?: ReadonlySet<string> | readonly string[];
|
|
1201
|
+
/** A column's declared position along a curve's axis (a tenor's years), or `undefined` for a column that has none. */
|
|
1202
|
+
readonly positionOf?: (column: string) => number | undefined;
|
|
1203
|
+
/** The title of the declared positions' axis, such as "Tenor (years)"; empty unless given. */
|
|
1204
|
+
readonly positionTitle?: string;
|
|
1205
|
+
/** Whether the declared positions are drawn proportional to their values or as categories (ADR-0251);
|
|
1206
|
+
* `proportional` unless given. */
|
|
1207
|
+
readonly positionScale?: AxisScale;
|
|
1208
|
+
/** A row's name in the legend and the tooltip, for series in rows; the Row Key's text unless given. */
|
|
1209
|
+
readonly rowName?: (row: Row) => string;
|
|
1210
|
+
/** The orientation every selection is charted in, when the Consumer fixes it; absent lets the grid's
|
|
1211
|
+
* declarations decide (ADR-0258). */
|
|
1212
|
+
readonly orientation?: ChartOrientation;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
/**
|
|
1216
|
+
* The grid whose selections are charted, as the Consumer handed it to `createGrid` or `<ExGrid>`: its columns
|
|
1217
|
+
* and Header Groups as they stand, and the Grid Source its rows come from, whose snapshot is the Window and the
|
|
1218
|
+
* Row Sequence Version the grid shows.
|
|
1219
|
+
*/
|
|
1220
|
+
export declare interface GridChartGrid<Row> {
|
|
1221
|
+
/** The columns, in display order. */
|
|
1222
|
+
readonly columns: readonly GridColumn<Row>[];
|
|
1223
|
+
/** The Header Groups over them; none unless given. */
|
|
1224
|
+
readonly headerGroups?: readonly GridHeaderGroup[];
|
|
1225
|
+
/** The source the grid reads its rows from. */
|
|
1226
|
+
readonly source: GridSource<Row>;
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
/** Every Row Key some series of `chart` is charted at. */
|
|
1230
|
+
export declare function gridChartRowKeys(chart: GridChart): ReadonlySet<RowKey>;
|
|
1231
|
+
|
|
1232
|
+
/** One series of a {@link GridChart}, in the data's terms (ADR-0251). */
|
|
1233
|
+
export declare type GridChartSeries = ColumnSeries | RowSeries;
|
|
1234
|
+
|
|
1235
|
+
/**
|
|
1236
|
+
* Where the bridge asks the grid to put the Focus (ADR-0258, M3-Q6): the cell a point stands for, as the
|
|
1237
|
+
* Selection, under the Row Sequence Version the bridge found it in, which the grid's placement refuses under
|
|
1238
|
+
* another order.
|
|
1239
|
+
*/
|
|
1240
|
+
export declare interface GridSelectionPlacement {
|
|
1241
|
+
/** The Selection to place: the one cell. */
|
|
1242
|
+
readonly range: SelectionRange;
|
|
1243
|
+
/** Where the Focus goes: the same cell. */
|
|
1244
|
+
readonly focus: CellPosition;
|
|
1245
|
+
/** The Row Sequence Version the positions are written in. */
|
|
1246
|
+
readonly rowSequenceVersion: number;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/** A tick of the horizontal axis: its position, its pixel, and its label or `null`. */
|
|
1250
|
+
export declare type HorizontalTick = readonly [position: number, x: number, label: string | null];
|
|
1251
|
+
|
|
1252
|
+
/**
|
|
1253
|
+
* A curve interpolated by one of the methods (`interpolateLinear`, `interpolateNaturalCubicSpline`): its
|
|
1254
|
+
* method's name, the range it has values over, and its value at a position, `null` outside that range
|
|
1255
|
+
* (ADR-0257).
|
|
1256
|
+
*/
|
|
1257
|
+
export declare class Interpolant1D {
|
|
1258
|
+
#private;
|
|
1259
|
+
/** A curve of the given method and function. */
|
|
1260
|
+
constructor(options: Interpolant1DOptions);
|
|
1261
|
+
/** The method's name, shown as it is, such as `natural cubic spline`. */
|
|
1262
|
+
get method(): string;
|
|
1263
|
+
/** The first position it has a value at. */
|
|
1264
|
+
get from(): number;
|
|
1265
|
+
/** The last position it has a value at. */
|
|
1266
|
+
get to(): number;
|
|
1267
|
+
/** Its value at a position, `null` outside `from`–`to`, as the function it was made with answers. */
|
|
1268
|
+
get evaluate(): (x: number) => number | null;
|
|
1269
|
+
/** The value at `x`, or `null` outside the range it was made over or where it is not a finite number. */
|
|
1270
|
+
valueAt(x: number): number | null;
|
|
1271
|
+
/**
|
|
1272
|
+
* The curve as a series declared Interpolated, sampled by the chart as it draws, with one Segment named by
|
|
1273
|
+
* the method, so the tooltip and the Notes say it (ADR-0257).
|
|
1274
|
+
*/
|
|
1275
|
+
series(id: string, name: string): ChartSeriesOptions;
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
/** What a curve interpolated by one of the methods is made of: the C# record's members. */
|
|
1279
|
+
export declare interface Interpolant1DOptions {
|
|
1280
|
+
/** The method's name, shown as it is, such as `natural cubic spline`. */
|
|
1281
|
+
readonly method: string;
|
|
1282
|
+
/** The first position it has a value at. */
|
|
1283
|
+
readonly from: number;
|
|
1284
|
+
/** The last position it has a value at. */
|
|
1285
|
+
readonly to: number;
|
|
1286
|
+
/** Its value at a position, `null` outside `from`–`to`. */
|
|
1287
|
+
readonly evaluate: (x: number) => number | null;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1290
|
+
/**
|
|
1291
|
+
* A surface interpolated by one of the methods (`interpolateBilinear`, `interpolateTriangles`): its method's
|
|
1292
|
+
* name, the rectangle it is evaluated over, and its value at a point, `null` where it has none — outside the
|
|
1293
|
+
* points it was made from, or where a value it would need is missing (ADR-0257, ADR-0274).
|
|
1294
|
+
*/
|
|
1295
|
+
export declare class Interpolant2D {
|
|
1296
|
+
#private;
|
|
1297
|
+
/** A surface of the given method and function. */
|
|
1298
|
+
constructor(options: Interpolant2DOptions);
|
|
1299
|
+
/** The method's name, shown as it is, such as `bilinear`. */
|
|
1300
|
+
get method(): string;
|
|
1301
|
+
/** The rectangle's left edge. */
|
|
1302
|
+
get xFrom(): number;
|
|
1303
|
+
/** Its right edge. */
|
|
1304
|
+
get xTo(): number;
|
|
1305
|
+
/** Its near edge. */
|
|
1306
|
+
get yFrom(): number;
|
|
1307
|
+
/** Its far edge. */
|
|
1308
|
+
get yTo(): number;
|
|
1309
|
+
/** Its value at a point, or `null`, as the function it was made with answers. */
|
|
1310
|
+
get evaluate(): (x: number, y: number) => number | null;
|
|
1311
|
+
/** The value at (`x`, `y`), or `null` where it has none or where it is not a finite number. */
|
|
1312
|
+
valueAt(x: number, y: number): number | null;
|
|
1313
|
+
/**
|
|
1314
|
+
* The surface sampled across its rectangle under its method's name, as `SurfaceDefinition.sampled` samples a
|
|
1315
|
+
* function (ADR-0257): every value marked interpolated, a hole where it has none.
|
|
1316
|
+
*/
|
|
1317
|
+
surface(options: InterpolatedSurfaceOptions): SurfaceDefinition;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
/** What a surface interpolated by one of the methods is made of: the C# record's members. */
|
|
1321
|
+
export declare interface Interpolant2DOptions {
|
|
1322
|
+
/** The method's name, shown as it is, such as `bilinear`. */
|
|
1323
|
+
readonly method: string;
|
|
1324
|
+
/** The rectangle's left edge. */
|
|
1325
|
+
readonly xFrom: number;
|
|
1326
|
+
/** Its right edge. */
|
|
1327
|
+
readonly xTo: number;
|
|
1328
|
+
/** Its near edge. */
|
|
1329
|
+
readonly yFrom: number;
|
|
1330
|
+
/** Its far edge. */
|
|
1331
|
+
readonly yTo: number;
|
|
1332
|
+
/** Its value at a point, or `null` where it has none. */
|
|
1333
|
+
readonly evaluate: (x: number, y: number) => number | null;
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* Bilinear interpolation on a grid (ADR-0257): `z` holds one row per y value and one value per x value, both
|
|
1338
|
+
* axes strictly increasing. A cell with a missing corner, `null`, has no value inside (ADR-0274).
|
|
1339
|
+
*/
|
|
1340
|
+
export declare function interpolateBilinear(xs: readonly number[], ys: readonly number[], z: readonly (readonly (number | null)[])[]): Interpolant2D;
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* What a surface from an interpolant is sampled with besides: everything `SurfaceDefinition.sampled` takes but
|
|
1344
|
+
* the method, the rectangle and the function, which the interpolant gives.
|
|
1345
|
+
*/
|
|
1346
|
+
export declare type InterpolatedSurfaceOptions = Omit<SurfaceSampledOptions, 'method' | 'xFrom' | 'xTo' | 'yFrom' | 'yTo' | 'z'>;
|
|
1347
|
+
|
|
1348
|
+
/** Straight lines between neighbouring points (ADR-0257); `xs` strictly increasing. */
|
|
1349
|
+
export declare function interpolateLinear(xs: readonly number[], ys: readonly number[]): Interpolant1D;
|
|
1350
|
+
|
|
1351
|
+
/** A natural cubic spline through the points (ADR-0257): zero second derivative at both ends; `xs` strictly increasing. */
|
|
1352
|
+
export declare function interpolateNaturalCubicSpline(xs: readonly number[], ys: readonly number[]): Interpolant1D;
|
|
1353
|
+
|
|
1354
|
+
/**
|
|
1355
|
+
* Linear interpolation on a triangle mesh (P1, ADR-0257): within each triangle the plane through its three
|
|
1356
|
+
* corners. `triangles` index into `points`; outside every triangle there is no value. The mesh is the
|
|
1357
|
+
* Consumer's, from its own solver or triangulation.
|
|
1358
|
+
*/
|
|
1359
|
+
export declare function interpolateTriangles(points: readonly MeshPoint[], triangles: readonly SurfaceTriangle[]): Interpolant2D;
|
|
1360
|
+
|
|
1361
|
+
/** An Interval's bounds at one position of its series (ADR-0303). */
|
|
1362
|
+
export declare interface IntervalBound {
|
|
1363
|
+
/** The position: one of the series' points. */
|
|
1364
|
+
readonly x: number;
|
|
1365
|
+
/** The lower bound, or `null`. */
|
|
1366
|
+
readonly lower: ChartValue | null;
|
|
1367
|
+
/** The upper bound, or `null`. */
|
|
1368
|
+
readonly upper: ChartValue | null;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/** How a series' Interval is drawn (ADR-0303): whiskers at each point, or a band joining neighbours. */
|
|
1372
|
+
export declare type IntervalStyle = 'whiskers' | 'band';
|
|
1373
|
+
|
|
1374
|
+
/** ExChart's Japanese: `label: japaneseChartWords`. A Consumer's own function may fall back to it. */
|
|
1375
|
+
export declare const japaneseChartWords: ChartLabel;
|
|
1376
|
+
|
|
1377
|
+
/** A row a series was made from, by its Row Key, with the axis value it had then. */
|
|
1378
|
+
export declare interface KeyedPosition {
|
|
1379
|
+
/** The row's Row Key (ADR-0140). */
|
|
1380
|
+
readonly key: RowKey;
|
|
1381
|
+
/** The row's axis value when the chart was made, which places its gap once the row is gone. */
|
|
1382
|
+
readonly x: number;
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/** A tick of a key: its value, its height in CSS pixels, and its label. */
|
|
1386
|
+
export declare interface KeyTick {
|
|
1387
|
+
/** The value. */
|
|
1388
|
+
readonly value: number;
|
|
1389
|
+
/** Its height in CSS pixels. */
|
|
1390
|
+
readonly y: number;
|
|
1391
|
+
/** Its label. */
|
|
1392
|
+
readonly label: string;
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/** How a legend's entries align along its side (ADR-0271). */
|
|
1396
|
+
export declare type LegendAlign = 'start' | 'centre' | 'end';
|
|
1397
|
+
|
|
1398
|
+
/** One legend entry, laid out. */
|
|
1399
|
+
export declare interface LegendEntry {
|
|
1400
|
+
/** The key a click hides it by: the series' identity, which for quotes and their Interpolated curve is the quotes' and hides both (ADR-0257). */
|
|
1401
|
+
readonly id: string;
|
|
1402
|
+
/** Its name. */
|
|
1403
|
+
readonly name: string;
|
|
1404
|
+
/** Its look, which hiding does not change. */
|
|
1405
|
+
readonly look: SeriesLook;
|
|
1406
|
+
/** Whether it is hidden, which fades the entry. */
|
|
1407
|
+
readonly hidden: boolean;
|
|
1408
|
+
/** Where the entry sits, swatch first. */
|
|
1409
|
+
readonly box: Box;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/**
|
|
1413
|
+
* The identities of the series the legend entry keyed `key` stands for (ADR-0257): the quotes and their
|
|
1414
|
+
* Interpolated curves for a pair's entry, otherwise the series itself. Showing the entry again shows each
|
|
1415
|
+
* of them, however one came to be hidden.
|
|
1416
|
+
*/
|
|
1417
|
+
export declare function legendMembers(definition: ChartDefinition, key: string): readonly string[];
|
|
1418
|
+
|
|
1419
|
+
/** The Consumer's placement of the legend: a side and an alignment, never a pixel offset (ADR-0271). */
|
|
1420
|
+
export declare interface LegendPlacement {
|
|
1421
|
+
/** The side; `top` by default. */
|
|
1422
|
+
readonly position?: LegendPosition;
|
|
1423
|
+
/** The alignment; `start` by default. */
|
|
1424
|
+
readonly align?: LegendAlign;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
/** Where a panel's legend sits (ADR-0271). */
|
|
1428
|
+
export declare type LegendPosition =
|
|
1429
|
+
/** Above each panel's plot. */
|
|
1430
|
+
'top'
|
|
1431
|
+
/** Below it; under the horizontal axis for the last panel. */
|
|
1432
|
+
| 'bottom'
|
|
1433
|
+
/** Left of the plots. */
|
|
1434
|
+
| 'left'
|
|
1435
|
+
/** Right of the plots. */
|
|
1436
|
+
| 'right'
|
|
1437
|
+
/** No legend. */
|
|
1438
|
+
| 'none';
|
|
1439
|
+
|
|
1440
|
+
/** The shapes a marker key chooses from, in order. */
|
|
1441
|
+
export declare type MarkerShape = 'circle' | 'square' | 'diamond' | 'triangle';
|
|
1442
|
+
|
|
1443
|
+
/** A point of a Consumer's mesh: its position and its value. */
|
|
1444
|
+
export declare interface MeshPoint {
|
|
1445
|
+
/** Its x position. */
|
|
1446
|
+
readonly x: number;
|
|
1447
|
+
/** Its y position. */
|
|
1448
|
+
readonly y: number;
|
|
1449
|
+
/** Its value. */
|
|
1450
|
+
readonly z: number;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
/** A labelled position of a number axis, such as "6M" at 0.5. */
|
|
1454
|
+
export declare type NamedPosition = readonly [position: number, label: string];
|
|
1455
|
+
|
|
1456
|
+
/** A panel: its plot's box, its vertical axes and its series. */
|
|
1457
|
+
export declare interface PanelScene {
|
|
1458
|
+
/** The panel's name. */
|
|
1459
|
+
readonly name: string;
|
|
1460
|
+
/** The plot's box. */
|
|
1461
|
+
readonly plot: Box;
|
|
1462
|
+
/** The left axis, or `null` when no series reads on it. */
|
|
1463
|
+
readonly left: VerticalAxis | null;
|
|
1464
|
+
/** The right axis, or `null`. */
|
|
1465
|
+
readonly right: VerticalAxis | null;
|
|
1466
|
+
/** The height of zero in pixels, where the plot holds it, or `null`. */
|
|
1467
|
+
readonly zeroY: number | null;
|
|
1468
|
+
/** The visible series, in the definition's order. */
|
|
1469
|
+
readonly series: readonly SeriesPiece[];
|
|
1470
|
+
/** Its legend: every series of the panel, hidden ones included (ADR-0271). */
|
|
1471
|
+
readonly legend: readonly LegendEntry[];
|
|
1472
|
+
/** The Price Range whose volume this panel draws, or `null` for a panel of the Consumer's (ADR-0300). */
|
|
1473
|
+
readonly volumeOf: string | null;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
/** What one thinned device pixel holds, for the tooltip to say (ADR-0254). */
|
|
1477
|
+
export declare interface PixelSummary {
|
|
1478
|
+
/** The first position in the pixel. */
|
|
1479
|
+
readonly from: number;
|
|
1480
|
+
/** The last. */
|
|
1481
|
+
readonly to: number;
|
|
1482
|
+
/** The lowest height. */
|
|
1483
|
+
readonly min: number;
|
|
1484
|
+
/** The highest. */
|
|
1485
|
+
readonly max: number;
|
|
1486
|
+
/** How many points the pixel holds. */
|
|
1487
|
+
readonly count: number;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
/** A Price Range's candle in pixels (ADR-0300). */
|
|
1491
|
+
export declare interface PlacedCandle {
|
|
1492
|
+
/** Its centre across. */
|
|
1493
|
+
readonly x: number;
|
|
1494
|
+
/** Half its body's width. */
|
|
1495
|
+
readonly halfWidth: number;
|
|
1496
|
+
/** Its open's height, or `null` for a High-Low-Close bar. */
|
|
1497
|
+
readonly openY: number | null;
|
|
1498
|
+
/** Its high's height. */
|
|
1499
|
+
readonly highY: number;
|
|
1500
|
+
/** Its low's height. */
|
|
1501
|
+
readonly lowY: number;
|
|
1502
|
+
/** Its close's height. */
|
|
1503
|
+
readonly closeY: number;
|
|
1504
|
+
/** Its close above its own open, drawn hollow. */
|
|
1505
|
+
readonly rising: boolean;
|
|
1506
|
+
/** Its close equal to its own open. */
|
|
1507
|
+
readonly unchanged: boolean;
|
|
1508
|
+
/** How many rows it stands for. */
|
|
1509
|
+
readonly rows: number;
|
|
1510
|
+
/** The first position it stands for. */
|
|
1511
|
+
readonly from: number;
|
|
1512
|
+
/** The last. */
|
|
1513
|
+
readonly to: number;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/** A volume bar in pixels (ADR-0300). */
|
|
1517
|
+
export declare interface PlacedVolume {
|
|
1518
|
+
/** Its centre across. */
|
|
1519
|
+
readonly x: number;
|
|
1520
|
+
/** Half its width. */
|
|
1521
|
+
readonly halfWidth: number;
|
|
1522
|
+
/** Its top's height. */
|
|
1523
|
+
readonly topY: number;
|
|
1524
|
+
/** Its base's height: zero's. */
|
|
1525
|
+
readonly baseY: number;
|
|
1526
|
+
/** Whether its candle rose. */
|
|
1527
|
+
readonly rising: boolean;
|
|
1528
|
+
/** Whether its candle was unchanged. */
|
|
1529
|
+
readonly unchanged: boolean;
|
|
1530
|
+
/** How many rows it stands for. */
|
|
1531
|
+
readonly rows: number;
|
|
1532
|
+
/** The first position it stands for. */
|
|
1533
|
+
readonly from: number;
|
|
1534
|
+
/** The last. */
|
|
1535
|
+
readonly to: number;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/** A point's colour read from a column (ADR-0320): one value a point, coloured in nine bands. */
|
|
1539
|
+
export declare interface PointColour {
|
|
1540
|
+
/** What the values are. */
|
|
1541
|
+
readonly title: string;
|
|
1542
|
+
/** One value a point; `null` where it has none, drawn as an outline. */
|
|
1543
|
+
readonly values: readonly (ChartValue | null)[];
|
|
1544
|
+
/** The value the colours diverge from (ADR-0310); absent colours the values low to high. */
|
|
1545
|
+
readonly centre?: number;
|
|
1546
|
+
}
|
|
1547
|
+
|
|
1548
|
+
/** A column an Observation's tooltip says beside its values, one value a point (ADR-0321). */
|
|
1549
|
+
export declare interface PointDetail {
|
|
1550
|
+
/** What the values are. */
|
|
1551
|
+
readonly title: string;
|
|
1552
|
+
/** One value a point, written; `null` where the point has none. */
|
|
1553
|
+
readonly values: readonly (string | null)[];
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
/** A position the pointer can be over, and its pixel. */
|
|
1557
|
+
export declare type PointerPosition = readonly [position: number, x: number];
|
|
1558
|
+
|
|
1559
|
+
/** A point's size read from a column (ADR-0320): one value a point, never negative. */
|
|
1560
|
+
export declare interface PointSize {
|
|
1561
|
+
/** What the values are. */
|
|
1562
|
+
readonly title: string;
|
|
1563
|
+
/** One value a point; `null` where it has none, drawn as an outline. */
|
|
1564
|
+
readonly values: readonly (ChartValue | null)[];
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
/** The position across that stands at `x` pixels, on a proportional or logarithmic axis. */
|
|
1568
|
+
export declare function positionAt(scene: ChartScene, x: number): number;
|
|
1569
|
+
|
|
1570
|
+
/** One row of a Price Range (ADR-0300): a period's open, high, low and close, and optionally its volume. */
|
|
1571
|
+
export declare interface PriceBar {
|
|
1572
|
+
/** The period's position: on a Dates axis, its day number. */
|
|
1573
|
+
readonly x: number;
|
|
1574
|
+
/** The first price of the period, or `null`. */
|
|
1575
|
+
readonly open: ChartValue | null;
|
|
1576
|
+
/** The highest, or `null`. */
|
|
1577
|
+
readonly high: ChartValue | null;
|
|
1578
|
+
/** The lowest, or `null`. */
|
|
1579
|
+
readonly low: ChartValue | null;
|
|
1580
|
+
/** The last, or `null`. */
|
|
1581
|
+
readonly close: ChartValue | null;
|
|
1582
|
+
/** The quantity traded, or `null` (absent is the same). */
|
|
1583
|
+
readonly volume?: ChartValue | null;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* Reads `text`, a Chart Spec, into a Chart Definition or a 3D surface, taking each Data Handle's table from
|
|
1588
|
+
* `tables`, which answers `undefined` for a handle it does not know: the counterpart of C#'s
|
|
1589
|
+
* `ChartSpec.Read`. A spec that cannot be drawn throws a {@link ChartSpecRefusedError}, whose message says
|
|
1590
|
+
* where and why.
|
|
1591
|
+
*/
|
|
1592
|
+
export declare function readChartSpec(text: string, tables: (handle: string) => ChartData | undefined): ChartSpecReading;
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* Reads `text`, a Chart Spec, through Chart Sources (ADR-0344): each series asks its Data Handle's source for its own
|
|
1596
|
+
* column, from `from` to `to` at `pixels` columns, all at once, and is read from the points the source kept, carrying
|
|
1597
|
+
* what each thinned pixel held. What a thinned point cannot stand for — a surface, a labels axis, a series that is not
|
|
1598
|
+
* a line from `x` and `y` — is refused by path before any source is asked, and so is a reading whose answers for one
|
|
1599
|
+
* Data Handle name different versions of its data: one chart is never drawn from two moments (spine rule 6). The
|
|
1600
|
+
* counterpart of C#'s `ChartSpec.ReadAsync`.
|
|
1601
|
+
*/
|
|
1602
|
+
export declare function readChartSpecThrough(text: string, sources: (handle: string) => ChartSource | undefined, pixels: number, options?: {
|
|
1603
|
+
readonly from?: number | null;
|
|
1604
|
+
readonly to?: number | null;
|
|
1605
|
+
readonly signal?: AbortSignal;
|
|
1606
|
+
}): Promise<ChartSourceReading>;
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* What the tooltip says at `position` in panel `panel` of `scene`, built from `definition` at `metrics`.
|
|
1610
|
+
* Past what fits the plot's height, the series nearest `pointerY` are listed and the rest counted. The
|
|
1611
|
+
* view is the scene's own: what it hides and the range it shows are already laid out in it.
|
|
1612
|
+
*/
|
|
1613
|
+
export declare function readingAt(definition: ChartDefinition, scene: ChartScene, metrics: ChartMetrics, position: number, panel: number, pointerY: number): ChartReading;
|
|
1614
|
+
|
|
1615
|
+
/** One series' line in the tooltip (ADR-0270). */
|
|
1616
|
+
export declare interface ReadingLine {
|
|
1617
|
+
/** The series' identity. */
|
|
1618
|
+
readonly id: string;
|
|
1619
|
+
/** Its name. */
|
|
1620
|
+
readonly name: string;
|
|
1621
|
+
/** Its look, for the swatch. */
|
|
1622
|
+
readonly look: SeriesLook;
|
|
1623
|
+
/** Its value at the position, written through the series' format; `null` when it has none there. */
|
|
1624
|
+
readonly value: string | null;
|
|
1625
|
+
/** What the value is: a step's interval, a thinned pixel's count, interpolated or extrapolated, or why there is no value. */
|
|
1626
|
+
readonly note: string | null;
|
|
1627
|
+
/** The value's height in pixels, which the nearest lines are chosen by; `null` when it has none there. */
|
|
1628
|
+
readonly y: number | null;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
/**
|
|
1632
|
+
* What the tooltip says over an edge (ADR-0321): its two keys. An edge has no value of its own, and nothing
|
|
1633
|
+
* about it is read from its nodes.
|
|
1634
|
+
*/
|
|
1635
|
+
export declare function readingOfEdge(definition: ChartDefinition, scene: ChartScene, edge: number): ChartReading;
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* What the tooltip says over an Observation's mark (ADR-0290): the point's name, or its position across,
|
|
1639
|
+
* then the series with the point's x and y, and how many points the mark stands for when markers on one
|
|
1640
|
+
* device pixel were merged — never one of them as if it were the only one.
|
|
1641
|
+
*/
|
|
1642
|
+
export declare function readingOfMark(definition: ChartDefinition, scene: ChartScene, mark: number): ChartReading;
|
|
1643
|
+
|
|
1644
|
+
/** A row, by its Row Key, across columns at declared positions (series in rows). */
|
|
1645
|
+
export declare interface RowSeries {
|
|
1646
|
+
/** Says the series is a row. */
|
|
1647
|
+
readonly type: 'row';
|
|
1648
|
+
/** The series' identity in the Chart Definition: the row's key and its Header Group. */
|
|
1649
|
+
readonly id: string;
|
|
1650
|
+
/** The panel it was given when it was made. */
|
|
1651
|
+
readonly panel: string;
|
|
1652
|
+
/** The row's Row Key (ADR-0140). */
|
|
1653
|
+
readonly rowKey: RowKey;
|
|
1654
|
+
/** The row's name when the chart was made, kept for the legend once the row is gone. */
|
|
1655
|
+
readonly name: string;
|
|
1656
|
+
/** The Header Group the columns stand under, or empty. */
|
|
1657
|
+
readonly group: string;
|
|
1658
|
+
/** The columns it is charted across, by name, in their positions' order. */
|
|
1659
|
+
readonly columns: readonly string[];
|
|
1660
|
+
}
|
|
1661
|
+
|
|
1662
|
+
/** What a scene is laid out with, beside the definition and the metrics. */
|
|
1663
|
+
export declare interface SceneOptions {
|
|
1664
|
+
/** What the viewer narrowed the chart to; everything by default. */
|
|
1665
|
+
readonly view?: ChartView;
|
|
1666
|
+
/** How the horizontal axis is ticked and labelled. */
|
|
1667
|
+
readonly style?: AxisStyle;
|
|
1668
|
+
/** The panels whose left and right axes the Consumer declared independent (ADR-0251). */
|
|
1669
|
+
readonly independentScales?: ReadonlySet<string> | readonly string[];
|
|
1670
|
+
/** Where each panel's legend sits (ADR-0271); top, at the start, by default. */
|
|
1671
|
+
readonly legend?: LegendPlacement;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/** A range of an Interpolated series and the method the Consumer used over it (ADR-0257). */
|
|
1675
|
+
export declare interface Segment {
|
|
1676
|
+
/** Where the range starts. */
|
|
1677
|
+
readonly from: number;
|
|
1678
|
+
/** Where it ends. */
|
|
1679
|
+
readonly to: number;
|
|
1680
|
+
/** The method's name, as the tooltip and the Notes say it. */
|
|
1681
|
+
readonly method: string;
|
|
1682
|
+
/** Whether the range lies beyond the quotes. */
|
|
1683
|
+
readonly extrapolated?: boolean;
|
|
1684
|
+
}
|
|
1685
|
+
|
|
1686
|
+
/** A series' Interval (ADR-0303): bounds handed in by the Consumer, with what they mean. */
|
|
1687
|
+
export declare interface SeriesInterval {
|
|
1688
|
+
/** What the interval is — "95% CI", "±1σ", "Bid–Ask"; required. */
|
|
1689
|
+
readonly meaning: string;
|
|
1690
|
+
/** The bounds at the series' positions. */
|
|
1691
|
+
readonly bounds: readonly IntervalBound[];
|
|
1692
|
+
/** Whiskers (the default) or a band. */
|
|
1693
|
+
readonly style?: IntervalStyle;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
/** What a series' numbers are, which decides how it is drawn (ADR-0253). Declared, never defaulted. */
|
|
1697
|
+
export declare type SeriesKind =
|
|
1698
|
+
/** A quantity at an instant: points, joined only to their neighbours in the data. */
|
|
1699
|
+
'level'
|
|
1700
|
+
/** A rate constant over an interval: a step with a filled end where it takes the value and an open end where it does not. */
|
|
1701
|
+
| 'rateOverInterval'
|
|
1702
|
+
/** A total over its interval: a step whose height is the amount per year, from zero. */
|
|
1703
|
+
| 'amountPerPeriod'
|
|
1704
|
+
/** One thing measured on two quantities: a marker, never joined, its points neither ordered nor unique in x (ADR-0290). */
|
|
1705
|
+
| 'observation'
|
|
1706
|
+
/** One period's open, high, low and close, and optionally its volume: a candle (ADR-0300). */
|
|
1707
|
+
| 'priceRange';
|
|
1708
|
+
|
|
1709
|
+
/** The look a series' Appearance Keys chose (ADR-0256): slot numbers the stylesheet's Visual Tokens say the look of. */
|
|
1710
|
+
export declare interface SeriesLook {
|
|
1711
|
+
/** The colour slot, from 0. */
|
|
1712
|
+
readonly colour: number;
|
|
1713
|
+
/** The line-style slot, from 0 (solid). */
|
|
1714
|
+
readonly lineStyle: number;
|
|
1715
|
+
/** The marker slot, from 0 (a circle). */
|
|
1716
|
+
readonly marker: number;
|
|
1717
|
+
/** The marker's shape. */
|
|
1718
|
+
readonly shape: MarkerShape;
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
/** One series as the scene draws it: everything its component needs (ADR-0252). */
|
|
1722
|
+
export declare interface SeriesPiece {
|
|
1723
|
+
/** The series' identity. */
|
|
1724
|
+
readonly id: string;
|
|
1725
|
+
/** Its name. */
|
|
1726
|
+
readonly name: string;
|
|
1727
|
+
/** The keys its look is chosen by (ADR-0256). */
|
|
1728
|
+
readonly keys: AppearanceKeys;
|
|
1729
|
+
/** The look they chose. */
|
|
1730
|
+
readonly look: SeriesLook;
|
|
1731
|
+
/** Its Series Kind. */
|
|
1732
|
+
readonly kind: SeriesKind;
|
|
1733
|
+
/** Whether it is the Consumer's interpolation (ADR-0257). */
|
|
1734
|
+
readonly interpolated: boolean;
|
|
1735
|
+
/** Its lines in pixels, each unbroken. */
|
|
1736
|
+
readonly lines: readonly (readonly DrawnPoint[])[];
|
|
1737
|
+
/** Its markers in pixels. */
|
|
1738
|
+
readonly markers: readonly DrawnMarker[];
|
|
1739
|
+
/** Its extrapolated ranges in pixels, drawn distinctly. */
|
|
1740
|
+
readonly extrapolated: readonly (readonly [from: number, to: number])[];
|
|
1741
|
+
/** What each thinned pixel holds (ADR-0254). */
|
|
1742
|
+
readonly thinned: readonly PixelSummary[];
|
|
1743
|
+
/** A Price Range's candles in pixels (ADR-0300). */
|
|
1744
|
+
readonly candles: readonly PlacedCandle[];
|
|
1745
|
+
/** The period its candles stand for: a row each, or the market period they were merged into (ADR-0302). */
|
|
1746
|
+
readonly period: CandlePeriod;
|
|
1747
|
+
/** A volume panel's bars in pixels (ADR-0300). */
|
|
1748
|
+
readonly volumes: readonly PlacedVolume[];
|
|
1749
|
+
/** Its Interval's whiskers in pixels (ADR-0303). */
|
|
1750
|
+
readonly whiskers: readonly DrawnWhisker[];
|
|
1751
|
+
/** Its Interval's bands in pixels, each a run of neighbours. */
|
|
1752
|
+
readonly bands: readonly (readonly DrawnWhisker[])[];
|
|
1753
|
+
/** What its Interval means, or `null` when it has none. */
|
|
1754
|
+
readonly intervalMeaning: string | null;
|
|
1755
|
+
/** Whether its markers' colour bands diverge from a centre (ADR-0320, ADR-0310). */
|
|
1756
|
+
readonly colourDiverging: boolean;
|
|
1757
|
+
/** Its edges in pixels, cut to the plot, drawn under its nodes (ADR-0321). */
|
|
1758
|
+
readonly edges: readonly DrawnEdge[];
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/** A Consumer's curve as a function, asked at about one position per device pixel as it is drawn (ADR-0257). */
|
|
1762
|
+
export declare interface SeriesSampler {
|
|
1763
|
+
/** The first position the function is asked at. */
|
|
1764
|
+
readonly from: number;
|
|
1765
|
+
/** The last. */
|
|
1766
|
+
readonly to: number;
|
|
1767
|
+
/** The Consumer's curve: the value at a position, or `null` where it has none. */
|
|
1768
|
+
readonly valueAt: (position: number) => ChartValue | null;
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
/** A series the user hid or showed from the legend (ADR-0271, ADR-0272). */
|
|
1772
|
+
export declare interface SeriesVisibility {
|
|
1773
|
+
/** The legend entry's key: the series' identity, which for quotes and their Interpolated curve is the quotes' and hides both (ADR-0257). */
|
|
1774
|
+
readonly key: string;
|
|
1775
|
+
/** Whether it is now hidden. */
|
|
1776
|
+
readonly hidden: boolean;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
/** A size key's entry: a value, its label, and the radius a marker of that value is drawn at. */
|
|
1780
|
+
export declare interface SizeEntry {
|
|
1781
|
+
/** The value. */
|
|
1782
|
+
readonly value: number;
|
|
1783
|
+
/** Its label. */
|
|
1784
|
+
readonly label: string;
|
|
1785
|
+
/** The radius in CSS pixels. */
|
|
1786
|
+
readonly radius: number;
|
|
1787
|
+
}
|
|
1788
|
+
|
|
1789
|
+
/** The size key a series' size is read on (ADR-0320). */
|
|
1790
|
+
export declare interface SizeKey {
|
|
1791
|
+
/** The series it belongs to. */
|
|
1792
|
+
readonly seriesId: string;
|
|
1793
|
+
/** What the sizes are. */
|
|
1794
|
+
readonly title: string;
|
|
1795
|
+
/** Its entries, smallest first. */
|
|
1796
|
+
readonly entries: readonly SizeEntry[];
|
|
1797
|
+
/** Its box in CSS pixels, under its title. */
|
|
1798
|
+
readonly box: Box;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/** Which interval a step's point stands for: `preceding` is (tᵢ₋₁, tᵢ], `following` is [tᵢ, tᵢ₊₁). */
|
|
1802
|
+
export declare type StepSide = 'preceding' | 'following';
|
|
1803
|
+
|
|
1804
|
+
/**
|
|
1805
|
+
* One axis of a 3D surface (ADR-0274): its title and its values in order, each written through its
|
|
1806
|
+
* format. A grid's lines are evenly spaced, one per value, unless its scale places them by value (ADR-0312).
|
|
1807
|
+
*/
|
|
1808
|
+
export declare class SurfaceAxis {
|
|
1809
|
+
#private;
|
|
1810
|
+
/** An axis of the given values, in the order the grid holds them; a code it cannot write them with is refused. */
|
|
1811
|
+
constructor(options: SurfaceAxisOptions);
|
|
1812
|
+
/** The axis' title. */
|
|
1813
|
+
get title(): string;
|
|
1814
|
+
/** The values, one per grid line, in order. */
|
|
1815
|
+
get values(): readonly SurfaceValue[];
|
|
1816
|
+
/** The Consumer's writer of a value, if any. */
|
|
1817
|
+
get format(): ((value: SurfaceValue) => string) | undefined;
|
|
1818
|
+
/** How the axis places its values (ADR-0312). */
|
|
1819
|
+
get scale(): AxisScale;
|
|
1820
|
+
/** The Excel format code its values and ticks are written by (ADR-0420), if any. */
|
|
1821
|
+
get formatCode(): string | undefined;
|
|
1822
|
+
/** Writes the value at `index` through the format or the code. */
|
|
1823
|
+
write(index: number): string;
|
|
1824
|
+
/** Writes `value` through the format or the code, or invariantly. */
|
|
1825
|
+
writeValue(value: SurfaceValue): string;
|
|
1826
|
+
/**
|
|
1827
|
+
* Writes a position that need not be one of the values, such as a tick: through the code, through the
|
|
1828
|
+
* format when the values are numbers, invariantly otherwise.
|
|
1829
|
+
*/
|
|
1830
|
+
writeTick(position: number): string;
|
|
1831
|
+
/** The index of `value` among the values, or -1. */
|
|
1832
|
+
indexOf(value: SurfaceValue): number;
|
|
1833
|
+
/**
|
|
1834
|
+
* The value at `index` as a number; a value that is not one is a defect of the caller, which checked it.
|
|
1835
|
+
*
|
|
1836
|
+
* @internal
|
|
1837
|
+
*/
|
|
1838
|
+
number(index: number): number;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
/** One axis of a surface as a Consumer declares it (ADR-0274, ADR-0312). */
|
|
1842
|
+
export declare interface SurfaceAxisOptions {
|
|
1843
|
+
/** The axis' title. */
|
|
1844
|
+
readonly title: string;
|
|
1845
|
+
/** The values, one per grid line, in order. */
|
|
1846
|
+
readonly values: readonly SurfaceValue[];
|
|
1847
|
+
/** Writes a value as the column it came from writes it; absent writes it invariantly. */
|
|
1848
|
+
readonly format?: (value: SurfaceValue) => string;
|
|
1849
|
+
/** How the axis places its values; `categories`, evenly spaced, by default (ADR-0312). */
|
|
1850
|
+
readonly scale?: AxisScale;
|
|
1851
|
+
/**
|
|
1852
|
+
* An Excel number format code in the invariant spelling, such as `0.0%`, read by the family's `FormatCode`
|
|
1853
|
+
* (ADR-0420): it writes the axis' values and its ticks between them, in place of a format. It writes numbers,
|
|
1854
|
+
* so the axis' values are numbers.
|
|
1855
|
+
*/
|
|
1856
|
+
readonly formatCode?: string;
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
/**
|
|
1860
|
+
* How many colour bands a face is coloured from, low to high; each is a Visual Token, `--ex-chart-heat-0`
|
|
1861
|
+
* on, or `--ex-chart-diverge-0` on when the colours diverge (ADR-0310).
|
|
1862
|
+
*/
|
|
1863
|
+
export declare const surfaceBandCount = 9;
|
|
1864
|
+
|
|
1865
|
+
/** The colour bar beside a surface (ADR-0310). */
|
|
1866
|
+
export declare interface SurfaceColourBar {
|
|
1867
|
+
/** The value at the foot of the lowest band, on the vertical scale. */
|
|
1868
|
+
readonly from: number;
|
|
1869
|
+
/** The value at the head of the highest band. */
|
|
1870
|
+
readonly to: number;
|
|
1871
|
+
/** The labelled values along it. */
|
|
1872
|
+
readonly ticks: readonly SurfaceTick[];
|
|
1873
|
+
/** Whether the bands diverge from a centre, which the middle band holds. */
|
|
1874
|
+
readonly diverging: boolean;
|
|
1875
|
+
/** How many bands it is drawn in: `surfaceBandCount`, handed to the entry so it holds no copy. */
|
|
1876
|
+
readonly bands: number;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
/**
|
|
1880
|
+
* A 3D surface in the data's terms (ADR-0274): x values × y values × a table of z, one row per y value
|
|
1881
|
+
* and one column per x value. A missing value is a hole, drawn as one: never 0 and never filled from its
|
|
1882
|
+
* neighbours. Scattered points are refused by name (`fromPoints`). Interpolation is the Consumer's
|
|
1883
|
+
* (ADR-0257): a surface may be handed in as a function, which ExChart samples (`sampled`), or as a grid
|
|
1884
|
+
* whose interpolated values are marked. A Consumer's own triangle mesh is drawn as its triangles
|
|
1885
|
+
* (`fromTriangles`, ADR-0311).
|
|
1886
|
+
*/
|
|
1887
|
+
export declare class SurfaceDefinition {
|
|
1888
|
+
#private;
|
|
1889
|
+
private constructor();
|
|
1890
|
+
/** A surface of the given grid; refused with a `ChartRefusedError` when it cannot be drawn as asked. */
|
|
1891
|
+
static grid(options: SurfaceGridOptions): SurfaceDefinition;
|
|
1892
|
+
/**
|
|
1893
|
+
* A surface from points, each at an x value and a y value. The points must lie on a grid: every x value
|
|
1894
|
+
* they name must hold a value at two y values at least, and every y value at two x values, or the point
|
|
1895
|
+
* stands alone and could join a surface only by interpolation (ADR-0257, ADR-0274). Where the grid has no
|
|
1896
|
+
* point, it has a hole.
|
|
1897
|
+
*/
|
|
1898
|
+
static fromPoints(options: SurfacePointsOptions): SurfaceDefinition;
|
|
1899
|
+
/**
|
|
1900
|
+
* A surface drawn on the Consumer's own triangle mesh (ADR-0311), each triangle flat through its three
|
|
1901
|
+
* corners, never resampled onto a grid. A slice cuts the triangles exactly, reading between nodes
|
|
1902
|
+
* linearly on them (`trianglesMethod`), which it says.
|
|
1903
|
+
*/
|
|
1904
|
+
static fromTriangles(options: SurfaceTrianglesOptions): SurfaceDefinition;
|
|
1905
|
+
/**
|
|
1906
|
+
* A surface handed in as a function z(x, y), the Consumer's interpolation, which names its method
|
|
1907
|
+
* (ADR-0257). ExChart samples it on a grid of `samples` values an axis across the rectangle — evenly in
|
|
1908
|
+
* the axis' own scale, so geometrically on a logarithmic one (ADR-0312) — and draws a hole where it
|
|
1909
|
+
* returns `null`. Every value is marked interpolated.
|
|
1910
|
+
*/
|
|
1911
|
+
static sampled(options: SurfaceSampledOptions): SurfaceDefinition;
|
|
1912
|
+
/** The x axis: the table's columns, or a mesh's x positions in order. */
|
|
1913
|
+
get x(): SurfaceAxis;
|
|
1914
|
+
/** The y axis: the table's rows, or a mesh's y positions in order. */
|
|
1915
|
+
get y(): SurfaceAxis;
|
|
1916
|
+
/** A grid's values, one row per y value, `null` at a hole; empty for a mesh. */
|
|
1917
|
+
get z(): readonly (readonly (ChartValue | null)[])[];
|
|
1918
|
+
/** What the values are, such as "Volatility". */
|
|
1919
|
+
get zTitle(): string;
|
|
1920
|
+
/** The Consumer's writer of a value, if any. */
|
|
1921
|
+
get zFormat(): ((value: ChartValue) => string) | undefined;
|
|
1922
|
+
/** The Excel format code the values are written by (ADR-0420), if any. */
|
|
1923
|
+
get zFormatCode(): string | undefined;
|
|
1924
|
+
/** The method the interpolated values were made with, if the surface claims one. */
|
|
1925
|
+
get method(): string | undefined;
|
|
1926
|
+
/** Which values are interpolated, in the table's shape; absent with a method marks every value. */
|
|
1927
|
+
get interpolated(): readonly (readonly boolean[])[] | undefined;
|
|
1928
|
+
/** The Consumer's Notes (ADR-0257). */
|
|
1929
|
+
get notes(): readonly string[];
|
|
1930
|
+
/** A mesh's nodes; absent for a grid (ADR-0311). */
|
|
1931
|
+
get nodes(): readonly SurfaceNode[] | undefined;
|
|
1932
|
+
/** A mesh's triangles; absent for a grid (ADR-0311). */
|
|
1933
|
+
get triangles(): readonly SurfaceTriangle[] | undefined;
|
|
1934
|
+
/** Whether the surface is a Consumer's triangle mesh rather than a grid (ADR-0311). */
|
|
1935
|
+
get isMesh(): boolean;
|
|
1936
|
+
/** The vertical scale asked for (ADR-0312). */
|
|
1937
|
+
get zScale(): AxisScale;
|
|
1938
|
+
/** The value the colours diverge from, if any (ADR-0310). */
|
|
1939
|
+
get centre(): number | undefined;
|
|
1940
|
+
/** The vertical scale as drawn: the one asked for, unless a value or the centre cannot lie on it. */
|
|
1941
|
+
get effectiveZScale(): AxisScale;
|
|
1942
|
+
/** The lines shown under the surface: the Consumer's Notes, the method (ADR-0257), and why a logarithmic scale stays proportional (ADR-0312). */
|
|
1943
|
+
get allNotes(): readonly string[];
|
|
1944
|
+
/** How many points the surface holds: a grid's points, row by row, or a mesh's nodes. */
|
|
1945
|
+
get nodeCount(): number;
|
|
1946
|
+
/** Whether a grid's value at x index `x` and y index `y` is interpolated; a mesh has no grid indices, and is refused. */
|
|
1947
|
+
isInterpolated(x: number, y: number): boolean;
|
|
1948
|
+
/** A grid's value at x index `x` and y index `y`, or `null` at a hole; a mesh has no grid indices, and is refused. */
|
|
1949
|
+
at(x: number, y: number): ChartValue | null;
|
|
1950
|
+
/** The point at `index`, counted as `nodeCount` counts: its x and y as the axes hold them, and its value, or `null`. */
|
|
1951
|
+
node(index: number): readonly [x: SurfaceValue, y: SurfaceValue, z: ChartValue | null];
|
|
1952
|
+
/** Whether the point at `index` is interpolated; a mesh's nodes are its values. */
|
|
1953
|
+
isInterpolatedNode(index: number): boolean;
|
|
1954
|
+
/**
|
|
1955
|
+
* A tick on the vertical axis or the colour bar, and the centre the colours diverge from: through the code, as
|
|
1956
|
+
* the values are, or plainly; a format, written for the values a column holds, leaves them plain (ADR-0420).
|
|
1957
|
+
*
|
|
1958
|
+
* @internal
|
|
1959
|
+
*/
|
|
1960
|
+
writeZTick(value: number): string;
|
|
1961
|
+
/** Writes a value through the format or the code, or invariantly. */
|
|
1962
|
+
writeZ(value: ChartValue): string;
|
|
1963
|
+
/**
|
|
1964
|
+
* The values the surface holds, holes left out.
|
|
1965
|
+
*
|
|
1966
|
+
* @internal
|
|
1967
|
+
*/
|
|
1968
|
+
present(): ChartValue[];
|
|
1969
|
+
/**
|
|
1970
|
+
* The slice as a 2D chart (ADR-0274): the values along the other axis, read exactly — as categories on
|
|
1971
|
+
* an evenly spaced axis, as numbers on the axis' own scale otherwise (ADR-0312). A hole is a gap. A
|
|
1972
|
+
* mesh's slice cuts its triangles and reads between nodes linearly on them, which it says (ADR-0311).
|
|
1973
|
+
* `undefined` when the slice's value is not on this surface.
|
|
1974
|
+
*/
|
|
1975
|
+
sliceChart(slice: SurfaceSlice): ChartDefinition | undefined;
|
|
1976
|
+
/**
|
|
1977
|
+
* A mesh cut at the slice's value (ADR-0311): the runs of positions along the other axis and the values
|
|
1978
|
+
* there, linear on each triangle, broken where no triangle is. `undefined` when the value is not a number
|
|
1979
|
+
* within the mesh's positions.
|
|
1980
|
+
*
|
|
1981
|
+
* @internal
|
|
1982
|
+
*/
|
|
1983
|
+
cut(slice: SurfaceSlice): readonly (readonly {
|
|
1984
|
+
readonly along: number;
|
|
1985
|
+
readonly z: ChartValue;
|
|
1986
|
+
}[])[] | undefined;
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
/** A face the 3D entry draws: its corners, as indices of the nodes, and its colour band. */
|
|
1990
|
+
export declare interface SurfaceFace {
|
|
1991
|
+
/** Four corners for a grid's cell, three for a mesh's triangle. */
|
|
1992
|
+
readonly corners: readonly number[];
|
|
1993
|
+
/** Its colour band, 0 to `surfaceBandCount` - 1. */
|
|
1994
|
+
readonly band: number;
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
/** A surface of a grid (ADR-0274): `z` holds one row per y value, each with one value per x value. */
|
|
1998
|
+
export declare interface SurfaceGridOptions extends SurfaceScaleOptions {
|
|
1999
|
+
/** The x axis: the table's columns. */
|
|
2000
|
+
readonly x: SurfaceAxisOptions;
|
|
2001
|
+
/** The y axis: the table's rows. */
|
|
2002
|
+
readonly y: SurfaceAxisOptions;
|
|
2003
|
+
/** The values, one row per y value, `null` at a hole. */
|
|
2004
|
+
readonly z: readonly (readonly (ChartValue | null)[])[];
|
|
2005
|
+
/** What the values are; empty by default. */
|
|
2006
|
+
readonly zTitle?: string;
|
|
2007
|
+
/** Writes a value as its cell writes it. */
|
|
2008
|
+
readonly zFormat?: (value: ChartValue) => string;
|
|
2009
|
+
/** The method the interpolated values were made with, as the tooltip and the Notes say it (ADR-0257). */
|
|
2010
|
+
readonly method?: string;
|
|
2011
|
+
/** Which values are interpolated, in the table's shape; absent with a method marks every value. */
|
|
2012
|
+
readonly interpolated?: readonly (readonly boolean[])[];
|
|
2013
|
+
/** The Consumer's Notes, shown under the surface (ADR-0257). */
|
|
2014
|
+
readonly notes?: readonly string[];
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
/** A 3D surface drawn into an element, handed back by {@link createSurface}. */
|
|
2018
|
+
export declare interface SurfaceHandle {
|
|
2019
|
+
/** Takes the options again, whole: what did not change costs nothing. */
|
|
2020
|
+
update(options: SurfaceOptions): void;
|
|
2021
|
+
/** Stops the surface: it hears nothing more and empties its element. */
|
|
2022
|
+
destroy(): void;
|
|
2023
|
+
/**
|
|
2024
|
+
* Saves the drawing as it stands as `svg`, or as `png` painted at the screen's Device Pixel (ADR-0282). One
|
|
2025
|
+
* call is one save. False for `csv` — a surface's values are read in "View as table" — and once destroyed.
|
|
2026
|
+
*/
|
|
2027
|
+
download(format: ChartFileFormat): Promise<boolean>;
|
|
2028
|
+
/** The drawing as it stands as SVG text, its colours resolved; `undefined` once destroyed (ADR-0282). */
|
|
2029
|
+
svgText(): string | undefined;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/** What the 3D entry is handed to draw a surface (ADR-0255). */
|
|
2033
|
+
export declare interface SurfaceMesh {
|
|
2034
|
+
/** The x axis' title. */
|
|
2035
|
+
readonly xTitle: string;
|
|
2036
|
+
/** The y axis' title. */
|
|
2037
|
+
readonly yTitle: string;
|
|
2038
|
+
/** The values' title. */
|
|
2039
|
+
readonly zTitle: string;
|
|
2040
|
+
/** The points, counted as the definition's `nodeCount` counts them. */
|
|
2041
|
+
readonly nodes: readonly SurfaceMeshNode[];
|
|
2042
|
+
/** The faces to draw; a face with a hole at a corner is no face. */
|
|
2043
|
+
readonly faces: readonly SurfaceFace[];
|
|
2044
|
+
/** A grid's lines along x, one per y value, as node indices; empty for a mesh. */
|
|
2045
|
+
readonly rows: readonly (readonly number[])[];
|
|
2046
|
+
/** A grid's lines along y, one per x value, as node indices; empty for a mesh. */
|
|
2047
|
+
readonly columns: readonly (readonly number[])[];
|
|
2048
|
+
/** The floor's lines across x. */
|
|
2049
|
+
readonly xLines: readonly SurfaceTick[];
|
|
2050
|
+
/** The floor's lines along y. */
|
|
2051
|
+
readonly yLines: readonly SurfaceTick[];
|
|
2052
|
+
/** The bottom of the vertical scale. */
|
|
2053
|
+
readonly zMin: number;
|
|
2054
|
+
/** The top of the vertical scale. */
|
|
2055
|
+
readonly zMax: number;
|
|
2056
|
+
/** The vertical scale's ticks. */
|
|
2057
|
+
readonly zTicks: readonly SurfaceTick[];
|
|
2058
|
+
/** The colour bar. */
|
|
2059
|
+
readonly bar: SurfaceColourBar;
|
|
2060
|
+
/** How many points are holes. */
|
|
2061
|
+
readonly holes: number;
|
|
2062
|
+
}
|
|
2063
|
+
|
|
2064
|
+
/** The mesh of `definition`. */
|
|
2065
|
+
export declare function surfaceMesh(definition: SurfaceDefinition): SurfaceMesh;
|
|
2066
|
+
|
|
2067
|
+
/** A point of a surface as the 3D entry places it. */
|
|
2068
|
+
export declare interface SurfaceMeshNode {
|
|
2069
|
+
/** Its place across the floor, 0 to 1. */
|
|
2070
|
+
readonly x: number;
|
|
2071
|
+
/** Its place along the floor, 0 to 1. */
|
|
2072
|
+
readonly y: number;
|
|
2073
|
+
/** Its value on the vertical scale (its logarithm on a logarithmic one), or `null` at a hole. */
|
|
2074
|
+
readonly z: number | null;
|
|
2075
|
+
/** Whether its value is interpolated, so the entry draws it no dot (ADR-0257). */
|
|
2076
|
+
readonly interpolated: boolean;
|
|
2077
|
+
}
|
|
2078
|
+
|
|
2079
|
+
/** A point of a slice's line on the surface, placed as a mesh node is. */
|
|
2080
|
+
export declare interface SurfaceMeshPoint {
|
|
2081
|
+
/** Its place across the floor, 0 to 1. */
|
|
2082
|
+
readonly x: number;
|
|
2083
|
+
/** Its place along the floor, 0 to 1. */
|
|
2084
|
+
readonly y: number;
|
|
2085
|
+
/** Its value on the vertical scale. */
|
|
2086
|
+
readonly z: number;
|
|
2087
|
+
}
|
|
2088
|
+
|
|
2089
|
+
/** A node of a Consumer's triangle mesh (ADR-0311): its place in the plane and its value, or `null`, a hole. */
|
|
2090
|
+
export declare interface SurfaceNode {
|
|
2091
|
+
/** Its x position. */
|
|
2092
|
+
readonly x: number;
|
|
2093
|
+
/** Its y position. */
|
|
2094
|
+
readonly y: number;
|
|
2095
|
+
/** Its value, or `null`: no triangle at it is drawn. */
|
|
2096
|
+
readonly z: ChartValue | null;
|
|
2097
|
+
}
|
|
2098
|
+
|
|
2099
|
+
/** What a 3D surface is drawn from, and what it raises. */
|
|
2100
|
+
export declare interface SurfaceOptions {
|
|
2101
|
+
/** The surface, in the data's terms. */
|
|
2102
|
+
readonly definition: SurfaceDefinition;
|
|
2103
|
+
/** Its width in CSS pixels: 640 when not given. Geometry is an option, never only a stylesheet value (ADR-0027). */
|
|
2104
|
+
readonly width?: number;
|
|
2105
|
+
/** Its height in CSS pixels, which the slice's chart beside it shares: 420 when not given. */
|
|
2106
|
+
readonly height?: number;
|
|
2107
|
+
/** The width of the slice's chart, in CSS pixels: 420 when not given. */
|
|
2108
|
+
readonly sliceWidth?: number;
|
|
2109
|
+
/** The density the font size is resolved from, as a grid's is (ADR-0028): `standard` when not given. */
|
|
2110
|
+
readonly density?: GridDensity;
|
|
2111
|
+
/** The surface's title, which opens its accessible summary. */
|
|
2112
|
+
readonly title?: string;
|
|
2113
|
+
/** A sentence the accessible summary ends with. */
|
|
2114
|
+
readonly description?: string;
|
|
2115
|
+
/** The view, taken back from `onViewChanged`; `null` or not given is the default view. */
|
|
2116
|
+
readonly view?: SurfaceView | null;
|
|
2117
|
+
/** Raised when the user ends a turn, a zoom or a pan, with the view it left (ADR-0272). */
|
|
2118
|
+
readonly onViewChanged?: (view: SurfaceView) => void;
|
|
2119
|
+
/** The slice drawn beside the surface, taken back from `onSliceChanged`; `null` or not given draws none. */
|
|
2120
|
+
readonly slice?: SurfaceSlice | null;
|
|
2121
|
+
/** Raised when the user clicks a tenor or a strike, with the slice it names (ADR-0274). */
|
|
2122
|
+
readonly onSliceChanged?: (slice: SurfaceSlice) => void;
|
|
2123
|
+
/** The name a saved file takes, without its extension; the title when not set, then `surface` (ADR-0282). */
|
|
2124
|
+
readonly fileName?: string;
|
|
2125
|
+
/** The Consumer's words for ExChart's own (ADR-0370 section 10); `japaneseChartWords` for Japanese. */
|
|
2126
|
+
readonly label?: ChartLabel;
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
/** A point of a surface handed in as points, at an x value and a y value. */
|
|
2130
|
+
export declare interface SurfacePoint {
|
|
2131
|
+
/** Its x value. */
|
|
2132
|
+
readonly x: SurfaceValue;
|
|
2133
|
+
/** Its y value. */
|
|
2134
|
+
readonly y: SurfaceValue;
|
|
2135
|
+
/** Its value. */
|
|
2136
|
+
readonly z: ChartValue;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
/** A surface from points on a grid (ADR-0274). */
|
|
2140
|
+
export declare interface SurfacePointsOptions extends SurfaceScaleOptions {
|
|
2141
|
+
/** The points. */
|
|
2142
|
+
readonly points: readonly SurfacePoint[];
|
|
2143
|
+
/** The x axis' title. */
|
|
2144
|
+
readonly xTitle: string;
|
|
2145
|
+
/** The y axis' title. */
|
|
2146
|
+
readonly yTitle: string;
|
|
2147
|
+
/** What the values are. */
|
|
2148
|
+
readonly zTitle?: string;
|
|
2149
|
+
/** Writes an x value. */
|
|
2150
|
+
readonly xFormat?: (value: SurfaceValue) => string;
|
|
2151
|
+
/** Writes a y value. */
|
|
2152
|
+
readonly yFormat?: (value: SurfaceValue) => string;
|
|
2153
|
+
/** The x axis' Excel format code, in place of `xFormat` (ADR-0420). */
|
|
2154
|
+
readonly xFormatCode?: string;
|
|
2155
|
+
/** The y axis' Excel format code, in place of `yFormat`. */
|
|
2156
|
+
readonly yFormatCode?: string;
|
|
2157
|
+
/** Writes a value. */
|
|
2158
|
+
readonly zFormat?: (value: ChartValue) => string;
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
/** A surface handed in as the Consumer's function z(x, y), which names its method (ADR-0257). */
|
|
2162
|
+
export declare interface SurfaceSampledOptions extends SurfaceScaleOptions {
|
|
2163
|
+
/** The method the function interpolates with, as the tooltip and the Notes say it. */
|
|
2164
|
+
readonly method: string;
|
|
2165
|
+
/** The first x sampled. */
|
|
2166
|
+
readonly xFrom: number;
|
|
2167
|
+
/** The last. */
|
|
2168
|
+
readonly xTo: number;
|
|
2169
|
+
/** The first y sampled. */
|
|
2170
|
+
readonly yFrom: number;
|
|
2171
|
+
/** The last. */
|
|
2172
|
+
readonly yTo: number;
|
|
2173
|
+
/** The Consumer's surface: the value at (x, y), or `null` where it has none, outside its points. */
|
|
2174
|
+
readonly z: (x: number, y: number) => ChartValue | null;
|
|
2175
|
+
/** The x axis' title. */
|
|
2176
|
+
readonly xTitle: string;
|
|
2177
|
+
/** The y axis' title. */
|
|
2178
|
+
readonly yTitle: string;
|
|
2179
|
+
/** What the values are. */
|
|
2180
|
+
readonly zTitle?: string;
|
|
2181
|
+
/** How many values an axis is sampled at; 25 by default. */
|
|
2182
|
+
readonly samples?: number;
|
|
2183
|
+
/** Writes an x value. */
|
|
2184
|
+
readonly xFormat?: (value: SurfaceValue) => string;
|
|
2185
|
+
/** Writes a y value. */
|
|
2186
|
+
readonly yFormat?: (value: SurfaceValue) => string;
|
|
2187
|
+
/** The x axis' Excel format code, in place of `xFormat` (ADR-0420). */
|
|
2188
|
+
readonly xFormatCode?: string;
|
|
2189
|
+
/** The y axis' Excel format code, in place of `yFormat`. */
|
|
2190
|
+
readonly yFormatCode?: string;
|
|
2191
|
+
/** Writes a value. */
|
|
2192
|
+
readonly zFormat?: (value: ChartValue) => string;
|
|
2193
|
+
/** How x values are sampled and placed; `categories` by default. */
|
|
2194
|
+
readonly xScale?: AxisScale;
|
|
2195
|
+
/** How y values are sampled and placed. */
|
|
2196
|
+
readonly yScale?: AxisScale;
|
|
2197
|
+
}
|
|
2198
|
+
|
|
2199
|
+
/** How the values are scaled, coloured and written, which every form of surface may say (ADR-0310, ADR-0312, ADR-0420). */
|
|
2200
|
+
export declare interface SurfaceScaleOptions {
|
|
2201
|
+
/**
|
|
2202
|
+
* An Excel number format code in the invariant spelling, such as `0.00%`, read by the family's `FormatCode`
|
|
2203
|
+
* (ADR-0420): it writes the values the surface holds and the ones a slice reads between them, in place of a
|
|
2204
|
+
* `zFormat`.
|
|
2205
|
+
*/
|
|
2206
|
+
readonly zFormatCode?: string;
|
|
2207
|
+
/** The vertical scale: `proportional`, the default, or `logarithmic`; never `categories`. */
|
|
2208
|
+
readonly zScale?: AxisScale;
|
|
2209
|
+
/** The value the colours diverge from, such as 0 for a P&L (ADR-0310); absent colours low to high. */
|
|
2210
|
+
readonly centre?: number;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
/** A slice of a surface, named in the data's terms (ADR-0272, ADR-0274): the axis held fixed and its value there. */
|
|
2214
|
+
export declare interface SurfaceSlice {
|
|
2215
|
+
/** The axis held fixed. */
|
|
2216
|
+
readonly axis: SurfaceSliceAxis;
|
|
2217
|
+
/** Its value, as the axis holds it. */
|
|
2218
|
+
readonly value: SurfaceValue;
|
|
2219
|
+
}
|
|
2220
|
+
|
|
2221
|
+
/** Which of a surface's two axes a slice holds fixed: `x` runs along y, `y` along x. */
|
|
2222
|
+
export declare type SurfaceSliceAxis = 'x' | 'y';
|
|
2223
|
+
|
|
2224
|
+
/**
|
|
2225
|
+
* The slice's line on the surface, placed as the mesh's points are, in runs broken at a hole: along a
|
|
2226
|
+
* grid's line, or across a mesh's triangles where the slice cuts them (ADR-0311). Empty when the slice is
|
|
2227
|
+
* not on this surface.
|
|
2228
|
+
*/
|
|
2229
|
+
export declare function surfaceSlicePath(definition: SurfaceDefinition, slice: SurfaceSlice): readonly (readonly SurfaceMeshPoint[])[];
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* The surface said in words, for a screen reader (ADR-0275's shape): what it is of, its grid or its mesh,
|
|
2233
|
+
* the range of its values, its holes, and how it is coloured and scaled; then the Consumer's description.
|
|
2234
|
+
*/
|
|
2235
|
+
export declare function surfaceSummary(definition: SurfaceDefinition, title?: string, description?: string): string;
|
|
2236
|
+
|
|
2237
|
+
/** A labelled position on one of a surface's scales: its value there, and its label or `null` where labels would crowd. */
|
|
2238
|
+
export declare interface SurfaceTick {
|
|
2239
|
+
/** A fraction of the floor for x and y; a value on the vertical scale for z and the colour bar. */
|
|
2240
|
+
readonly value: number;
|
|
2241
|
+
/** The label, or `null` for a line drawn unlabelled. */
|
|
2242
|
+
readonly label: string | null;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
/** A triangle of a Consumer's mesh (ADR-0311): the indices of its three nodes. */
|
|
2246
|
+
export declare interface SurfaceTriangle {
|
|
2247
|
+
/** The first corner's index. */
|
|
2248
|
+
readonly a: number;
|
|
2249
|
+
/** The second corner's index. */
|
|
2250
|
+
readonly b: number;
|
|
2251
|
+
/** The third corner's index. */
|
|
2252
|
+
readonly c: number;
|
|
2253
|
+
}
|
|
2254
|
+
|
|
2255
|
+
/** A surface on the Consumer's own triangle mesh (ADR-0311). */
|
|
2256
|
+
export declare interface SurfaceTrianglesOptions extends SurfaceScaleOptions {
|
|
2257
|
+
/** The nodes. */
|
|
2258
|
+
readonly nodes: readonly SurfaceNode[];
|
|
2259
|
+
/** The triangles. */
|
|
2260
|
+
readonly triangles: readonly SurfaceTriangle[];
|
|
2261
|
+
/** The x axis' title. */
|
|
2262
|
+
readonly xTitle: string;
|
|
2263
|
+
/** The y axis' title. */
|
|
2264
|
+
readonly yTitle: string;
|
|
2265
|
+
/** What the values are. */
|
|
2266
|
+
readonly zTitle?: string;
|
|
2267
|
+
/** Writes an x position. */
|
|
2268
|
+
readonly xFormat?: (value: SurfaceValue) => string;
|
|
2269
|
+
/** Writes a y position. */
|
|
2270
|
+
readonly yFormat?: (value: SurfaceValue) => string;
|
|
2271
|
+
/** The x axis' Excel format code, in place of `xFormat` (ADR-0420). */
|
|
2272
|
+
readonly xFormatCode?: string;
|
|
2273
|
+
/** The y axis' Excel format code, in place of `yFormat`. */
|
|
2274
|
+
readonly yFormatCode?: string;
|
|
2275
|
+
/** Writes a value. */
|
|
2276
|
+
readonly zFormat?: (value: ChartValue) => string;
|
|
2277
|
+
/** How x positions are placed: `proportional`, the default, or `logarithmic`. */
|
|
2278
|
+
readonly xScale?: AxisScale;
|
|
2279
|
+
/** How y positions are placed. */
|
|
2280
|
+
readonly yScale?: AxisScale;
|
|
2281
|
+
/** The Consumer's Notes. */
|
|
2282
|
+
readonly notes?: readonly string[];
|
|
2283
|
+
}
|
|
2284
|
+
|
|
2285
|
+
/** A value of a surface's axis: a strike, a delta or a tenor, as the column holds it. */
|
|
2286
|
+
export declare type SurfaceValue = string | number;
|
|
2287
|
+
|
|
2288
|
+
/** How a surface is seen, in its own terms (ADR-0272): angles in degrees, the zoom, and the centre's offset as fractions. Never pixels. */
|
|
2289
|
+
export declare interface SurfaceView {
|
|
2290
|
+
/** The turn about the vertical, in degrees. */
|
|
2291
|
+
readonly yaw: number;
|
|
2292
|
+
/** The tilt from level, in degrees, -90 to 90. */
|
|
2293
|
+
readonly pitch: number;
|
|
2294
|
+
/** The zoom, 1 fitting the surface to its box. */
|
|
2295
|
+
readonly zoom: number;
|
|
2296
|
+
/** The centre's horizontal offset, as a fraction of the width. */
|
|
2297
|
+
readonly panX: number;
|
|
2298
|
+
/** The centre's vertical offset, as a fraction of the height. */
|
|
2299
|
+
readonly panY: number;
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
/** A tenor in years written as the market writes it: 6M, 18M, 1Y, 2.5Y. */
|
|
2303
|
+
export declare function tenor(years: number): string;
|
|
2304
|
+
|
|
2305
|
+
/** The most points `fitTheilSen` takes: it weighs every pair, which past this is too many to run. */
|
|
2306
|
+
export declare const theilSenLimit = 3000;
|
|
2307
|
+
|
|
2308
|
+
/**
|
|
2309
|
+
* Thins `data` as `query` asks (ADR-0344): the range cut into `pixels` equal columns, each keeping its first, last,
|
|
2310
|
+
* lowest and highest row (ADR-0254), never a row picked by LTTB; a row with no value kept where it is, so a gap stays a
|
|
2311
|
+
* gap. Rows are answered in order across, a row's place in the data breaking a tie. A table without the query's
|
|
2312
|
+
* columns, or a query of no pixels, of a range that is not finite or of a labels axis, is refused with a `TypeError`; a
|
|
2313
|
+
* position that is not the axis' kind, or a value that is no number, with a {@link ChartSpecRefusedError}.
|
|
2314
|
+
*/
|
|
2315
|
+
export declare function thinChartData(data: ChartData, query: ChartSourceQuery, version?: bigint): ChartSourceAnswer;
|
|
2316
|
+
|
|
2317
|
+
/** Where a horizontal axis puts its ticks. */
|
|
2318
|
+
export declare type TickPlacement =
|
|
2319
|
+
/** The default for the axis: calendar boundaries for dates, round numbers for numbers, every category. */
|
|
2320
|
+
'auto'
|
|
2321
|
+
/** At calendar boundaries — years, quarters, months or days, the finest that fits. */
|
|
2322
|
+
| 'calendar'
|
|
2323
|
+
/** At every position some series has a point at. */
|
|
2324
|
+
| 'everyPoint'
|
|
2325
|
+
/** At the market's tenors counted from the first date: 1M, 3M, 6M, 1Y, 2Y, 3Y, 5Y, 7Y, 10Y … */
|
|
2326
|
+
| 'tenors'
|
|
2327
|
+
/** At the positions the axis names. */
|
|
2328
|
+
| 'named';
|
|
2329
|
+
|
|
2330
|
+
/** The method a slice through a Consumer's triangles reads between its nodes with (ADR-0311). */
|
|
2331
|
+
export declare const trianglesMethod = "linear on the Consumer's triangles (P1)";
|
|
2332
|
+
|
|
2333
|
+
/** The value that stands at height `y` on `plot`. */
|
|
2334
|
+
export declare function valueAt(axis: VerticalAxis, y: number, plot: Box): number;
|
|
2335
|
+
|
|
2336
|
+
/** A vertical axis, laid out. */
|
|
2337
|
+
export declare interface VerticalAxis {
|
|
2338
|
+
/** Which side it stands on. */
|
|
2339
|
+
readonly side: AxisSide;
|
|
2340
|
+
/** The value at the plot's foot. */
|
|
2341
|
+
readonly min: number;
|
|
2342
|
+
/** The value at its top. */
|
|
2343
|
+
readonly max: number;
|
|
2344
|
+
/** Its ticks. */
|
|
2345
|
+
readonly ticks: readonly VerticalTick[];
|
|
2346
|
+
/** Whether it does not reach zero, which a break mark at its foot says (ADR-0253). */
|
|
2347
|
+
readonly broken: boolean;
|
|
2348
|
+
/** Whether it is logarithmic, its `min` and `max` then both above zero (ADR-0290). */
|
|
2349
|
+
readonly logarithmic: boolean;
|
|
2350
|
+
}
|
|
2351
|
+
|
|
2352
|
+
/** A tick of a vertical axis: its value, its height in pixels, and its label. */
|
|
2353
|
+
export declare type VerticalTick = readonly [value: number, y: number, label: string];
|
|
2354
|
+
|
|
2355
|
+
/** The height in pixels at which `value` stands on `plot`. */
|
|
2356
|
+
export declare function yOf(axis: VerticalAxis, value: number, plot: Box): number;
|
|
2357
|
+
|
|
2358
|
+
export { }
|