@mechane-ai/elements 0.46.0 → 0.47.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 +306 -33
- package/dist/ai.js +4 -4
- package/dist/catalog.json +2382 -33
- package/dist/categorical-values-DdfGIowV.js +107 -0
- package/dist/cells--Bd1fQFR.js +384 -0
- package/dist/chart-link-AE_xuxiP.js +35 -0
- package/dist/chart-tones-ei3BC2AL.js +27 -0
- package/dist/charts/cartesian.js +1 -2958
- package/dist/charts/cells.js +1 -0
- package/dist/charts/comparison.js +1 -0
- package/dist/charts/distribution.js +1 -781
- package/dist/charts/figure.js +3404 -0
- package/dist/charts/graph.js +1 -655
- package/dist/charts/hierarchy.js +1 -121
- package/dist/charts/image.js +1 -0
- package/dist/charts/matrix.js +3 -644
- package/dist/charts/plot.js +15 -0
- package/dist/charts/relationship.js +1 -0
- package/dist/charts/text.js +1 -0
- package/dist/charts/timeline.js +1 -266
- package/dist/charts/transforms.js +677 -0
- package/dist/charts/trend.js +1 -0
- package/dist/charts.js +8 -3
- package/dist/collections.js +1 -2195
- package/dist/color-legend-CIo7DhXB.js +62 -0
- package/dist/dates-Cww8UR_n.js +810 -0
- package/dist/dumbbell-plot-B2ZTgQaI.js +508 -0
- package/dist/embedding-map-CGM_k6lC.js +1929 -0
- package/dist/feedback.js +1 -1
- package/dist/figure-format-B8kRZMlo.js +36 -0
- package/dist/figure-frame-wRkIEAwe.js +270 -0
- package/dist/forms/dates.js +1 -810
- package/dist/heatmap-scale-Zte6Ya-g.js +20 -0
- package/dist/image-grid-CVA4SOy_.js +598 -0
- package/dist/kits/evaluation.js +431 -0
- package/dist/kits/explainers.js +452 -0
- package/dist/kits/interpretability.js +1033 -0
- package/dist/kits/operations.js +239 -0
- package/dist/kits/training.js +335 -0
- package/dist/label-place-Z0fryBZb.js +42 -0
- package/dist/locate-Bcg3QcP4.js +11 -0
- package/dist/packages/charts/src/cartesian/bar-chart.d.ts +40 -21
- package/dist/packages/charts/src/cartesian/bar-data.d.ts +15 -4
- package/dist/packages/charts/src/cartesian/bar-overlays.d.ts +7 -3
- package/dist/packages/charts/src/cartesian/breakdown-bar.d.ts +10 -8
- package/dist/packages/charts/src/cartesian/bridge-chart.d.ts +20 -16
- package/dist/packages/charts/src/cartesian/bridge-data.d.ts +5 -4
- package/dist/packages/charts/src/cartesian/composition-bars.d.ts +8 -4
- package/dist/packages/charts/src/cartesian/index.d.ts +5 -5
- package/dist/packages/charts/src/cartesian/reference-lines.d.ts +25 -18
- package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +30 -25
- package/dist/packages/charts/src/cartesian/sparkline.d.ts +14 -2
- package/dist/packages/charts/src/cartesian/time-series-bands.d.ts +3 -2
- package/dist/packages/charts/src/cartesian/time-series-data.d.ts +12 -2
- package/dist/packages/charts/src/cartesian/time-series-line.d.ts +2 -2
- package/dist/packages/charts/src/cartesian/time-series-overlays.d.ts +6 -4
- package/dist/packages/charts/src/cartesian/time-series.d.ts +60 -36
- package/dist/packages/charts/src/cartesian/value-labels.d.ts +22 -0
- package/dist/packages/charts/src/categorical-values.d.ts +1 -1
- package/dist/packages/charts/src/cells/bar-cell.d.ts +13 -0
- package/dist/packages/charts/src/cells/cell-layout.d.ts +81 -0
- package/dist/packages/charts/src/cells/change-cell.d.ts +17 -0
- package/dist/packages/charts/src/cells/heat-cell.d.ts +19 -0
- package/dist/packages/charts/src/cells/index.d.ts +11 -0
- package/dist/packages/charts/src/cells/interval-cell.d.ts +16 -0
- package/dist/packages/charts/src/cells/spark-cell.d.ts +22 -0
- package/dist/packages/charts/src/chart-frame.d.ts +14 -7
- package/dist/packages/charts/src/chart-grid.d.ts +19 -0
- package/dist/packages/charts/src/chart-input.d.ts +1 -9
- package/dist/packages/charts/src/chart-link.d.ts +56 -0
- package/dist/packages/charts/src/chart.d.ts +0 -8
- package/dist/packages/charts/src/comparison/bullet-bar.d.ts +34 -0
- package/dist/packages/charts/src/comparison/comparison-plot.d.ts +54 -0
- package/dist/packages/charts/src/comparison/dot-plot.d.ts +41 -0
- package/dist/packages/charts/src/comparison/dumbbell-plot.d.ts +33 -0
- package/dist/packages/charts/src/comparison/index.d.ts +6 -0
- package/dist/packages/charts/src/distribution/box-plot.d.ts +40 -0
- package/dist/packages/charts/src/distribution/distribution-input.d.ts +5 -3
- package/dist/packages/charts/src/distribution/distribution-plot.d.ts +28 -161
- package/dist/packages/charts/src/distribution/ecdf.d.ts +16 -15
- package/dist/packages/charts/src/distribution/group-plot-input.d.ts +35 -0
- package/dist/packages/charts/src/distribution/group-plot-layout.d.ts +79 -0
- package/dist/packages/charts/src/distribution/group-plot.d.ts +73 -0
- package/dist/packages/charts/src/distribution/histogram.d.ts +16 -16
- package/dist/packages/charts/src/distribution/index.d.ts +11 -0
- package/dist/packages/charts/src/distribution/interval-plot.d.ts +16 -13
- package/dist/packages/charts/src/distribution/ranked-bars.d.ts +17 -14
- package/dist/packages/charts/src/distribution/ridgeline.d.ts +34 -0
- package/dist/packages/charts/src/distribution/strip-plot.d.ts +37 -0
- package/dist/packages/charts/src/distribution/violin-plot.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-format.d.ts +34 -0
- package/dist/packages/charts/src/figure/figure-frame.d.ts +47 -0
- package/dist/packages/charts/src/figure/figure-props.d.ts +54 -0
- package/dist/packages/charts/src/figure/tone-scope.d.ts +32 -0
- package/dist/packages/charts/src/graph/attribution-graph.d.ts +62 -0
- package/dist/packages/charts/src/graph/attribution-layout.d.ts +88 -0
- package/dist/packages/charts/src/graph/flow-diagram.d.ts +14 -15
- package/dist/packages/charts/src/graph/flow-layout.d.ts +4 -2
- package/dist/packages/charts/src/graph/graph-canvas.d.ts +33 -0
- package/dist/packages/charts/src/graph/index.d.ts +6 -2
- package/dist/packages/charts/src/graph/relation-graph.d.ts +24 -13
- package/dist/packages/charts/src/graph/tree-diagram.d.ts +41 -0
- package/dist/packages/charts/src/graph/tree-layout.d.ts +71 -0
- package/dist/packages/charts/src/hierarchy/area-mark.d.ts +17 -0
- package/dist/packages/charts/src/hierarchy/icicle.d.ts +35 -0
- package/dist/packages/charts/src/hierarchy/index.d.ts +2 -0
- package/dist/packages/charts/src/hierarchy/partition-layout.d.ts +25 -0
- package/dist/packages/charts/src/hierarchy/treemap-layout.d.ts +26 -0
- package/dist/packages/charts/src/hierarchy/treemap.d.ts +11 -9
- package/dist/packages/charts/src/image/attribution-legend.d.ts +13 -0
- package/dist/packages/charts/src/image/attribution-overlay.d.ts +50 -0
- package/dist/packages/charts/src/image/attribution-ramp.d.ts +16 -0
- package/dist/packages/charts/src/image/image-atlas.d.ts +37 -0
- package/dist/packages/charts/src/image/image-fill.d.ts +9 -0
- package/dist/packages/charts/src/image/image-grid.d.ts +26 -0
- package/dist/packages/charts/src/image/image-input.d.ts +27 -0
- package/dist/packages/charts/src/image/image-tile.d.ts +27 -0
- package/dist/packages/charts/src/image/index.d.ts +7 -0
- package/dist/packages/charts/src/index.d.ts +15 -1
- package/dist/packages/charts/src/matrix/attention-matrix.d.ts +41 -0
- package/dist/packages/charts/src/matrix/calendar-heatmap.d.ts +37 -0
- package/dist/packages/charts/src/matrix/color-legend.d.ts +9 -2
- package/dist/packages/charts/src/matrix/confusion-matrix.d.ts +36 -0
- package/dist/packages/charts/src/matrix/correlation-matrix.d.ts +34 -0
- package/dist/packages/charts/src/matrix/heatmap-scale.d.ts +8 -2
- package/dist/packages/charts/src/matrix/index.d.ts +14 -3
- package/dist/packages/charts/src/matrix/matrix-cells.d.ts +27 -3
- package/dist/packages/charts/src/matrix/matrix-figure.d.ts +50 -0
- package/dist/packages/charts/src/matrix/matrix-mark.d.ts +34 -0
- package/dist/packages/charts/src/matrix/matrix-presets.d.ts +20 -0
- package/dist/packages/charts/src/matrix/matrix-range.d.ts +45 -0
- package/dist/packages/charts/src/matrix/matrix-strip.d.ts +13 -14
- package/dist/packages/charts/src/matrix/matrix-types.d.ts +40 -0
- package/dist/packages/charts/src/matrix/matrix.d.ts +13 -11
- package/dist/packages/charts/src/matrix/token-heatmap.d.ts +16 -10
- package/dist/packages/charts/src/plot/contours.d.ts +45 -0
- package/dist/packages/charts/src/plot/index.d.ts +49 -0
- package/dist/packages/charts/src/plot/label-place.d.ts +35 -0
- package/dist/packages/charts/src/plot/locate.d.ts +18 -0
- package/dist/packages/charts/src/plot/path.d.ts +39 -0
- package/dist/packages/charts/src/plot/plot-axes.d.ts +20 -0
- package/dist/packages/charts/src/plot/plot-layout.d.ts +221 -0
- package/dist/packages/charts/src/plot/plot-marks.d.ts +124 -0
- package/dist/packages/charts/src/plot/plot-surface.d.ts +32 -0
- package/dist/packages/charts/src/plot/render/density-layer.d.ts +17 -0
- package/dist/packages/charts/src/plot/render/hit-index.d.ts +37 -0
- package/dist/packages/charts/src/plot/render/plot-viewport.d.ts +39 -0
- package/dist/packages/charts/src/plot/render/point-layer.d.ts +41 -0
- package/dist/packages/charts/src/plot/render/theme-colors.d.ts +15 -0
- package/dist/packages/charts/src/plot/scale.d.ts +48 -0
- package/dist/packages/charts/src/plot/ticks.d.ts +34 -0
- package/dist/packages/charts/src/plot-width.d.ts +3 -2
- package/dist/packages/charts/src/relationship/contour-plot.d.ts +61 -0
- package/dist/packages/charts/src/relationship/density-map.d.ts +45 -0
- package/dist/packages/charts/src/relationship/embedding-map.d.ts +75 -0
- package/dist/packages/charts/src/relationship/index.d.ts +11 -0
- package/dist/packages/charts/src/relationship/level-legend.d.ts +11 -0
- package/dist/packages/charts/src/relationship/measures.d.ts +85 -0
- package/dist/packages/charts/src/relationship/parallel-coordinates.d.ts +30 -0
- package/dist/packages/charts/src/relationship/range-controls.d.ts +20 -0
- package/dist/packages/charts/src/relationship/scatter-matrix.d.ts +20 -0
- package/dist/packages/charts/src/spec/chart-guide.d.ts +21 -0
- package/dist/packages/charts/src/spec/figure-registry.d.ts +44 -0
- package/dist/packages/charts/src/spec/figure-spec.d.ts +147 -0
- package/dist/packages/charts/src/spec/figure-text.d.ts +8 -0
- package/dist/packages/charts/src/spec/figure.d.ts +12 -0
- package/dist/packages/charts/src/spec/guide-data.d.ts +85 -0
- package/dist/packages/charts/src/spec/index.d.ts +10 -0
- package/dist/packages/charts/src/spec/validate-figure.d.ts +15 -0
- package/dist/packages/charts/src/text/index.d.ts +11 -0
- package/dist/packages/charts/src/text/token-examples.d.ts +42 -0
- package/dist/packages/charts/src/text/token-grid.d.ts +47 -0
- package/dist/packages/charts/src/text/token-links.d.ts +49 -0
- package/dist/packages/charts/src/text/token-predictions.d.ts +38 -0
- package/dist/packages/charts/src/text/token-scale.d.ts +20 -0
- package/dist/packages/charts/src/text/token-text.d.ts +39 -0
- package/dist/packages/charts/src/timeline/event-strip.d.ts +70 -0
- package/dist/packages/charts/src/timeline/index.d.ts +3 -1
- package/dist/packages/charts/src/timeline/waterfall.d.ts +24 -13
- package/dist/packages/charts/src/transforms/bins.d.ts +91 -0
- package/dist/packages/charts/src/transforms/density.d.ts +53 -0
- package/dist/packages/charts/src/transforms/fits.d.ts +50 -0
- package/dist/packages/charts/src/transforms/index.d.ts +19 -0
- package/dist/packages/charts/src/transforms/matrices.d.ts +49 -0
- package/dist/packages/charts/src/transforms/quantiles.d.ts +96 -0
- package/dist/packages/charts/src/transforms/ranks.d.ts +44 -0
- package/dist/packages/charts/src/transforms/runs.d.ts +47 -0
- package/dist/packages/charts/src/transforms/sampling.d.ts +75 -0
- package/dist/packages/charts/src/transforms/smoothing.d.ts +41 -0
- package/dist/packages/charts/src/transforms/values.d.ts +70 -0
- package/dist/packages/charts/src/trend/bump-chart.d.ts +33 -0
- package/dist/packages/charts/src/trend/column-figure.d.ts +38 -0
- package/dist/packages/charts/src/trend/column-positions.d.ts +21 -0
- package/dist/packages/charts/src/trend/curve-chart.d.ts +69 -0
- package/dist/packages/charts/src/trend/end-labels.d.ts +40 -0
- package/dist/packages/charts/src/trend/horizon-chart.d.ts +37 -0
- package/dist/packages/charts/src/trend/index.d.ts +10 -0
- package/dist/packages/charts/src/trend/line-locate.d.ts +21 -0
- package/dist/packages/charts/src/trend/runs-chart.d.ts +50 -0
- package/dist/packages/charts/src/trend/slope-chart.d.ts +35 -0
- package/dist/packages/kits/src/evaluation/evaluation-data.d.ts +31 -0
- package/dist/packages/kits/src/evaluation/index.d.ts +8 -0
- package/dist/packages/kits/src/evaluation/leaderboard-cells.d.ts +62 -0
- package/dist/packages/kits/src/evaluation/leaderboard.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/model-comparison.d.ts +59 -0
- package/dist/packages/kits/src/evaluation/score-breakdown.d.ts +33 -0
- package/dist/packages/kits/src/explainers/bound-value.d.ts +29 -0
- package/dist/packages/kits/src/explainers/figures.d.ts +31 -0
- package/dist/packages/kits/src/explainers/index.d.ts +8 -0
- package/dist/packages/kits/src/explainers/linked-target.d.ts +22 -0
- package/dist/packages/kits/src/explainers/story-steps.d.ts +46 -0
- package/dist/packages/kits/src/explainers/term.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/attention-head-grid.d.ts +56 -0
- package/dist/packages/kits/src/interpretability/attribution-workbench.d.ts +29 -0
- package/dist/packages/kits/src/interpretability/embedding-atlas.d.ts +41 -0
- package/dist/packages/kits/src/interpretability/feature-card.d.ts +33 -0
- package/dist/packages/kits/src/interpretability/feature-list.d.ts +51 -0
- package/dist/packages/kits/src/interpretability/feature-logits.d.ts +23 -0
- package/dist/packages/kits/src/interpretability/features.d.ts +70 -0
- package/dist/packages/kits/src/interpretability/index.d.ts +16 -0
- package/dist/packages/kits/src/interpretability/kit-styles.d.ts +118 -0
- package/dist/packages/kits/src/interpretability/logit-lens.d.ts +50 -0
- package/dist/packages/kits/src/interpretability/node-panel.d.ts +32 -0
- package/dist/packages/kits/src/interpretability/shared-link.d.ts +8 -0
- package/dist/packages/kits/src/interpretability/steering-panel.d.ts +52 -0
- package/dist/packages/kits/src/operations/budget-board.d.ts +49 -0
- package/dist/packages/kits/src/operations/incident-timeline.d.ts +30 -0
- package/dist/packages/kits/src/operations/index.d.ts +6 -0
- package/dist/packages/kits/src/operations/service-health.d.ts +66 -0
- package/dist/packages/kits/src/training/index.d.ts +8 -0
- package/dist/packages/kits/src/training/run-dashboard.d.ts +49 -0
- package/dist/packages/kits/src/training/run-legend.d.ts +21 -0
- package/dist/packages/kits/src/training/run-marker.d.ts +5 -0
- package/dist/packages/kits/src/training/run-state.d.ts +7 -0
- package/dist/packages/kits/src/training/run-table.d.ts +63 -0
- package/dist/packages/kits/src/training/runs-overview.d.ts +20 -0
- package/dist/packages/kits/src/training/runs.d.ts +34 -0
- package/dist/path-BglsXpnO.js +59 -0
- package/dist/plot-axes-DJkLW4wk.js +100 -0
- package/dist/plot-layout-BEuoOHbs.js +911 -0
- package/dist/plot-marks-A64v7aTw.js +226 -0
- package/dist/plot-surface-CJTIqtck.js +51 -0
- package/dist/plot-width-DcqtSgzb.js +124 -0
- package/dist/point-layer-C-EYETAt.js +655 -0
- package/dist/reference-lines-CWA8VeUR.js +82 -0
- package/dist/scale-C2xgZyZN.js +63 -0
- package/dist/slope-chart-DT22h_ym.js +1279 -0
- package/dist/{src-DVHlknB6.js → src-CExIrXPC.js} +169 -193
- package/dist/src-D5NXRJZe.js +2195 -0
- package/dist/src-DIS0YOj0.js +44 -0
- package/dist/styles2.css +453 -62
- package/dist/time-series-IB3CB93O.js +2668 -0
- package/dist/token-heatmap-C00DnoNO.js +1354 -0
- package/dist/token-predictions-Cxx29iDr.js +1093 -0
- package/dist/tone-scope-DKiSw-JR.js +32 -0
- package/dist/tree-diagram-DsckNKaW.js +1629 -0
- package/dist/treemap-9_DpLCW9.js +472 -0
- package/dist/values-963L6n1m.js +65 -0
- package/dist/violin-plot-BhPHKXsN.js +1291 -0
- package/dist/waterfall-CGksuTy5.js +576 -0
- package/package.json +57 -4
- package/recipes/allocation-report.tsx +15 -7
- package/skills/extend-elements/SKILL.md +60 -0
- package/skills/review-elements/SKILL.md +43 -1
- package/skills/upgrade-elements/SKILL.md +3 -1
- package/skills/upgrade-elements/references/releases.md +184 -0
- package/skills/use-elements/SKILL.md +19 -13
- package/skills/use-elements/references/charts.md +362 -41
- package/skills/use-elements/references/figures.md +173 -0
- package/skills/use-elements/references/kits.md +198 -0
- package/dist/categorical-values-BXi-rJuv.js +0 -74
- package/dist/chart-data-CIJVWCYt.js +0 -21
- package/dist/chart-frame-BaxKn_MB.js +0 -236
- package/dist/chart-input-Bm82_9Rd.js +0 -22
- package/dist/chart-theme-4zprJ3rW.js +0 -404
- package/dist/plot-width-v2c_rA20.js +0 -63
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Stack, Text } from '@mechane-ai/elements';
|
|
2
|
-
import
|
|
2
|
+
import { formatValue } from '@mechane-ai/elements/charts';
|
|
3
|
+
import type { ChartTone, ValueFormat } from '@mechane-ai/elements/charts';
|
|
3
4
|
import { BreakdownBar, BridgeChart } from '@mechane-ai/elements/charts/cartesian';
|
|
4
5
|
import type { BridgeStep, ChartReferenceLine } from '@mechane-ai/elements/charts/cartesian';
|
|
5
6
|
import { FlowDiagram } from '@mechane-ai/elements/charts/graph';
|
|
@@ -19,7 +20,10 @@ type AllocationProps = {
|
|
|
19
20
|
readonly remainderLabel: string;
|
|
20
21
|
readonly target?: ChartReferenceLine;
|
|
21
22
|
readonly explanation: 'bridge' | 'flow';
|
|
22
|
-
|
|
23
|
+
/** How every amount is written, such as `{ style: 'currency', currency: 'USD' }`. */
|
|
24
|
+
readonly valueFormat: ValueFormat;
|
|
25
|
+
/** The locale every amount is written in. */
|
|
26
|
+
readonly locale: string;
|
|
23
27
|
};
|
|
24
28
|
|
|
25
29
|
const REMAINDER_ID = 'remainder';
|
|
@@ -39,7 +43,8 @@ export function AllocationReport({
|
|
|
39
43
|
remainderLabel,
|
|
40
44
|
target,
|
|
41
45
|
explanation,
|
|
42
|
-
|
|
46
|
+
valueFormat,
|
|
47
|
+
locale,
|
|
43
48
|
}: AllocationProps) {
|
|
44
49
|
const remainder = total - commitments.reduce((sum, commitment) => sum + commitment.amount, 0);
|
|
45
50
|
const report = { summary: <Text>{headline}</Text> };
|
|
@@ -83,29 +88,32 @@ export function AllocationReport({
|
|
|
83
88
|
<PageContent>
|
|
84
89
|
<Stack>
|
|
85
90
|
<BreakdownBar
|
|
86
|
-
title={`${totalLabel}: ${formatValue(total)}`}
|
|
91
|
+
title={`${totalLabel}: ${formatValue({ value: total, locale, format: valueFormat })}`}
|
|
92
|
+
locale={locale}
|
|
87
93
|
items={[
|
|
88
94
|
...commitments.map(({ id, label, amount, tone }) => ({ id, label, value: amount, tone })),
|
|
89
95
|
{ id: REMAINDER_ID, label: remainderLabel, value: remainder, tone: REMAINDER_TONE },
|
|
90
96
|
]}
|
|
91
97
|
total={total}
|
|
92
|
-
|
|
98
|
+
valueFormat={valueFormat}
|
|
93
99
|
/>
|
|
94
100
|
{explanation === 'bridge' ? (
|
|
95
101
|
<BridgeChart
|
|
96
102
|
title={`From ${totalLabel.toLowerCase()} to ${remainderLabel.toLowerCase()}`}
|
|
103
|
+
locale={locale}
|
|
97
104
|
report={report}
|
|
98
105
|
steps={steps}
|
|
99
|
-
|
|
106
|
+
valueFormat={valueFormat}
|
|
100
107
|
referenceLines={target === undefined ? [] : [target]}
|
|
101
108
|
/>
|
|
102
109
|
) : (
|
|
103
110
|
<FlowDiagram
|
|
104
111
|
title={`Where ${totalLabel.toLowerCase()} goes`}
|
|
112
|
+
locale={locale}
|
|
105
113
|
report={report}
|
|
106
114
|
nodes={nodes}
|
|
107
115
|
links={links}
|
|
108
|
-
|
|
116
|
+
valueFormat={valueFormat}
|
|
109
117
|
/>
|
|
110
118
|
)}
|
|
111
119
|
</Stack>
|
|
@@ -100,3 +100,63 @@ Check a representative task in the family story with keyboard and the public `/a
|
|
|
100
100
|
once the control is disabled, its selection changes, or its data is loading. For sensitive controls also inspect
|
|
101
101
|
compound snapshots and action results for private values. Update the page recipe if the preferred consumer composition
|
|
102
102
|
changes.
|
|
103
|
+
|
|
104
|
+
## A chart
|
|
105
|
+
|
|
106
|
+
Read contract `workspaces/core/.contracts/140-ui-data-display/CONTRACT.md` and the chart guide
|
|
107
|
+
`workspaces/core/docs/ui-charts.md` first. Copy the structure of `packages/charts/src/trend/curve-chart.tsx` and its
|
|
108
|
+
story.
|
|
109
|
+
|
|
110
|
+
1. Choose the family by the reader's question. A chart that no family fits needs a new kernel part first, and only when
|
|
111
|
+
a named chart needs it. Add the part to `packages/charts/src/plot` or `figure`, keep the edit additive, and export it
|
|
112
|
+
from `plot/index.ts`, which is the public kernel entry `@mechane-ai/elements/charts/plot`.
|
|
113
|
+
2. Draw with the kernel only: `numericPlot` or `categoryPlot`, `PlotSurface`, `PlotAxes`, `PlotClip` and the marks
|
|
114
|
+
(`LineMark`, `AreaMark`, `BandMark`, `DotMark`, `BarMark`, `RuleMark`, `IntervalMark`, `LabelMark`, `SymbolMark`,
|
|
115
|
+
`RingMark`, `LinkMark`, `ConnectorMark`, `GuideMark`). Do not write a scale, a tick, an axis or a path again, and do
|
|
116
|
+
not restyle a mark. The marks carry the channel meanings.
|
|
117
|
+
3. Take `FigureProps`, plus `FigureSelectionProps` when a record can be selected. Name state the way the others do:
|
|
118
|
+
`selected` with `onSelectedChange`, `range` with `onRangeChange`. No `format*` function props: use `PlotAxis`,
|
|
119
|
+
`valueFormat` and `timeFormat`, and write text with `formatValue` and `formatTime`. `locale` is required. Height is a
|
|
120
|
+
`PlotHeight`.
|
|
121
|
+
4. Write ticks with `axisTicks` or `timeAxisTicks` and `tickTexts` from `plot`, and place labels with `freeLabelSpot`.
|
|
122
|
+
Give `FigureFrame` a `seriesLegend` for a legend that names things (above the plot) and a `scaleLegend` for a color
|
|
123
|
+
or size scale (below it). Resolve tones with `useTones()` and never hard-code a color. Spread `useLinkedInspection()`
|
|
124
|
+
into `Chart` when item ids mean the same thing in other charts.
|
|
125
|
+
5. Validate first and return `FigureInvalid` with the reason. Never repair, clamp, reorder or drop. Refuse input above a
|
|
126
|
+
`<chart>Limits` object with a message that names it. Handle `status`, empty input and `coverage`.
|
|
127
|
+
6. Keep every prop except callbacks and `ReactNode` slots plain JSON, then register the chart so a figure spec can name
|
|
128
|
+
it. In `packages/charts/src/spec/figure-spec.ts`, add its props to `FigureChartProps`, and a new family to
|
|
129
|
+
`FigureFamily`. In `spec/figure-registry.tsx`, add an entry with the component, its family, its required props with
|
|
130
|
+
their JSON kinds and `isSelectable`. Render the chart from its spec and compare it with the direct call.
|
|
131
|
+
7. Keep statistics out. If the chart needs a bin, quantile, density or fit, add a named function to
|
|
132
|
+
`packages/charts/src/transforms` with a `describe...` footnote, and take the result as props.
|
|
133
|
+
8. Add a guide entry in `spec/chart-guide.tsx`: the `question` the chart answers in a reader's words, `use` for when to
|
|
134
|
+
choose it, `avoid` for the chart that is better otherwise, and a small valid `example` spec. Build the data with the
|
|
135
|
+
helpers in `spec/guide-data.ts` where they fit. The types require one entry for every registered chart. The entry
|
|
136
|
+
feeds the wall. Write the chart into the chooser tables of the package `README.md`, `docs/ui-charts.md` and the
|
|
137
|
+
`use-elements` charts reference, which are the guide written out.
|
|
138
|
+
9. Write the stories: `Charts/<ChartName>` with a default, an interactive story and a `States` story, in `en-US` with
|
|
139
|
+
deterministic data.
|
|
140
|
+
10. Check the wall. `Charts/Wall`, in `spec/wall.stories.tsx`, draws every registered chart from its guide example
|
|
141
|
+
through `Figure`, so the new chart appears in its family story and in `All` with no further edit. A new family also
|
|
142
|
+
needs a title and a place in the wall's list. Review it in light and dark themes and at phone width. Inspect a
|
|
143
|
+
record by pointer, touch and keyboard. Compare the frame, axes, ticks, legend, readout, footnote and each state with
|
|
144
|
+
its neighbors.
|
|
145
|
+
11. Add the chart to the family `index.ts`, with its types and its limits. Run `mise run fix` and `mise run check` from
|
|
146
|
+
the factory root.
|
|
147
|
+
|
|
148
|
+
## A kit component
|
|
149
|
+
|
|
150
|
+
A kit under `packages/kits/src/<kit>` composes charts and collections for a domain question. It adds no marks, scales,
|
|
151
|
+
axes or colors. If you want to draw an SVG mark, use or request a chart instead.
|
|
152
|
+
|
|
153
|
+
- Follow contract `workspaces/core/.contracts/141-ui-domain-kits/CONTRACT.md`. Import other families only through their
|
|
154
|
+
public `index.ts` entries.
|
|
155
|
+
- Take `locale` and declared formats. Take the state the application owns as a value with a change callback. Take the
|
|
156
|
+
words as one partial `labels` prop with English defaults.
|
|
157
|
+
- Use one `ToneScope` over the things shown in more than one figure, and one `ChartLink` or `ChartGrid` where figures
|
|
158
|
+
share ids. Use the table cells from `charts/cells` inside `DataTable` columns.
|
|
159
|
+
- Handle `status`, empty, partial and invalid input. Refuse bad input with a sentence.
|
|
160
|
+
- Compute no statistic. The application supplies means, intervals, ranks and deltas.
|
|
161
|
+
- Write one stories file titled `Kits/<Kit name>` with a story per component, one page that composes them and a `States`
|
|
162
|
+
story. Export the components from the kit's `index.ts` and add the entry to `package.json`.
|
|
@@ -53,7 +53,8 @@ Check 360 pixels wide, a tablet width and a wide desktop.
|
|
|
53
53
|
- Unknown is not zero. A missing value shows as unavailable, and a chart draws a gap.
|
|
54
54
|
- Try the longest real name, a large number, an empty optional field and a single row.
|
|
55
55
|
- Dates and numbers carry a unit, and come from a formatter with an explicit locale and time zone.
|
|
56
|
-
- An icon-only button has an accessible name. A chart's title says what was measured and for which period.
|
|
56
|
+
- An icon-only button has an accessible name. A chart's title says what was measured and for which period. Review a
|
|
57
|
+
chart further in section 8.
|
|
57
58
|
|
|
58
59
|
## 6. What an agent sees
|
|
59
60
|
|
|
@@ -72,5 +73,46 @@ When the app enables the bridge from `/agent`, print `agent.snapshot()` on the p
|
|
|
72
73
|
- Each value has one owner: controlled with its callback, or an uncontrolled default.
|
|
73
74
|
- The server authorizes every read and mutation. The UI's disabled state is not the permission check.
|
|
74
75
|
|
|
76
|
+
## 8. Figures
|
|
77
|
+
|
|
78
|
+
Run this pass on every page with a chart, a kit component or a figure spec. Look at the figure, then read its footnote
|
|
79
|
+
and its readout.
|
|
80
|
+
|
|
81
|
+
- **After a chart change, look at the wall first.** When you changed a chart in the Elements source, open `Charts/Wall`
|
|
82
|
+
in the Elements Storybook before the page. It is one page that draws every registered chart from its `chartGuide`
|
|
83
|
+
example through `Figure`, with one story per family and an `All` story. Compare the changed chart's frame, axes,
|
|
84
|
+
ticks, legend, readout, footnote and states with its neighbors, in the light and dark themes and at phone width. A
|
|
85
|
+
chart that looks different from the others there is wrong before any page uses it. The wall is part of the Elements
|
|
86
|
+
Storybook, so an app with only the installed package has no wall. There, compare the figure with its `example` in
|
|
87
|
+
`chartGuide`.
|
|
88
|
+
- **One hue per thing.** The same model, run or series has the same hue in every figure, table and sentence on the page.
|
|
89
|
+
A `ToneScope` names the ids. A hue that changes between figures means an id differs or a scope is missing.
|
|
90
|
+
- **Linked figures answer together.** Inside a `ChartLink`, hover a row or a point and check that the same id is marked
|
|
91
|
+
in each other figure. A figure that stays still has a different id for the same thing.
|
|
92
|
+
- **A spec from JSON validates.** For a figure drawn from a spec, `validateFigureSpec` returns `ok`, or the page shows
|
|
93
|
+
its `message`. An invalid spec in the figure itself shows the same reason in place of the chart.
|
|
94
|
+
- **Declared formats and units.** Every number comes from a declared format with a `locale`, and every axis title names
|
|
95
|
+
its unit. A time format names its time zone. No formatter function appears in the props.
|
|
96
|
+
- **Bars start at zero.** A bar, histogram or area that starts elsewhere misleads. Dots and lines may use a fitted
|
|
97
|
+
range.
|
|
98
|
+
- **Log axes are named.** A log or symlog axis says so in its title. A log axis holds no zero or negative value.
|
|
99
|
+
- **Missing is hollow.** A missing value is a hollow mark, a gap or "Unavailable", never zero. A zero is drawn as zero.
|
|
100
|
+
- **Partial data states its coverage.** A sample or a window shows how much it draws, such as "1,000 of 48,000 points",
|
|
101
|
+
beside the title.
|
|
102
|
+
- **Source and transforms in the footnote.** The footnote names where the data came from and each step the app applied:
|
|
103
|
+
smoothing, binning, quantile method, sample.
|
|
104
|
+
- **One meaning per channel.** A dashed stroke is modelled, a pale band is uncertainty, gray is context, and size has a
|
|
105
|
+
legend. No second value axis on one plot.
|
|
106
|
+
- **Reachable by keyboard.** The plot is one Tab stop. Arrow keys inspect, Enter selects, and Escape closes the readout.
|
|
107
|
+
A range or a pan has a keyboard path.
|
|
108
|
+
- **Readout text is present.** The inspected record states its exact values in text, and the exact-value table lists
|
|
109
|
+
every record.
|
|
110
|
+
- **Limits are respected.** The page stays inside each chart's `<chart>Limits` and names its window or aggregate. A
|
|
111
|
+
chart that refuses input shows the reason, not a blank.
|
|
112
|
+
- **States match.** Loading holds the final geometry, empty says why, and invalid names the problem.
|
|
113
|
+
- **Dark theme and phone width.** In the dark theme, marks and labels keep their contrast. At 360 pixels, labels do not
|
|
114
|
+
overlap, the readout stays in view, and the plot does not scroll the page sideways.
|
|
115
|
+
- **No statistic in the chart.** The app computed every quantile, density, bin and fit, with a named transform.
|
|
116
|
+
|
|
75
117
|
Not covered by this review: a real screen reader, a physical touch device and right-to-left text. Say so in the report
|
|
76
118
|
unless you ran them.
|
|
@@ -27,7 +27,9 @@ is large.
|
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
5. Search the app for what the type check cannot see: agent component names in an `allow` function, role or Tab-order
|
|
30
|
-
assumptions in tests, and CSS that targets Elements internals.
|
|
30
|
+
assumptions in tests, and CSS that targets Elements internals. After 0.47, also search for `MAX_` limit constants,
|
|
31
|
+
`selection={` and `ChartSelection`, `@visx` imports your app relied on Elements to install, chart `height` numbers,
|
|
32
|
+
and `format` function props or missing `locale` props passed through spread objects.
|
|
31
33
|
6. Review each changed page with the `review-elements` skill. Behavior changes show in the browser, not in types.
|
|
32
34
|
|
|
33
35
|
Do not pin an old behavior back with a wrapper or a patch. Move the call site to the new API, and report anything the
|
|
@@ -2,6 +2,190 @@
|
|
|
2
2
|
|
|
3
3
|
Newest first. Each section lists what an application must change, then what it may adopt.
|
|
4
4
|
|
|
5
|
+
## 0.47
|
|
6
|
+
|
|
7
|
+
Elements has a data display system. Every chart is built from one plot kernel and takes the same figure props. This
|
|
8
|
+
release breaks the API of every existing chart. There are no aliases: change each call site.
|
|
9
|
+
|
|
10
|
+
Elements no longer depends on `@visx/hierarchy`, `@visx/scale` or `@visx/shape`, and no chart uses them. If your app
|
|
11
|
+
imports `@visx/*` itself, add it to your own `package.json`: it no longer arrives through Elements. No export moved from
|
|
12
|
+
one entry to another in this release. The names that left an entry are listed under "Removed exports".
|
|
13
|
+
|
|
14
|
+
### Change
|
|
15
|
+
|
|
16
|
+
- **`locale` is required on every chart.** A number or a date is written from a declared format and the figure's
|
|
17
|
+
`locale`, so a server and a browser render alike. Pass a BCP 47 tag such as `"en-US"`.
|
|
18
|
+
- **Formatter functions are gone.** `formatValue`, `formatX`, `formatY`, `formatTick`, `formatTimestamp`,
|
|
19
|
+
`formatChange`, `formatCount`, `formatProbability` and `formatOffset` are replaced by declared formats: `Intl` options
|
|
20
|
+
as a `ValueFormat` or a `TimeFormat` (which names its `timeZone`). A function is still accepted where no option can
|
|
21
|
+
write the text. Ticks use the compact form of the format unless you set `tickFormat`.
|
|
22
|
+
|
|
23
|
+
```tsx
|
|
24
|
+
// Before
|
|
25
|
+
<BarChart formatValue={(value) => `${value.toFixed(1)} ms`} formatTick={(value) => `${value}`} />
|
|
26
|
+
// After
|
|
27
|
+
<BarChart locale="en-US" valueFormat={{ style: 'unit', unit: 'millisecond', maximumFractionDigits: 1 }} />
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **Selection is `selected` and `onSelectedChange`.** The `selection={{ selectedId, onSelect }}` object is removed, and
|
|
31
|
+
so is the `ChartSelection` type.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
// Before
|
|
35
|
+
<Histogram selection={{ selectedId, onSelect: (id) => setSelectedId(id) }} />
|
|
36
|
+
// After
|
|
37
|
+
<Histogram selected={selectedId} onSelectedChange={(id) => setSelectedId(id)} />
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
- **Heights are named.** `height` takes `'compact'` (160 px), `'regular'` (260 px) or `'tall'` (380 px), not a number.
|
|
41
|
+
`RelationGraph` `width` and `height` stay numbers: they are the extent of your node positions.
|
|
42
|
+
- **Limits are objects.** Every `MAX_*` export is removed, as the table under "Removed exports" shows.
|
|
43
|
+
- **`description` is a string** on every chart. It was a `ReactNode` on the time-series charts, `BarChart` and
|
|
44
|
+
`FlowDiagram`.
|
|
45
|
+
- **Records take an optional `tone`.** An absent tone comes from the enclosing `ToneScope`, then from the record's
|
|
46
|
+
place.
|
|
47
|
+
- **Removed exports.** Each name below left the entry shown and has the replacement beside it.
|
|
48
|
+
|
|
49
|
+
| Entry | Removed | Use instead |
|
|
50
|
+
| ------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
|
|
51
|
+
| `/charts` | type `ChartSelection` | `selected` and `onSelectedChange` props, and type `FigureSelectionProps` |
|
|
52
|
+
| `/charts/cartesian` | types `ScatterRangeSelection` and `TimeRangeSelection` | `range`, `onRangeChange` and `rangeStep` props |
|
|
53
|
+
| `/charts/cartesian` | `MAX_SCATTER_POINTS` | `scatterLimits.points` |
|
|
54
|
+
| `/charts/matrix` | `MAX_MATRIX_CELLS` | `matrixLimits.cells` |
|
|
55
|
+
| `/charts/matrix` | `MAX_HEATMAP_TOKENS` | `tokenHeatmapLimits.tokens` |
|
|
56
|
+
| `/charts/graph` | `MAX_FLOW_NODES` and `MAX_FLOW_LINKS` | `flowLimits.nodes` and `flowLimits.links` |
|
|
57
|
+
| `/charts/graph` | `MAX_RELATION_NODES`, `MAX_RELATION_EDGES`, `MAX_RELATION_GROUPS`, `MAX_RELATION_DIMENSION` | `relationGraphLimits.nodes`, `.edges`, `.groups` and `.dimension` |
|
|
58
|
+
|
|
59
|
+
`ChartInputError` and `colorTone` were helpers inside the package and were never exported from an entry, so an app
|
|
60
|
+
could not import them. They are gone. A chart now shows an invalid input with `FigureInvalid`, which `/charts/plot`
|
|
61
|
+
exports for a chart you build yourself, and takes a hue from `ToneScope` or a record's `tone`.
|
|
62
|
+
|
|
63
|
+
#### Migration by chart
|
|
64
|
+
|
|
65
|
+
| Chart | Before | After |
|
|
66
|
+
| --------------------------------------------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
67
|
+
| `LineChart`, `AreaChart` | `formatTimestamp`, `formatValue`, `formatTick`, `rangeSelection={{ value, onChange, step }}` | `timeFormat`, `valueFormat`, `tickFormat`, `range`, `onRangeChange`, `rangeStep`, and `locale` |
|
|
68
|
+
| `SmallMultiples` | `formatTimestamp` on the group, `formatValue` and `formatTick` per panel | `timeFormat` and `locale` on the group, `valueFormat` and `tickFormat` per panel. Panels take no `locale`. |
|
|
69
|
+
| `Sparkline` | No change | No change |
|
|
70
|
+
| `BarChart` | `domain` required, `formatValue`, `formatTick`, `highlightedSeriesId`, `selection`, `height` number | `domain` optional (fitted from zero), `valueFormat`, `tickFormat`, `highlighted`, `selected`, `onSelectedChange`, `height` name |
|
|
71
|
+
| `BreakdownBar`, `Treemap` | `formatValue`, `selection` | `valueFormat`, `selected`, `onSelectedChange`. `Treemap` `height` is a name. |
|
|
72
|
+
| `BridgeChart` | `formatValue`, `formatChange`, `formatTick`, `selection` | `valueFormat`, `changeFormat`, `tickFormat`, `selected`, `onSelectedChange` |
|
|
73
|
+
| `ScatterPlot` | `xDomain`, `xLabel`, `formatX`, `yDomain`, `yLabel`, `formatY`, `rangeSelection` | `x` and `y` as `PlotAxis`, `range`, `onRangeChange`, `rangeStep={{ x, y }}`. A point `tone` is optional. |
|
|
74
|
+
| `Histogram` | `domain`, `valueLabel`, `formatValue`, `maximumCount`, `countLabel`, `formatCount` | `value` and `count` as `PlotAxis`. The count domain starts at zero and is fitted when absent. |
|
|
75
|
+
| `ECDF` | `domain`, `valueLabel`, `formatValue`, `probabilityLabel`, `formatProbability` | `value` and `probability` as `PlotAxis`. The probability domain is `[0, 1]` when absent. |
|
|
76
|
+
| `IntervalPlot`, `RankedBars` | `domain`, `valueLabel`, `formatValue` | `value` as `PlotAxis`. `intervalLabel` stays on `IntervalPlot`. |
|
|
77
|
+
| `Matrix`, `TokenHeatmap` | `formatValue`, `selection`, required `description` and `emptyLabel` | `valueFormat`, `selected`, `onSelectedChange`. `description` and `emptyLabel` are optional. |
|
|
78
|
+
| `ColorLegend` | `formatValue` | `valueFormat` and `locale` |
|
|
79
|
+
| `RelationGraph` | `selection`, required `description` and `emptyLabel`, node `tone` required | `selected`, `onSelectedChange`. `description` and `emptyLabel` optional, node `tone` optional. |
|
|
80
|
+
| `FlowDiagram` | `formatValue`, `selection`, `height` number | `valueFormat`, `selected`, `onSelectedChange`, `height` name |
|
|
81
|
+
| `Waterfall` | `label`, `selectedId`, `onSelect`, `formatOffset`, `emptyLabel` required | `title`, `selected`, `onSelectedChange`, `offsetFormat`, `locale`. `emptyLabel` is optional. Item `tone` is optional. |
|
|
82
|
+
| `TimeSeriesChartPlaceholder`, `BarChartPlaceholder` | Frame props without `locale` | Same frame props and `locale`. `BarChartPlaceholder` `height` is a name. |
|
|
83
|
+
| `SmallMultiplesPlaceholder` | `charts`, `height` number | `charts`, `locale`, `height` name |
|
|
84
|
+
|
|
85
|
+
The most common calls, before and after:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
// BarChart
|
|
89
|
+
<BarChart domain={[0, 100]} formatValue={format} highlightedSeriesId={hovered} selection={{ selectedId, onSelect }} height={200} />
|
|
90
|
+
<BarChart locale="en-US" domain={[0, 100]} valueFormat={{ maximumFractionDigits: 1 }} highlighted={hovered} selected={selectedId} onSelectedChange={onSelect} height="regular" />
|
|
91
|
+
|
|
92
|
+
// LineChart (SmallMultiples panels take valueFormat and tickFormat, the group takes timeFormat)
|
|
93
|
+
<LineChart formatTimestamp={formatTime} formatValue={format} rangeSelection={{ value: range, onChange: setRange, step: 60_000 }} />
|
|
94
|
+
<LineChart locale="en-US" timeFormat={{ timeZone: 'UTC', timeStyle: 'short' }} valueFormat={{ maximumFractionDigits: 1 }} range={range} onRangeChange={setRange} rangeStep={60_000} />
|
|
95
|
+
|
|
96
|
+
// ScatterPlot
|
|
97
|
+
<ScatterPlot xDomain={[0, 1]} xLabel="Cost" formatX={usd} yDomain={[0, 1]} yLabel="Quality" formatY={percent} rangeSelection={{ value: range, onChange: setRange, xStep: 0.01, yStep: 0.01, locale: 'en-US' }} />
|
|
98
|
+
<ScatterPlot locale="en-US" x={{ label: 'Cost (USD)', domain: [0, 1], format: { style: 'currency', currency: 'USD' } }} y={{ label: 'Quality', domain: [0, 1], format: { style: 'percent' } }} range={range} onRangeChange={setRange} rangeStep={{ x: 0.01, y: 0.01 }} />
|
|
99
|
+
|
|
100
|
+
// Histogram
|
|
101
|
+
<Histogram domain={[0, 500]} valueLabel="Latency (ms)" formatValue={ms} maximumCount={400} countLabel="Requests" formatCount={count} />
|
|
102
|
+
<Histogram locale="en-US" value={{ label: 'Latency (ms)', domain: [0, 500], format: { maximumFractionDigits: 0 } }} count={{ label: 'Requests', domain: [0, 400], format: { maximumFractionDigits: 0 } }} />
|
|
103
|
+
|
|
104
|
+
// ECDF
|
|
105
|
+
<ECDF domain={[0, 500]} valueLabel="Latency (ms)" formatValue={ms} probabilityLabel="Share" formatProbability={percent} />
|
|
106
|
+
<ECDF locale="en-US" value={{ label: 'Latency (ms)', domain: [0, 500], format: { maximumFractionDigits: 0 } }} probability={{ label: 'Share of requests', format: { style: 'percent' } }} />
|
|
107
|
+
|
|
108
|
+
// IntervalPlot and RankedBars
|
|
109
|
+
<RankedBars domain={[0, 1]} valueLabel="Share of errors" formatValue={percent} />
|
|
110
|
+
<RankedBars locale="en-US" value={{ label: 'Share of errors', domain: [0, 1], format: { style: 'percent' } }} />
|
|
111
|
+
|
|
112
|
+
// Matrix and TokenHeatmap
|
|
113
|
+
<Matrix valueLabel="Weight" formatValue={weight} selection={{ selectedId, onSelect }} />
|
|
114
|
+
<Matrix locale="en-US" valueLabel="Weight" valueFormat={{ maximumFractionDigits: 2 }} selected={selectedId} onSelectedChange={onSelect} />
|
|
115
|
+
|
|
116
|
+
// Treemap, BreakdownBar and FlowDiagram
|
|
117
|
+
<Treemap formatValue={bytes} selection={{ selectedId, onSelect }} height={180} />
|
|
118
|
+
<Treemap locale="en-US" valueFormat={{ notation: 'compact' }} selected={selectedId} onSelectedChange={onSelect} height="compact" />
|
|
119
|
+
|
|
120
|
+
// BridgeChart
|
|
121
|
+
<BridgeChart formatValue={usd} formatChange={signedUsd} formatTick={compactUsd} />
|
|
122
|
+
<BridgeChart locale="en-US" valueFormat={{ style: 'currency', currency: 'USD' }} changeFormat={{ style: 'currency', currency: 'USD', signDisplay: 'exceptZero' }} />
|
|
123
|
+
|
|
124
|
+
// Waterfall
|
|
125
|
+
<Waterfall label="Request" selectedId={id} onSelect={setId} formatOffset={ms} />
|
|
126
|
+
<Waterfall title="Request" locale="en-US" selected={id} onSelectedChange={setId} offsetFormat={{ style: 'unit', unit: 'millisecond' }} />
|
|
127
|
+
|
|
128
|
+
// RelationGraph (width and height stay numbers)
|
|
129
|
+
<RelationGraph title="Dependencies" selection={{ selectedId, onSelect }} width={640} height={360} />
|
|
130
|
+
<RelationGraph locale="en-US" title="Dependencies" selected={selectedId} onSelectedChange={onSelect} width={640} height={360} />
|
|
131
|
+
|
|
132
|
+
// Sparkline: no change
|
|
133
|
+
<Sparkline title="Latency" summary="Steady" unit="ms" timestampUnit="seconds" series={series} valueDomain={[0, 300]} />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- **`BridgeChart` `changeFormat`** defaults to `valueFormat` with `signDisplay: 'exceptZero'` when `valueFormat` is
|
|
137
|
+
options. When it is a function, the plus and minus prefix logic is unchanged.
|
|
138
|
+
- **A `timeFormat` function receives milliseconds**, whichever `timestampUnit` you declare. `timestampUnit` still tells
|
|
139
|
+
the chart whether your timestamps are seconds or milliseconds.
|
|
140
|
+
|
|
141
|
+
### Behavior to check
|
|
142
|
+
|
|
143
|
+
- **Default heights changed.** Time-series charts, `BarChart` and `Treemap` default to `compact` (160 px), where they
|
|
144
|
+
were 180, 200 and 180 px. `BridgeChart` defaults to `regular` (260 px), where it was 240 px. Pass `height="regular"`
|
|
145
|
+
to keep a taller plot.
|
|
146
|
+
- **States are shared.** Loading shows `FigureLoading` at the chart's height. The time-series charts, `SmallMultiples`
|
|
147
|
+
and `BarChart` keep their placeholders. Empty and invalid input use `FigureEmpty` and `FigureInvalid`.
|
|
148
|
+
- **A partial figure says so.** A chart given `coverage` states how much it draws beside its title, and the footnote
|
|
149
|
+
names `source` and `transforms`.
|
|
150
|
+
- **Invalid input is refused with a reason.** Axis domains that exclude data, a log axis with zero, and unordered
|
|
151
|
+
records show an invalid figure. Nothing is clamped or reordered.
|
|
152
|
+
- **Tick text and legends changed.** Tick text gains precision until neighbours differ, an axis longer than 120 px shows
|
|
153
|
+
at least three ticks, and an axis that draws its title leaves a `style: 'unit'` out of its ticks. A legend that names
|
|
154
|
+
things sits above the plot, and a color or size scale below it.
|
|
155
|
+
- **`IntervalPlot` and `RankedBars` write no value beside each row.** The readout and the exact-value table carry the
|
|
156
|
+
exact values. Both take `height` for the room per row.
|
|
157
|
+
- **A hollow mark means missing.** A bin, cell or mark with no value is drawn hollow and read as "Unavailable".
|
|
158
|
+
- **Hues come from a scope.** A record with no `tone` takes its hue from the enclosing `ToneScope`, then from its place
|
|
159
|
+
in the figure. Pin `tone` where color carries identity.
|
|
160
|
+
|
|
161
|
+
### Adopt
|
|
162
|
+
|
|
163
|
+
- **More charts.** 50 charts are registered in all. `/charts/trend` (`CurveChart`, `RunsChart`, `SlopeChart`,
|
|
164
|
+
`BumpChart`, `HorizonChart`), `/charts/comparison` (`DotPlot`, `DumbbellPlot`, `BulletBar`), `/charts/relationship`
|
|
165
|
+
(`ContourPlot`, `ScatterMatrix`, `ParallelCoordinates`, `EmbeddingMap`, `DensityMap`), `/charts/text`, `/charts/image`
|
|
166
|
+
and `/charts/cells`. `BoxPlot`, `ViolinPlot`, `StripPlot` and `Ridgeline` join `/charts/distribution`.
|
|
167
|
+
`ConfusionMatrix`, `CorrelationMatrix`, `AttentionMatrix` and `CalendarHeatmap` join `/charts/matrix`.
|
|
168
|
+
`AttributionGraph` and `TreeDiagram` join `/charts/graph`. `Icicle` joins `/charts/hierarchy` and `EventStrip` joins
|
|
169
|
+
`/charts/timeline`.
|
|
170
|
+
- **Newer props.** `valueLabel` titles the value axis of `LineChart`, `AreaChart`, `SmallMultiples` panels, `BarChart`
|
|
171
|
+
and `BridgeChart`. `Sparkline` takes `layout`, matrices take `cellValues`, and `Waterfall` takes `description`,
|
|
172
|
+
`actions`, `source` and `transforms`.
|
|
173
|
+
- **Linked figures.** `ToneScope` gives each id one hue in every figure. `ChartLink` and `ChartGrid` share one
|
|
174
|
+
inspection between figures, so hovering a row in one figure marks the same id in the others. `CurveChart` and
|
|
175
|
+
`DotPlot` take `highlighted` and follow the link when it is left out. `useScopedTone` and `useChartLinkControl` let
|
|
176
|
+
prose and diagrams join in. `CurveChart` takes `labels` of `'legend'`, `'inline'` or `'none'`.
|
|
177
|
+
- **Statistics as functions.** `/charts/transforms` has bins, densities, fits, quantiles, ranks, smoothing and sampling,
|
|
178
|
+
each with a `describe...` note for the footnote. `bin2d` counts points for `DensityMap`, and its rows count up from
|
|
179
|
+
the lowest `y`.
|
|
180
|
+
- **Figure specs.** `/charts/figure` has `FigureSpec`, `validateFigureSpec`, `Figure`, `describeFigure`, `figureCharts`
|
|
181
|
+
and `chartGuide`, so an agent or a server can describe a figure as JSON, check it, draw it and read it back as text.
|
|
182
|
+
`chartGuide` has one entry per registered chart with what it shows and when to use it.
|
|
183
|
+
- **The plot kernel.** `/charts/plot` exports the scales, ticks, axes, marks and states that every chart uses, so you
|
|
184
|
+
can build a chart the library lacks.
|
|
185
|
+
- **Kits.** `/kits/explainers`, `/kits/training`, `/kits/operations`, `/kits/evaluation` and `/kits/interpretability`
|
|
186
|
+
compose charts into pages.
|
|
187
|
+
- **Large point maps.** `EmbeddingMap` draws up to 100,000 points on canvas and 1,000,000 with WebGL.
|
|
188
|
+
|
|
5
189
|
## 0.46
|
|
6
190
|
|
|
7
191
|
Every interactive component now runs on a UI SDK primitive. `@base-ui/react`, `@tanstack/react-virtual` and
|
|
@@ -50,19 +50,21 @@ persistence and every asynchronous operation.
|
|
|
50
50
|
|
|
51
51
|
## Pick the component
|
|
52
52
|
|
|
53
|
-
| The page needs | Use
|
|
54
|
-
| ------------------------------------------------- |
|
|
55
|
-
| An app frame, a page, sections, a record page | `AppShell`, `PageLayout`, `PageSection`, `RecordPage`
|
|
56
|
-
| Records compared across columns, search, filters | `DataTable` with a `query`
|
|
57
|
-
| A selected record's fields beside its list | `Inspector`, `Details`
|
|
58
|
-
| Fields, choices, dates, files, a save | `Field`, the `/forms` controls, `FormActions`, `ConfirmButton`
|
|
59
|
-
| A trend, comparison, distribution or relationship | One chart from a `/charts/*` entry
|
|
60
|
-
| A
|
|
61
|
-
| A
|
|
62
|
-
|
|
|
63
|
-
| A
|
|
64
|
-
|
|
|
65
|
-
| A
|
|
53
|
+
| The page needs | Use | Read |
|
|
54
|
+
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------------------------------------------- |
|
|
55
|
+
| An app frame, a page, sections, a record page | `AppShell`, `PageLayout`, `PageSection`, `RecordPage` | [workspace](references/workspace.md) |
|
|
56
|
+
| Records compared across columns, search, filters | `DataTable` with a `query` | [collections](references/collections.md) |
|
|
57
|
+
| A selected record's fields beside its list | `Inspector`, `Details` | [collections](references/collections.md) |
|
|
58
|
+
| Fields, choices, dates, files, a save | `Field`, the `/forms` controls, `FormActions`, `ConfirmButton` | [forms](references/forms.md) |
|
|
59
|
+
| A trend, comparison, distribution or relationship | One chart from a `/charts/*` entry | [charts](references/charts.md) |
|
|
60
|
+
| A figure an agent or a server writes as JSON | `Figure`, `validateFigureSpec`, `describeFigure` and `chartGuide` from `/charts/figure` | [figures](references/figures.md) |
|
|
61
|
+
| A run, evaluation, service, feature or explainer | A kit from `/kits/training`, `/kits/evaluation`, `/kits/operations`, `/kits/explainers`, `/kits/interpretability` | [kits](references/kits.md) |
|
|
62
|
+
| A first read, a refresh, an empty or failed read | `AsyncRegion`, `LoadingScope`, `EmptyState`, `Notice` | [reports](references/reports.md) |
|
|
63
|
+
| A command menu, a decision, an anchored panel | `Menu`, `AlertDialog`, `Dialog`, `Drawer`, `Popover`, `Tooltip` | the catalog |
|
|
64
|
+
| Route destinations or panels inside one view | `PageNavigation` for links, `Tabs` or `ContentTabs` for panels | [workspace](references/workspace.md) |
|
|
65
|
+
| A transcript, a prompt, tool activity, approvals | `Conversation`, `Message`, `PromptInput`, `Approval` | [conversations](references/conversations.md) |
|
|
66
|
+
| Markdown, source, a diff, a file tree, a log | `/content/markdown`, `/content/code`, `/content/diff`, `/content/tree`, `/content` | the catalog |
|
|
67
|
+
| A model or browser agent that reads and acts | `createAgent` and `registerTools` from `/agent` | [agent access](references/agent.md) |
|
|
66
68
|
|
|
67
69
|
## Start from a recipe
|
|
68
70
|
|
|
@@ -71,6 +73,10 @@ persistence and every asynchronous operation.
|
|
|
71
73
|
need to return to the same results.
|
|
72
74
|
- **Sectioned report.** Mount the shell around the router outlet. Put each heading and its body in a sibling
|
|
73
75
|
`PageSection`. The shell and sections own the sticky geometry.
|
|
76
|
+
- **Linked figures.** Give each model, run or series one id. Wrap the figures in `ToneScope` and `ChartLink` so a thing
|
|
77
|
+
keeps one hue and inspecting it in one figure marks it in the others.
|
|
78
|
+
- **A chart you cannot name.** Read `chartGuide` from `/charts/figure`, or the chooser in
|
|
79
|
+
[charts](references/charts.md). It lists all 50 registered charts by family, with when to use each one.
|
|
74
80
|
- **Allocation report.** Show how one total divides with a parts strip above one explanatory chart. Give each part one
|
|
75
81
|
tone everywhere.
|
|
76
82
|
- **Tabbed workspace.** Put page-wide navigation and its actions in the page navigation slot. Use links for route
|