reflex-silverpoint-react 0.1.0__py3-none-any.whl
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.
- reflex_silverpoint_react/__init__.py +170 -0
- reflex_silverpoint_react/base.py +180 -0
- reflex_silverpoint_react/base.pyi +270 -0
- reflex_silverpoint_react/catalog.py +637 -0
- reflex_silverpoint_react/charts.py +645 -0
- reflex_silverpoint_react/charts.pyi +3944 -0
- reflex_silverpoint_react/helpers.py +148 -0
- reflex_silverpoint_react-0.1.0.dist-info/METADATA +224 -0
- reflex_silverpoint_react-0.1.0.dist-info/RECORD +12 -0
- reflex_silverpoint_react-0.1.0.dist-info/WHEEL +5 -0
- reflex_silverpoint_react-0.1.0.dist-info/licenses/LICENSE +21 -0
- reflex_silverpoint_react-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
"""The silverpoint catalog: every chart with its family and the reference of its props.
|
|
2
|
+
|
|
3
|
+
Useful to build galleries, playgrounds and documentation pages; the demo app is built on it.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from collections.abc import Callable
|
|
7
|
+
from dataclasses import dataclass, field
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
from . import charts as _charts
|
|
11
|
+
from .base import SilverpointChart
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class PropDoc:
|
|
16
|
+
"""One prop: its Python name, its JS name, its TypeScript type and what it does."""
|
|
17
|
+
|
|
18
|
+
name: str
|
|
19
|
+
js: str
|
|
20
|
+
type: str
|
|
21
|
+
doc: str
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class ChartInfo:
|
|
26
|
+
"""One chart of the catalog."""
|
|
27
|
+
|
|
28
|
+
chart: str
|
|
29
|
+
factory_name: str
|
|
30
|
+
slug: str
|
|
31
|
+
family: str
|
|
32
|
+
summary: str
|
|
33
|
+
props: tuple[PropDoc, ...] = field(default_factory=tuple)
|
|
34
|
+
|
|
35
|
+
@property
|
|
36
|
+
def component(self) -> type[SilverpointChart]:
|
|
37
|
+
"""The component class."""
|
|
38
|
+
return getattr(_charts, self.chart)
|
|
39
|
+
|
|
40
|
+
@property
|
|
41
|
+
def factory(self) -> Callable[..., Any]:
|
|
42
|
+
"""The ``create`` factory, e.g. ``line_chart``."""
|
|
43
|
+
return getattr(_charts, self.factory_name)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
#: Props every chart takes.
|
|
47
|
+
COMMON_PROPS: tuple[PropDoc, ...] = (
|
|
48
|
+
PropDoc("data", "data", "readonly Datum[]", "Rows to draw. If omitted, the demo dataset is rendered (REQ-093)."),
|
|
49
|
+
PropDoc("ground", "ground", "GroundRef", "Style ground. Defaults to the app provider's, or `silverpoint`."),
|
|
50
|
+
PropDoc("substrate", "substrate", "SubstrateName", "Prepared substrate within the ground (REQ-046)."),
|
|
51
|
+
PropDoc("mode", "mode", "InkMode", "`ink` by default; `precision` disables inking (REQ-021)."),
|
|
52
|
+
PropDoc("seed", "seed", "Seed", "Seed. If omitted, it is derived from `id` stably (REQ-003)."),
|
|
53
|
+
PropDoc("id", "id", "string", "Stable identifier. If omitted, it is generated deterministically."),
|
|
54
|
+
PropDoc("height", "height", "number", "Height of the drawing area in px. Width is the container's unless pinned."),
|
|
55
|
+
PropDoc("width", "width", "number", ""),
|
|
56
|
+
PropDoc(
|
|
57
|
+
"chrome", "chrome", "'card' | 'bare'", "`card` draws the full frame; `bare` only the drawing area (REQ-095)."
|
|
58
|
+
),
|
|
59
|
+
PropDoc("hatch_fill", "hatchFill", "'tile' | 'per-shape'", "How areas are filled (REQ-029)."),
|
|
60
|
+
PropDoc("title", "title", "string", ""),
|
|
61
|
+
PropDoc("badge", "badge", "string", ""),
|
|
62
|
+
PropDoc("value", "value", "string | number", ""),
|
|
63
|
+
PropDoc("unit", "unit", "string", ""),
|
|
64
|
+
PropDoc("footer_left", "footerLeft", "string", ""),
|
|
65
|
+
PropDoc("footer_right", "footerRight", "string", ""),
|
|
66
|
+
PropDoc("label", "label", "string", "Accessible name. If omitted, it is derived from `title` (REQ-120)."),
|
|
67
|
+
PropDoc("description", "description", "string", "Long description for screen readers (REQ-120)."),
|
|
68
|
+
PropDoc(
|
|
69
|
+
"data_table",
|
|
70
|
+
"dataTable",
|
|
71
|
+
"'visible' | 'hidden' | 'none'",
|
|
72
|
+
"Tabular alternative; `hidden` leaves it for assistive technology only (REQ-121).",
|
|
73
|
+
),
|
|
74
|
+
PropDoc("locale", "locale", "string", ""),
|
|
75
|
+
PropDoc("number_format", "numberFormat", "Intl.NumberFormatOptions", ""),
|
|
76
|
+
PropDoc("class_name", "className", "string", ""),
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
#: The 33 charts, in catalog order.
|
|
80
|
+
CHARTS: tuple[ChartInfo, ...] = (
|
|
81
|
+
ChartInfo(
|
|
82
|
+
chart="LineChart",
|
|
83
|
+
factory_name="line_chart",
|
|
84
|
+
slug="line-chart",
|
|
85
|
+
family="Lines",
|
|
86
|
+
summary="Spline with an optional dotted baseline series.",
|
|
87
|
+
props=(
|
|
88
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
89
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
90
|
+
PropDoc("secondary_key", "secondaryKey", "Accessor<number | null | undefined>", ""),
|
|
91
|
+
PropDoc("curve", "curve", "LineCurve", ""),
|
|
92
|
+
PropDoc(
|
|
93
|
+
"series",
|
|
94
|
+
"series",
|
|
95
|
+
"'all' | 'primary'",
|
|
96
|
+
"`all` draws the secondary series when there is one; `primary` omits it.",
|
|
97
|
+
),
|
|
98
|
+
PropDoc(
|
|
99
|
+
"connect_nulls",
|
|
100
|
+
"connectNulls",
|
|
101
|
+
"boolean",
|
|
102
|
+
"Whether a gap left by a missing value is bridged (REQ-008).",
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
),
|
|
106
|
+
ChartInfo(
|
|
107
|
+
chart="StepChart",
|
|
108
|
+
factory_name="step_chart",
|
|
109
|
+
slug="step-chart",
|
|
110
|
+
family="Lines",
|
|
111
|
+
summary="A series drawn as steps.",
|
|
112
|
+
props=(
|
|
113
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
114
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
115
|
+
PropDoc(
|
|
116
|
+
"step",
|
|
117
|
+
"step",
|
|
118
|
+
"'after' | 'before' | 'middle'",
|
|
119
|
+
"Where the step sits between two points; `after` by default.",
|
|
120
|
+
),
|
|
121
|
+
),
|
|
122
|
+
),
|
|
123
|
+
ChartInfo(
|
|
124
|
+
chart="SparklineRows",
|
|
125
|
+
factory_name="sparkline_rows",
|
|
126
|
+
slug="sparkline-rows",
|
|
127
|
+
family="Lines",
|
|
128
|
+
summary="One row per series — name, sparkline, readout.",
|
|
129
|
+
props=(
|
|
130
|
+
PropDoc("rows", "rows", "number", "Rows shown, from the first; all by default."),
|
|
131
|
+
PropDoc("name_key", "nameKey", "Accessor<string>", ""),
|
|
132
|
+
PropDoc(
|
|
133
|
+
"readout_key",
|
|
134
|
+
"readoutKey",
|
|
135
|
+
"Accessor<string | number | null | undefined>",
|
|
136
|
+
"The printed readout; the last value of the series by default.",
|
|
137
|
+
),
|
|
138
|
+
PropDoc(
|
|
139
|
+
"series_key",
|
|
140
|
+
"seriesKey",
|
|
141
|
+
"Accessor<readonly unknown[] | null | undefined>",
|
|
142
|
+
"The row's points: an array.",
|
|
143
|
+
),
|
|
144
|
+
PropDoc(
|
|
145
|
+
"point_key",
|
|
146
|
+
"pointKey",
|
|
147
|
+
"Accessor<number | null | undefined>",
|
|
148
|
+
"The value of one point; the point itself when it is a number, else its `value`.",
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
),
|
|
152
|
+
ChartInfo(
|
|
153
|
+
chart="KpiCard",
|
|
154
|
+
factory_name="kpi_card",
|
|
155
|
+
slug="kpi-card",
|
|
156
|
+
family="Lines",
|
|
157
|
+
summary="A metric, its delta, and an area sparkline of the series.",
|
|
158
|
+
props=(
|
|
159
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
160
|
+
PropDoc("metric", "metric", "string", "The metric's name, printed under the figure."),
|
|
161
|
+
PropDoc("delta", "delta", "number", "Signed change, printed with its sign and a direction mark."),
|
|
162
|
+
PropDoc(
|
|
163
|
+
"delta_tone",
|
|
164
|
+
"deltaTone",
|
|
165
|
+
"'up' | 'down' | 'flat'",
|
|
166
|
+
"Direction of the mark; from the sign of `delta` by default.",
|
|
167
|
+
),
|
|
168
|
+
),
|
|
169
|
+
),
|
|
170
|
+
ChartInfo(
|
|
171
|
+
chart="BarChart",
|
|
172
|
+
factory_name="bar_chart",
|
|
173
|
+
slug="bar-chart",
|
|
174
|
+
family="Bars",
|
|
175
|
+
summary="Pill bars, as columns or rows, with an optional second series.",
|
|
176
|
+
props=(
|
|
177
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
178
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
179
|
+
PropDoc("secondary_key", "secondaryKey", "Accessor<number | null | undefined>", ""),
|
|
180
|
+
PropDoc("orientation", "orientation", "'columns' | 'rows'", ""),
|
|
181
|
+
),
|
|
182
|
+
),
|
|
183
|
+
ChartInfo(
|
|
184
|
+
chart="StackedBarChart",
|
|
185
|
+
factory_name="stacked_bar_chart",
|
|
186
|
+
slug="stacked-bar-chart",
|
|
187
|
+
family="Bars",
|
|
188
|
+
summary="One stacked segment per key.",
|
|
189
|
+
props=(
|
|
190
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
191
|
+
PropDoc("keys", "keys", "readonly string[]", ""),
|
|
192
|
+
PropDoc(
|
|
193
|
+
"names",
|
|
194
|
+
"names",
|
|
195
|
+
"readonly string[]",
|
|
196
|
+
"Display names of the keys, in order; the keys themselves by default.",
|
|
197
|
+
),
|
|
198
|
+
),
|
|
199
|
+
),
|
|
200
|
+
ChartInfo(
|
|
201
|
+
chart="ComposedChart",
|
|
202
|
+
factory_name="composed_chart",
|
|
203
|
+
slug="composed-chart",
|
|
204
|
+
family="Bars",
|
|
205
|
+
summary="Columns and a spline on one value scale.",
|
|
206
|
+
props=(
|
|
207
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
208
|
+
PropDoc("bar_key", "barKey", "Accessor<number | null | undefined>", ""),
|
|
209
|
+
PropDoc("line_key", "lineKey", "Accessor<number | null | undefined>", ""),
|
|
210
|
+
PropDoc("show_line", "showLine", "boolean", ""),
|
|
211
|
+
),
|
|
212
|
+
),
|
|
213
|
+
ChartInfo(
|
|
214
|
+
chart="WaterfallChart",
|
|
215
|
+
factory_name="waterfall_chart",
|
|
216
|
+
slug="waterfall-chart",
|
|
217
|
+
family="Bars",
|
|
218
|
+
summary="Totals from zero and floating deltas from the running total.",
|
|
219
|
+
props=(
|
|
220
|
+
PropDoc("step_key", "stepKey", "Accessor<string>", ""),
|
|
221
|
+
PropDoc(
|
|
222
|
+
"base_key",
|
|
223
|
+
"baseKey",
|
|
224
|
+
"Accessor<number | null | undefined>",
|
|
225
|
+
"An absolute total: the bar starts at zero and resets the running total.",
|
|
226
|
+
),
|
|
227
|
+
PropDoc("delta_key", "deltaKey", "Accessor<number | null | undefined>", "A change from the running total."),
|
|
228
|
+
),
|
|
229
|
+
),
|
|
230
|
+
ChartInfo(
|
|
231
|
+
chart="FunnelChart",
|
|
232
|
+
factory_name="funnel_chart",
|
|
233
|
+
slug="funnel-chart",
|
|
234
|
+
family="Bars",
|
|
235
|
+
summary="Horizontal, centred stages.",
|
|
236
|
+
props=(
|
|
237
|
+
PropDoc("stage_key", "stageKey", "Accessor<string>", ""),
|
|
238
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
239
|
+
),
|
|
240
|
+
),
|
|
241
|
+
ChartInfo(
|
|
242
|
+
chart="BulletChart",
|
|
243
|
+
factory_name="bullet_chart",
|
|
244
|
+
slug="bullet-chart",
|
|
245
|
+
family="Bars",
|
|
246
|
+
summary="One bar per target, with a marker at the target. Values in 0-100.",
|
|
247
|
+
props=(
|
|
248
|
+
PropDoc("title_key", "titleKey", "Accessor<string>", ""),
|
|
249
|
+
PropDoc("actual_key", "actualKey", "Accessor<number | null | undefined>", ""),
|
|
250
|
+
PropDoc("target_key", "targetKey", "Accessor<number | null | undefined>", ""),
|
|
251
|
+
),
|
|
252
|
+
),
|
|
253
|
+
ChartInfo(
|
|
254
|
+
chart="PyramidChart",
|
|
255
|
+
factory_name="pyramid_chart",
|
|
256
|
+
slug="pyramid-chart",
|
|
257
|
+
family="Bars",
|
|
258
|
+
summary="Stacked tiers whose width encodes the value (0-100).",
|
|
259
|
+
props=(
|
|
260
|
+
PropDoc("label_key", "labelKey", "Accessor<string>", ""),
|
|
261
|
+
PropDoc("width_key", "widthKey", "Accessor<number | null | undefined>", ""),
|
|
262
|
+
PropDoc("tone_key", "toneKey", "Accessor<number | null | undefined>", ""),
|
|
263
|
+
),
|
|
264
|
+
),
|
|
265
|
+
ChartInfo(
|
|
266
|
+
chart="CandlestickChart",
|
|
267
|
+
factory_name="candlestick_chart",
|
|
268
|
+
slug="candlestick-chart",
|
|
269
|
+
family="Bars",
|
|
270
|
+
summary="OHLC bodies and wicks.",
|
|
271
|
+
props=(
|
|
272
|
+
PropDoc("time_key", "timeKey", "Accessor<string | number>", ""),
|
|
273
|
+
PropDoc("open_key", "openKey", "Accessor<number | null | undefined>", ""),
|
|
274
|
+
PropDoc("high_key", "highKey", "Accessor<number | null | undefined>", ""),
|
|
275
|
+
PropDoc("low_key", "lowKey", "Accessor<number | null | undefined>", ""),
|
|
276
|
+
PropDoc("close_key", "closeKey", "Accessor<number | null | undefined>", ""),
|
|
277
|
+
PropDoc(
|
|
278
|
+
"bounds",
|
|
279
|
+
"bounds",
|
|
280
|
+
"readonly [number, number]",
|
|
281
|
+
"Price bounds of the scale; derived from the data when omitted (REQ-097).",
|
|
282
|
+
),
|
|
283
|
+
),
|
|
284
|
+
),
|
|
285
|
+
ChartInfo(
|
|
286
|
+
chart="AreaChart",
|
|
287
|
+
factory_name="area_chart",
|
|
288
|
+
slug="area-chart",
|
|
289
|
+
family="Areas",
|
|
290
|
+
summary="A curved, toned area under its line.",
|
|
291
|
+
props=(
|
|
292
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
293
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
294
|
+
PropDoc("curve", "curve", "LineCurve", ""),
|
|
295
|
+
),
|
|
296
|
+
),
|
|
297
|
+
ChartInfo(
|
|
298
|
+
chart="RangeBandChart",
|
|
299
|
+
factory_name="range_band_chart",
|
|
300
|
+
slug="range-band-chart",
|
|
301
|
+
family="Areas",
|
|
302
|
+
summary="The band between a low and a high series.",
|
|
303
|
+
props=(
|
|
304
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
305
|
+
PropDoc("low_key", "lowKey", "Accessor<number | null | undefined>", ""),
|
|
306
|
+
PropDoc("high_key", "highKey", "Accessor<number | null | undefined>", ""),
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
ChartInfo(
|
|
310
|
+
chart="StreamChart",
|
|
311
|
+
factory_name="stream_chart",
|
|
312
|
+
slug="stream-chart",
|
|
313
|
+
family="Areas",
|
|
314
|
+
summary="Two waves, overlaid or stacked.",
|
|
315
|
+
props=(
|
|
316
|
+
PropDoc("x_key", "xKey", "Accessor<string | number>", ""),
|
|
317
|
+
PropDoc("keys", "keys", "readonly string[]", ""),
|
|
318
|
+
PropDoc("stacked", "stacked", "boolean", ""),
|
|
319
|
+
),
|
|
320
|
+
),
|
|
321
|
+
ChartInfo(
|
|
322
|
+
chart="ScatterChart",
|
|
323
|
+
factory_name="scatter_chart",
|
|
324
|
+
slug="scatter-chart",
|
|
325
|
+
family="Points & grids",
|
|
326
|
+
summary="Points on two linear scales, optionally sized.",
|
|
327
|
+
props=(
|
|
328
|
+
PropDoc("x_key", "xKey", "Accessor<number | null | undefined>", ""),
|
|
329
|
+
PropDoc("y_key", "yKey", "Accessor<number | null | undefined>", ""),
|
|
330
|
+
PropDoc("size_key", "sizeKey", "Accessor<number | null | undefined>", ""),
|
|
331
|
+
PropDoc(
|
|
332
|
+
"size_range",
|
|
333
|
+
"sizeRange",
|
|
334
|
+
"readonly [number, number]",
|
|
335
|
+
"Marker area in px², smallest to largest; `[60, 240]` by default.",
|
|
336
|
+
),
|
|
337
|
+
),
|
|
338
|
+
),
|
|
339
|
+
ChartInfo(
|
|
340
|
+
chart="BubbleChart",
|
|
341
|
+
factory_name="bubble_chart",
|
|
342
|
+
slug="bubble-chart",
|
|
343
|
+
family="Points & grids",
|
|
344
|
+
summary="Circles whose area encodes `sizeKey`.",
|
|
345
|
+
props=(
|
|
346
|
+
PropDoc("x_key", "xKey", "Accessor<number | null | undefined>", ""),
|
|
347
|
+
PropDoc("y_key", "yKey", "Accessor<number | null | undefined>", ""),
|
|
348
|
+
PropDoc("size_key", "sizeKey", "Accessor<number | null | undefined>", ""),
|
|
349
|
+
PropDoc(
|
|
350
|
+
"size_range",
|
|
351
|
+
"sizeRange",
|
|
352
|
+
"readonly [number, number]",
|
|
353
|
+
"Circle area in px², smallest to largest; `[100, 500]` by default.",
|
|
354
|
+
),
|
|
355
|
+
),
|
|
356
|
+
),
|
|
357
|
+
ChartInfo(
|
|
358
|
+
chart="HeatmapChart",
|
|
359
|
+
factory_name="heatmap_chart",
|
|
360
|
+
slug="heatmap-chart",
|
|
361
|
+
family="Points & grids",
|
|
362
|
+
summary="Labelled rows of values, normalised against `scaleMax`.",
|
|
363
|
+
props=(
|
|
364
|
+
PropDoc("label_key", "labelKey", "Accessor<string>", ""),
|
|
365
|
+
PropDoc("values_key", "valuesKey", "Accessor<readonly (number | null)[] | null | undefined>", ""),
|
|
366
|
+
PropDoc("scale_max", "scaleMax", "number", "Value that maps to the darkest tone; 100 by default."),
|
|
367
|
+
PropDoc(
|
|
368
|
+
"column_labels",
|
|
369
|
+
"columnLabels",
|
|
370
|
+
"readonly string[]",
|
|
371
|
+
"Names of the columns, in order; missing ones fall back to `#k` (delta-006).",
|
|
372
|
+
),
|
|
373
|
+
),
|
|
374
|
+
),
|
|
375
|
+
ChartInfo(
|
|
376
|
+
chart="TreemapChart",
|
|
377
|
+
factory_name="treemap_chart",
|
|
378
|
+
slug="treemap-chart",
|
|
379
|
+
family="Points & grids",
|
|
380
|
+
summary="Tiles of `cols × rows` cells placed in a `columns × rows` grid.",
|
|
381
|
+
props=(
|
|
382
|
+
PropDoc("label_key", "labelKey", "Accessor<string>", ""),
|
|
383
|
+
PropDoc("share_key", "shareKey", "Accessor<number | null | undefined>", ""),
|
|
384
|
+
PropDoc("columns", "columns", "number", ""),
|
|
385
|
+
PropDoc("rows", "rows", "number", ""),
|
|
386
|
+
),
|
|
387
|
+
),
|
|
388
|
+
ChartInfo(
|
|
389
|
+
chart="ActivityGrid",
|
|
390
|
+
factory_name="activity_grid",
|
|
391
|
+
slug="activity-grid",
|
|
392
|
+
family="Points & grids",
|
|
393
|
+
summary="One cell per day, a column per week.",
|
|
394
|
+
props=(
|
|
395
|
+
PropDoc("date_key", "dateKey", "Accessor<string>", ""),
|
|
396
|
+
PropDoc("count_key", "countKey", "Accessor<number | null | undefined>", ""),
|
|
397
|
+
PropDoc("level_key", "levelKey", "Accessor<number | null | undefined>", ""),
|
|
398
|
+
PropDoc("weeks", "weeks", "number", "Weeks shown, the most recent last; 26 by default."),
|
|
399
|
+
),
|
|
400
|
+
),
|
|
401
|
+
ChartInfo(
|
|
402
|
+
chart="SankeyChart",
|
|
403
|
+
factory_name="sankey_chart",
|
|
404
|
+
slug="sankey-chart",
|
|
405
|
+
family="Flows",
|
|
406
|
+
summary="Flow bands between layered nodes.",
|
|
407
|
+
props=(
|
|
408
|
+
PropDoc("source_key", "sourceKey", "Accessor<string>", ""),
|
|
409
|
+
PropDoc("target_key", "targetKey", "Accessor<string>", ""),
|
|
410
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
ChartInfo(
|
|
414
|
+
chart="ChordRing",
|
|
415
|
+
factory_name="chord_ring",
|
|
416
|
+
slug="chord-ring",
|
|
417
|
+
family="Flows",
|
|
418
|
+
summary="Directed flows between categories around a circle.",
|
|
419
|
+
props=(
|
|
420
|
+
PropDoc("source_key", "sourceKey", "Accessor<string | number>", ""),
|
|
421
|
+
PropDoc("target_key", "targetKey", "Accessor<string | number>", ""),
|
|
422
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
423
|
+
PropDoc(
|
|
424
|
+
"max_categories",
|
|
425
|
+
"maxCategories",
|
|
426
|
+
"number",
|
|
427
|
+
'Categories drawn; past it the smallest merge into "Other" (`SP010`). 12 by default.',
|
|
428
|
+
),
|
|
429
|
+
),
|
|
430
|
+
),
|
|
431
|
+
ChartInfo(
|
|
432
|
+
chart="DonutChart",
|
|
433
|
+
factory_name="donut_chart",
|
|
434
|
+
slug="donut-chart",
|
|
435
|
+
family="Radial",
|
|
436
|
+
summary="Sectors ∝ value around a central readout.",
|
|
437
|
+
props=(
|
|
438
|
+
PropDoc("name_key", "nameKey", "Accessor<string | number>", ""),
|
|
439
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
440
|
+
PropDoc("center_value", "centerValue", "string | number", "Printed in the centre; the total by default."),
|
|
441
|
+
PropDoc("center_label", "centerLabel", "string", "A line under the centre value."),
|
|
442
|
+
PropDoc(
|
|
443
|
+
"legend", "legend", "boolean", "Names every sector with its share beside the ring; `true` by default."
|
|
444
|
+
),
|
|
445
|
+
),
|
|
446
|
+
),
|
|
447
|
+
ChartInfo(
|
|
448
|
+
chart="RadarChart",
|
|
449
|
+
factory_name="radar_chart",
|
|
450
|
+
slug="radar-chart",
|
|
451
|
+
family="Radial",
|
|
452
|
+
summary="One spoke per subject, a closed polygon of values.",
|
|
453
|
+
props=(
|
|
454
|
+
PropDoc("subject_key", "subjectKey", "Accessor<string | number>", ""),
|
|
455
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
456
|
+
PropDoc(
|
|
457
|
+
"domain",
|
|
458
|
+
"domain",
|
|
459
|
+
"readonly [number, number]",
|
|
460
|
+
"The value range along a spoke; `[0, the largest value]`, niced, by default.",
|
|
461
|
+
),
|
|
462
|
+
),
|
|
463
|
+
),
|
|
464
|
+
ChartInfo(
|
|
465
|
+
chart="PolarBarChart",
|
|
466
|
+
factory_name="polar_bar_chart",
|
|
467
|
+
slug="polar-bar-chart",
|
|
468
|
+
family="Radial",
|
|
469
|
+
summary="360° bars out from a hole, length ∝ value.",
|
|
470
|
+
props=(
|
|
471
|
+
PropDoc("name_key", "nameKey", "Accessor<string | number>", ""),
|
|
472
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
473
|
+
),
|
|
474
|
+
),
|
|
475
|
+
ChartInfo(
|
|
476
|
+
chart="RadialArcGroup",
|
|
477
|
+
factory_name="radial_arc_group",
|
|
478
|
+
slug="radial-arc-group",
|
|
479
|
+
family="Radial",
|
|
480
|
+
summary="Concentric 180° tracks, sweep ∝ value / the largest.",
|
|
481
|
+
props=(
|
|
482
|
+
PropDoc("name_key", "nameKey", "Accessor<string | number>", ""),
|
|
483
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
484
|
+
),
|
|
485
|
+
),
|
|
486
|
+
ChartInfo(
|
|
487
|
+
chart="RadialRings",
|
|
488
|
+
factory_name="radial_rings",
|
|
489
|
+
slug="radial-rings",
|
|
490
|
+
family="Radial",
|
|
491
|
+
summary="Concentric progress rings, sweep ∝ value in 0-100.",
|
|
492
|
+
props=(
|
|
493
|
+
PropDoc("name_key", "nameKey", "Accessor<string | number>", ""),
|
|
494
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
495
|
+
),
|
|
496
|
+
),
|
|
497
|
+
ChartInfo(
|
|
498
|
+
chart="GaugeArc",
|
|
499
|
+
factory_name="gauge_arc",
|
|
500
|
+
slug="gauge-arc",
|
|
501
|
+
family="Radial",
|
|
502
|
+
summary="A 240° arc swept to a percent.",
|
|
503
|
+
props=(
|
|
504
|
+
PropDoc("percent", "percent", "number", "0 to 100; saturated at the ends outside it."),
|
|
505
|
+
PropDoc("caption", "caption", "string", "Names the measure under the readout."),
|
|
506
|
+
PropDoc("readout", "readout", "string", "Printed in place of the percent."),
|
|
507
|
+
),
|
|
508
|
+
),
|
|
509
|
+
ChartInfo(
|
|
510
|
+
chart="MeterChart",
|
|
511
|
+
factory_name="meter_chart",
|
|
512
|
+
slug="meter-chart",
|
|
513
|
+
family="Radial",
|
|
514
|
+
summary="A semicircular meter with a needle at a percent.",
|
|
515
|
+
props=(
|
|
516
|
+
PropDoc("percent", "percent", "number", "0 to 100; saturated at the ends outside it."),
|
|
517
|
+
PropDoc("caption", "caption", "string", "Names the measure under the readout."),
|
|
518
|
+
PropDoc("readout", "readout", "string", "Printed in place of the percent."),
|
|
519
|
+
),
|
|
520
|
+
),
|
|
521
|
+
ChartInfo(
|
|
522
|
+
chart="CoxcombChart",
|
|
523
|
+
factory_name="coxcomb_chart",
|
|
524
|
+
slug="coxcomb-chart",
|
|
525
|
+
family="Radial",
|
|
526
|
+
summary="Equal angles, sector **area** ∝ value.",
|
|
527
|
+
props=(
|
|
528
|
+
PropDoc("name_key", "nameKey", "Accessor<string | number>", ""),
|
|
529
|
+
PropDoc("value_key", "valueKey", "Accessor<number | null | undefined>", ""),
|
|
530
|
+
PropDoc(
|
|
531
|
+
"start_angle",
|
|
532
|
+
"startAngle",
|
|
533
|
+
"number",
|
|
534
|
+
"Where the first sector starts, in degrees clockwise from 12 o'clock; 0 by default.",
|
|
535
|
+
),
|
|
536
|
+
),
|
|
537
|
+
),
|
|
538
|
+
ChartInfo(
|
|
539
|
+
chart="WindRose",
|
|
540
|
+
factory_name="wind_rose",
|
|
541
|
+
slug="wind-rose",
|
|
542
|
+
family="Radial",
|
|
543
|
+
summary="Observations of (bearing, speed) binned by compass sector and speed.",
|
|
544
|
+
props=(
|
|
545
|
+
PropDoc(
|
|
546
|
+
"bearing_key",
|
|
547
|
+
"bearingKey",
|
|
548
|
+
"Accessor<number | null | undefined>",
|
|
549
|
+
"Where the wind blows from, in degrees clockwise from north.",
|
|
550
|
+
),
|
|
551
|
+
PropDoc(
|
|
552
|
+
"value_key",
|
|
553
|
+
"valueKey",
|
|
554
|
+
"Accessor<number | null | undefined>",
|
|
555
|
+
"The wind speed; 0 is a calm, which has no direction.",
|
|
556
|
+
),
|
|
557
|
+
PropDoc("sectors", "sectors", "number", "Compass sectors: 4, 8, 16 or 32; 16 by default."),
|
|
558
|
+
PropDoc(
|
|
559
|
+
"bins",
|
|
560
|
+
"bins",
|
|
561
|
+
"readonly number[]",
|
|
562
|
+
"Ascending speed thresholds that split each sector; `[5, 10, 15, 20]` by default.",
|
|
563
|
+
),
|
|
564
|
+
),
|
|
565
|
+
),
|
|
566
|
+
ChartInfo(
|
|
567
|
+
chart="VolvelleChart",
|
|
568
|
+
factory_name="volvelle_chart",
|
|
569
|
+
slug="volvelle-chart",
|
|
570
|
+
family="Radial",
|
|
571
|
+
summary="Concentric categorical rings read against one index.",
|
|
572
|
+
props=(
|
|
573
|
+
PropDoc("rings", "rings", "number", "Rings shown, from the inside out; all by default."),
|
|
574
|
+
PropDoc(
|
|
575
|
+
"index_ring",
|
|
576
|
+
"indexRing",
|
|
577
|
+
"number",
|
|
578
|
+
"The ring whose segment is brought under the index, 0-based; 0 by default.",
|
|
579
|
+
),
|
|
580
|
+
PropDoc(
|
|
581
|
+
"index_value",
|
|
582
|
+
"indexValue",
|
|
583
|
+
"string",
|
|
584
|
+
"The segment of `indexRing` under the index; its first segment by default.",
|
|
585
|
+
),
|
|
586
|
+
),
|
|
587
|
+
),
|
|
588
|
+
ChartInfo(
|
|
589
|
+
chart="OrbitChart",
|
|
590
|
+
factory_name="orbit_chart",
|
|
591
|
+
slug="orbit-chart",
|
|
592
|
+
family="Radial",
|
|
593
|
+
summary="Nested elliptical orbits with markers along them.",
|
|
594
|
+
props=(
|
|
595
|
+
PropDoc("orbits", "orbits", "number", "Orbits shown, from the inside out; all by default."),
|
|
596
|
+
PropDoc(
|
|
597
|
+
"marker_key",
|
|
598
|
+
"markerKey",
|
|
599
|
+
"Accessor<readonly unknown[] | null | undefined>",
|
|
600
|
+
"A row's markers; `'markers'` by default.",
|
|
601
|
+
),
|
|
602
|
+
PropDoc(
|
|
603
|
+
"period_key",
|
|
604
|
+
"periodKey",
|
|
605
|
+
"Accessor<number | null | undefined>",
|
|
606
|
+
"A marker's period, 0-1 over the cycle; `'period'` by default.",
|
|
607
|
+
),
|
|
608
|
+
),
|
|
609
|
+
),
|
|
610
|
+
)
|
|
611
|
+
|
|
612
|
+
#: Families, in catalog order.
|
|
613
|
+
FAMILIES: tuple[str, ...] = tuple(dict.fromkeys(info.family for info in CHARTS))
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
def chart_by_slug(slug: str) -> ChartInfo | None:
|
|
617
|
+
"""Look a chart up by its kebab-case slug (``"line-chart"``).
|
|
618
|
+
|
|
619
|
+
Args:
|
|
620
|
+
slug: The slug.
|
|
621
|
+
|
|
622
|
+
Returns:
|
|
623
|
+
The chart, or ``None``.
|
|
624
|
+
"""
|
|
625
|
+
return next((info for info in CHARTS if info.slug == slug), None)
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
def chart_by_name(name: str) -> ChartInfo | None:
|
|
629
|
+
"""Look a chart up by its component name (``"LineChart"``).
|
|
630
|
+
|
|
631
|
+
Args:
|
|
632
|
+
name: The component name.
|
|
633
|
+
|
|
634
|
+
Returns:
|
|
635
|
+
The chart, or ``None``.
|
|
636
|
+
"""
|
|
637
|
+
return next((info for info in CHARTS if info.chart == name), None)
|