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