@invana/charts 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/index.cjs +1737 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +681 -0
- package/dist/index.d.ts +681 -0
- package/dist/index.js +1701 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { LegendSwatchKind, LegendProps, ExpandedKeys } from '@invana/ui';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The frame every uPlot chart sits in. Internal — the package exports charts,
|
|
6
|
+
* not this.
|
|
7
|
+
*
|
|
8
|
+
* uPlot owns the scales, the canvas, the y axis and the cursor. Everything a
|
|
9
|
+
* reader reads as text — the period ticks, the tooltip, the legend, the table
|
|
10
|
+
* view — is DOM composed from `@invana/ui`, so it sets in the same type as the
|
|
11
|
+
* panel around it and never scales with a canvas.
|
|
12
|
+
*
|
|
13
|
+
* The x axis runs from -½ to n-½: every period owns one equal slot with its
|
|
14
|
+
* point or column in the middle, so a line and a column chart of the same days
|
|
15
|
+
* line up when they sit side by side, and a single period sits centred rather
|
|
16
|
+
* than on an edge.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
interface ChartMark {
|
|
20
|
+
/** The period the mark sits on. */
|
|
21
|
+
index: number;
|
|
22
|
+
/** Named above the rule. Without one the rule stands alone — a boundary, not an event. */
|
|
23
|
+
label?: string;
|
|
24
|
+
}
|
|
25
|
+
interface ChartReference {
|
|
26
|
+
/** Where the rule sits, on the chart's own axis. */
|
|
27
|
+
value: number;
|
|
28
|
+
label: string;
|
|
29
|
+
}
|
|
30
|
+
interface LegendEntry {
|
|
31
|
+
key: string;
|
|
32
|
+
label: string;
|
|
33
|
+
/** The series colour, as CSS — `var(--color-data-3)`. */
|
|
34
|
+
color: string;
|
|
35
|
+
kind?: LegendSwatchKind;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* One measure over time, with the moments that might explain it marked on the
|
|
40
|
+
* axis — a plan's work p50 a day, with each version's publish.
|
|
41
|
+
*
|
|
42
|
+
* One series and one axis, so no legend: the panel's title names what is
|
|
43
|
+
* plotted. A day with no value breaks the line rather than drawing it to zero,
|
|
44
|
+
* because *nothing ran* is not *it took no time*; a measured day between two
|
|
45
|
+
* gaps draws as a point, so it is not lost. A mark is a dashed rule with its
|
|
46
|
+
* label at the top — an event, not a value. A reference is a dashed rule with
|
|
47
|
+
* its label at the right — a line to compare against, such as the Graph's p95.
|
|
48
|
+
* Hover (or the arrow keys) reads the nearest day.
|
|
49
|
+
*
|
|
50
|
+
* A band shades the range the line is judged against — a normal range, or a
|
|
51
|
+
* forecast's interval — under the line. A highlight rings a period that stands
|
|
52
|
+
* out, in its own colour, without a label: whatever sits beside the chart says
|
|
53
|
+
* why. After `forecastFrom` the line is dashed, with an unlabelled rule at the
|
|
54
|
+
* boundary unless `forecastLabel` names it. A measure that never nears zero can
|
|
55
|
+
* drop the zero baseline (`zero={false}`), so its movement is not flattened.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
type LineChartMark = ChartMark;
|
|
59
|
+
type LineChartReference = ChartReference;
|
|
60
|
+
interface LineChartBand {
|
|
61
|
+
/** The bottom edge: one value across the plot, or one per period (`null` leaves a gap). */
|
|
62
|
+
lower: number | (number | null)[];
|
|
63
|
+
upper: number | (number | null)[];
|
|
64
|
+
/** Named below the band's right end — `normal range`. */
|
|
65
|
+
label?: string;
|
|
66
|
+
/** A CSS colour or token. Default: the line's. */
|
|
67
|
+
color?: string;
|
|
68
|
+
}
|
|
69
|
+
interface LineChartHighlight {
|
|
70
|
+
/** The period ringed. */
|
|
71
|
+
index: number;
|
|
72
|
+
/** A CSS colour or token — `var(--color-warning)`. Default: the line's. */
|
|
73
|
+
color?: string;
|
|
74
|
+
}
|
|
75
|
+
/** A line read against the main one — last year beside this — drawn behind it. */
|
|
76
|
+
interface LineChartSeries {
|
|
77
|
+
/** Named at the line's right end, in the hover and in the table. */
|
|
78
|
+
name: string;
|
|
79
|
+
/** One per period, as `values`; `null` where nothing was measured. */
|
|
80
|
+
values: (number | null)[];
|
|
81
|
+
/** A CSS colour or token. Default: the muted foreground. */
|
|
82
|
+
color?: string;
|
|
83
|
+
}
|
|
84
|
+
interface LineChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
85
|
+
/** One per period; `null` where nothing was measured. */
|
|
86
|
+
values: (number | null)[];
|
|
87
|
+
/**
|
|
88
|
+
* The main line's name. Needed once there is a `compare`: every line is then
|
|
89
|
+
* named at its right end, where it finishes, instead of in a legend.
|
|
90
|
+
*/
|
|
91
|
+
name?: string;
|
|
92
|
+
/** Lines to read the main one against, drawn behind it without its marks or forecast. */
|
|
93
|
+
compare?: LineChartSeries[];
|
|
94
|
+
/** One per period — what the hover and a tick name it. */
|
|
95
|
+
labels: string[];
|
|
96
|
+
/** How a value is written on the axis and in the hover — `6.0s`. */
|
|
97
|
+
format?: (value: number) => string;
|
|
98
|
+
/** Fixes the scale. Defaults to a clean step above the largest value. */
|
|
99
|
+
max?: number;
|
|
100
|
+
/** Values to draw a hairline at. Default: 0 and every clean step to the top. */
|
|
101
|
+
gridlines?: number[];
|
|
102
|
+
marks?: LineChartMark[];
|
|
103
|
+
/** A value to compare against, drawn as a dashed rule labelled at the right. */
|
|
104
|
+
reference?: LineChartReference;
|
|
105
|
+
/** A range shaded under the line. */
|
|
106
|
+
band?: LineChartBand;
|
|
107
|
+
/** Periods ringed because they stand out. */
|
|
108
|
+
highlights?: LineChartHighlight[];
|
|
109
|
+
/** The last actual period — the one the forecast runs from. The line is dashed after it. */
|
|
110
|
+
forecastFrom?: number;
|
|
111
|
+
/** Names the rule at `forecastFrom` — `today`. */
|
|
112
|
+
forecastLabel?: string;
|
|
113
|
+
/** Start the axis at 0. Default: true. */
|
|
114
|
+
zero?: boolean;
|
|
115
|
+
/** Which periods name themselves under the axis. Default: the first and the last. */
|
|
116
|
+
ticks?: number[];
|
|
117
|
+
/** The plot's height in px. */
|
|
118
|
+
height?: number;
|
|
119
|
+
/** A CSS colour or token — `var(--color-primary)`. */
|
|
120
|
+
color?: string;
|
|
121
|
+
/** Shown in place of the plot when no period has a value. */
|
|
122
|
+
empty?: React.ReactNode;
|
|
123
|
+
}
|
|
124
|
+
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Counts over days, split into the parts that make them up — `served` and
|
|
128
|
+
* `failed` in each day's runs, or a model's queries by caller.
|
|
129
|
+
*
|
|
130
|
+
* Vertical because the x-axis is time. The parts stack bottom-up in `series`
|
|
131
|
+
* order with a 2px surface gap between them, and only the top of a column is
|
|
132
|
+
* rounded, so a stack reads as one count cut into pieces rather than as bars
|
|
133
|
+
* balanced on each other. A day with nothing draws nothing: a zero is a gap,
|
|
134
|
+
* not a sliver.
|
|
135
|
+
*
|
|
136
|
+
* The floors: the count axis never tops out below five, so one run on a quiet
|
|
137
|
+
* day is a short column, not a full-height one; a column is never wider than
|
|
138
|
+
* 24px, however few days there are; and a window where every day is zero shows
|
|
139
|
+
* that it is empty rather than an axis of zeros.
|
|
140
|
+
*
|
|
141
|
+
* Every column answers a hover with its day and each part's count; the hover
|
|
142
|
+
* target is the day's whole slot, not the painted bar. Two or more series
|
|
143
|
+
* always carry a legend, inside the chart, because identity is never colour
|
|
144
|
+
* alone; the axis labels are sparse (`ticks`), because thirty dates under
|
|
145
|
+
* thirty columns is texture.
|
|
146
|
+
*/
|
|
147
|
+
|
|
148
|
+
interface StackSeries {
|
|
149
|
+
key: string;
|
|
150
|
+
label: string;
|
|
151
|
+
/** A token — `var(--color-success)`. Status tokens only for status series. */
|
|
152
|
+
color: string;
|
|
153
|
+
}
|
|
154
|
+
interface StackedColumnDatum {
|
|
155
|
+
/** The period, as the tooltip and a tick name it — `17 Sep`. */
|
|
156
|
+
label: string;
|
|
157
|
+
/** The count per series `key`. A missing key is 0. */
|
|
158
|
+
values: Record<string, number>;
|
|
159
|
+
}
|
|
160
|
+
interface StackedBarChartVProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
161
|
+
data: StackedColumnDatum[];
|
|
162
|
+
series: StackSeries[];
|
|
163
|
+
/** Fixes the scale. Defaults to a clean step above the tallest column, and never below 5. */
|
|
164
|
+
max?: number;
|
|
165
|
+
/** Values to draw a hairline at — `[20, 40, 60]`. */
|
|
166
|
+
gridlines?: number[];
|
|
167
|
+
/** The plot's height in px. */
|
|
168
|
+
height?: number;
|
|
169
|
+
/** Which columns name their period under the axis. Default: the first and the last. */
|
|
170
|
+
ticks?: number[];
|
|
171
|
+
/** Shown in place of the plot when every column is zero. */
|
|
172
|
+
empty?: React.ReactNode;
|
|
173
|
+
}
|
|
174
|
+
declare const StackedBarChartV: React.ForwardRefExoticComponent<StackedBarChartVProps & React.RefAttributes<HTMLDivElement>>;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Totals over time, split into the parts that make them up — records over time
|
|
178
|
+
* by model, or by node type inside one model.
|
|
179
|
+
*
|
|
180
|
+
* The paths are stepped: a record count only moves where a write happened, so
|
|
181
|
+
* the edge stays flat between writes and rises in one step at the write rather
|
|
182
|
+
* than sloping across days that changed nothing. Each write is marked — a
|
|
183
|
+
* dashed rule with its label at the top, `import` or `stitch commit` — because
|
|
184
|
+
* the step is the event and the mark says which one.
|
|
185
|
+
*
|
|
186
|
+
* The parts stack bottom-up in `series` order, which is fixed: a model keeps its
|
|
187
|
+
* band and its colour whatever its size, so a filter or a re-sort never
|
|
188
|
+
* repaints the survivors. Bands are separated by a 2px surface line rather than
|
|
189
|
+
* outlined. Up to four series are also named at the right edge, beside their
|
|
190
|
+
* band; a name that would collide with its neighbour is left to the legend,
|
|
191
|
+
* which is always there for two or more series. A series with nothing in it has
|
|
192
|
+
* no band and no direct label, but keeps its legend entry.
|
|
193
|
+
*/
|
|
194
|
+
|
|
195
|
+
interface AreaSeries {
|
|
196
|
+
key: string;
|
|
197
|
+
label: string;
|
|
198
|
+
/** A token — `var(--color-data-1)`. */
|
|
199
|
+
color: string;
|
|
200
|
+
}
|
|
201
|
+
interface StackedAreaDatum {
|
|
202
|
+
/** The period, as the tooltip and a tick name it — `17 Sep`. */
|
|
203
|
+
label: string;
|
|
204
|
+
/** The total per series `key` at the end of the period. A missing key is 0. */
|
|
205
|
+
values: Record<string, number>;
|
|
206
|
+
}
|
|
207
|
+
interface StackedAreaChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
208
|
+
data: StackedAreaDatum[];
|
|
209
|
+
series: AreaSeries[];
|
|
210
|
+
/** The writes that moved the totals — each import, each stitch commit. */
|
|
211
|
+
marks?: ChartMark[];
|
|
212
|
+
/** Names the marks in the legend — `a write — an import or a stitch commit`. */
|
|
213
|
+
markLegend?: string;
|
|
214
|
+
/** How a value is written on the axis and in the hover. Default: `1,284` / `12.9K`. */
|
|
215
|
+
format?: (value: number) => string;
|
|
216
|
+
/** Fixes the scale. Defaults to a clean step above the tallest stack. */
|
|
217
|
+
max?: number;
|
|
218
|
+
/** Values to draw a hairline at. Default: 0 and every clean step to the top. */
|
|
219
|
+
gridlines?: number[];
|
|
220
|
+
/** Which periods name themselves under the axis. Default: the first and the last. */
|
|
221
|
+
ticks?: number[];
|
|
222
|
+
/** The plot's height in px. */
|
|
223
|
+
height?: number;
|
|
224
|
+
/** Name each band at the right edge. Default: on for four series or fewer. */
|
|
225
|
+
directLabels?: boolean;
|
|
226
|
+
/** Shown in place of the plot when every period is zero. */
|
|
227
|
+
empty?: React.ReactNode;
|
|
228
|
+
}
|
|
229
|
+
declare const StackedAreaChart: React.ForwardRefExoticComponent<StackedAreaChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* TODO — provisional. Built ahead of its design review.
|
|
233
|
+
*
|
|
234
|
+
* The chart set was deliberately deferred while the rest of the kit was built,
|
|
235
|
+
* because charts are the one group with a real design question in them rather
|
|
236
|
+
* than a markup question: which forms this product actually needs, at what
|
|
237
|
+
* sizes, and how much a 330px drawer can carry. This component satisfies the
|
|
238
|
+
* dataviz rules and the validated palette, but the *form inventory* has not been
|
|
239
|
+
* agreed — treat the API as unsettled until a board screen uses it in anger.
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
interface SparklineProps extends Omit<React.SVGAttributes<SVGSVGElement>, "children" | "values"> {
|
|
243
|
+
values: number[];
|
|
244
|
+
width?: number;
|
|
245
|
+
height?: number;
|
|
246
|
+
color?: string;
|
|
247
|
+
/** Washes the area under the line at 10%. Off by default at this size. */
|
|
248
|
+
area?: boolean;
|
|
249
|
+
/** The line's width, in px. `2` by default; a sparkline beside a figure draws finer. */
|
|
250
|
+
strokeWidth?: number;
|
|
251
|
+
/** A filled dot on the last point, ringed in the surface colour. */
|
|
252
|
+
endMarker?: boolean;
|
|
253
|
+
/** What the line is, for assistive tech. The surface around it usually says. */
|
|
254
|
+
label?: string;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* The shape of a series, small enough to sit inside a row.
|
|
258
|
+
*
|
|
259
|
+
* No axis, no gridlines, no labels — a sparkline answers "which way, and how
|
|
260
|
+
* steadily", and the number it accompanies answers "how much". If a reader
|
|
261
|
+
* needs to read a value off it, it wanted to be a chart.
|
|
262
|
+
*
|
|
263
|
+
* The end marker carries a 2px ring in the surface colour so it stays legible
|
|
264
|
+
* where the line runs under it.
|
|
265
|
+
*/
|
|
266
|
+
declare const Sparkline: React.ForwardRefExoticComponent<SparklineProps & React.RefAttributes<SVGSVGElement>>;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* A share, drawn as a bar inside a table cell with its value beside it — a
|
|
270
|
+
* model's share of queries, a step's share of a plan's work.
|
|
271
|
+
*
|
|
272
|
+
* DOM, not canvas: it sits in every row of a table, sets in the row's own type
|
|
273
|
+
* and needs nothing a canvas gives.
|
|
274
|
+
*
|
|
275
|
+
* The bar's length is `value ÷ max`; the number is `value` itself. A column of
|
|
276
|
+
* small shares can pass `max` = the largest share so the longest bar fills the
|
|
277
|
+
* track while every number stays the true share. Zero, or no value, reads `—`
|
|
278
|
+
* with no track: an empty bar looks like a measured zero, and a dash says there
|
|
279
|
+
* is nothing to measure.
|
|
280
|
+
*
|
|
281
|
+
* `tone` is the fill's job: `primary` by default, `muted` for a secondary column,
|
|
282
|
+
* and the status tones only when the share *is* a status. When the row is an
|
|
283
|
+
* entity with its own colour — a model, a node type — pass `color` instead, so
|
|
284
|
+
* the meter carries the same hue as the entity everywhere else.
|
|
285
|
+
*/
|
|
286
|
+
|
|
287
|
+
type InlineMeterTone = "primary" | "muted" | "success" | "warning" | "destructive";
|
|
288
|
+
interface InlineMeterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
289
|
+
/** The share, on the same scale as `max` — `0.32` of 1. `null` reads as `—`. */
|
|
290
|
+
value: number | null | undefined;
|
|
291
|
+
/** What a full track means. Default 1. */
|
|
292
|
+
max?: number;
|
|
293
|
+
/** How the value is written. Default: a whole percentage of 1 — `32%`. */
|
|
294
|
+
format?: (value: number) => string;
|
|
295
|
+
tone?: InlineMeterTone;
|
|
296
|
+
/** An entity's colour, as CSS — `var(--color-data-2)`. Overrides `tone`. */
|
|
297
|
+
color?: string;
|
|
298
|
+
/** What is being measured, for assistive tech — `share of queries`. */
|
|
299
|
+
label?: string;
|
|
300
|
+
}
|
|
301
|
+
declare const InlineMeter: React.ForwardRefExoticComponent<InlineMeterProps & React.RefAttributes<HTMLDivElement>>;
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* One row's total, split into categories along a single 100% bar — a model's
|
|
305
|
+
* queries by caller: agent, plan, Explorer, API.
|
|
306
|
+
*
|
|
307
|
+
* DOM, not canvas: it repeats down a table, one per row.
|
|
308
|
+
*
|
|
309
|
+
* The categories run left to right in `series` order, and the order is the same
|
|
310
|
+
* in every row, so a caller is always in the same place and the same colour
|
|
311
|
+
* down the column. Segments are separated by a 2px gap in the surface colour,
|
|
312
|
+
* never outlined. A category with nothing in it takes no space. A row with
|
|
313
|
+
* nothing at all draws an empty track rather than a bar of one category.
|
|
314
|
+
*
|
|
315
|
+
* The legend is not per row. Pass the same `series` to one
|
|
316
|
+
* {@link SegmentedBarLegend} in the table's header, so the colours are named
|
|
317
|
+
* once for the whole column. Each segment names itself on hover, so identity
|
|
318
|
+
* is never colour alone.
|
|
319
|
+
*/
|
|
320
|
+
|
|
321
|
+
interface SegmentSeries {
|
|
322
|
+
key: string;
|
|
323
|
+
label: string;
|
|
324
|
+
/** A token — `var(--color-data-7)`. */
|
|
325
|
+
color: string;
|
|
326
|
+
}
|
|
327
|
+
interface SegmentedBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
328
|
+
/** The count per series `key`. A missing key is 0. */
|
|
329
|
+
values: Record<string, number>;
|
|
330
|
+
/** The categories, in the fixed order every row shares. */
|
|
331
|
+
series: SegmentSeries[];
|
|
332
|
+
/** How a count is written in the hover. Default: `1,284`. */
|
|
333
|
+
format?: (value: number) => string;
|
|
334
|
+
}
|
|
335
|
+
declare const SegmentedBar: React.ForwardRefExoticComponent<SegmentedBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
336
|
+
interface SegmentedBarLegendProps extends Omit<LegendProps, "children"> {
|
|
337
|
+
/** The same `series` every row's {@link SegmentedBar} is given. */
|
|
338
|
+
series: SegmentSeries[];
|
|
339
|
+
}
|
|
340
|
+
/** The one legend for a column of {@link SegmentedBar}s. */
|
|
341
|
+
declare const SegmentedBarLegend: React.ForwardRefExoticComponent<SegmentedBarLegendProps & React.RefAttributes<HTMLDivElement>>;
|
|
342
|
+
|
|
343
|
+
/** A cell that is more than how busy it was: a guardrail said no, or data left the boundary. */
|
|
344
|
+
interface HeatLaneMark {
|
|
345
|
+
/** The cell's index. */
|
|
346
|
+
at: number;
|
|
347
|
+
/** `refused` — a rule stopped it; `egress` — data crossed to a third party or a model. */
|
|
348
|
+
kind: "refused" | "egress";
|
|
349
|
+
}
|
|
350
|
+
interface HeatLaneProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
351
|
+
/**
|
|
352
|
+
* How busy each slice of time was, `0`–`1`, oldest first. `0` is touched and
|
|
353
|
+
* idle — a faint cell; `null` is not touched at all — a hollow one.
|
|
354
|
+
*/
|
|
355
|
+
values: (number | null)[];
|
|
356
|
+
marks?: HeatLaneMark[];
|
|
357
|
+
/** The cell held open — drawn ringed. */
|
|
358
|
+
pinned?: number | null;
|
|
359
|
+
/** Makes every lit cell a button: it receives the cell's index, or `null` to let it go. */
|
|
360
|
+
onPin?: (at: number | null) => void;
|
|
361
|
+
/** What each cell's title says — `4.25–4.50 s`. Defaults to its index. */
|
|
362
|
+
cellLabel?: (at: number) => string;
|
|
363
|
+
/**
|
|
364
|
+
* The lit cells' fill, as a class — `bg-info`, `bg-data-3`. The lane's
|
|
365
|
+
* busyness is the cell's opacity, so one hue carries the whole lane.
|
|
366
|
+
* @default "bg-info"
|
|
367
|
+
*/
|
|
368
|
+
fill?: string;
|
|
369
|
+
/** No signal: the lane is dimmed, not cooled — it does not know, rather than knows it is quiet. */
|
|
370
|
+
stale?: boolean;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* One lane of busyness over time: a cell per slice, brighter where it was
|
|
374
|
+
* busier.
|
|
375
|
+
*
|
|
376
|
+
* The lanes of a layer-activity drawing, one per layer, sharing an axis — so
|
|
377
|
+
* *which layers were busy, and when* is read down the column rather than
|
|
378
|
+
* from numbers. **Not touched and touched-but-idle are different cells**:
|
|
379
|
+
* hollow is *nothing reached for it*, faint is *it was there and quiet*. A
|
|
380
|
+
* refusal or a crossing is marked in its cell in a status colour, never a
|
|
381
|
+
* brighter one, so it is not mistaken for load.
|
|
382
|
+
*
|
|
383
|
+
* The cells stretch to the lane's width: the axis is the same for every lane,
|
|
384
|
+
* whatever the width it is drawn at.
|
|
385
|
+
*/
|
|
386
|
+
declare const HeatLane: React.ForwardRefExoticComponent<HeatLaneProps & React.RefAttributes<HTMLDivElement>>;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* TODO — provisional. Built ahead of its design review.
|
|
390
|
+
*
|
|
391
|
+
* The chart set was deliberately deferred while the rest of the kit was built,
|
|
392
|
+
* because charts are the one group with a real design question in them rather
|
|
393
|
+
* than a markup question: which forms this product actually needs, at what
|
|
394
|
+
* sizes, and how much a 330px drawer can carry. This component satisfies the
|
|
395
|
+
* dataviz rules and the validated palette, but the *form inventory* has not been
|
|
396
|
+
* agreed — treat the API as unsettled until a board screen uses it in anger.
|
|
397
|
+
*/
|
|
398
|
+
|
|
399
|
+
interface BarDatum {
|
|
400
|
+
label: React.ReactNode;
|
|
401
|
+
value: number;
|
|
402
|
+
/**
|
|
403
|
+
* Overrides the series colour for this bar. Use a data-palette token
|
|
404
|
+
* (`var(--color-data-3)`) when the bar's identity is an entity — a node type,
|
|
405
|
+
* a theme — so it matches that entity everywhere else it appears.
|
|
406
|
+
*/
|
|
407
|
+
color?: string;
|
|
408
|
+
/** What the tip should read, if not the raw value. */
|
|
409
|
+
display?: React.ReactNode;
|
|
410
|
+
/**
|
|
411
|
+
* Drawn as the remainder rather than an item — `3 others`, the rest folded
|
|
412
|
+
* into one line: its label and bar in the muted colour. `ranked` only.
|
|
413
|
+
*/
|
|
414
|
+
muted?: boolean;
|
|
415
|
+
}
|
|
416
|
+
interface BarChartHProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
417
|
+
data: BarDatum[];
|
|
418
|
+
/** Fixes the scale. Defaults to the largest value present. */
|
|
419
|
+
max?: number;
|
|
420
|
+
/** Width of the label column, so bars start on the same x. Default: 78, or 96 in `ranked`. */
|
|
421
|
+
labelWidth?: number;
|
|
422
|
+
/** Series colour when a datum does not override it. */
|
|
423
|
+
color?: string;
|
|
424
|
+
/** Names what is plotted. A single series needs no legend when this is set. */
|
|
425
|
+
caption?: React.ReactNode;
|
|
426
|
+
/**
|
|
427
|
+
* `tips` labels each bar at its end. `ranked` is a list read top to bottom —
|
|
428
|
+
* drivers, top-N, likely causes: the labels are the reading in the text
|
|
429
|
+
* colour and may wrap, the bars take the width between, and the values line
|
|
430
|
+
* up in a column at the right. A negative value draws in `negativeColor`,
|
|
431
|
+
* its length its size.
|
|
432
|
+
*/
|
|
433
|
+
variant?: "tips" | "ranked";
|
|
434
|
+
/** The colour of a bar below zero, in `ranked`. */
|
|
435
|
+
negativeColor?: string;
|
|
436
|
+
/**
|
|
437
|
+
* `ranked` only: bars grow both ways from a zero rule in the middle, and the
|
|
438
|
+
* line under them says what each side means — `− pulls margin down`,
|
|
439
|
+
* `lifts it +`.
|
|
440
|
+
*/
|
|
441
|
+
diverging?: {
|
|
442
|
+
below?: React.ReactNode;
|
|
443
|
+
above?: React.ReactNode;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Magnitude across a handful of named things.
|
|
448
|
+
*
|
|
449
|
+
* Horizontal because the labels are words — a stock, a pattern, a theme — and
|
|
450
|
+
* words read badly rotated under a column. Bars grow from a single baseline on
|
|
451
|
+
* the left, so length is the only thing carrying the value.
|
|
452
|
+
*
|
|
453
|
+
* One series, so there is no legend: `caption` names what is plotted. Every bar
|
|
454
|
+
* is directly labelled at its tip, which is also what discharges the light-mode
|
|
455
|
+
* contrast obligation on the data palette — identity and value are never
|
|
456
|
+
* carried by hue alone.
|
|
457
|
+
*/
|
|
458
|
+
declare const BarChartH: React.ForwardRefExoticComponent<BarChartHProps & React.RefAttributes<HTMLDivElement>>;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* TODO — provisional. Built ahead of its design review.
|
|
462
|
+
*
|
|
463
|
+
* The chart set was deliberately deferred while the rest of the kit was built,
|
|
464
|
+
* because charts are the one group with a real design question in them rather
|
|
465
|
+
* than a markup question: which forms this product actually needs, at what
|
|
466
|
+
* sizes, and how much a 330px drawer can carry. This component satisfies the
|
|
467
|
+
* dataviz rules and the validated palette, but the *form inventory* has not been
|
|
468
|
+
* agreed — treat the API as unsettled until a board screen uses it in anger.
|
|
469
|
+
*/
|
|
470
|
+
|
|
471
|
+
interface ColumnBase {
|
|
472
|
+
/** The period or group — `wk 36`, `F`, `paid`. */
|
|
473
|
+
label: React.ReactNode;
|
|
474
|
+
/** A second line under the label — `1–5 Sep`. */
|
|
475
|
+
sublabel?: React.ReactNode;
|
|
476
|
+
}
|
|
477
|
+
/** One column: one measure in one period. */
|
|
478
|
+
interface SingleColumnDatum extends ColumnBase {
|
|
479
|
+
value: number;
|
|
480
|
+
display?: React.ReactNode;
|
|
481
|
+
/**
|
|
482
|
+
* What the column was meant to reach — drawn as a dashed column the value
|
|
483
|
+
* stands inside, so falling short reads as the gap between them.
|
|
484
|
+
*/
|
|
485
|
+
plan?: number;
|
|
486
|
+
}
|
|
487
|
+
/** A group of columns side by side, one per {@link BarSeries}, in the same order. */
|
|
488
|
+
interface GroupedColumnDatum extends ColumnBase {
|
|
489
|
+
values: number[];
|
|
490
|
+
/** Written values, index for index with `values`. */
|
|
491
|
+
display?: React.ReactNode[];
|
|
492
|
+
}
|
|
493
|
+
type ColumnDatum = SingleColumnDatum | GroupedColumnDatum;
|
|
494
|
+
interface BarSeries {
|
|
495
|
+
/** What the series is — `before 2 Jun`. Named in the legend. */
|
|
496
|
+
name: React.ReactNode;
|
|
497
|
+
/** Defaults to the data palette in order: `--color-data-1`, `-2`, … */
|
|
498
|
+
color?: string;
|
|
499
|
+
}
|
|
500
|
+
interface BarTarget {
|
|
501
|
+
value: number;
|
|
502
|
+
/** Written at the right-hand end of the rule — `avg`, `target`. */
|
|
503
|
+
label?: React.ReactNode;
|
|
504
|
+
/** Defaults to the muted text colour. */
|
|
505
|
+
color?: string;
|
|
506
|
+
}
|
|
507
|
+
interface BarChartVProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
508
|
+
data: ColumnDatum[];
|
|
509
|
+
/**
|
|
510
|
+
* Names the series when `data` is grouped. Two or more draw a legend; the
|
|
511
|
+
* columns in a group follow this order.
|
|
512
|
+
*/
|
|
513
|
+
series?: BarSeries[];
|
|
514
|
+
/** Fixes the scale. Defaults to the largest value present, or the target. */
|
|
515
|
+
max?: number;
|
|
516
|
+
/** Values to draw a hairline at — `[50, 75, 100]`. */
|
|
517
|
+
gridlines?: number[];
|
|
518
|
+
/** A dashed rule across the plot — a target, a baseline, an average. */
|
|
519
|
+
target?: BarTarget;
|
|
520
|
+
height?: number;
|
|
521
|
+
color?: string;
|
|
522
|
+
/** Colour for the column the story is about. Defaults to `color`. Single series only. */
|
|
523
|
+
highlightColor?: string;
|
|
524
|
+
/**
|
|
525
|
+
* Which column (or group) carries the emphasis. The rest are drawn lighter.
|
|
526
|
+
*
|
|
527
|
+
* A single series defaults to the most recent. A grouped chart defaults to
|
|
528
|
+
* none, because there the comparison is inside each group, not between them.
|
|
529
|
+
* `null` says none outright.
|
|
530
|
+
*/
|
|
531
|
+
highlightIndex?: number | null;
|
|
532
|
+
/**
|
|
533
|
+
* Which columns get a value on the cap.
|
|
534
|
+
*
|
|
535
|
+
* `last` by default — the emphasised column or group. A number on every
|
|
536
|
+
* column stops being a label and becomes texture; the gridlines carry the rest.
|
|
537
|
+
*/
|
|
538
|
+
labelMode?: "last" | "all" | "none";
|
|
539
|
+
caption?: React.ReactNode;
|
|
540
|
+
/**
|
|
541
|
+
* `default` caps columns at 24px so the band's leftover is air. `comparison`
|
|
542
|
+
* is the answer-card form: columns take two thirds of their band, so they
|
|
543
|
+
* grow with the card from 280px to 720px, stand on a baseline with square
|
|
544
|
+
* caps, and carry their values in the muted text colour.
|
|
545
|
+
*/
|
|
546
|
+
variant?: "default" | "comparison";
|
|
547
|
+
/** Names the dashed plan columns in the legend — `plan`. */
|
|
548
|
+
planLabel?: React.ReactNode;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* One measure over a few periods, or a few series side by side per group.
|
|
552
|
+
*
|
|
553
|
+
* Vertical because the x-axis is time and time reads left to right. Columns are
|
|
554
|
+
* capped at 24px and separated by real gaps, so the band's leftover is air
|
|
555
|
+
* rather than a fatter bar; columns in a group touch but for a 2px gap.
|
|
556
|
+
*
|
|
557
|
+
* Rule labels — gridlines and the target — sit in a gutter at the right that is
|
|
558
|
+
* as wide as the longest of them, so a label never sits on a column however
|
|
559
|
+
* narrow the chart. One series needs no legend (`caption` says what is
|
|
560
|
+
* plotted); two or more get one, with the target in it.
|
|
561
|
+
*/
|
|
562
|
+
declare const BarChartV: React.ForwardRefExoticComponent<BarChartVProps & React.RefAttributes<HTMLDivElement>>;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* TODO — provisional. Built ahead of its design review.
|
|
566
|
+
*
|
|
567
|
+
* The chart set was deliberately deferred while the rest of the kit was built,
|
|
568
|
+
* because charts are the one group with a real design question in them rather
|
|
569
|
+
* than a markup question: which forms this product actually needs, at what
|
|
570
|
+
* sizes, and how much a 330px drawer can carry. This component satisfies the
|
|
571
|
+
* dataviz rules and the validated palette, but the *form inventory* has not been
|
|
572
|
+
* agreed — treat the API as unsettled until a board screen uses it in anger.
|
|
573
|
+
*/
|
|
574
|
+
|
|
575
|
+
interface DivergingDatum {
|
|
576
|
+
label: React.ReactNode;
|
|
577
|
+
/** Signed. The sign is the whole point of this chart. */
|
|
578
|
+
value: number;
|
|
579
|
+
display?: React.ReactNode;
|
|
580
|
+
}
|
|
581
|
+
interface DivergingBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
582
|
+
data: DivergingDatum[];
|
|
583
|
+
/** Fixes the scale on both sides. Defaults to the largest magnitude present. */
|
|
584
|
+
max?: number;
|
|
585
|
+
labelWidth?: number;
|
|
586
|
+
/** Above the midpoint. Defaults to `--color-success`. */
|
|
587
|
+
positiveColor?: string;
|
|
588
|
+
/** Below it. Defaults to `--color-destructive`. */
|
|
589
|
+
negativeColor?: string;
|
|
590
|
+
caption?: React.ReactNode;
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Polarity — how far either side of zero.
|
|
594
|
+
*
|
|
595
|
+
* A net learning weight, a delta against a baseline, a sentiment score. The
|
|
596
|
+
* midpoint is a real zero line, drawn in the neutral border colour, and both
|
|
597
|
+
* sides share one scale so a `−9` is visibly longer than a `+6`.
|
|
598
|
+
*
|
|
599
|
+
* The poles use the **status** colours rather than data-palette hues, because
|
|
600
|
+
* this chart's two directions are good and bad, not two categories. That is the
|
|
601
|
+
* one place status colour belongs on a chart — it is encoding valence, not
|
|
602
|
+
* identity, so it is never "series 1 and series 2". Every bar is directly
|
|
603
|
+
* labelled, so the sign is readable without seeing colour at all.
|
|
604
|
+
*/
|
|
605
|
+
declare const DivergingBar: React.ForwardRefExoticComponent<DivergingBarProps & React.RefAttributes<HTMLDivElement>>;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* TODO — provisional. Built ahead of its design review.
|
|
609
|
+
*
|
|
610
|
+
* The chart set was deliberately deferred while the rest of the kit was built,
|
|
611
|
+
* because charts are the one group with a real design question in them rather
|
|
612
|
+
* than a markup question: which forms this product actually needs, at what
|
|
613
|
+
* sizes, and how much a 330px drawer can carry. This component satisfies the
|
|
614
|
+
* dataviz rules and the validated palette, but the *form inventory* has not been
|
|
615
|
+
* agreed — treat the API as unsettled until a board screen uses it in anger.
|
|
616
|
+
*/
|
|
617
|
+
|
|
618
|
+
interface HeatCell {
|
|
619
|
+
/** When this cell is — `09:45`. Used in the hover title. */
|
|
620
|
+
at: React.ReactNode;
|
|
621
|
+
/** Which state key this cell is in. Must exist in `states`. */
|
|
622
|
+
state: string;
|
|
623
|
+
/** Extra detail for the hover title — `2 names: BPCL, HINDPETRO`. */
|
|
624
|
+
detail?: React.ReactNode;
|
|
625
|
+
}
|
|
626
|
+
interface HeatState {
|
|
627
|
+
key: string;
|
|
628
|
+
/** What the state is called. Shown in the legend and the hover title. */
|
|
629
|
+
label: React.ReactNode;
|
|
630
|
+
color?: string;
|
|
631
|
+
/** Renders as a ring rather than a fill — for "nothing happened here". */
|
|
632
|
+
hollow?: boolean;
|
|
633
|
+
}
|
|
634
|
+
/** One labelled strip, and the strips it opens into — a schedule, then each of its jobs. */
|
|
635
|
+
interface HeatStripRow {
|
|
636
|
+
key: string;
|
|
637
|
+
label: React.ReactNode;
|
|
638
|
+
cells: HeatCell[];
|
|
639
|
+
/** Drawn under it, indented, when it is open. */
|
|
640
|
+
children?: HeatStripRow[];
|
|
641
|
+
}
|
|
642
|
+
interface HeatStripProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
643
|
+
/** One strip. Pass this or `rows`. */
|
|
644
|
+
cells?: HeatCell[];
|
|
645
|
+
/** Labelled strips over one axis, each opening into its `children`. Pass this or `cells`. */
|
|
646
|
+
rows?: HeatStripRow[];
|
|
647
|
+
states: HeatState[];
|
|
648
|
+
/** Axis ticks under the strip — `[{at: 0, label: '09'}, …]`. */
|
|
649
|
+
ticks?: {
|
|
650
|
+
at: number;
|
|
651
|
+
label: React.ReactNode;
|
|
652
|
+
}[];
|
|
653
|
+
cellSize?: number;
|
|
654
|
+
/** The label column of `rows`, in px. Defaults to its longest label, up to 40%. */
|
|
655
|
+
labelWidth?: number;
|
|
656
|
+
/** Which rows with `children` are open, by key — `true` for all. Controlled. */
|
|
657
|
+
expanded?: ExpandedKeys;
|
|
658
|
+
/** Which are open at first, uncontrolled. Closed by default. */
|
|
659
|
+
defaultExpanded?: ExpandedKeys;
|
|
660
|
+
onExpandedChange?: (expanded: ExpandedKeys) => void;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* A run of firings, one square each, in time order.
|
|
664
|
+
*
|
|
665
|
+
* A schedule's day: twenty-one firings, most served, one skipped, one that could
|
|
666
|
+
* not answer. The shape of the day is the point — a reader sees the run of green
|
|
667
|
+
* and the one square that is not, without reading any of them.
|
|
668
|
+
*
|
|
669
|
+
* `rows` draws several strips over one axis, each labelled, and a row opens into
|
|
670
|
+
* its `children` — an agent into its tasks, a schedule into its jobs — so the one
|
|
671
|
+
* red square can be followed down to the part that went red.
|
|
672
|
+
*
|
|
673
|
+
* These are **status** colours, so they are reserved and never stand in for
|
|
674
|
+
* categories. The legend is mandatory rather than optional: a square carries no
|
|
675
|
+
* label of its own, so without the legend the strip would be colour-alone. Each
|
|
676
|
+
* cell also names its state in the hover title, which is what a screen reader
|
|
677
|
+
* and a keyboard user get.
|
|
678
|
+
*/
|
|
679
|
+
declare const HeatStrip: React.ForwardRefExoticComponent<HeatStripProps & React.RefAttributes<HTMLDivElement>>;
|
|
680
|
+
|
|
681
|
+
export { type AreaSeries, BarChartH, type BarChartHProps, BarChartV, type BarChartVProps, type BarDatum, type BarSeries, type BarTarget, type ChartMark, type ChartReference, type ColumnDatum, DivergingBar, type DivergingBarProps, type DivergingDatum, type GroupedColumnDatum, type HeatCell, HeatLane, type HeatLaneMark, type HeatLaneProps, type HeatState, HeatStrip, type HeatStripProps, type HeatStripRow, InlineMeter, type InlineMeterProps, type InlineMeterTone, type LegendEntry, LineChart, type LineChartBand, type LineChartHighlight, type LineChartMark, type LineChartProps, type LineChartReference, type LineChartSeries, type SegmentSeries, SegmentedBar, SegmentedBarLegend, type SegmentedBarLegendProps, type SegmentedBarProps, type SingleColumnDatum, Sparkline, type SparklineProps, type StackSeries, StackedAreaChart, type StackedAreaChartProps, type StackedAreaDatum, StackedBarChartV, type StackedBarChartVProps, type StackedColumnDatum };
|