@czi-sds/data-viz 1.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/index.cjs.d.ts +296 -60
- package/dist/index.cjs.js +2763 -6
- package/dist/index.esm.d.ts +297 -60
- package/dist/index.esm.js +2869 -128
- package/package.json +13 -6
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@czi-sds/data-viz`
|
|
2
2
|
|
|
3
|
-
Data visualization components for the [Science Design System (SDS)](https://
|
|
3
|
+
Data visualization components for the [Science Design System (SDS)](https://chanzuckerberg.github.io/sci-components/), primarily built on [Apache ECharts](https://echarts.apache.org/). Shares the same Material UI v9 peer dependencies as `@czi-sds/components`.
|
|
4
4
|
|
|
5
5
|
Full documentation (usage, scripts, contributing) lives in the [repository README](https://github.com/chanzuckerberg/sci-components#readme).
|
|
6
6
|
|
|
@@ -36,7 +36,7 @@ The `@czi-sds/data-viz` release that ships with SDS `24.0.0` also requires Mater
|
|
|
36
36
|
|
|
37
37
|
## Links
|
|
38
38
|
|
|
39
|
-
- [Design
|
|
39
|
+
- [Design system documentation](https://chanzuckerberg.github.io/sci-components/)
|
|
40
40
|
- [Full repo docs](https://github.com/chanzuckerberg/sci-components#readme)
|
|
41
41
|
- [npm package](https://www.npmjs.com/package/@czi-sds/data-viz)
|
|
42
42
|
- [ECharts documentation](https://echarts.apache.org/en/index.html)
|
package/dist/index.cjs.d.ts
CHANGED
|
@@ -3,15 +3,60 @@ import { HTMLAttributes } from "react";
|
|
|
3
3
|
import { DatasetComponentOption, ECharts, EChartsOption, ScatterSeriesOption } from "echarts";
|
|
4
4
|
import { DiscreteColorGeneratorOptions, TooltipTableContentProps } from "@czi-sds/components";
|
|
5
5
|
|
|
6
|
+
//#region src/common/colorScales.d.ts
|
|
7
|
+
/** RGB triplet with each channel in the range 0-255. */
|
|
8
|
+
type Rgb = [number, number, number];
|
|
9
|
+
/** A stop on a continuous color scale, positioned at `t` in the range 0-1. */
|
|
10
|
+
interface ContinuousColorStop {
|
|
11
|
+
t: number;
|
|
12
|
+
color: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* A band on a stepped color scale. `threshold` is the upper bound of the band
|
|
16
|
+
* on the normalized 0-1 value range; `label` is rendered above the band in the
|
|
17
|
+
* legend.
|
|
18
|
+
*/
|
|
19
|
+
interface SteppedColorStop {
|
|
20
|
+
threshold: number;
|
|
21
|
+
color: string;
|
|
22
|
+
label: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* How values map to colors, both in a visualization and in its legend. A
|
|
26
|
+
* continuous scale interpolates between its stops and renders as a gradient
|
|
27
|
+
* bar; a stepped scale renders as discrete bands.
|
|
28
|
+
*/
|
|
29
|
+
type ColorScale = {
|
|
30
|
+
kind: "continuous";
|
|
31
|
+
stops: ContinuousColorStop[];
|
|
32
|
+
} | {
|
|
33
|
+
kind: "stepped";
|
|
34
|
+
stops: SteppedColorStop[];
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Perceptually uniform sequential scale (matplotlib's plasma), the default for
|
|
38
|
+
* value overlays.
|
|
39
|
+
*/
|
|
40
|
+
declare const PLASMA_COLOR_SCALE: ColorScale;
|
|
41
|
+
/**
|
|
42
|
+
* Colors a raw value against a scale, normalizing it into `min`-`max` first.
|
|
43
|
+
* Returns null when the value sits at or below `min`, or when the range is
|
|
44
|
+
* degenerate, so callers can fall back to a neutral color.
|
|
45
|
+
*/
|
|
46
|
+
declare function sampleColorScale(scale: ColorScale, value: number, max: number, min?: number): Rgb | null;
|
|
47
|
+
/** CSS `linear-gradient` spanning a continuous scale, for the legend bar. */
|
|
48
|
+
declare function toCssGradient(stops: ContinuousColorStop[]): string;
|
|
49
|
+
//#endregion
|
|
6
50
|
//#region src/core/HeatmapChart/hooks/utils.d.ts
|
|
7
51
|
interface CreateChartOptionsProps {
|
|
8
52
|
/**
|
|
9
|
-
*
|
|
53
|
+
* The crosshair following the pointer. One object applies to both axes; a
|
|
54
|
+
* two-entry array configures them separately.
|
|
10
55
|
* https://echarts.apache.org/en/option.html#axisPointer
|
|
11
56
|
*/
|
|
12
57
|
axisPointer?: EChartsOption["axisPointer"];
|
|
13
58
|
/**
|
|
14
|
-
* The
|
|
59
|
+
* The cells, as a flat array of objects whose fields are named by `encode`.
|
|
15
60
|
* The data point object shape can be whatever you like, but it must be consistent with the `encode` option
|
|
16
61
|
* For example, if the data point shape is:
|
|
17
62
|
* {
|
|
@@ -27,6 +72,10 @@ interface CreateChartOptionsProps {
|
|
|
27
72
|
*/
|
|
28
73
|
data: DatasetComponentOption["source"];
|
|
29
74
|
/**
|
|
75
|
+
* ECharts' dataZoom configuration for that window, merged over the defaults
|
|
76
|
+
* it sets. One object applies to both axes; a two-entry array configures them
|
|
77
|
+
* separately. It reaches the chart only while `camera.active` is true.
|
|
78
|
+
*
|
|
30
79
|
* The `dataZoom` prop is utilized for implementing zoom functionality within a
|
|
31
80
|
* specific area of the chart. This feature empowers users to inspect data in
|
|
32
81
|
* granular detail, obtain an overview of the entire dataset, or eliminate
|
|
@@ -42,6 +91,9 @@ interface CreateChartOptionsProps {
|
|
|
42
91
|
*/
|
|
43
92
|
dataZoom?: EChartsOption["dataZoom"];
|
|
44
93
|
/**
|
|
94
|
+
* Renders only a window of the grid, measured in cells, and lets the pointer
|
|
95
|
+
* pan it. Sizes are ignored unless `active` is true.
|
|
96
|
+
*
|
|
45
97
|
* The `camera` prop is utilized for implementing camera view port functionality
|
|
46
98
|
* within a specific area of the chart. This feature empowers users to render
|
|
47
99
|
* a confined portion of the heatmap. This selective rendering strategy becomes
|
|
@@ -60,32 +112,36 @@ interface CreateChartOptionsProps {
|
|
|
60
112
|
width: number;
|
|
61
113
|
};
|
|
62
114
|
/**
|
|
63
|
-
*
|
|
115
|
+
* How a cell is drawn while the pointer is over it. Takes the same shape as
|
|
116
|
+
* `itemStyle`: color, border, opacity.
|
|
64
117
|
* https://echarts.apache.org/en/option.html#series-scatter.emphasis
|
|
65
118
|
*/
|
|
66
119
|
emphasis?: ScatterSeriesOption["emphasis"];
|
|
67
120
|
/**
|
|
68
|
-
* The
|
|
121
|
+
* The categories along the x axis. A cell's encoded x value is an index into
|
|
122
|
+
* this array.
|
|
69
123
|
* For example:
|
|
70
124
|
* [{ value: "gene1", textStyle: { color: "red" } }, "gene2", "gene3"]
|
|
71
125
|
*/
|
|
72
126
|
xAxisData: CategoryAxisData;
|
|
73
127
|
/**
|
|
74
|
-
* The
|
|
128
|
+
* The categories along the y axis.
|
|
75
129
|
* For example:
|
|
76
130
|
* [{ value: "cellType1", textStyle: { color: "red" } }, "cellType2", "cellType3"]
|
|
77
131
|
*/
|
|
78
132
|
yAxisData: CategoryAxisData;
|
|
79
133
|
/**
|
|
80
|
-
*
|
|
134
|
+
* Width of the chart in pixels. Must be greater than zero; the component
|
|
135
|
+
* throws otherwise.
|
|
81
136
|
*/
|
|
82
137
|
width: number;
|
|
83
138
|
/**
|
|
84
|
-
*
|
|
139
|
+
* Height of the chart in pixels, under the same rule.
|
|
85
140
|
*/
|
|
86
141
|
height: number;
|
|
87
142
|
/**
|
|
88
|
-
*
|
|
143
|
+
* Which fields of a data item place it on each axis. Omitting it leaves
|
|
144
|
+
* ECharts to guess from the field order.
|
|
89
145
|
* For example, if the data is:
|
|
90
146
|
* {
|
|
91
147
|
* geneIndex: 0,
|
|
@@ -104,15 +160,20 @@ interface CreateChartOptionsProps {
|
|
|
104
160
|
y: string;
|
|
105
161
|
};
|
|
106
162
|
/**
|
|
107
|
-
*
|
|
163
|
+
* How a cell is painted. Its color accepts a callback receiving the data
|
|
164
|
+
* item, which is how a value becomes a color.
|
|
108
165
|
* https://echarts.apache.org/en/option.html#series-scatter.itemStyle
|
|
109
166
|
*/
|
|
110
167
|
itemStyle?: ScatterSeriesOption["itemStyle"];
|
|
111
168
|
/**
|
|
112
|
-
* The shape of the
|
|
169
|
+
* The shape of a cell. Circles turn the grid into a dot plot, where diameter
|
|
170
|
+
* can carry a second measurement.
|
|
113
171
|
*/
|
|
114
172
|
symbol?: "circle" | "rect" | "roundRect";
|
|
115
173
|
/**
|
|
174
|
+
* Cell size in pixels: one number, a [width, height] pair, or a callback
|
|
175
|
+
* given the data item. Set it to the cell pitch for a solid grid.
|
|
176
|
+
*
|
|
116
177
|
* `symbolSize` can be set to single numbers like 10, or use an array to represent width and height. For example, [20, 10] means symbol width is 20, and height is 10.
|
|
117
178
|
*
|
|
118
179
|
* If size of symbols needs to be different, you can set with callback function in the following format:
|
|
@@ -124,16 +185,20 @@ interface CreateChartOptionsProps {
|
|
|
124
185
|
*/
|
|
125
186
|
symbolSize?: ScatterSeriesOption["symbolSize"];
|
|
126
187
|
/**
|
|
188
|
+
* Where the plotting area sits inside the container. The function form
|
|
189
|
+
* receives the computed default, for insetting it without recomputing the
|
|
190
|
+
* size.
|
|
127
191
|
* https://echarts.apache.org/en/option.html#grid
|
|
128
192
|
*/
|
|
129
193
|
grid?: EChartsOption["grid"] | ((defaultOption: EChartsOption["grid"]) => EChartsOption["grid"]);
|
|
130
194
|
/**
|
|
131
|
-
*
|
|
195
|
+
* Anything else ECharts understands, merged over the generated options.
|
|
132
196
|
* https://echarts.apache.org/en/option.html
|
|
133
197
|
*/
|
|
134
198
|
options?: EChartsOption;
|
|
135
199
|
/**
|
|
136
|
-
*
|
|
200
|
+
* ECharts event listeners by name. Each handler gets the raw event, whose
|
|
201
|
+
* data property is the cell, and the chart instance.
|
|
137
202
|
* https://echarts.apache.org/en/api.html#events
|
|
138
203
|
*/
|
|
139
204
|
onEvents?: Record<string, (event: unknown, chart: ECharts) => void>;
|
|
@@ -152,159 +217,330 @@ type CategoryAxisData = (OrdinalRawValue | {
|
|
|
152
217
|
//#endregion
|
|
153
218
|
//#region src/core/HeatmapChart/index.d.ts
|
|
154
219
|
interface HeatmapChartProps extends HTMLAttributes<HTMLDivElement>, CreateChartOptionsProps {
|
|
220
|
+
/**
|
|
221
|
+
* Which renderer ECharts initialises with. Canvas copes better with very
|
|
222
|
+
* large grids. Changing it rebuilds the chart.
|
|
223
|
+
* @default "svg"
|
|
224
|
+
*/
|
|
155
225
|
echartsRendererMode?: "svg" | "canvas";
|
|
156
226
|
}
|
|
157
227
|
declare const _default: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<HeatmapChartProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
158
228
|
//#endregion
|
|
229
|
+
//#region src/core/ProteinStructureViewer/ProteinStructureViewer.types.d.ts
|
|
230
|
+
/**
|
|
231
|
+
* Per-residue values painted onto the structure in place of the default pLDDT
|
|
232
|
+
* coloring, along with the legend that describes them.
|
|
233
|
+
*/
|
|
234
|
+
interface ResidueValueOverlay {
|
|
235
|
+
/** 0-based residue index to value. Residues absent from the map read as 0. */
|
|
236
|
+
values: Map<number, number>;
|
|
237
|
+
/** Value mapped to the top of the color scale. */
|
|
238
|
+
max: number;
|
|
239
|
+
/**
|
|
240
|
+
* Values at or below this render in a neutral gray rather than on the scale.
|
|
241
|
+
* Values above it are normalized into `min`-`max` before being sampled, so
|
|
242
|
+
* this is also what the legend's lower tick reports.
|
|
243
|
+
* @default 0
|
|
244
|
+
*/
|
|
245
|
+
min?: number;
|
|
246
|
+
/**
|
|
247
|
+
* Scale used to color residues and to draw the legend.
|
|
248
|
+
* @default PLASMA_COLOR_SCALE
|
|
249
|
+
*/
|
|
250
|
+
colorScale?: ColorScale;
|
|
251
|
+
/** Legend caption, e.g. "Feature activation". */
|
|
252
|
+
label?: string;
|
|
253
|
+
/** Help tooltip attached to the legend caption. */
|
|
254
|
+
tooltip?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Label for the per-residue readout that replaces a stat slot on hover.
|
|
257
|
+
* @default "Value"
|
|
258
|
+
*/
|
|
259
|
+
readoutLabel?: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* A residue the user pointed at, in each of the ways a caller might need to
|
|
263
|
+
* address it.
|
|
264
|
+
*
|
|
265
|
+
* `index` is the viewer's own key: the position in `plddt` and in
|
|
266
|
+
* `residueOverlay`'s map, and what `selectedResidue` takes. `chainId`, `seqId`
|
|
267
|
+
* and `insCode` are what the file says, which is what the sequence panel shows
|
|
268
|
+
* and what a system that supplied the structure will recognise. They differ
|
|
269
|
+
* from `index` whenever the file does not number a single chain from 1 -- a
|
|
270
|
+
* crop, or a complex -- so address a residue outside the viewer with those
|
|
271
|
+
* three, not with `index`.
|
|
272
|
+
*
|
|
273
|
+
* `insCode` is rarely set but is part of the address when it is: `10` and `10A`
|
|
274
|
+
* are different residues on the same chain, so chain and number alone do not
|
|
275
|
+
* name one.
|
|
276
|
+
*/
|
|
277
|
+
interface ResidueRef {
|
|
278
|
+
/** 0-based position in the structure, counting residues in file order. */
|
|
279
|
+
index: number;
|
|
280
|
+
/** Three-letter residue code, e.g. `"LYS"`. */
|
|
281
|
+
compId: string;
|
|
282
|
+
/** Chain the residue sits on, as named in the file. */
|
|
283
|
+
chainId: string;
|
|
284
|
+
/** Residue number as written in the file. */
|
|
285
|
+
seqId: number;
|
|
286
|
+
/** Insertion code, or `""` when the residue has none. */
|
|
287
|
+
insCode: string;
|
|
288
|
+
}
|
|
289
|
+
/** A whole-structure statistic shown along the bottom of the viewer. */
|
|
290
|
+
interface StructureStat {
|
|
291
|
+
value: string;
|
|
292
|
+
label: string;
|
|
293
|
+
}
|
|
294
|
+
interface ProteinStructureViewerProps extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
295
|
+
/** Structure to render, as raw PDB text. */
|
|
296
|
+
pdb: string;
|
|
297
|
+
/**
|
|
298
|
+
* Per-residue pLDDT confidence on a 0-1 scale, ordered by residue. When
|
|
299
|
+
* supplied the structure is colored by pLDDT unless `residueOverlay` takes
|
|
300
|
+
* over.
|
|
301
|
+
*/
|
|
302
|
+
plddt?: number[] | null;
|
|
303
|
+
/**
|
|
304
|
+
* Canvas background, as `#RRGGBB`. Defaults to the SDS theme's base
|
|
305
|
+
* background, so the canvas follows the surrounding page in both modes.
|
|
306
|
+
*/
|
|
307
|
+
backgroundColor?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Sequence panel background, as any CSS color. Defaults to the SDS theme's
|
|
310
|
+
* primary surface, so the panel follows the surrounding page in both modes.
|
|
311
|
+
*/
|
|
312
|
+
sequenceViewerBackgroundColor?: string;
|
|
313
|
+
/**
|
|
314
|
+
* Show the orientation axes widget and the reset-camera button.
|
|
315
|
+
* @default true
|
|
316
|
+
*/
|
|
317
|
+
showAxes?: boolean;
|
|
318
|
+
/**
|
|
319
|
+
* Show the sequence panel pinned along the bottom of the viewer.
|
|
320
|
+
* @default true
|
|
321
|
+
*/
|
|
322
|
+
showSequenceViewer?: boolean;
|
|
323
|
+
/**
|
|
324
|
+
* Show the stats and color scale legend overlaid on the viewer.
|
|
325
|
+
* @default true
|
|
326
|
+
*/
|
|
327
|
+
showLegend?: boolean;
|
|
328
|
+
/** Per-residue values that override pLDDT coloring while set. */
|
|
329
|
+
residueOverlay?: ResidueValueOverlay | null;
|
|
330
|
+
/**
|
|
331
|
+
* 0-based index of the selected residue, or null when none is selected.
|
|
332
|
+
* Controlled: selecting a residue zooms the camera in on it, and clearing the
|
|
333
|
+
* selection zooms back out to the default view.
|
|
334
|
+
*/
|
|
335
|
+
selectedResidue?: number | null;
|
|
336
|
+
/**
|
|
337
|
+
* Up to three whole-structure stats shown along the bottom. A null entry
|
|
338
|
+
* reserves its column without rendering anything, so the columns never shift
|
|
339
|
+
* as values come and go.
|
|
340
|
+
*/
|
|
341
|
+
stats?: (StructureStat | null)[];
|
|
342
|
+
/** Called with the clicked residue. */
|
|
343
|
+
onResidueClick?: (residue: ResidueRef) => void;
|
|
344
|
+
/**
|
|
345
|
+
* Called as the pointer moves over residues, and with `null` when it leaves
|
|
346
|
+
* the structure.
|
|
347
|
+
*/
|
|
348
|
+
onResidueHover?: (residue: ResidueRef | null) => void;
|
|
349
|
+
/** Called when the user clicks empty space, clearing the selection. */
|
|
350
|
+
onSelectionClear?: () => void;
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Per-residue readout that replaces the whole-structure stats while a residue
|
|
354
|
+
* is hovered or selected.
|
|
355
|
+
*/
|
|
356
|
+
interface ResidueReadout {
|
|
357
|
+
/** e.g. "PHE 17" */
|
|
358
|
+
label: string;
|
|
359
|
+
/** Residue pLDDT on a 0-1 scale, or null when unavailable. */
|
|
360
|
+
plddt: number | null;
|
|
361
|
+
/**
|
|
362
|
+
* Residue overlay value, or null when the overlay holds none for it - which
|
|
363
|
+
* is also what a structure paints neutral - or when no overlay is set.
|
|
364
|
+
*/
|
|
365
|
+
value: number | null;
|
|
366
|
+
}
|
|
367
|
+
//#endregion
|
|
368
|
+
//#region src/core/ProteinStructureViewer/utils/plddt.d.ts
|
|
369
|
+
/**
|
|
370
|
+
* AlphaFold's pLDDT confidence bands. Thresholds are on the 0-1 scale that
|
|
371
|
+
* `plddt` values use, ascending from lowest to highest confidence.
|
|
372
|
+
*/
|
|
373
|
+
declare const PLDDT_COLOR_SCALE: ColorScale;
|
|
374
|
+
/**
|
|
375
|
+
* Rewrites a PDB file's B-factor column with pLDDT scores so Mol* can read them
|
|
376
|
+
* off the parsed model. B-factors occupy columns 60-66 of ATOM/HETATM lines;
|
|
377
|
+
* scores arrive on a 0-1 scale and are stored on the conventional 0-100 one.
|
|
378
|
+
* Residues past the end of `plddtValues` fall back to a mid-confidence 50.
|
|
379
|
+
*
|
|
380
|
+
* A residue is identified by chain, sequence number and insertion code. The
|
|
381
|
+
* code has to be part of that: `10` and `10A` are two residues, Mol* counts
|
|
382
|
+
* them as two, and treating them as one here would hand every residue after
|
|
383
|
+
* them its neighbour's score.
|
|
384
|
+
*/
|
|
385
|
+
declare function injectPlddtIntoPdb(pdbData: string, plddtValues: number[]): string;
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/core/ProteinStructureViewer/index.d.ts
|
|
388
|
+
declare const _default$1: import("react").MemoExoticComponent<import("react").ForwardRefExoticComponent<ProteinStructureViewerProps & import("react").RefAttributes<HTMLDivElement>>>;
|
|
389
|
+
//#endregion
|
|
159
390
|
//#region src/core/StackedBarChart/StackedBarChart.types.d.ts
|
|
160
391
|
interface StackedBarChartDataItem {
|
|
161
392
|
/**
|
|
162
|
-
*
|
|
393
|
+
* The segment's label in the legend, and the key the animations track it by.
|
|
394
|
+
* Must be unique within the chart.
|
|
163
395
|
*/
|
|
164
396
|
name: string;
|
|
165
397
|
/**
|
|
166
|
-
*
|
|
398
|
+
* The quantity the segment stands for.
|
|
167
399
|
*/
|
|
168
400
|
value: number;
|
|
169
401
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
402
|
+
* Any CSS color. Without it the segment takes a generated palette color,
|
|
403
|
+
* which can shift as categories come and go.
|
|
172
404
|
*/
|
|
173
405
|
color?: string;
|
|
174
406
|
/**
|
|
175
|
-
*
|
|
176
|
-
*
|
|
407
|
+
* A unit for this item's counted value, for data that mixes units across
|
|
408
|
+
* categories.
|
|
177
409
|
*/
|
|
178
410
|
unit?: string;
|
|
179
411
|
/**
|
|
180
|
-
*
|
|
412
|
+
* Takes the segment and its legend item out of every interaction: no hover,
|
|
413
|
+
* no tooltip, no selection.
|
|
181
414
|
* @default false
|
|
182
415
|
*/
|
|
183
416
|
disabled?: boolean;
|
|
184
417
|
/**
|
|
185
|
-
*
|
|
418
|
+
* Content for a TooltipTable shown above the segment on hover. Use it for the
|
|
419
|
+
* breakdown behind the number; a segment without it has no tooltip.
|
|
186
420
|
*/
|
|
187
421
|
tooltip?: TooltipTableContentProps;
|
|
188
422
|
}
|
|
189
423
|
interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
190
424
|
/**
|
|
191
|
-
*
|
|
425
|
+
* A heading above the bar. It is also what makes room for the badge; with no
|
|
426
|
+
* title, no badge is drawn.
|
|
192
427
|
*/
|
|
193
428
|
title?: string;
|
|
194
429
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* - No selection: total count (e.g., "5")
|
|
198
|
-
* - Partial selection: selected count (e.g., "3 of 5")
|
|
199
|
-
* - All selected: "All"
|
|
430
|
+
* Overrides the badge text, which otherwise counts the data and the selection
|
|
431
|
+
* ("7", or "3 of 7").
|
|
200
432
|
*/
|
|
201
433
|
badge?: string;
|
|
202
434
|
/**
|
|
203
|
-
*
|
|
435
|
+
* Removes the badge, leaving the title on its own.
|
|
204
436
|
* @default false
|
|
205
437
|
*/
|
|
206
438
|
hideBadge?: boolean;
|
|
207
439
|
/**
|
|
208
|
-
*
|
|
440
|
+
* The segments, in the order they are drawn.
|
|
209
441
|
*/
|
|
210
442
|
data: StackedBarChartDataItem[];
|
|
211
443
|
/**
|
|
212
|
-
*
|
|
444
|
+
* Any CSS width; a number is read as pixels. It sets the width of the whole
|
|
445
|
+
* chart, legend included.
|
|
213
446
|
* @default 100%
|
|
214
447
|
*/
|
|
215
448
|
width?: number | string;
|
|
216
449
|
/**
|
|
217
|
-
* Height of the bar in pixels
|
|
450
|
+
* Height of the bar in pixels. Values below 1 are clamped to 1, so the bar
|
|
451
|
+
* cannot disappear.
|
|
218
452
|
* @default 16
|
|
219
453
|
*/
|
|
220
454
|
barHeight?: number;
|
|
221
455
|
/**
|
|
222
|
-
*
|
|
456
|
+
* Draws the legend below the bar. It is the only place segment names appear,
|
|
457
|
+
* and the only part of the chart a keyboard can reach.
|
|
223
458
|
* @default true
|
|
224
459
|
*/
|
|
225
460
|
showLegend?: boolean;
|
|
226
461
|
/**
|
|
227
|
-
*
|
|
462
|
+
* Shows each item's value beside its name in the legend.
|
|
228
463
|
* @default true
|
|
229
464
|
*/
|
|
230
465
|
showLegendValues?: boolean;
|
|
231
466
|
/**
|
|
232
|
-
*
|
|
233
|
-
*
|
|
234
|
-
*
|
|
467
|
+
* "percentage" shows the segment's share of the bar, rounded. "count" shows
|
|
468
|
+
* the raw value followed by the item's unit, or the chart's unit if the item
|
|
469
|
+
* has none.
|
|
235
470
|
* @default "percentage"
|
|
236
471
|
*/
|
|
237
472
|
legendValueFormat?: "percentage" | "count";
|
|
238
473
|
/**
|
|
239
|
-
*
|
|
474
|
+
* Indices into data that are currently selected. The chart is controlled: it
|
|
475
|
+
* draws this and never changes it.
|
|
240
476
|
*/
|
|
241
477
|
selectedIndices?: number[];
|
|
242
478
|
/**
|
|
243
|
-
*
|
|
479
|
+
* Called with the next selection when a segment or legend item is clicked.
|
|
480
|
+
* Without it, clicking selects nothing.
|
|
244
481
|
*/
|
|
245
482
|
onSelectionChange?: (selectedIndices: number[], selectedData: StackedBarChartDataItem[]) => void;
|
|
246
483
|
/**
|
|
247
|
-
*
|
|
484
|
+
* Called when the pointer enters a segment. The chart already syncs its own
|
|
485
|
+
* hover highlight between bar and legend, so this is for driving something
|
|
486
|
+
* outside it.
|
|
248
487
|
*/
|
|
249
488
|
onSegmentMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
250
489
|
/**
|
|
251
|
-
*
|
|
490
|
+
* Called when the pointer leaves a segment.
|
|
252
491
|
*/
|
|
253
492
|
onSegmentMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
254
493
|
/**
|
|
255
|
-
*
|
|
494
|
+
* Called when the pointer enters a legend item.
|
|
256
495
|
*/
|
|
257
496
|
onLegendItemMouseEnter?: (item: StackedBarChartDataItem, index: number) => void;
|
|
258
497
|
/**
|
|
259
|
-
*
|
|
498
|
+
* Called when the pointer leaves a legend item.
|
|
260
499
|
*/
|
|
261
500
|
onLegendItemMouseLeave?: (item: StackedBarChartDataItem, index: number) => void;
|
|
262
501
|
/**
|
|
263
|
-
*
|
|
502
|
+
* Fires on a segment click, alongside any selection change rather than
|
|
503
|
+
* instead of it.
|
|
264
504
|
*/
|
|
265
505
|
onSegmentClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
266
506
|
/**
|
|
267
|
-
*
|
|
507
|
+
* The same, for a click on a legend item.
|
|
268
508
|
*/
|
|
269
509
|
onLegendItemClick?: (item: StackedBarChartDataItem, index: number) => void;
|
|
270
510
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* - "hide": Non-selected segments are hidden from the bar chart
|
|
511
|
+
* What a selection does to the unselected segments: fade them to 20% opacity,
|
|
512
|
+
* or drop them from the bar and let the rest take the space.
|
|
274
513
|
* @default "dim"
|
|
275
514
|
*/
|
|
276
515
|
selectionBehavior?: "dim" | "hide";
|
|
277
516
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
* - "cumulative": Segments sized based on actual values relative to maxAmount
|
|
517
|
+
* Whether the bar shows a breakdown of the data (segments always fill it) or
|
|
518
|
+
* progress towards maxAmount.
|
|
281
519
|
* @default "proportional"
|
|
282
520
|
*/
|
|
283
521
|
mode?: "proportional" | "cumulative";
|
|
284
522
|
/**
|
|
285
|
-
*
|
|
286
|
-
*
|
|
287
|
-
* If provided and sum < maxAmount, shows gray "remaining" segment
|
|
523
|
+
* Cumulative mode only. The value the full bar represents. Any difference
|
|
524
|
+
* between it and the sum of the data is drawn as the Remaining segment.
|
|
288
525
|
*/
|
|
289
526
|
maxAmount?: number;
|
|
290
527
|
/**
|
|
291
|
-
*
|
|
528
|
+
* Name of the grey gap segment in cumulative mode.
|
|
292
529
|
* @default "Remaining"
|
|
293
530
|
*/
|
|
294
531
|
remainingLabel?: string;
|
|
295
532
|
/**
|
|
296
|
-
*
|
|
297
|
-
* If not provided, uses the unit from the first data item (if available)
|
|
533
|
+
* A unit for the Remaining segment's value alone.
|
|
298
534
|
*/
|
|
299
535
|
remainingUnit?: string;
|
|
300
536
|
/**
|
|
301
|
-
*
|
|
302
|
-
*
|
|
303
|
-
* Only shown when mode is "cumulative"
|
|
537
|
+
* The unit appended to counted values, for items that do not carry one of
|
|
538
|
+
* their own.
|
|
304
539
|
*/
|
|
305
540
|
unit?: string;
|
|
306
541
|
/**
|
|
307
|
-
*
|
|
542
|
+
* Tunes the generated palette (start hue, rotations, lightness range, gamma).
|
|
543
|
+
* Items with their own color are untouched by it.
|
|
308
544
|
*/
|
|
309
545
|
colorGeneratorOptions?: DiscreteColorGeneratorOptions;
|
|
310
546
|
}
|
|
@@ -312,4 +548,4 @@ interface StackedBarChartProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
312
548
|
//#region src/core/StackedBarChart/index.d.ts
|
|
313
549
|
declare const StackedBarChart: (props: StackedBarChartProps) => JSX.Element;
|
|
314
550
|
//#endregion
|
|
315
|
-
export { _default as HeatmapChart, HeatmapChartProps, StackedBarChart, type StackedBarChartDataItem, type StackedBarChartProps };
|
|
551
|
+
export { type ColorScale, type ContinuousColorStop, _default as HeatmapChart, HeatmapChartProps, PLASMA_COLOR_SCALE, PLDDT_COLOR_SCALE, _default$1 as ProteinStructureViewer, ProteinStructureViewerProps, ResidueReadout, ResidueRef, ResidueValueOverlay, StackedBarChart, type StackedBarChartDataItem, type StackedBarChartProps, type SteppedColorStop, StructureStat, injectPlddtIntoPdb, sampleColorScale, toCssGradient };
|