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.
@@ -0,0 +1,645 @@
1
+ """The 33 silverpoint charts as Reflex components.
2
+
3
+ Generated from the silverpoint API reference (``docs/site/generated/props.json``) and then
4
+ kept by hand. Every class wraps the client component of the same name exported by
5
+ ``@silverpoint/react``; every chart also takes the props of :class:`SilverpointChart`.
6
+ """
7
+
8
+ from typing import Literal
9
+
10
+ import reflex as rx
11
+
12
+ from .base import SilverpointChart
13
+
14
+
15
+ class LineChart(SilverpointChart):
16
+ """Spline with an optional dotted baseline series."""
17
+
18
+ tag = "LineChart"
19
+
20
+ # Key of each row in `data` to read.
21
+ x_key: rx.Var[str]
22
+
23
+ # Key of each row in `data` to read.
24
+ value_key: rx.Var[str]
25
+
26
+ # Key of each row in `data` to read.
27
+ secondary_key: rx.Var[str]
28
+
29
+ curve: rx.Var[Literal["monotone", "linear", "natural", "step"]]
30
+
31
+ # `all` draws the secondary series when there is one; `primary` omits it.
32
+ series: rx.Var[Literal["all", "primary"]]
33
+
34
+ # Whether a gap left by a missing value is bridged.
35
+ connect_nulls: rx.Var[bool]
36
+
37
+
38
+ line_chart = LineChart.create
39
+
40
+
41
+ class StepChart(SilverpointChart):
42
+ """A series drawn as steps."""
43
+
44
+ tag = "StepChart"
45
+
46
+ # Key of each row in `data` to read.
47
+ x_key: rx.Var[str]
48
+
49
+ # Key of each row in `data` to read.
50
+ value_key: rx.Var[str]
51
+
52
+ # Where the step sits between two points; `after` by default.
53
+ step: rx.Var[Literal["after", "before", "middle"]]
54
+
55
+
56
+ step_chart = StepChart.create
57
+
58
+
59
+ class SparklineRows(SilverpointChart):
60
+ """One row per series — name, sparkline, readout."""
61
+
62
+ tag = "SparklineRows"
63
+
64
+ # Rows shown, from the first; all by default.
65
+ rows: rx.Var[int]
66
+
67
+ # Key of each row in `data` to read.
68
+ name_key: rx.Var[str]
69
+
70
+ # The printed readout; the last value of the series by default.
71
+ readout_key: rx.Var[str]
72
+
73
+ # The row's points: an array.
74
+ series_key: rx.Var[str]
75
+
76
+ # The value of one point; the point itself when it is a number, else its `value`.
77
+ point_key: rx.Var[str]
78
+
79
+
80
+ sparkline_rows = SparklineRows.create
81
+
82
+
83
+ class KpiCard(SilverpointChart):
84
+ """A metric, its delta, and an area sparkline of the series."""
85
+
86
+ tag = "KpiCard"
87
+
88
+ # Key of each row in `data` to read.
89
+ value_key: rx.Var[str]
90
+
91
+ # The metric's name, printed under the figure.
92
+ metric: rx.Var[str]
93
+
94
+ # Signed change, printed with its sign and a direction mark.
95
+ delta: rx.Var[int | float]
96
+
97
+ # Direction of the mark; from the sign of `delta` by default.
98
+ delta_tone: rx.Var[Literal["up", "down", "flat"]]
99
+
100
+
101
+ kpi_card = KpiCard.create
102
+
103
+
104
+ class BarChart(SilverpointChart):
105
+ """Pill bars, as columns or rows, with an optional second series."""
106
+
107
+ tag = "BarChart"
108
+
109
+ # Key of each row in `data` to read.
110
+ x_key: rx.Var[str]
111
+
112
+ # Key of each row in `data` to read.
113
+ value_key: rx.Var[str]
114
+
115
+ # Key of each row in `data` to read.
116
+ secondary_key: rx.Var[str]
117
+
118
+ orientation: rx.Var[Literal["columns", "rows"]]
119
+
120
+
121
+ bar_chart = BarChart.create
122
+
123
+
124
+ class StackedBarChart(SilverpointChart):
125
+ """One stacked segment per key."""
126
+
127
+ tag = "StackedBarChart"
128
+
129
+ # Key of each row in `data` to read.
130
+ x_key: rx.Var[str]
131
+
132
+ keys: rx.Var[list[str]]
133
+
134
+ # Display names of the keys, in order; the keys themselves by default.
135
+ names: rx.Var[list[str]]
136
+
137
+
138
+ stacked_bar_chart = StackedBarChart.create
139
+
140
+
141
+ class ComposedChart(SilverpointChart):
142
+ """Columns and a spline on one value scale."""
143
+
144
+ tag = "ComposedChart"
145
+
146
+ # Key of each row in `data` to read.
147
+ x_key: rx.Var[str]
148
+
149
+ # Key of each row in `data` to read.
150
+ bar_key: rx.Var[str]
151
+
152
+ # Key of each row in `data` to read.
153
+ line_key: rx.Var[str]
154
+
155
+ show_line: rx.Var[bool]
156
+
157
+
158
+ composed_chart = ComposedChart.create
159
+
160
+
161
+ class WaterfallChart(SilverpointChart):
162
+ """Totals from zero and floating deltas from the running total."""
163
+
164
+ tag = "WaterfallChart"
165
+
166
+ # Key of each row in `data` to read.
167
+ step_key: rx.Var[str]
168
+
169
+ # An absolute total: the bar starts at zero and resets the running total.
170
+ base_key: rx.Var[str]
171
+
172
+ # A change from the running total.
173
+ delta_key: rx.Var[str]
174
+
175
+
176
+ waterfall_chart = WaterfallChart.create
177
+
178
+
179
+ class FunnelChart(SilverpointChart):
180
+ """Horizontal, centred stages."""
181
+
182
+ tag = "FunnelChart"
183
+
184
+ # Key of each row in `data` to read.
185
+ stage_key: rx.Var[str]
186
+
187
+ # Key of each row in `data` to read.
188
+ value_key: rx.Var[str]
189
+
190
+
191
+ funnel_chart = FunnelChart.create
192
+
193
+
194
+ class BulletChart(SilverpointChart):
195
+ """One bar per target, with a marker at the target. Values in 0-100."""
196
+
197
+ tag = "BulletChart"
198
+
199
+ # Key of each row in `data` to read.
200
+ title_key: rx.Var[str]
201
+
202
+ # Key of each row in `data` to read.
203
+ actual_key: rx.Var[str]
204
+
205
+ # Key of each row in `data` to read.
206
+ target_key: rx.Var[str]
207
+
208
+
209
+ bullet_chart = BulletChart.create
210
+
211
+
212
+ class PyramidChart(SilverpointChart):
213
+ """Stacked tiers whose width encodes the value (0-100)."""
214
+
215
+ tag = "PyramidChart"
216
+
217
+ # Key of each row in `data` to read.
218
+ label_key: rx.Var[str]
219
+
220
+ # Key of each row in `data` to read.
221
+ width_key: rx.Var[str]
222
+
223
+ # Key of each row in `data` to read.
224
+ tone_key: rx.Var[str]
225
+
226
+
227
+ pyramid_chart = PyramidChart.create
228
+
229
+
230
+ class CandlestickChart(SilverpointChart):
231
+ """OHLC bodies and wicks."""
232
+
233
+ tag = "CandlestickChart"
234
+
235
+ # Key of each row in `data` to read.
236
+ time_key: rx.Var[str]
237
+
238
+ # Key of each row in `data` to read.
239
+ open_key: rx.Var[str]
240
+
241
+ # Key of each row in `data` to read.
242
+ high_key: rx.Var[str]
243
+
244
+ # Key of each row in `data` to read.
245
+ low_key: rx.Var[str]
246
+
247
+ # Key of each row in `data` to read.
248
+ close_key: rx.Var[str]
249
+
250
+ # Price bounds of the scale; derived from the data when omitted.
251
+ bounds: rx.Var[list[int | float]]
252
+
253
+
254
+ candlestick_chart = CandlestickChart.create
255
+
256
+
257
+ class AreaChart(SilverpointChart):
258
+ """A curved, toned area under its line."""
259
+
260
+ tag = "AreaChart"
261
+
262
+ # Key of each row in `data` to read.
263
+ x_key: rx.Var[str]
264
+
265
+ # Key of each row in `data` to read.
266
+ value_key: rx.Var[str]
267
+
268
+ curve: rx.Var[Literal["monotone", "linear", "natural", "step"]]
269
+
270
+
271
+ area_chart = AreaChart.create
272
+
273
+
274
+ class RangeBandChart(SilverpointChart):
275
+ """The band between a low and a high series."""
276
+
277
+ tag = "RangeBandChart"
278
+
279
+ # Key of each row in `data` to read.
280
+ x_key: rx.Var[str]
281
+
282
+ # Key of each row in `data` to read.
283
+ low_key: rx.Var[str]
284
+
285
+ # Key of each row in `data` to read.
286
+ high_key: rx.Var[str]
287
+
288
+
289
+ range_band_chart = RangeBandChart.create
290
+
291
+
292
+ class StreamChart(SilverpointChart):
293
+ """Two waves, overlaid or stacked."""
294
+
295
+ tag = "StreamChart"
296
+
297
+ # Key of each row in `data` to read.
298
+ x_key: rx.Var[str]
299
+
300
+ keys: rx.Var[list[str]]
301
+
302
+ stacked: rx.Var[bool]
303
+
304
+
305
+ stream_chart = StreamChart.create
306
+
307
+
308
+ class ScatterChart(SilverpointChart):
309
+ """Points on two linear scales, optionally sized."""
310
+
311
+ tag = "ScatterChart"
312
+
313
+ # Key of each row in `data` to read.
314
+ x_key: rx.Var[str]
315
+
316
+ # Key of each row in `data` to read.
317
+ y_key: rx.Var[str]
318
+
319
+ # Key of each row in `data` to read.
320
+ size_key: rx.Var[str]
321
+
322
+ # Marker area in px², smallest to largest; `[60, 240]` by default.
323
+ size_range: rx.Var[list[int | float]]
324
+
325
+
326
+ scatter_chart = ScatterChart.create
327
+
328
+
329
+ class BubbleChart(SilverpointChart):
330
+ """Circles whose area encodes `sizeKey`."""
331
+
332
+ tag = "BubbleChart"
333
+
334
+ # Key of each row in `data` to read.
335
+ x_key: rx.Var[str]
336
+
337
+ # Key of each row in `data` to read.
338
+ y_key: rx.Var[str]
339
+
340
+ # Key of each row in `data` to read.
341
+ size_key: rx.Var[str]
342
+
343
+ # Circle area in px², smallest to largest; `[100, 500]` by default.
344
+ size_range: rx.Var[list[int | float]]
345
+
346
+
347
+ bubble_chart = BubbleChart.create
348
+
349
+
350
+ class HeatmapChart(SilverpointChart):
351
+ """Labelled rows of values, normalised against `scaleMax`."""
352
+
353
+ tag = "HeatmapChart"
354
+
355
+ # Key of each row in `data` to read.
356
+ label_key: rx.Var[str]
357
+
358
+ # Key of each row in `data` to read.
359
+ values_key: rx.Var[str]
360
+
361
+ # Value that maps to the darkest tone; 100 by default.
362
+ scale_max: rx.Var[int | float]
363
+
364
+ # Names of the columns, in order; missing ones fall back to `#k`.
365
+ column_labels: rx.Var[list[str]]
366
+
367
+
368
+ heatmap_chart = HeatmapChart.create
369
+
370
+
371
+ class TreemapChart(SilverpointChart):
372
+ """Tiles of `cols × rows` cells placed in a `columns × rows` grid."""
373
+
374
+ tag = "TreemapChart"
375
+
376
+ # Key of each row in `data` to read.
377
+ label_key: rx.Var[str]
378
+
379
+ # Key of each row in `data` to read.
380
+ share_key: rx.Var[str]
381
+
382
+ columns: rx.Var[int]
383
+
384
+ rows: rx.Var[int]
385
+
386
+
387
+ treemap_chart = TreemapChart.create
388
+
389
+
390
+ class ActivityGrid(SilverpointChart):
391
+ """One cell per day, a column per week."""
392
+
393
+ tag = "ActivityGrid"
394
+
395
+ # Key of each row in `data` to read.
396
+ date_key: rx.Var[str]
397
+
398
+ # Key of each row in `data` to read.
399
+ count_key: rx.Var[str]
400
+
401
+ # Key of each row in `data` to read.
402
+ level_key: rx.Var[str]
403
+
404
+ # Weeks shown, the most recent last; 26 by default.
405
+ weeks: rx.Var[int]
406
+
407
+
408
+ activity_grid = ActivityGrid.create
409
+
410
+
411
+ class SankeyChart(SilverpointChart):
412
+ """Flow bands between layered nodes."""
413
+
414
+ tag = "SankeyChart"
415
+
416
+ # Key of each row in `data` to read.
417
+ source_key: rx.Var[str]
418
+
419
+ # Key of each row in `data` to read.
420
+ target_key: rx.Var[str]
421
+
422
+ # Key of each row in `data` to read.
423
+ value_key: rx.Var[str]
424
+
425
+
426
+ sankey_chart = SankeyChart.create
427
+
428
+
429
+ class ChordRing(SilverpointChart):
430
+ """Directed flows between categories around a circle."""
431
+
432
+ tag = "ChordRing"
433
+
434
+ # Key of each row in `data` to read.
435
+ source_key: rx.Var[str]
436
+
437
+ # Key of each row in `data` to read.
438
+ target_key: rx.Var[str]
439
+
440
+ # Key of each row in `data` to read.
441
+ value_key: rx.Var[str]
442
+
443
+ # Categories drawn; past it the smallest merge into "Other" (`SP010`). 12 by default.
444
+ max_categories: rx.Var[int]
445
+
446
+
447
+ chord_ring = ChordRing.create
448
+
449
+
450
+ class DonutChart(SilverpointChart):
451
+ """Sectors ∝ value around a central readout."""
452
+
453
+ tag = "DonutChart"
454
+
455
+ # Key of each row in `data` to read.
456
+ name_key: rx.Var[str]
457
+
458
+ # Key of each row in `data` to read.
459
+ value_key: rx.Var[str]
460
+
461
+ # Printed in the centre; the total by default.
462
+ center_value: rx.Var[str | int | float]
463
+
464
+ # A line under the centre value.
465
+ center_label: rx.Var[str]
466
+
467
+ # Names every sector with its share beside the ring; `true` by default.
468
+ legend: rx.Var[bool]
469
+
470
+
471
+ donut_chart = DonutChart.create
472
+
473
+
474
+ class RadarChart(SilverpointChart):
475
+ """One spoke per subject, a closed polygon of values."""
476
+
477
+ tag = "RadarChart"
478
+
479
+ # Key of each row in `data` to read.
480
+ subject_key: rx.Var[str]
481
+
482
+ # Key of each row in `data` to read.
483
+ value_key: rx.Var[str]
484
+
485
+ # The value range along a spoke; `[0, the largest value]`, niced, by default.
486
+ domain: rx.Var[list[int | float]]
487
+
488
+
489
+ radar_chart = RadarChart.create
490
+
491
+
492
+ class PolarBarChart(SilverpointChart):
493
+ """360° bars out from a hole, length ∝ value."""
494
+
495
+ tag = "PolarBarChart"
496
+
497
+ # Key of each row in `data` to read.
498
+ name_key: rx.Var[str]
499
+
500
+ # Key of each row in `data` to read.
501
+ value_key: rx.Var[str]
502
+
503
+
504
+ polar_bar_chart = PolarBarChart.create
505
+
506
+
507
+ class RadialArcGroup(SilverpointChart):
508
+ """Concentric 180° tracks, sweep ∝ value / the largest."""
509
+
510
+ tag = "RadialArcGroup"
511
+
512
+ # Key of each row in `data` to read.
513
+ name_key: rx.Var[str]
514
+
515
+ # Key of each row in `data` to read.
516
+ value_key: rx.Var[str]
517
+
518
+
519
+ radial_arc_group = RadialArcGroup.create
520
+
521
+
522
+ class RadialRings(SilverpointChart):
523
+ """Concentric progress rings, sweep ∝ value in 0-100."""
524
+
525
+ tag = "RadialRings"
526
+
527
+ # Key of each row in `data` to read.
528
+ name_key: rx.Var[str]
529
+
530
+ # Key of each row in `data` to read.
531
+ value_key: rx.Var[str]
532
+
533
+
534
+ radial_rings = RadialRings.create
535
+
536
+
537
+ class GaugeArc(SilverpointChart):
538
+ """A 240° arc swept to a percent."""
539
+
540
+ tag = "GaugeArc"
541
+
542
+ # 0 to 100; saturated at the ends outside it.
543
+ percent: rx.Var[int | float]
544
+
545
+ # Names the measure under the readout.
546
+ caption: rx.Var[str]
547
+
548
+ # Printed in place of the percent.
549
+ readout: rx.Var[str]
550
+
551
+
552
+ gauge_arc = GaugeArc.create
553
+
554
+
555
+ class MeterChart(SilverpointChart):
556
+ """A semicircular meter with a needle at a percent."""
557
+
558
+ tag = "MeterChart"
559
+
560
+ # 0 to 100; saturated at the ends outside it.
561
+ percent: rx.Var[int | float]
562
+
563
+ # Names the measure under the readout.
564
+ caption: rx.Var[str]
565
+
566
+ # Printed in place of the percent.
567
+ readout: rx.Var[str]
568
+
569
+
570
+ meter_chart = MeterChart.create
571
+
572
+
573
+ class CoxcombChart(SilverpointChart):
574
+ """Equal angles, sector **area** ∝ value."""
575
+
576
+ tag = "CoxcombChart"
577
+
578
+ # Key of each row in `data` to read.
579
+ name_key: rx.Var[str]
580
+
581
+ # Key of each row in `data` to read.
582
+ value_key: rx.Var[str]
583
+
584
+ # Where the first sector starts, in degrees clockwise from 12 o'clock; 0 by default.
585
+ start_angle: rx.Var[int | float]
586
+
587
+
588
+ coxcomb_chart = CoxcombChart.create
589
+
590
+
591
+ class WindRose(SilverpointChart):
592
+ """Observations of (bearing, speed) binned by compass sector and speed."""
593
+
594
+ tag = "WindRose"
595
+
596
+ # Where the wind blows from, in degrees clockwise from north.
597
+ bearing_key: rx.Var[str]
598
+
599
+ # The wind speed; 0 is a calm, which has no direction.
600
+ value_key: rx.Var[str]
601
+
602
+ # Compass sectors: 4, 8, 16 or 32; 16 by default.
603
+ sectors: rx.Var[int]
604
+
605
+ # Ascending speed thresholds that split each sector; `[5, 10, 15, 20]` by default.
606
+ bins: rx.Var[list[int | float]]
607
+
608
+
609
+ wind_rose = WindRose.create
610
+
611
+
612
+ class VolvelleChart(SilverpointChart):
613
+ """Concentric categorical rings read against one index."""
614
+
615
+ tag = "VolvelleChart"
616
+
617
+ # Rings shown, from the inside out; all by default.
618
+ rings: rx.Var[int]
619
+
620
+ # The ring whose segment is brought under the index, 0-based; 0 by default.
621
+ index_ring: rx.Var[int]
622
+
623
+ # The segment of `indexRing` under the index; its first segment by default.
624
+ index_value: rx.Var[str]
625
+
626
+
627
+ volvelle_chart = VolvelleChart.create
628
+
629
+
630
+ class OrbitChart(SilverpointChart):
631
+ """Nested elliptical orbits with markers along them."""
632
+
633
+ tag = "OrbitChart"
634
+
635
+ # Orbits shown, from the inside out; all by default.
636
+ orbits: rx.Var[int]
637
+
638
+ # A row's markers; `'markers'` by default.
639
+ marker_key: rx.Var[str]
640
+
641
+ # A marker's period, 0-1 over the cycle; `'period'` by default.
642
+ period_key: rx.Var[str]
643
+
644
+
645
+ orbit_chart = OrbitChart.create