@stealthscale/component-charts 0.2.2 → 0.2.3
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/dist/cyclonedx/bom.json +1 -1
- package/dist/index.js +1 -14710
- package/dist/pages/area-chart/area-chart.js +1151 -0
- package/dist/pages/area-chart/area-chart.props.js +3 -0
- package/dist/pages/bar-chart/bar-chart.js +990 -0
- package/dist/pages/bar-chart/bar-chart.props.js +3 -0
- package/dist/pages/box-plot/box-plot.js +1585 -0
- package/dist/pages/box-plot/box-plot.props.js +3 -0
- package/dist/pages/bubble-chart/bubble-chart.js +938 -0
- package/dist/pages/bubble-chart/bubble-chart.props.js +3 -0
- package/dist/pages/burndown-chart/burndown-chart.js +805 -0
- package/dist/pages/burndown-chart/burndown-chart.props.js +3 -0
- package/dist/pages/candlestick-chart/candlestick-chart.js +853 -0
- package/dist/pages/candlestick-chart/candlestick-chart.props.js +3 -0
- package/dist/pages/chart/chart.js +1190 -0
- package/dist/pages/chart/chart.props.js +3 -0
- package/dist/pages/chord-diagram/chord-diagram.js +891 -0
- package/dist/pages/chord-diagram/chord-diagram.props.js +3 -0
- package/dist/pages/combo-chart/combo-chart.js +873 -0
- package/dist/pages/combo-chart/combo-chart.props.js +3 -0
- package/dist/pages/distribution-chart/distribution-chart.js +1066 -0
- package/dist/pages/distribution-chart/distribution-chart.props.js +3 -0
- package/dist/pages/donut-chart/donut-chart.js +726 -0
- package/dist/pages/donut-chart/donut-chart.props.js +3 -0
- package/dist/pages/funnel-chart/funnel-chart.js +1094 -0
- package/dist/pages/funnel-chart/funnel-chart.props.js +3 -0
- package/dist/pages/gauge-chart/gauge-chart.js +767 -0
- package/dist/pages/gauge-chart/gauge-chart.props.js +3 -0
- package/dist/pages/heatmap/heatmap.js +1967 -0
- package/dist/pages/heatmap/heatmap.props.js +3 -0
- package/dist/pages/histogram-chart/histogram-chart.js +768 -0
- package/dist/pages/histogram-chart/histogram-chart.props.js +3 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.js +701 -0
- package/dist/pages/horizontal-bar-chart/horizontal-bar-chart.props.js +3 -0
- package/dist/pages/line-chart/line-chart.js +1882 -0
- package/dist/pages/line-chart/line-chart.props.js +3 -0
- package/dist/pages/pages.json +393 -0
- package/dist/pages/pareto-chart/pareto-chart.js +669 -0
- package/dist/pages/pareto-chart/pareto-chart.props.js +3 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.js +662 -0
- package/dist/pages/percent-stacked-bar/percent-stacked-bar.props.js +3 -0
- package/dist/pages/pie-chart/pie-chart.js +1007 -0
- package/dist/pages/pie-chart/pie-chart.props.js +3 -0
- package/dist/pages/polar-area-chart/polar-area-chart.js +812 -0
- package/dist/pages/polar-area-chart/polar-area-chart.props.js +3 -0
- package/dist/pages/radar-chart/radar-chart.js +1101 -0
- package/dist/pages/radar-chart/radar-chart.props.js +3 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.js +766 -0
- package/dist/pages/radial-bar-chart/radial-bar-chart.props.js +3 -0
- package/dist/pages/range-chart/range-chart.js +914 -0
- package/dist/pages/range-chart/range-chart.props.js +3 -0
- package/dist/pages/regression-overlay/regression-overlay.js +494 -0
- package/dist/pages/regression-overlay/regression-overlay.props.js +3 -0
- package/dist/pages/sankey-chart/sankey-chart.js +700 -0
- package/dist/pages/sankey-chart/sankey-chart.props.js +3 -0
- package/dist/pages/scatter-plot/scatter-plot.js +1248 -0
- package/dist/pages/scatter-plot/scatter-plot.props.js +3 -0
- package/dist/pages/sparkbar/sparkbar.js +629 -0
- package/dist/pages/sparkbar/sparkbar.props.js +3 -0
- package/dist/pages/sparkline/sparkline.js +960 -0
- package/dist/pages/sparkline/sparkline.props.js +3 -0
- package/dist/pages/spend-5xQ76WSj.js +185 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.js +912 -0
- package/dist/pages/stacked-area-chart/stacked-area-chart.props.js +3 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.js +722 -0
- package/dist/pages/stacked-bar-chart/stacked-bar-chart.props.js +3 -0
- package/dist/pages/step-line-chart/step-line-chart.js +573 -0
- package/dist/pages/step-line-chart/step-line-chart.props.js +3 -0
- package/dist/pages/stream-graph/stream-graph.js +1662 -0
- package/dist/pages/stream-graph/stream-graph.props.js +3 -0
- package/dist/pages/sunburst-chart/sunburst-chart.js +1051 -0
- package/dist/pages/sunburst-chart/sunburst-chart.props.js +3 -0
- package/dist/pages/timeline-chart/timeline-chart.js +1124 -0
- package/dist/pages/timeline-chart/timeline-chart.props.js +3 -0
- package/dist/pages/treemap-chart/treemap-chart.js +904 -0
- package/dist/pages/treemap-chart/treemap-chart.props.js +3 -0
- package/dist/pages/violin-plot/violin-plot.js +1303 -0
- package/dist/pages/violin-plot/violin-plot.props.js +3 -0
- package/dist/pages/visitors-oFFVcbIZ.js +248 -0
- package/dist/pages/waterfall-chart/waterfall-chart.js +1195 -0
- package/dist/pages/waterfall-chart/waterfall-chart.props.js +3 -0
- package/dist/shared-DVZJ2nST.js +14711 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/area-chart.json +56 -0
- package/locales/en/specimen/bar-chart.json +56 -0
- package/locales/en/specimen/box-plot.json +65 -0
- package/locales/en/specimen/bubble-chart.json +47 -0
- package/locales/en/specimen/burndown-chart.json +46 -0
- package/locales/en/specimen/candlestick-chart.json +42 -0
- package/locales/en/specimen/chart.json +53 -0
- package/locales/en/specimen/chord-diagram.json +69 -0
- package/locales/en/specimen/combo-chart.json +41 -0
- package/locales/en/specimen/distribution-chart.json +47 -0
- package/locales/en/specimen/donut-chart.json +63 -0
- package/locales/en/specimen/funnel-chart.json +84 -0
- package/locales/en/specimen/gauge-chart.json +68 -0
- package/locales/en/specimen/heatmap.json +187 -0
- package/locales/en/specimen/histogram-chart.json +48 -0
- package/locales/en/specimen/horizontal-bar-chart.json +54 -0
- package/locales/en/specimen/line-chart.json +106 -0
- package/locales/en/specimen/pareto-chart.json +43 -0
- package/locales/en/specimen/percent-stacked-bar.json +37 -0
- package/locales/en/specimen/pie-chart.json +80 -0
- package/locales/en/specimen/polar-area-chart.json +90 -0
- package/locales/en/specimen/radar-chart.json +82 -0
- package/locales/en/specimen/radial-bar-chart.json +62 -0
- package/locales/en/specimen/range-chart.json +42 -0
- package/locales/en/specimen/regression-overlay.json +36 -0
- package/locales/en/specimen/sankey-chart.json +89 -0
- package/locales/en/specimen/scatter-plot.json +88 -0
- package/locales/en/specimen/sparkbar.json +51 -0
- package/locales/en/specimen/sparkline.json +70 -0
- package/locales/en/specimen/stacked-area-chart.json +44 -0
- package/locales/en/specimen/stacked-bar-chart.json +34 -0
- package/locales/en/specimen/step-line-chart.json +33 -0
- package/locales/en/specimen/stream-graph.json +54 -0
- package/locales/en/specimen/sunburst-chart.json +110 -0
- package/locales/en/specimen/timeline-chart.json +77 -0
- package/locales/en/specimen/treemap-chart.json +107 -0
- package/locales/en/specimen/violin-plot.json +54 -0
- package/locales/en/specimen/waterfall-chart.json +71 -0
- package/package.json +8 -7
- /package/dist/{recipe-BbGw00ut.js → recipes-BbGw00ut.js} +0 -0
|
@@ -0,0 +1,1882 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { Dt as Crosshair, Mt as colorOf, N as LineChart$1, Z as retentionSeries, bt as alignPeriods } from "../../shared-DVZJ2nST.js";
|
|
3
|
+
import { c } from "react/compiler-runtime";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ReferenceLine } from "recharts";
|
|
7
|
+
import { Room, specimen, useWords } from "@stealthscale/specimen";
|
|
8
|
+
import { EyeIcon, RotateCcwIcon } from "lucide-react";
|
|
9
|
+
import { Button } from "@stealthscale/component-actions";
|
|
10
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
11
|
+
import { Text as Text$1 } from "@stealthscale/component-typography";
|
|
12
|
+
//#region src/line-chart/examples/anomalies.example.tsx
|
|
13
|
+
var anomalies_example_exports = /* @__PURE__ */ __exportAll({
|
|
14
|
+
Anomalies: () => Anomalies,
|
|
15
|
+
source: () => source$12
|
|
16
|
+
});
|
|
17
|
+
const DAYS$7 = [
|
|
18
|
+
1180,
|
|
19
|
+
1215,
|
|
20
|
+
1240,
|
|
21
|
+
1198,
|
|
22
|
+
312,
|
|
23
|
+
1170,
|
|
24
|
+
1225,
|
|
25
|
+
1260,
|
|
26
|
+
1244,
|
|
27
|
+
1290,
|
|
28
|
+
1410,
|
|
29
|
+
1265,
|
|
30
|
+
1250,
|
|
31
|
+
1238
|
|
32
|
+
].map((orders, index) => ({
|
|
33
|
+
day: `2026-09-${String(index + 14)}`,
|
|
34
|
+
orders
|
|
35
|
+
}));
|
|
36
|
+
function Anomalies() {
|
|
37
|
+
const $ = c(25);
|
|
38
|
+
const { t } = useWords("line-chart");
|
|
39
|
+
let t0;
|
|
40
|
+
if ($[0] !== t) {
|
|
41
|
+
t0 = t("anomalies.outage");
|
|
42
|
+
$[0] = t;
|
|
43
|
+
$[1] = t0;
|
|
44
|
+
} else t0 = $[1];
|
|
45
|
+
let t1;
|
|
46
|
+
if ($[2] !== t0) {
|
|
47
|
+
t1 = {
|
|
48
|
+
at: "2026-09-18",
|
|
49
|
+
color: "error",
|
|
50
|
+
key: "outage",
|
|
51
|
+
label: t0,
|
|
52
|
+
value: 312
|
|
53
|
+
};
|
|
54
|
+
$[2] = t0;
|
|
55
|
+
$[3] = t1;
|
|
56
|
+
} else t1 = $[3];
|
|
57
|
+
let t2;
|
|
58
|
+
if ($[4] !== t) {
|
|
59
|
+
t2 = t("anomalies.duplicates");
|
|
60
|
+
$[4] = t;
|
|
61
|
+
$[5] = t2;
|
|
62
|
+
} else t2 = $[5];
|
|
63
|
+
let t3;
|
|
64
|
+
if ($[6] !== t2) {
|
|
65
|
+
t3 = {
|
|
66
|
+
at: "2026-09-24",
|
|
67
|
+
color: "warning",
|
|
68
|
+
key: "duplicates",
|
|
69
|
+
label: t2,
|
|
70
|
+
value: 1410
|
|
71
|
+
};
|
|
72
|
+
$[6] = t2;
|
|
73
|
+
$[7] = t3;
|
|
74
|
+
} else t3 = $[7];
|
|
75
|
+
let t4;
|
|
76
|
+
if ($[8] !== t1 || $[9] !== t3) {
|
|
77
|
+
t4 = [t1, t3];
|
|
78
|
+
$[8] = t1;
|
|
79
|
+
$[9] = t3;
|
|
80
|
+
$[10] = t4;
|
|
81
|
+
} else t4 = $[10];
|
|
82
|
+
let t5;
|
|
83
|
+
if ($[11] !== t) {
|
|
84
|
+
t5 = t("anomalies.caption");
|
|
85
|
+
$[11] = t;
|
|
86
|
+
$[12] = t5;
|
|
87
|
+
} else t5 = $[12];
|
|
88
|
+
let t6;
|
|
89
|
+
if ($[13] !== t) {
|
|
90
|
+
t6 = t("anomalies.label");
|
|
91
|
+
$[13] = t;
|
|
92
|
+
$[14] = t6;
|
|
93
|
+
} else t6 = $[14];
|
|
94
|
+
let t7;
|
|
95
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
96
|
+
t7 = {
|
|
97
|
+
day: "numeric",
|
|
98
|
+
month: "short",
|
|
99
|
+
timeZone: "UTC"
|
|
100
|
+
};
|
|
101
|
+
$[15] = t7;
|
|
102
|
+
} else t7 = $[15];
|
|
103
|
+
let t8;
|
|
104
|
+
if ($[16] !== t) {
|
|
105
|
+
t8 = t("anomalies.orders");
|
|
106
|
+
$[16] = t;
|
|
107
|
+
$[17] = t8;
|
|
108
|
+
} else t8 = $[17];
|
|
109
|
+
let t9;
|
|
110
|
+
if ($[18] !== t8) {
|
|
111
|
+
t9 = [{
|
|
112
|
+
key: "orders",
|
|
113
|
+
label: t8
|
|
114
|
+
}];
|
|
115
|
+
$[18] = t8;
|
|
116
|
+
$[19] = t9;
|
|
117
|
+
} else t9 = $[19];
|
|
118
|
+
let t10;
|
|
119
|
+
if ($[20] !== t4 || $[21] !== t5 || $[22] !== t6 || $[23] !== t9) {
|
|
120
|
+
t10 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
121
|
+
annotations: t4,
|
|
122
|
+
caption: t5,
|
|
123
|
+
categoryKey: "day",
|
|
124
|
+
curve: "linear",
|
|
125
|
+
data: DAYS$7,
|
|
126
|
+
label: t6,
|
|
127
|
+
labelOptions: t7,
|
|
128
|
+
series: t9
|
|
129
|
+
});
|
|
130
|
+
$[20] = t4;
|
|
131
|
+
$[21] = t5;
|
|
132
|
+
$[22] = t6;
|
|
133
|
+
$[23] = t9;
|
|
134
|
+
$[24] = t10;
|
|
135
|
+
} else t10 = $[24];
|
|
136
|
+
return t10;
|
|
137
|
+
}
|
|
138
|
+
const source$12 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n 1180, 1215, 1240, 1198, 312, 1170, 1225, 1260, 1244, 1290, 1410, 1265, 1250, 1238,\n].map((orders, index) => ({ day: `2026-09-${String(index + 14)}`, orders }));\n\nexport function Anomalies(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n annotations={[\n {\n at: \"2026-09-18\",\n color: \"error\",\n key: \"outage\",\n label: t(\"anomalies.outage\"),\n value: 312,\n },\n {\n at: \"2026-09-24\",\n color: \"warning\",\n key: \"duplicates\",\n label: t(\"anomalies.duplicates\"),\n value: 1410,\n },\n ]}\n caption={t(\"anomalies.caption\")}\n categoryKey=\"day\"\n curve=\"linear\"\n data={DAYS}\n label={t(\"anomalies.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n series={[{ key: \"orders\", label: t(\"anomalies.orders\") }]}\n />\n );\n}\n";
|
|
139
|
+
//#endregion
|
|
140
|
+
//#region src/line-chart/examples/budget.example.tsx
|
|
141
|
+
var budget_example_exports = /* @__PURE__ */ __exportAll({
|
|
142
|
+
Budget: () => Budget,
|
|
143
|
+
source: () => source$11
|
|
144
|
+
});
|
|
145
|
+
const DAYS$6 = [
|
|
146
|
+
{
|
|
147
|
+
day: "2026-09-21",
|
|
148
|
+
spend: 980
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
day: "2026-09-22",
|
|
152
|
+
spend: 1340
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
day: "2026-09-23",
|
|
156
|
+
spend: 1290
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
day: "2026-09-24",
|
|
160
|
+
spend: 1110
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
day: "2026-09-25",
|
|
164
|
+
spend: 1050
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
day: "2026-09-26",
|
|
168
|
+
spend: 720
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
day: "2026-09-27",
|
|
172
|
+
spend: 690
|
|
173
|
+
}
|
|
174
|
+
];
|
|
175
|
+
function Budget() {
|
|
176
|
+
const $ = c(22);
|
|
177
|
+
const { t } = useWords("line-chart");
|
|
178
|
+
let t0;
|
|
179
|
+
if ($[0] !== t) {
|
|
180
|
+
t0 = t("budget.caption");
|
|
181
|
+
$[0] = t;
|
|
182
|
+
$[1] = t0;
|
|
183
|
+
} else t0 = $[1];
|
|
184
|
+
let t1;
|
|
185
|
+
if ($[2] !== t) {
|
|
186
|
+
t1 = t("budget.label");
|
|
187
|
+
$[2] = t;
|
|
188
|
+
$[3] = t1;
|
|
189
|
+
} else t1 = $[3];
|
|
190
|
+
let t2;
|
|
191
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
192
|
+
t2 = {
|
|
193
|
+
timeZone: "UTC",
|
|
194
|
+
weekday: "short"
|
|
195
|
+
};
|
|
196
|
+
$[4] = t2;
|
|
197
|
+
} else t2 = $[4];
|
|
198
|
+
let t3;
|
|
199
|
+
if ($[5] !== t) {
|
|
200
|
+
t3 = t("budget.spend");
|
|
201
|
+
$[5] = t;
|
|
202
|
+
$[6] = t3;
|
|
203
|
+
} else t3 = $[6];
|
|
204
|
+
let t4;
|
|
205
|
+
if ($[7] !== t3) {
|
|
206
|
+
t4 = [{
|
|
207
|
+
key: "spend",
|
|
208
|
+
label: t3
|
|
209
|
+
}];
|
|
210
|
+
$[7] = t3;
|
|
211
|
+
$[8] = t4;
|
|
212
|
+
} else t4 = $[8];
|
|
213
|
+
let t5;
|
|
214
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
215
|
+
t5 = {
|
|
216
|
+
currency: "EUR",
|
|
217
|
+
maximumFractionDigits: 0,
|
|
218
|
+
style: "currency"
|
|
219
|
+
};
|
|
220
|
+
$[9] = t5;
|
|
221
|
+
} else t5 = $[9];
|
|
222
|
+
let t6;
|
|
223
|
+
if ($[10] !== t) {
|
|
224
|
+
t6 = t("budget.budget");
|
|
225
|
+
$[10] = t;
|
|
226
|
+
$[11] = t6;
|
|
227
|
+
} else t6 = $[11];
|
|
228
|
+
let t7;
|
|
229
|
+
if ($[12] !== t6) {
|
|
230
|
+
t7 = {
|
|
231
|
+
position: "insideTopRight",
|
|
232
|
+
value: t6
|
|
233
|
+
};
|
|
234
|
+
$[12] = t6;
|
|
235
|
+
$[13] = t7;
|
|
236
|
+
} else t7 = $[13];
|
|
237
|
+
let t8;
|
|
238
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
239
|
+
t8 = colorOf("error");
|
|
240
|
+
$[14] = t8;
|
|
241
|
+
} else t8 = $[14];
|
|
242
|
+
let t9;
|
|
243
|
+
if ($[15] !== t7) {
|
|
244
|
+
t9 = /* @__PURE__ */ jsx(ReferenceLine, {
|
|
245
|
+
label: t7,
|
|
246
|
+
stroke: t8,
|
|
247
|
+
strokeDasharray: "6 4",
|
|
248
|
+
y: 1200
|
|
249
|
+
});
|
|
250
|
+
$[15] = t7;
|
|
251
|
+
$[16] = t9;
|
|
252
|
+
} else t9 = $[16];
|
|
253
|
+
let t10;
|
|
254
|
+
if ($[17] !== t0 || $[18] !== t1 || $[19] !== t4 || $[20] !== t9) {
|
|
255
|
+
t10 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
256
|
+
caption: t0,
|
|
257
|
+
categoryKey: "day",
|
|
258
|
+
data: DAYS$6,
|
|
259
|
+
label: t1,
|
|
260
|
+
labelOptions: t2,
|
|
261
|
+
series: t4,
|
|
262
|
+
valueOptions: t5,
|
|
263
|
+
children: t9
|
|
264
|
+
});
|
|
265
|
+
$[17] = t0;
|
|
266
|
+
$[18] = t1;
|
|
267
|
+
$[19] = t4;
|
|
268
|
+
$[20] = t9;
|
|
269
|
+
$[21] = t10;
|
|
270
|
+
} else t10 = $[21];
|
|
271
|
+
return t10;
|
|
272
|
+
}
|
|
273
|
+
const source$11 = "import { type ReactElement } from \"react\";\n\nimport { ReferenceLine } from \"recharts\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart, LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n { day: \"2026-09-21\", spend: 980 },\n { day: \"2026-09-22\", spend: 1340 },\n { day: \"2026-09-23\", spend: 1290 },\n { day: \"2026-09-24\", spend: 1110 },\n { day: \"2026-09-25\", spend: 1050 },\n { day: \"2026-09-26\", spend: 720 },\n { day: \"2026-09-27\", spend: 690 },\n];\n\nexport function Budget(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"budget.caption\")}\n categoryKey=\"day\"\n data={DAYS}\n label={t(\"budget.label\")}\n labelOptions={{ timeZone: \"UTC\", weekday: \"short\" }}\n series={[{ key: \"spend\", label: t(\"budget.spend\") }]}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n >\n <ReferenceLine\n label={{ position: \"insideTopRight\", value: t(\"budget.budget\") }}\n stroke={Chart.colorOf(\"error\")}\n strokeDasharray=\"6 4\"\n y={1200}\n />\n </LineChart>\n );\n}\n";
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/line-chart/examples/comparison.example.tsx
|
|
276
|
+
var comparison_example_exports = /* @__PURE__ */ __exportAll({
|
|
277
|
+
Comparison: () => Comparison,
|
|
278
|
+
source: () => source$10
|
|
279
|
+
});
|
|
280
|
+
const THIS_WEEK = [
|
|
281
|
+
18200,
|
|
282
|
+
21400,
|
|
283
|
+
20100,
|
|
284
|
+
24800,
|
|
285
|
+
26300,
|
|
286
|
+
15900,
|
|
287
|
+
14700
|
|
288
|
+
].map((revenue, index) => ({
|
|
289
|
+
day: `2026-09-${String(index + 21)}`,
|
|
290
|
+
revenue
|
|
291
|
+
}));
|
|
292
|
+
const LAST_WEEK = [
|
|
293
|
+
16900,
|
|
294
|
+
19800,
|
|
295
|
+
20600,
|
|
296
|
+
22100,
|
|
297
|
+
24300,
|
|
298
|
+
16400,
|
|
299
|
+
13200
|
|
300
|
+
].map((revenue, index) => ({
|
|
301
|
+
day: `2026-09-${String(index + 14)}`,
|
|
302
|
+
revenue
|
|
303
|
+
}));
|
|
304
|
+
const DAYS$5 = alignPeriods(THIS_WEEK, LAST_WEEK, {
|
|
305
|
+
categoryKey: "day",
|
|
306
|
+
keys: ["revenue"]
|
|
307
|
+
});
|
|
308
|
+
function Comparison() {
|
|
309
|
+
const $ = c(24);
|
|
310
|
+
const { t } = useWords("line-chart");
|
|
311
|
+
let t0;
|
|
312
|
+
if ($[0] !== t) {
|
|
313
|
+
t0 = t("comparison.caption");
|
|
314
|
+
$[0] = t;
|
|
315
|
+
$[1] = t0;
|
|
316
|
+
} else t0 = $[1];
|
|
317
|
+
let t1;
|
|
318
|
+
if ($[2] !== t) {
|
|
319
|
+
t1 = t("revenue.label");
|
|
320
|
+
$[2] = t;
|
|
321
|
+
$[3] = t1;
|
|
322
|
+
} else t1 = $[3];
|
|
323
|
+
let t2;
|
|
324
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
325
|
+
t2 = {
|
|
326
|
+
timeZone: "UTC",
|
|
327
|
+
weekday: "short"
|
|
328
|
+
};
|
|
329
|
+
$[4] = t2;
|
|
330
|
+
} else t2 = $[4];
|
|
331
|
+
let t3;
|
|
332
|
+
if ($[5] !== t) {
|
|
333
|
+
t3 = t("comparison.weeks");
|
|
334
|
+
$[5] = t;
|
|
335
|
+
$[6] = t3;
|
|
336
|
+
} else t3 = $[6];
|
|
337
|
+
let t4;
|
|
338
|
+
if ($[7] !== t) {
|
|
339
|
+
t4 = t("comparison.current");
|
|
340
|
+
$[7] = t;
|
|
341
|
+
$[8] = t4;
|
|
342
|
+
} else t4 = $[8];
|
|
343
|
+
let t5;
|
|
344
|
+
if ($[9] !== t4) {
|
|
345
|
+
t5 = {
|
|
346
|
+
key: "revenue",
|
|
347
|
+
label: t4
|
|
348
|
+
};
|
|
349
|
+
$[9] = t4;
|
|
350
|
+
$[10] = t5;
|
|
351
|
+
} else t5 = $[10];
|
|
352
|
+
let t6;
|
|
353
|
+
if ($[11] !== t) {
|
|
354
|
+
t6 = t("comparison.previous");
|
|
355
|
+
$[11] = t;
|
|
356
|
+
$[12] = t6;
|
|
357
|
+
} else t6 = $[12];
|
|
358
|
+
let t7;
|
|
359
|
+
if ($[13] !== t6) {
|
|
360
|
+
t7 = {
|
|
361
|
+
key: "revenuePrevious",
|
|
362
|
+
label: t6,
|
|
363
|
+
previousOf: "revenue"
|
|
364
|
+
};
|
|
365
|
+
$[13] = t6;
|
|
366
|
+
$[14] = t7;
|
|
367
|
+
} else t7 = $[14];
|
|
368
|
+
let t8;
|
|
369
|
+
if ($[15] !== t5 || $[16] !== t7) {
|
|
370
|
+
t8 = [t5, t7];
|
|
371
|
+
$[15] = t5;
|
|
372
|
+
$[16] = t7;
|
|
373
|
+
$[17] = t8;
|
|
374
|
+
} else t8 = $[17];
|
|
375
|
+
let t9;
|
|
376
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
377
|
+
t9 = {
|
|
378
|
+
currency: "EUR",
|
|
379
|
+
maximumFractionDigits: 0,
|
|
380
|
+
style: "currency"
|
|
381
|
+
};
|
|
382
|
+
$[18] = t9;
|
|
383
|
+
} else t9 = $[18];
|
|
384
|
+
let t10;
|
|
385
|
+
if ($[19] !== t0 || $[20] !== t1 || $[21] !== t3 || $[22] !== t8) {
|
|
386
|
+
t10 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
387
|
+
caption: t0,
|
|
388
|
+
categoryKey: "day",
|
|
389
|
+
data: DAYS$5,
|
|
390
|
+
defaultIndex: 4,
|
|
391
|
+
label: t1,
|
|
392
|
+
labelOptions: t2,
|
|
393
|
+
legendLabel: t3,
|
|
394
|
+
series: t8,
|
|
395
|
+
valueOptions: t9
|
|
396
|
+
});
|
|
397
|
+
$[19] = t0;
|
|
398
|
+
$[20] = t1;
|
|
399
|
+
$[21] = t3;
|
|
400
|
+
$[22] = t8;
|
|
401
|
+
$[23] = t10;
|
|
402
|
+
} else t10 = $[23];
|
|
403
|
+
return t10;
|
|
404
|
+
}
|
|
405
|
+
const source$10 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart, alignPeriods } from \"@stealthscale/component-charts\";\n\nconst THIS_WEEK = [18_200, 21_400, 20_100, 24_800, 26_300, 15_900, 14_700].map(\n (revenue, index) => ({ day: `2026-09-${String(index + 21)}`, revenue }),\n);\n\nconst LAST_WEEK = [16_900, 19_800, 20_600, 22_100, 24_300, 16_400, 13_200].map(\n (revenue, index) => ({ day: `2026-09-${String(index + 14)}`, revenue }),\n);\n\nconst DAYS = alignPeriods(THIS_WEEK, LAST_WEEK, { categoryKey: \"day\", keys: [\"revenue\"] });\n\nexport function Comparison(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"comparison.caption\")}\n categoryKey=\"day\"\n data={DAYS}\n defaultIndex={4}\n label={t(\"revenue.label\")}\n labelOptions={{ timeZone: \"UTC\", weekday: \"short\" }}\n legendLabel={t(\"comparison.weeks\")}\n series={[\n { key: \"revenue\", label: t(\"comparison.current\") },\n { key: \"revenuePrevious\", label: t(\"comparison.previous\"), previousOf: \"revenue\" },\n ]}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/line-chart/examples/controlled.example.tsx
|
|
408
|
+
var controlled_example_exports = /* @__PURE__ */ __exportAll({
|
|
409
|
+
Controlled: () => Controlled,
|
|
410
|
+
source: () => source$9
|
|
411
|
+
});
|
|
412
|
+
const HOURS$3 = [
|
|
413
|
+
[92, 180],
|
|
414
|
+
[95, 190],
|
|
415
|
+
[101, 210],
|
|
416
|
+
[118, 260],
|
|
417
|
+
[142, 340],
|
|
418
|
+
[155, 390],
|
|
419
|
+
[131, 310],
|
|
420
|
+
[112, 240],
|
|
421
|
+
[104, 205],
|
|
422
|
+
[99, 195]
|
|
423
|
+
].map(([p50, p95], index) => ({
|
|
424
|
+
hour: `2026-09-28T${String(index + 8).padStart(2, "0")}:00:00Z`,
|
|
425
|
+
p50,
|
|
426
|
+
p95,
|
|
427
|
+
target: 300
|
|
428
|
+
}));
|
|
429
|
+
const KEYS = [
|
|
430
|
+
"p50",
|
|
431
|
+
"p95",
|
|
432
|
+
"target"
|
|
433
|
+
];
|
|
434
|
+
function Controlled() {
|
|
435
|
+
const $ = c(48);
|
|
436
|
+
const { t } = useWords("line-chart");
|
|
437
|
+
let t0;
|
|
438
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
439
|
+
t0 = ["p50"];
|
|
440
|
+
$[0] = t0;
|
|
441
|
+
} else t0 = $[0];
|
|
442
|
+
const [hidden, setHidden] = useState(t0);
|
|
443
|
+
let t1;
|
|
444
|
+
if ($[1] !== t) {
|
|
445
|
+
t1 = t("latency.caption");
|
|
446
|
+
$[1] = t;
|
|
447
|
+
$[2] = t1;
|
|
448
|
+
} else t1 = $[2];
|
|
449
|
+
let t2;
|
|
450
|
+
if ($[3] !== t) {
|
|
451
|
+
t2 = t("latency.label");
|
|
452
|
+
$[3] = t;
|
|
453
|
+
$[4] = t2;
|
|
454
|
+
} else t2 = $[4];
|
|
455
|
+
let t3;
|
|
456
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
457
|
+
t3 = {
|
|
458
|
+
hour: "2-digit",
|
|
459
|
+
hourCycle: "h23",
|
|
460
|
+
minute: "2-digit",
|
|
461
|
+
timeZone: "UTC"
|
|
462
|
+
};
|
|
463
|
+
$[5] = t3;
|
|
464
|
+
} else t3 = $[5];
|
|
465
|
+
let t4;
|
|
466
|
+
if ($[6] !== t) {
|
|
467
|
+
t4 = t("series");
|
|
468
|
+
$[6] = t;
|
|
469
|
+
$[7] = t4;
|
|
470
|
+
} else t4 = $[7];
|
|
471
|
+
let t5;
|
|
472
|
+
if ($[8] !== t) {
|
|
473
|
+
t5 = t("latency.p50");
|
|
474
|
+
$[8] = t;
|
|
475
|
+
$[9] = t5;
|
|
476
|
+
} else t5 = $[9];
|
|
477
|
+
let t6;
|
|
478
|
+
if ($[10] !== t5) {
|
|
479
|
+
t6 = {
|
|
480
|
+
key: "p50",
|
|
481
|
+
label: t5
|
|
482
|
+
};
|
|
483
|
+
$[10] = t5;
|
|
484
|
+
$[11] = t6;
|
|
485
|
+
} else t6 = $[11];
|
|
486
|
+
let t7;
|
|
487
|
+
if ($[12] !== t) {
|
|
488
|
+
t7 = t("latency.p95");
|
|
489
|
+
$[12] = t;
|
|
490
|
+
$[13] = t7;
|
|
491
|
+
} else t7 = $[13];
|
|
492
|
+
let t8;
|
|
493
|
+
if ($[14] !== t7) {
|
|
494
|
+
t8 = {
|
|
495
|
+
key: "p95",
|
|
496
|
+
label: t7
|
|
497
|
+
};
|
|
498
|
+
$[14] = t7;
|
|
499
|
+
$[15] = t8;
|
|
500
|
+
} else t8 = $[15];
|
|
501
|
+
let t9;
|
|
502
|
+
if ($[16] !== t) {
|
|
503
|
+
t9 = t("latency.target");
|
|
504
|
+
$[16] = t;
|
|
505
|
+
$[17] = t9;
|
|
506
|
+
} else t9 = $[17];
|
|
507
|
+
let t10;
|
|
508
|
+
if ($[18] !== t9) {
|
|
509
|
+
t10 = {
|
|
510
|
+
color: "error",
|
|
511
|
+
dashed: true,
|
|
512
|
+
key: "target",
|
|
513
|
+
label: t9
|
|
514
|
+
};
|
|
515
|
+
$[18] = t9;
|
|
516
|
+
$[19] = t10;
|
|
517
|
+
} else t10 = $[19];
|
|
518
|
+
let t11;
|
|
519
|
+
if ($[20] !== t10 || $[21] !== t6 || $[22] !== t8) {
|
|
520
|
+
t11 = [
|
|
521
|
+
t6,
|
|
522
|
+
t8,
|
|
523
|
+
t10
|
|
524
|
+
];
|
|
525
|
+
$[20] = t10;
|
|
526
|
+
$[21] = t6;
|
|
527
|
+
$[22] = t8;
|
|
528
|
+
$[23] = t11;
|
|
529
|
+
} else t11 = $[23];
|
|
530
|
+
let t12;
|
|
531
|
+
if ($[24] === Symbol.for("react.memo_cache_sentinel")) {
|
|
532
|
+
t12 = {
|
|
533
|
+
style: "unit",
|
|
534
|
+
unit: "millisecond",
|
|
535
|
+
unitDisplay: "narrow"
|
|
536
|
+
};
|
|
537
|
+
$[24] = t12;
|
|
538
|
+
} else t12 = $[24];
|
|
539
|
+
let t13;
|
|
540
|
+
if ($[25] !== hidden || $[26] !== t1 || $[27] !== t11 || $[28] !== t2 || $[29] !== t4) {
|
|
541
|
+
t13 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
542
|
+
caption: t1,
|
|
543
|
+
categoryKey: "hour",
|
|
544
|
+
curve: "linear",
|
|
545
|
+
data: HOURS$3,
|
|
546
|
+
hiddenKeys: hidden,
|
|
547
|
+
label: t2,
|
|
548
|
+
labelOptions: t3,
|
|
549
|
+
legendLabel: t4,
|
|
550
|
+
onHiddenKeysChange: setHidden,
|
|
551
|
+
series: t11,
|
|
552
|
+
valueOptions: t12
|
|
553
|
+
});
|
|
554
|
+
$[25] = hidden;
|
|
555
|
+
$[26] = t1;
|
|
556
|
+
$[27] = t11;
|
|
557
|
+
$[28] = t2;
|
|
558
|
+
$[29] = t4;
|
|
559
|
+
$[30] = t13;
|
|
560
|
+
} else t13 = $[30];
|
|
561
|
+
const t14 = KEYS.length - hidden.length;
|
|
562
|
+
let t15;
|
|
563
|
+
if ($[31] !== t || $[32] !== t14) {
|
|
564
|
+
t15 = t("controlled.shown", { count: t14 });
|
|
565
|
+
$[31] = t;
|
|
566
|
+
$[32] = t14;
|
|
567
|
+
$[33] = t15;
|
|
568
|
+
} else t15 = $[33];
|
|
569
|
+
let t16;
|
|
570
|
+
if ($[34] !== t15) {
|
|
571
|
+
t16 = /* @__PURE__ */ jsx(Text$1, {
|
|
572
|
+
as: "output",
|
|
573
|
+
size: "sm",
|
|
574
|
+
tone: "muted",
|
|
575
|
+
children: t15
|
|
576
|
+
});
|
|
577
|
+
$[34] = t15;
|
|
578
|
+
$[35] = t16;
|
|
579
|
+
} else t16 = $[35];
|
|
580
|
+
let t17;
|
|
581
|
+
if ($[36] === Symbol.for("react.memo_cache_sentinel")) {
|
|
582
|
+
t17 = () => {
|
|
583
|
+
setHidden([]);
|
|
584
|
+
};
|
|
585
|
+
$[36] = t17;
|
|
586
|
+
} else t17 = $[36];
|
|
587
|
+
let t18;
|
|
588
|
+
if ($[37] === Symbol.for("react.memo_cache_sentinel")) {
|
|
589
|
+
t18 = /* @__PURE__ */ jsx(EyeIcon, {});
|
|
590
|
+
$[37] = t18;
|
|
591
|
+
} else t18 = $[37];
|
|
592
|
+
let t19;
|
|
593
|
+
if ($[38] !== t) {
|
|
594
|
+
t19 = t("controlled.all");
|
|
595
|
+
$[38] = t;
|
|
596
|
+
$[39] = t19;
|
|
597
|
+
} else t19 = $[39];
|
|
598
|
+
let t20;
|
|
599
|
+
if ($[40] !== t19) {
|
|
600
|
+
t20 = /* @__PURE__ */ jsxs(Button, {
|
|
601
|
+
onClick: t17,
|
|
602
|
+
size: "sm",
|
|
603
|
+
variant: "outline",
|
|
604
|
+
children: [t18, t19]
|
|
605
|
+
});
|
|
606
|
+
$[40] = t19;
|
|
607
|
+
$[41] = t20;
|
|
608
|
+
} else t20 = $[41];
|
|
609
|
+
let t21;
|
|
610
|
+
if ($[42] !== t16 || $[43] !== t20) {
|
|
611
|
+
t21 = /* @__PURE__ */ jsxs(Stack, {
|
|
612
|
+
direction: "row",
|
|
613
|
+
children: [t16, t20]
|
|
614
|
+
});
|
|
615
|
+
$[42] = t16;
|
|
616
|
+
$[43] = t20;
|
|
617
|
+
$[44] = t21;
|
|
618
|
+
} else t21 = $[44];
|
|
619
|
+
let t22;
|
|
620
|
+
if ($[45] !== t13 || $[46] !== t21) {
|
|
621
|
+
t22 = /* @__PURE__ */ jsxs(Stack, {
|
|
622
|
+
align: "flex-start",
|
|
623
|
+
children: [t13, t21]
|
|
624
|
+
});
|
|
625
|
+
$[45] = t13;
|
|
626
|
+
$[46] = t21;
|
|
627
|
+
$[47] = t22;
|
|
628
|
+
} else t22 = $[47];
|
|
629
|
+
return t22;
|
|
630
|
+
}
|
|
631
|
+
const source$9 = "import { type ReactElement, useState } from \"react\";\n\nimport { EyeIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { Text } from \"@stealthscale/component-typography\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst HOURS = [\n [92, 180],\n [95, 190],\n [101, 210],\n [118, 260],\n [142, 340],\n [155, 390],\n [131, 310],\n [112, 240],\n [104, 205],\n [99, 195],\n].map(([p50, p95], index) => ({\n hour: `2026-09-28T${String(index + 8).padStart(2, \"0\")}:00:00Z`,\n p50,\n p95,\n target: 300,\n}));\n\nconst KEYS = [\"p50\", \"p95\", \"target\"];\n\nexport function Controlled(): ReactElement {\n const { t } = useWords(\"line-chart\");\n const [hidden, setHidden] = useState<readonly string[]>([\"p50\"]);\n\n return (\n <Stack align=\"flex-start\">\n <LineChart\n caption={t(\"latency.caption\")}\n categoryKey=\"hour\"\n curve=\"linear\"\n data={HOURS}\n hiddenKeys={hidden}\n label={t(\"latency.label\")}\n labelOptions={{ hour: \"2-digit\", hourCycle: \"h23\", minute: \"2-digit\", timeZone: \"UTC\" }}\n legendLabel={t(\"series\")}\n onHiddenKeysChange={setHidden}\n series={[\n { key: \"p50\", label: t(\"latency.p50\") },\n { key: \"p95\", label: t(\"latency.p95\") },\n { color: \"error\", dashed: true, key: \"target\", label: t(\"latency.target\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n />\n <Stack direction=\"row\">\n <Text as=\"output\" size=\"sm\" tone=\"muted\">\n {t(\"controlled.shown\", { count: KEYS.length - hidden.length })}\n </Text>\n <Button\n onClick={() => {\n setHidden([]);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <EyeIcon />\n {t(\"controlled.all\")}\n </Button>\n </Stack>\n </Stack>\n );\n}\n";
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/line-chart/examples/guide.example.tsx
|
|
634
|
+
var guide_example_exports = /* @__PURE__ */ __exportAll({
|
|
635
|
+
Guide: () => Guide,
|
|
636
|
+
source: () => source$8
|
|
637
|
+
});
|
|
638
|
+
const HOURS$2 = [
|
|
639
|
+
[92, 180],
|
|
640
|
+
[95, 190],
|
|
641
|
+
[101, 210],
|
|
642
|
+
[118, 260],
|
|
643
|
+
[142, 340],
|
|
644
|
+
[155, 390],
|
|
645
|
+
[131, 310],
|
|
646
|
+
[112, 240],
|
|
647
|
+
[104, 205],
|
|
648
|
+
[99, 195]
|
|
649
|
+
].map(([p50, p95], index) => ({
|
|
650
|
+
hour: `2026-09-28T${String(index + 8).padStart(2, "0")}:00:00Z`,
|
|
651
|
+
p50,
|
|
652
|
+
p95
|
|
653
|
+
}));
|
|
654
|
+
function Guide() {
|
|
655
|
+
const $ = c(25);
|
|
656
|
+
const { t } = useWords("line-chart");
|
|
657
|
+
let t0;
|
|
658
|
+
if ($[0] !== t) {
|
|
659
|
+
t0 = t("peak.caption");
|
|
660
|
+
$[0] = t;
|
|
661
|
+
$[1] = t0;
|
|
662
|
+
} else t0 = $[1];
|
|
663
|
+
let t1;
|
|
664
|
+
if ($[2] !== t) {
|
|
665
|
+
t1 = t("latency.label");
|
|
666
|
+
$[2] = t;
|
|
667
|
+
$[3] = t1;
|
|
668
|
+
} else t1 = $[3];
|
|
669
|
+
let t2;
|
|
670
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
671
|
+
t2 = {
|
|
672
|
+
hour: "2-digit",
|
|
673
|
+
hourCycle: "h23",
|
|
674
|
+
minute: "2-digit",
|
|
675
|
+
timeZone: "UTC"
|
|
676
|
+
};
|
|
677
|
+
$[4] = t2;
|
|
678
|
+
} else t2 = $[4];
|
|
679
|
+
let t3;
|
|
680
|
+
if ($[5] !== t) {
|
|
681
|
+
t3 = t("series");
|
|
682
|
+
$[5] = t;
|
|
683
|
+
$[6] = t3;
|
|
684
|
+
} else t3 = $[6];
|
|
685
|
+
let t4;
|
|
686
|
+
if ($[7] !== t) {
|
|
687
|
+
t4 = t("latency.p50");
|
|
688
|
+
$[7] = t;
|
|
689
|
+
$[8] = t4;
|
|
690
|
+
} else t4 = $[8];
|
|
691
|
+
let t5;
|
|
692
|
+
if ($[9] !== t4) {
|
|
693
|
+
t5 = {
|
|
694
|
+
key: "p50",
|
|
695
|
+
label: t4
|
|
696
|
+
};
|
|
697
|
+
$[9] = t4;
|
|
698
|
+
$[10] = t5;
|
|
699
|
+
} else t5 = $[10];
|
|
700
|
+
let t6;
|
|
701
|
+
if ($[11] !== t) {
|
|
702
|
+
t6 = t("latency.p95");
|
|
703
|
+
$[11] = t;
|
|
704
|
+
$[12] = t6;
|
|
705
|
+
} else t6 = $[12];
|
|
706
|
+
let t7;
|
|
707
|
+
if ($[13] !== t6) {
|
|
708
|
+
t7 = {
|
|
709
|
+
key: "p95",
|
|
710
|
+
label: t6
|
|
711
|
+
};
|
|
712
|
+
$[13] = t6;
|
|
713
|
+
$[14] = t7;
|
|
714
|
+
} else t7 = $[14];
|
|
715
|
+
let t8;
|
|
716
|
+
if ($[15] !== t5 || $[16] !== t7) {
|
|
717
|
+
t8 = [t5, t7];
|
|
718
|
+
$[15] = t5;
|
|
719
|
+
$[16] = t7;
|
|
720
|
+
$[17] = t8;
|
|
721
|
+
} else t8 = $[17];
|
|
722
|
+
let t10;
|
|
723
|
+
let t9;
|
|
724
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
725
|
+
t9 = {
|
|
726
|
+
style: "unit",
|
|
727
|
+
unit: "millisecond",
|
|
728
|
+
unitDisplay: "narrow"
|
|
729
|
+
};
|
|
730
|
+
t10 = /* @__PURE__ */ jsx(Crosshair, { dataKey: "p95" });
|
|
731
|
+
$[18] = t10;
|
|
732
|
+
$[19] = t9;
|
|
733
|
+
} else {
|
|
734
|
+
t10 = $[18];
|
|
735
|
+
t9 = $[19];
|
|
736
|
+
}
|
|
737
|
+
let t11;
|
|
738
|
+
if ($[20] !== t0 || $[21] !== t1 || $[22] !== t3 || $[23] !== t8) {
|
|
739
|
+
t11 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
740
|
+
caption: t0,
|
|
741
|
+
categoryKey: "hour",
|
|
742
|
+
data: HOURS$2,
|
|
743
|
+
defaultIndex: 4,
|
|
744
|
+
label: t1,
|
|
745
|
+
labelOptions: t2,
|
|
746
|
+
legendLabel: t3,
|
|
747
|
+
series: t8,
|
|
748
|
+
valueOptions: t9,
|
|
749
|
+
children: t10
|
|
750
|
+
});
|
|
751
|
+
$[20] = t0;
|
|
752
|
+
$[21] = t1;
|
|
753
|
+
$[22] = t3;
|
|
754
|
+
$[23] = t8;
|
|
755
|
+
$[24] = t11;
|
|
756
|
+
} else t11 = $[24];
|
|
757
|
+
return t11;
|
|
758
|
+
}
|
|
759
|
+
const source$8 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { Chart, LineChart } from \"@stealthscale/component-charts\";\n\nconst HOURS = [\n [92, 180],\n [95, 190],\n [101, 210],\n [118, 260],\n [142, 340],\n [155, 390],\n [131, 310],\n [112, 240],\n [104, 205],\n [99, 195],\n].map(([p50, p95], index) => ({\n hour: `2026-09-28T${String(index + 8).padStart(2, \"0\")}:00:00Z`,\n p50,\n p95,\n}));\n\nexport function Guide(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"peak.caption\")}\n categoryKey=\"hour\"\n data={HOURS}\n defaultIndex={4}\n label={t(\"latency.label\")}\n labelOptions={{ hour: \"2-digit\", hourCycle: \"h23\", minute: \"2-digit\", timeZone: \"UTC\" }}\n legendLabel={t(\"series\")}\n series={[\n { key: \"p50\", label: t(\"latency.p50\") },\n { key: \"p95\", label: t(\"latency.p95\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n >\n <Chart.Crosshair dataKey=\"p95\" />\n </LineChart>\n );\n}\n";
|
|
760
|
+
//#endregion
|
|
761
|
+
//#region src/line-chart/examples/latency.example.tsx
|
|
762
|
+
var latency_example_exports = /* @__PURE__ */ __exportAll({
|
|
763
|
+
Latency: () => Latency,
|
|
764
|
+
source: () => source$7
|
|
765
|
+
});
|
|
766
|
+
const HOURS$1 = [
|
|
767
|
+
[92, 180],
|
|
768
|
+
[95, 190],
|
|
769
|
+
[101, 210],
|
|
770
|
+
[118, 260],
|
|
771
|
+
[142, 340],
|
|
772
|
+
[155, 390],
|
|
773
|
+
[131, 310],
|
|
774
|
+
[112, 240],
|
|
775
|
+
[104, 205],
|
|
776
|
+
[99, 195]
|
|
777
|
+
].map(([p50, p95], index) => ({
|
|
778
|
+
hour: `2026-09-28T${String(index + 8).padStart(2, "0")}:00:00Z`,
|
|
779
|
+
p50,
|
|
780
|
+
p95,
|
|
781
|
+
target: 300
|
|
782
|
+
}));
|
|
783
|
+
function Latency() {
|
|
784
|
+
const $ = c(29);
|
|
785
|
+
const { t } = useWords("line-chart");
|
|
786
|
+
let t0;
|
|
787
|
+
if ($[0] !== t) {
|
|
788
|
+
t0 = t("latency.caption");
|
|
789
|
+
$[0] = t;
|
|
790
|
+
$[1] = t0;
|
|
791
|
+
} else t0 = $[1];
|
|
792
|
+
let t1;
|
|
793
|
+
if ($[2] !== t) {
|
|
794
|
+
t1 = t("latency.label");
|
|
795
|
+
$[2] = t;
|
|
796
|
+
$[3] = t1;
|
|
797
|
+
} else t1 = $[3];
|
|
798
|
+
let t2;
|
|
799
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
800
|
+
t2 = {
|
|
801
|
+
hour: "2-digit",
|
|
802
|
+
hourCycle: "h23",
|
|
803
|
+
minute: "2-digit",
|
|
804
|
+
timeZone: "UTC"
|
|
805
|
+
};
|
|
806
|
+
$[4] = t2;
|
|
807
|
+
} else t2 = $[4];
|
|
808
|
+
let t3;
|
|
809
|
+
if ($[5] !== t) {
|
|
810
|
+
t3 = t("series");
|
|
811
|
+
$[5] = t;
|
|
812
|
+
$[6] = t3;
|
|
813
|
+
} else t3 = $[6];
|
|
814
|
+
let t4;
|
|
815
|
+
if ($[7] !== t) {
|
|
816
|
+
t4 = t("latency.p50");
|
|
817
|
+
$[7] = t;
|
|
818
|
+
$[8] = t4;
|
|
819
|
+
} else t4 = $[8];
|
|
820
|
+
let t5;
|
|
821
|
+
if ($[9] !== t4) {
|
|
822
|
+
t5 = {
|
|
823
|
+
key: "p50",
|
|
824
|
+
label: t4
|
|
825
|
+
};
|
|
826
|
+
$[9] = t4;
|
|
827
|
+
$[10] = t5;
|
|
828
|
+
} else t5 = $[10];
|
|
829
|
+
let t6;
|
|
830
|
+
if ($[11] !== t) {
|
|
831
|
+
t6 = t("latency.p95");
|
|
832
|
+
$[11] = t;
|
|
833
|
+
$[12] = t6;
|
|
834
|
+
} else t6 = $[12];
|
|
835
|
+
let t7;
|
|
836
|
+
if ($[13] !== t6) {
|
|
837
|
+
t7 = {
|
|
838
|
+
key: "p95",
|
|
839
|
+
label: t6
|
|
840
|
+
};
|
|
841
|
+
$[13] = t6;
|
|
842
|
+
$[14] = t7;
|
|
843
|
+
} else t7 = $[14];
|
|
844
|
+
let t8;
|
|
845
|
+
if ($[15] !== t) {
|
|
846
|
+
t8 = t("latency.target");
|
|
847
|
+
$[15] = t;
|
|
848
|
+
$[16] = t8;
|
|
849
|
+
} else t8 = $[16];
|
|
850
|
+
let t9;
|
|
851
|
+
if ($[17] !== t8) {
|
|
852
|
+
t9 = {
|
|
853
|
+
color: "error",
|
|
854
|
+
dashed: true,
|
|
855
|
+
key: "target",
|
|
856
|
+
label: t8
|
|
857
|
+
};
|
|
858
|
+
$[17] = t8;
|
|
859
|
+
$[18] = t9;
|
|
860
|
+
} else t9 = $[18];
|
|
861
|
+
let t10;
|
|
862
|
+
if ($[19] !== t5 || $[20] !== t7 || $[21] !== t9) {
|
|
863
|
+
t10 = [
|
|
864
|
+
t5,
|
|
865
|
+
t7,
|
|
866
|
+
t9
|
|
867
|
+
];
|
|
868
|
+
$[19] = t5;
|
|
869
|
+
$[20] = t7;
|
|
870
|
+
$[21] = t9;
|
|
871
|
+
$[22] = t10;
|
|
872
|
+
} else t10 = $[22];
|
|
873
|
+
let t11;
|
|
874
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
875
|
+
t11 = {
|
|
876
|
+
style: "unit",
|
|
877
|
+
unit: "millisecond",
|
|
878
|
+
unitDisplay: "narrow"
|
|
879
|
+
};
|
|
880
|
+
$[23] = t11;
|
|
881
|
+
} else t11 = $[23];
|
|
882
|
+
let t12;
|
|
883
|
+
if ($[24] !== t0 || $[25] !== t1 || $[26] !== t10 || $[27] !== t3) {
|
|
884
|
+
t12 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
885
|
+
caption: t0,
|
|
886
|
+
categoryKey: "hour",
|
|
887
|
+
curve: "linear",
|
|
888
|
+
data: HOURS$1,
|
|
889
|
+
label: t1,
|
|
890
|
+
labelOptions: t2,
|
|
891
|
+
legendLabel: t3,
|
|
892
|
+
series: t10,
|
|
893
|
+
valueOptions: t11
|
|
894
|
+
});
|
|
895
|
+
$[24] = t0;
|
|
896
|
+
$[25] = t1;
|
|
897
|
+
$[26] = t10;
|
|
898
|
+
$[27] = t3;
|
|
899
|
+
$[28] = t12;
|
|
900
|
+
} else t12 = $[28];
|
|
901
|
+
return t12;
|
|
902
|
+
}
|
|
903
|
+
const source$7 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst HOURS = [\n [92, 180],\n [95, 190],\n [101, 210],\n [118, 260],\n [142, 340],\n [155, 390],\n [131, 310],\n [112, 240],\n [104, 205],\n [99, 195],\n].map(([p50, p95], index) => ({\n hour: `2026-09-28T${String(index + 8).padStart(2, \"0\")}:00:00Z`,\n p50,\n p95,\n target: 300,\n}));\n\nexport function Latency(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"latency.caption\")}\n categoryKey=\"hour\"\n curve=\"linear\"\n data={HOURS}\n label={t(\"latency.label\")}\n labelOptions={{ hour: \"2-digit\", hourCycle: \"h23\", minute: \"2-digit\", timeZone: \"UTC\" }}\n legendLabel={t(\"series\")}\n series={[\n { key: \"p50\", label: t(\"latency.p50\") },\n { key: \"p95\", label: t(\"latency.p95\") },\n { color: \"error\", dashed: true, key: \"target\", label: t(\"latency.target\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n />\n );\n}\n";
|
|
904
|
+
//#endregion
|
|
905
|
+
//#region src/line-chart/examples/peak.example.tsx
|
|
906
|
+
var peak_example_exports = /* @__PURE__ */ __exportAll({
|
|
907
|
+
Peak: () => Peak,
|
|
908
|
+
source: () => source$6
|
|
909
|
+
});
|
|
910
|
+
const HOURS = [
|
|
911
|
+
[92, 180],
|
|
912
|
+
[95, 190],
|
|
913
|
+
[101, 210],
|
|
914
|
+
[118, 260],
|
|
915
|
+
[142, 340],
|
|
916
|
+
[155, 390],
|
|
917
|
+
[131, 310],
|
|
918
|
+
[112, 240],
|
|
919
|
+
[104, 205],
|
|
920
|
+
[99, 195]
|
|
921
|
+
].map(([p50, p95], index) => ({
|
|
922
|
+
hour: `2026-09-28T${String(index + 8).padStart(2, "0")}:00:00Z`,
|
|
923
|
+
p50,
|
|
924
|
+
p95
|
|
925
|
+
}));
|
|
926
|
+
function Peak() {
|
|
927
|
+
const $ = c(24);
|
|
928
|
+
const { t } = useWords("line-chart");
|
|
929
|
+
let t0;
|
|
930
|
+
if ($[0] !== t) {
|
|
931
|
+
t0 = t("peak.caption");
|
|
932
|
+
$[0] = t;
|
|
933
|
+
$[1] = t0;
|
|
934
|
+
} else t0 = $[1];
|
|
935
|
+
let t1;
|
|
936
|
+
if ($[2] !== t) {
|
|
937
|
+
t1 = t("latency.label");
|
|
938
|
+
$[2] = t;
|
|
939
|
+
$[3] = t1;
|
|
940
|
+
} else t1 = $[3];
|
|
941
|
+
let t2;
|
|
942
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
943
|
+
t2 = {
|
|
944
|
+
hour: "2-digit",
|
|
945
|
+
hourCycle: "h23",
|
|
946
|
+
minute: "2-digit",
|
|
947
|
+
timeZone: "UTC"
|
|
948
|
+
};
|
|
949
|
+
$[4] = t2;
|
|
950
|
+
} else t2 = $[4];
|
|
951
|
+
let t3;
|
|
952
|
+
if ($[5] !== t) {
|
|
953
|
+
t3 = t("series");
|
|
954
|
+
$[5] = t;
|
|
955
|
+
$[6] = t3;
|
|
956
|
+
} else t3 = $[6];
|
|
957
|
+
let t4;
|
|
958
|
+
if ($[7] !== t) {
|
|
959
|
+
t4 = t("latency.p50");
|
|
960
|
+
$[7] = t;
|
|
961
|
+
$[8] = t4;
|
|
962
|
+
} else t4 = $[8];
|
|
963
|
+
let t5;
|
|
964
|
+
if ($[9] !== t4) {
|
|
965
|
+
t5 = {
|
|
966
|
+
key: "p50",
|
|
967
|
+
label: t4
|
|
968
|
+
};
|
|
969
|
+
$[9] = t4;
|
|
970
|
+
$[10] = t5;
|
|
971
|
+
} else t5 = $[10];
|
|
972
|
+
let t6;
|
|
973
|
+
if ($[11] !== t) {
|
|
974
|
+
t6 = t("latency.p95");
|
|
975
|
+
$[11] = t;
|
|
976
|
+
$[12] = t6;
|
|
977
|
+
} else t6 = $[12];
|
|
978
|
+
let t7;
|
|
979
|
+
if ($[13] !== t6) {
|
|
980
|
+
t7 = {
|
|
981
|
+
key: "p95",
|
|
982
|
+
label: t6
|
|
983
|
+
};
|
|
984
|
+
$[13] = t6;
|
|
985
|
+
$[14] = t7;
|
|
986
|
+
} else t7 = $[14];
|
|
987
|
+
let t8;
|
|
988
|
+
if ($[15] !== t5 || $[16] !== t7) {
|
|
989
|
+
t8 = [t5, t7];
|
|
990
|
+
$[15] = t5;
|
|
991
|
+
$[16] = t7;
|
|
992
|
+
$[17] = t8;
|
|
993
|
+
} else t8 = $[17];
|
|
994
|
+
let t9;
|
|
995
|
+
if ($[18] === Symbol.for("react.memo_cache_sentinel")) {
|
|
996
|
+
t9 = {
|
|
997
|
+
style: "unit",
|
|
998
|
+
unit: "millisecond",
|
|
999
|
+
unitDisplay: "narrow"
|
|
1000
|
+
};
|
|
1001
|
+
$[18] = t9;
|
|
1002
|
+
} else t9 = $[18];
|
|
1003
|
+
let t10;
|
|
1004
|
+
if ($[19] !== t0 || $[20] !== t1 || $[21] !== t3 || $[22] !== t8) {
|
|
1005
|
+
t10 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1006
|
+
caption: t0,
|
|
1007
|
+
categoryKey: "hour",
|
|
1008
|
+
data: HOURS,
|
|
1009
|
+
defaultIndex: 5,
|
|
1010
|
+
label: t1,
|
|
1011
|
+
labelOptions: t2,
|
|
1012
|
+
legendLabel: t3,
|
|
1013
|
+
series: t8,
|
|
1014
|
+
valueOptions: t9
|
|
1015
|
+
});
|
|
1016
|
+
$[19] = t0;
|
|
1017
|
+
$[20] = t1;
|
|
1018
|
+
$[21] = t3;
|
|
1019
|
+
$[22] = t8;
|
|
1020
|
+
$[23] = t10;
|
|
1021
|
+
} else t10 = $[23];
|
|
1022
|
+
return t10;
|
|
1023
|
+
}
|
|
1024
|
+
const source$6 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst HOURS = [\n [92, 180],\n [95, 190],\n [101, 210],\n [118, 260],\n [142, 340],\n [155, 390],\n [131, 310],\n [112, 240],\n [104, 205],\n [99, 195],\n].map(([p50, p95], index) => ({\n hour: `2026-09-28T${String(index + 8).padStart(2, \"0\")}:00:00Z`,\n p50,\n p95,\n}));\n\nexport function Peak(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"peak.caption\")}\n categoryKey=\"hour\"\n data={HOURS}\n defaultIndex={5}\n label={t(\"latency.label\")}\n labelOptions={{ hour: \"2-digit\", hourCycle: \"h23\", minute: \"2-digit\", timeZone: \"UTC\" }}\n legendLabel={t(\"series\")}\n series={[\n { key: \"p50\", label: t(\"latency.p50\") },\n { key: \"p95\", label: t(\"latency.p95\") },\n ]}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n />\n );\n}\n";
|
|
1025
|
+
//#endregion
|
|
1026
|
+
//#region src/line-chart/examples/quiet.example.tsx
|
|
1027
|
+
var quiet_example_exports = /* @__PURE__ */ __exportAll({
|
|
1028
|
+
Quiet: () => Quiet,
|
|
1029
|
+
source: () => source$5
|
|
1030
|
+
});
|
|
1031
|
+
const DAYS$4 = [];
|
|
1032
|
+
function Quiet() {
|
|
1033
|
+
const $ = c(15);
|
|
1034
|
+
const { t } = useWords("line-chart");
|
|
1035
|
+
let t0;
|
|
1036
|
+
if ($[0] !== t) {
|
|
1037
|
+
t0 = t("quiet.caption");
|
|
1038
|
+
$[0] = t;
|
|
1039
|
+
$[1] = t0;
|
|
1040
|
+
} else t0 = $[1];
|
|
1041
|
+
let t1;
|
|
1042
|
+
if ($[2] !== t) {
|
|
1043
|
+
t1 = t("quiet.empty");
|
|
1044
|
+
$[2] = t;
|
|
1045
|
+
$[3] = t1;
|
|
1046
|
+
} else t1 = $[3];
|
|
1047
|
+
let t2;
|
|
1048
|
+
if ($[4] !== t) {
|
|
1049
|
+
t2 = t("quiet.label");
|
|
1050
|
+
$[4] = t;
|
|
1051
|
+
$[5] = t2;
|
|
1052
|
+
} else t2 = $[5];
|
|
1053
|
+
let t3;
|
|
1054
|
+
if ($[6] !== t) {
|
|
1055
|
+
t3 = t("quiet.errors");
|
|
1056
|
+
$[6] = t;
|
|
1057
|
+
$[7] = t3;
|
|
1058
|
+
} else t3 = $[7];
|
|
1059
|
+
let t4;
|
|
1060
|
+
if ($[8] !== t3) {
|
|
1061
|
+
t4 = [{
|
|
1062
|
+
key: "errors",
|
|
1063
|
+
label: t3
|
|
1064
|
+
}];
|
|
1065
|
+
$[8] = t3;
|
|
1066
|
+
$[9] = t4;
|
|
1067
|
+
} else t4 = $[9];
|
|
1068
|
+
let t5;
|
|
1069
|
+
if ($[10] !== t0 || $[11] !== t1 || $[12] !== t2 || $[13] !== t4) {
|
|
1070
|
+
t5 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1071
|
+
caption: t0,
|
|
1072
|
+
categoryKey: "day",
|
|
1073
|
+
data: DAYS$4,
|
|
1074
|
+
empty: t1,
|
|
1075
|
+
label: t2,
|
|
1076
|
+
series: t4
|
|
1077
|
+
});
|
|
1078
|
+
$[10] = t0;
|
|
1079
|
+
$[11] = t1;
|
|
1080
|
+
$[12] = t2;
|
|
1081
|
+
$[13] = t4;
|
|
1082
|
+
$[14] = t5;
|
|
1083
|
+
} else t5 = $[14];
|
|
1084
|
+
return t5;
|
|
1085
|
+
}
|
|
1086
|
+
const source$5 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS: Array<{ day: string; errors: number }> = [];\n\nexport function Quiet(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"quiet.caption\")}\n categoryKey=\"day\"\n data={DAYS}\n empty={t(\"quiet.empty\")}\n label={t(\"quiet.label\")}\n series={[{ key: \"errors\", label: t(\"quiet.errors\") }]}\n />\n );\n}\n";
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region src/line-chart/examples/releases.example.tsx
|
|
1089
|
+
var releases_example_exports = /* @__PURE__ */ __exportAll({
|
|
1090
|
+
Releases: () => Releases,
|
|
1091
|
+
source: () => source$4
|
|
1092
|
+
});
|
|
1093
|
+
const DAYS$3 = [
|
|
1094
|
+
212,
|
|
1095
|
+
205,
|
|
1096
|
+
218,
|
|
1097
|
+
381,
|
|
1098
|
+
396,
|
|
1099
|
+
372,
|
|
1100
|
+
368,
|
|
1101
|
+
362,
|
|
1102
|
+
355,
|
|
1103
|
+
358,
|
|
1104
|
+
214,
|
|
1105
|
+
208,
|
|
1106
|
+
221,
|
|
1107
|
+
199
|
|
1108
|
+
].map((p95, index) => ({
|
|
1109
|
+
day: `2026-09-${String(index + 14)}`,
|
|
1110
|
+
p95
|
|
1111
|
+
}));
|
|
1112
|
+
function Releases() {
|
|
1113
|
+
const $ = c(31);
|
|
1114
|
+
const { t } = useWords("line-chart");
|
|
1115
|
+
let t0;
|
|
1116
|
+
if ($[0] !== t) {
|
|
1117
|
+
t0 = t("releases.first");
|
|
1118
|
+
$[0] = t;
|
|
1119
|
+
$[1] = t0;
|
|
1120
|
+
} else t0 = $[1];
|
|
1121
|
+
let t1;
|
|
1122
|
+
if ($[2] !== t0) {
|
|
1123
|
+
t1 = {
|
|
1124
|
+
at: "2026-09-17",
|
|
1125
|
+
key: "4.12",
|
|
1126
|
+
label: t0
|
|
1127
|
+
};
|
|
1128
|
+
$[2] = t0;
|
|
1129
|
+
$[3] = t1;
|
|
1130
|
+
} else t1 = $[3];
|
|
1131
|
+
let t2;
|
|
1132
|
+
if ($[4] !== t) {
|
|
1133
|
+
t2 = t("releases.freeze");
|
|
1134
|
+
$[4] = t;
|
|
1135
|
+
$[5] = t2;
|
|
1136
|
+
} else t2 = $[5];
|
|
1137
|
+
let t3;
|
|
1138
|
+
if ($[6] !== t2) {
|
|
1139
|
+
t3 = {
|
|
1140
|
+
at: "2026-09-20",
|
|
1141
|
+
color: "info",
|
|
1142
|
+
key: "freeze",
|
|
1143
|
+
label: t2,
|
|
1144
|
+
until: "2026-09-22"
|
|
1145
|
+
};
|
|
1146
|
+
$[6] = t2;
|
|
1147
|
+
$[7] = t3;
|
|
1148
|
+
} else t3 = $[7];
|
|
1149
|
+
let t4;
|
|
1150
|
+
if ($[8] !== t) {
|
|
1151
|
+
t4 = t("releases.second");
|
|
1152
|
+
$[8] = t;
|
|
1153
|
+
$[9] = t4;
|
|
1154
|
+
} else t4 = $[9];
|
|
1155
|
+
let t5;
|
|
1156
|
+
if ($[10] !== t4) {
|
|
1157
|
+
t5 = {
|
|
1158
|
+
at: "2026-09-24",
|
|
1159
|
+
key: "4.13",
|
|
1160
|
+
label: t4
|
|
1161
|
+
};
|
|
1162
|
+
$[10] = t4;
|
|
1163
|
+
$[11] = t5;
|
|
1164
|
+
} else t5 = $[11];
|
|
1165
|
+
let t6;
|
|
1166
|
+
if ($[12] !== t1 || $[13] !== t3 || $[14] !== t5) {
|
|
1167
|
+
t6 = [
|
|
1168
|
+
t1,
|
|
1169
|
+
t3,
|
|
1170
|
+
t5
|
|
1171
|
+
];
|
|
1172
|
+
$[12] = t1;
|
|
1173
|
+
$[13] = t3;
|
|
1174
|
+
$[14] = t5;
|
|
1175
|
+
$[15] = t6;
|
|
1176
|
+
} else t6 = $[15];
|
|
1177
|
+
let t7;
|
|
1178
|
+
if ($[16] !== t) {
|
|
1179
|
+
t7 = t("releases.caption");
|
|
1180
|
+
$[16] = t;
|
|
1181
|
+
$[17] = t7;
|
|
1182
|
+
} else t7 = $[17];
|
|
1183
|
+
let t8;
|
|
1184
|
+
if ($[18] !== t) {
|
|
1185
|
+
t8 = t("releases.label");
|
|
1186
|
+
$[18] = t;
|
|
1187
|
+
$[19] = t8;
|
|
1188
|
+
} else t8 = $[19];
|
|
1189
|
+
let t9;
|
|
1190
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1191
|
+
t9 = {
|
|
1192
|
+
day: "numeric",
|
|
1193
|
+
month: "short",
|
|
1194
|
+
timeZone: "UTC"
|
|
1195
|
+
};
|
|
1196
|
+
$[20] = t9;
|
|
1197
|
+
} else t9 = $[20];
|
|
1198
|
+
let t10;
|
|
1199
|
+
if ($[21] !== t) {
|
|
1200
|
+
t10 = t("releases.p95");
|
|
1201
|
+
$[21] = t;
|
|
1202
|
+
$[22] = t10;
|
|
1203
|
+
} else t10 = $[22];
|
|
1204
|
+
let t11;
|
|
1205
|
+
if ($[23] !== t10) {
|
|
1206
|
+
t11 = [{
|
|
1207
|
+
key: "p95",
|
|
1208
|
+
label: t10
|
|
1209
|
+
}];
|
|
1210
|
+
$[23] = t10;
|
|
1211
|
+
$[24] = t11;
|
|
1212
|
+
} else t11 = $[24];
|
|
1213
|
+
let t12;
|
|
1214
|
+
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1215
|
+
t12 = {
|
|
1216
|
+
style: "unit",
|
|
1217
|
+
unit: "millisecond",
|
|
1218
|
+
unitDisplay: "narrow"
|
|
1219
|
+
};
|
|
1220
|
+
$[25] = t12;
|
|
1221
|
+
} else t12 = $[25];
|
|
1222
|
+
let t13;
|
|
1223
|
+
if ($[26] !== t11 || $[27] !== t6 || $[28] !== t7 || $[29] !== t8) {
|
|
1224
|
+
t13 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1225
|
+
annotations: t6,
|
|
1226
|
+
caption: t7,
|
|
1227
|
+
categoryKey: "day",
|
|
1228
|
+
curve: "linear",
|
|
1229
|
+
data: DAYS$3,
|
|
1230
|
+
defaultIndex: 3,
|
|
1231
|
+
label: t8,
|
|
1232
|
+
labelOptions: t9,
|
|
1233
|
+
series: t11,
|
|
1234
|
+
valueOptions: t12
|
|
1235
|
+
});
|
|
1236
|
+
$[26] = t11;
|
|
1237
|
+
$[27] = t6;
|
|
1238
|
+
$[28] = t7;
|
|
1239
|
+
$[29] = t8;
|
|
1240
|
+
$[30] = t13;
|
|
1241
|
+
} else t13 = $[30];
|
|
1242
|
+
return t13;
|
|
1243
|
+
}
|
|
1244
|
+
const source$4 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [212, 205, 218, 381, 396, 372, 368, 362, 355, 358, 214, 208, 221, 199].map(\n (p95, index) => ({ day: `2026-09-${String(index + 14)}`, p95 }),\n);\n\nexport function Releases(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n annotations={[\n { at: \"2026-09-17\", key: \"4.12\", label: t(\"releases.first\") },\n {\n at: \"2026-09-20\",\n color: \"info\",\n key: \"freeze\",\n label: t(\"releases.freeze\"),\n until: \"2026-09-22\",\n },\n { at: \"2026-09-24\", key: \"4.13\", label: t(\"releases.second\") },\n ]}\n caption={t(\"releases.caption\")}\n categoryKey=\"day\"\n curve=\"linear\"\n data={DAYS}\n defaultIndex={3}\n label={t(\"releases.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n series={[{ key: \"p95\", label: t(\"releases.p95\") }]}\n valueOptions={{ style: \"unit\", unit: \"millisecond\", unitDisplay: \"narrow\" }}\n />\n );\n}\n";
|
|
1245
|
+
//#endregion
|
|
1246
|
+
//#region src/line-chart/examples/replay.example.tsx
|
|
1247
|
+
var replay_example_exports = /* @__PURE__ */ __exportAll({
|
|
1248
|
+
Replay: () => Replay,
|
|
1249
|
+
source: () => source$3
|
|
1250
|
+
});
|
|
1251
|
+
const DAYS$2 = [
|
|
1252
|
+
{
|
|
1253
|
+
day: "2026-09-21",
|
|
1254
|
+
revenue: 18200
|
|
1255
|
+
},
|
|
1256
|
+
{
|
|
1257
|
+
day: "2026-09-22",
|
|
1258
|
+
revenue: 21400
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
day: "2026-09-23",
|
|
1262
|
+
revenue: 20100
|
|
1263
|
+
},
|
|
1264
|
+
{
|
|
1265
|
+
day: "2026-09-24",
|
|
1266
|
+
revenue: 24800
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
day: "2026-09-25",
|
|
1270
|
+
revenue: 26300
|
|
1271
|
+
},
|
|
1272
|
+
{
|
|
1273
|
+
day: "2026-09-26",
|
|
1274
|
+
revenue: 15900
|
|
1275
|
+
},
|
|
1276
|
+
{
|
|
1277
|
+
day: "2026-09-27",
|
|
1278
|
+
revenue: 14700
|
|
1279
|
+
}
|
|
1280
|
+
];
|
|
1281
|
+
function Replay() {
|
|
1282
|
+
const $ = c(26);
|
|
1283
|
+
const { t } = useWords("line-chart");
|
|
1284
|
+
const [run, setRun] = useState(0);
|
|
1285
|
+
let t0;
|
|
1286
|
+
if ($[0] !== t) {
|
|
1287
|
+
t0 = t("revenue.caption");
|
|
1288
|
+
$[0] = t;
|
|
1289
|
+
$[1] = t0;
|
|
1290
|
+
} else t0 = $[1];
|
|
1291
|
+
let t1;
|
|
1292
|
+
if ($[2] !== t) {
|
|
1293
|
+
t1 = t("revenue.label");
|
|
1294
|
+
$[2] = t;
|
|
1295
|
+
$[3] = t1;
|
|
1296
|
+
} else t1 = $[3];
|
|
1297
|
+
let t2;
|
|
1298
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1299
|
+
t2 = {
|
|
1300
|
+
timeZone: "UTC",
|
|
1301
|
+
weekday: "short"
|
|
1302
|
+
};
|
|
1303
|
+
$[4] = t2;
|
|
1304
|
+
} else t2 = $[4];
|
|
1305
|
+
let t3;
|
|
1306
|
+
if ($[5] !== t) {
|
|
1307
|
+
t3 = t("revenue.revenue");
|
|
1308
|
+
$[5] = t;
|
|
1309
|
+
$[6] = t3;
|
|
1310
|
+
} else t3 = $[6];
|
|
1311
|
+
let t4;
|
|
1312
|
+
if ($[7] !== t3) {
|
|
1313
|
+
t4 = [{
|
|
1314
|
+
key: "revenue",
|
|
1315
|
+
label: t3
|
|
1316
|
+
}];
|
|
1317
|
+
$[7] = t3;
|
|
1318
|
+
$[8] = t4;
|
|
1319
|
+
} else t4 = $[8];
|
|
1320
|
+
let t5;
|
|
1321
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1322
|
+
t5 = {
|
|
1323
|
+
currency: "EUR",
|
|
1324
|
+
maximumFractionDigits: 0,
|
|
1325
|
+
style: "currency"
|
|
1326
|
+
};
|
|
1327
|
+
$[9] = t5;
|
|
1328
|
+
} else t5 = $[9];
|
|
1329
|
+
let t6;
|
|
1330
|
+
if ($[10] !== run || $[11] !== t0 || $[12] !== t1 || $[13] !== t4) {
|
|
1331
|
+
t6 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1332
|
+
animate: true,
|
|
1333
|
+
caption: t0,
|
|
1334
|
+
categoryKey: "day",
|
|
1335
|
+
data: DAYS$2,
|
|
1336
|
+
label: t1,
|
|
1337
|
+
labelOptions: t2,
|
|
1338
|
+
series: t4,
|
|
1339
|
+
valueOptions: t5
|
|
1340
|
+
}, run);
|
|
1341
|
+
$[10] = run;
|
|
1342
|
+
$[11] = t0;
|
|
1343
|
+
$[12] = t1;
|
|
1344
|
+
$[13] = t4;
|
|
1345
|
+
$[14] = t6;
|
|
1346
|
+
} else t6 = $[14];
|
|
1347
|
+
let t7;
|
|
1348
|
+
if ($[15] !== run) {
|
|
1349
|
+
t7 = () => {
|
|
1350
|
+
setRun(run + 1);
|
|
1351
|
+
};
|
|
1352
|
+
$[15] = run;
|
|
1353
|
+
$[16] = t7;
|
|
1354
|
+
} else t7 = $[16];
|
|
1355
|
+
let t8;
|
|
1356
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1357
|
+
t8 = /* @__PURE__ */ jsx(RotateCcwIcon, {});
|
|
1358
|
+
$[17] = t8;
|
|
1359
|
+
} else t8 = $[17];
|
|
1360
|
+
let t9;
|
|
1361
|
+
if ($[18] !== t) {
|
|
1362
|
+
t9 = t("replay.replay");
|
|
1363
|
+
$[18] = t;
|
|
1364
|
+
$[19] = t9;
|
|
1365
|
+
} else t9 = $[19];
|
|
1366
|
+
let t10;
|
|
1367
|
+
if ($[20] !== t7 || $[21] !== t9) {
|
|
1368
|
+
t10 = /* @__PURE__ */ jsxs(Button, {
|
|
1369
|
+
onClick: t7,
|
|
1370
|
+
size: "sm",
|
|
1371
|
+
variant: "outline",
|
|
1372
|
+
children: [t8, t9]
|
|
1373
|
+
});
|
|
1374
|
+
$[20] = t7;
|
|
1375
|
+
$[21] = t9;
|
|
1376
|
+
$[22] = t10;
|
|
1377
|
+
} else t10 = $[22];
|
|
1378
|
+
let t11;
|
|
1379
|
+
if ($[23] !== t10 || $[24] !== t6) {
|
|
1380
|
+
t11 = /* @__PURE__ */ jsxs(Stack, {
|
|
1381
|
+
align: "flex-start",
|
|
1382
|
+
children: [t6, t10]
|
|
1383
|
+
});
|
|
1384
|
+
$[23] = t10;
|
|
1385
|
+
$[24] = t6;
|
|
1386
|
+
$[25] = t11;
|
|
1387
|
+
} else t11 = $[25];
|
|
1388
|
+
return t11;
|
|
1389
|
+
}
|
|
1390
|
+
const source$3 = "import { type ReactElement, useState } from \"react\";\n\nimport { RotateCcwIcon } from \"lucide-react\";\n\nimport { Button } from \"@stealthscale/component-actions\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n { day: \"2026-09-21\", revenue: 18_200 },\n { day: \"2026-09-22\", revenue: 21_400 },\n { day: \"2026-09-23\", revenue: 20_100 },\n { day: \"2026-09-24\", revenue: 24_800 },\n { day: \"2026-09-25\", revenue: 26_300 },\n { day: \"2026-09-26\", revenue: 15_900 },\n { day: \"2026-09-27\", revenue: 14_700 },\n];\n\nexport function Replay(): ReactElement {\n const { t } = useWords(\"line-chart\");\n const [run, setRun] = useState(0);\n\n return (\n <Stack align=\"flex-start\">\n <LineChart\n animate\n caption={t(\"revenue.caption\")}\n categoryKey=\"day\"\n data={DAYS}\n key={run}\n label={t(\"revenue.label\")}\n labelOptions={{ timeZone: \"UTC\", weekday: \"short\" }}\n series={[{ key: \"revenue\", label: t(\"revenue.revenue\") }]}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n <Button\n onClick={() => {\n setRun(run + 1);\n }}\n size=\"sm\"\n variant=\"outline\"\n >\n <RotateCcwIcon />\n {t(\"replay.replay\")}\n </Button>\n </Stack>\n );\n}\n";
|
|
1391
|
+
//#endregion
|
|
1392
|
+
//#region src/line-chart/examples/retention.example.tsx
|
|
1393
|
+
var retention_example_exports = /* @__PURE__ */ __exportAll({
|
|
1394
|
+
Retention: () => Retention,
|
|
1395
|
+
source: () => source$2
|
|
1396
|
+
});
|
|
1397
|
+
const TRIALS = [
|
|
1398
|
+
420,
|
|
1399
|
+
385,
|
|
1400
|
+
440,
|
|
1401
|
+
398,
|
|
1402
|
+
412,
|
|
1403
|
+
455,
|
|
1404
|
+
430,
|
|
1405
|
+
402,
|
|
1406
|
+
447,
|
|
1407
|
+
390
|
|
1408
|
+
].map((size, at) => {
|
|
1409
|
+
const first = (at >= 5 ? .62 : .5) + (at * 7 % 5 - 2) * .015;
|
|
1410
|
+
const kept = .86 + at * 3 % 4 * .015;
|
|
1411
|
+
return {
|
|
1412
|
+
retained: Array.from({ length: 10 - at }, (_, week) => week === 0 ? size : Math.round(size * first * kept ** (week - 1))),
|
|
1413
|
+
size
|
|
1414
|
+
};
|
|
1415
|
+
});
|
|
1416
|
+
function Retention() {
|
|
1417
|
+
const $ = c(12);
|
|
1418
|
+
const { t } = useWords("line-chart");
|
|
1419
|
+
let T0;
|
|
1420
|
+
let t0;
|
|
1421
|
+
if ($[0] !== t) {
|
|
1422
|
+
const cohorts = TRIALS.map((t1, at) => {
|
|
1423
|
+
const { retained, size } = t1;
|
|
1424
|
+
return {
|
|
1425
|
+
key: `w${String(at + 1)}`,
|
|
1426
|
+
label: t("retention.cohort", { week: at + 1 }),
|
|
1427
|
+
retained,
|
|
1428
|
+
size
|
|
1429
|
+
};
|
|
1430
|
+
});
|
|
1431
|
+
T0 = LineChart$1;
|
|
1432
|
+
t0 = retentionSeries(cohorts, {
|
|
1433
|
+
averageLabel: t("retention.average"),
|
|
1434
|
+
periodLabel: (week) => t("retention.period", { week }),
|
|
1435
|
+
sparseLabel: t("retention.sparse")
|
|
1436
|
+
});
|
|
1437
|
+
$[0] = t;
|
|
1438
|
+
$[1] = T0;
|
|
1439
|
+
$[2] = t0;
|
|
1440
|
+
} else {
|
|
1441
|
+
T0 = $[1];
|
|
1442
|
+
t0 = $[2];
|
|
1443
|
+
}
|
|
1444
|
+
let t1;
|
|
1445
|
+
if ($[3] !== t) {
|
|
1446
|
+
t1 = t("retention.caption");
|
|
1447
|
+
$[3] = t;
|
|
1448
|
+
$[4] = t1;
|
|
1449
|
+
} else t1 = $[4];
|
|
1450
|
+
let t2;
|
|
1451
|
+
if ($[5] !== t) {
|
|
1452
|
+
t2 = t("retention.label");
|
|
1453
|
+
$[5] = t;
|
|
1454
|
+
$[6] = t2;
|
|
1455
|
+
} else t2 = $[6];
|
|
1456
|
+
let t3;
|
|
1457
|
+
if ($[7] !== T0 || $[8] !== t0 || $[9] !== t1 || $[10] !== t2) {
|
|
1458
|
+
t3 = /* @__PURE__ */ jsx(T0, {
|
|
1459
|
+
...t0,
|
|
1460
|
+
caption: t1,
|
|
1461
|
+
label: t2
|
|
1462
|
+
});
|
|
1463
|
+
$[7] = T0;
|
|
1464
|
+
$[8] = t0;
|
|
1465
|
+
$[9] = t1;
|
|
1466
|
+
$[10] = t2;
|
|
1467
|
+
$[11] = t3;
|
|
1468
|
+
} else t3 = $[11];
|
|
1469
|
+
return t3;
|
|
1470
|
+
}
|
|
1471
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart, retentionSeries } from \"@stealthscale/component-charts\";\n\nconst TRIALS = [420, 385, 440, 398, 412, 455, 430, 402, 447, 390].map((size, at) => {\n const first = (at >= 5 ? 0.62 : 0.5) + (((at * 7) % 5) - 2) * 0.015;\n const kept = 0.86 + ((at * 3) % 4) * 0.015;\n\n return {\n retained: Array.from({ length: 10 - at }, (_, week) =>\n week === 0 ? size : Math.round(size * first * kept ** (week - 1)),\n ),\n size,\n };\n});\n\nexport function Retention(): ReactElement {\n const { t } = useWords(\"line-chart\");\n const cohorts = TRIALS.map(({ retained, size }, at) => ({\n key: `w${String(at + 1)}`,\n label: t(\"retention.cohort\", { week: at + 1 }),\n retained,\n size,\n }));\n\n return (\n <LineChart\n {...retentionSeries(cohorts, {\n averageLabel: t(\"retention.average\"),\n periodLabel: (week) => t(\"retention.period\", { week }),\n sparseLabel: t(\"retention.sparse\"),\n })}\n caption={t(\"retention.caption\")}\n label={t(\"retention.label\")}\n />\n );\n}\n";
|
|
1472
|
+
//#endregion
|
|
1473
|
+
//#region src/line-chart/examples/uptime.example.tsx
|
|
1474
|
+
var uptime_example_exports = /* @__PURE__ */ __exportAll({
|
|
1475
|
+
Uptime: () => Uptime,
|
|
1476
|
+
source: () => source$1
|
|
1477
|
+
});
|
|
1478
|
+
const DAYS$1 = [
|
|
1479
|
+
.9998,
|
|
1480
|
+
.9999,
|
|
1481
|
+
.9995,
|
|
1482
|
+
1,
|
|
1483
|
+
.9997,
|
|
1484
|
+
.9999,
|
|
1485
|
+
.9994,
|
|
1486
|
+
.9998,
|
|
1487
|
+
.9999,
|
|
1488
|
+
.9971,
|
|
1489
|
+
.9992,
|
|
1490
|
+
.9998,
|
|
1491
|
+
1,
|
|
1492
|
+
.9999
|
|
1493
|
+
].map((availability, index) => ({
|
|
1494
|
+
availability,
|
|
1495
|
+
day: `2026-09-${String(index + 15)}`
|
|
1496
|
+
}));
|
|
1497
|
+
function Uptime() {
|
|
1498
|
+
const $ = c(15);
|
|
1499
|
+
const { t } = useWords("line-chart");
|
|
1500
|
+
let t0;
|
|
1501
|
+
if ($[0] !== t) {
|
|
1502
|
+
t0 = t("uptime.caption");
|
|
1503
|
+
$[0] = t;
|
|
1504
|
+
$[1] = t0;
|
|
1505
|
+
} else t0 = $[1];
|
|
1506
|
+
let t1;
|
|
1507
|
+
if ($[2] !== t) {
|
|
1508
|
+
t1 = t("uptime.label");
|
|
1509
|
+
$[2] = t;
|
|
1510
|
+
$[3] = t1;
|
|
1511
|
+
} else t1 = $[3];
|
|
1512
|
+
let t2;
|
|
1513
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1514
|
+
t2 = {
|
|
1515
|
+
day: "numeric",
|
|
1516
|
+
month: "short",
|
|
1517
|
+
timeZone: "UTC"
|
|
1518
|
+
};
|
|
1519
|
+
$[4] = t2;
|
|
1520
|
+
} else t2 = $[4];
|
|
1521
|
+
let t3;
|
|
1522
|
+
if ($[5] !== t) {
|
|
1523
|
+
t3 = t("uptime.availability");
|
|
1524
|
+
$[5] = t;
|
|
1525
|
+
$[6] = t3;
|
|
1526
|
+
} else t3 = $[6];
|
|
1527
|
+
let t4;
|
|
1528
|
+
if ($[7] !== t3) {
|
|
1529
|
+
t4 = [{
|
|
1530
|
+
color: "success",
|
|
1531
|
+
key: "availability",
|
|
1532
|
+
label: t3
|
|
1533
|
+
}];
|
|
1534
|
+
$[7] = t3;
|
|
1535
|
+
$[8] = t4;
|
|
1536
|
+
} else t4 = $[8];
|
|
1537
|
+
let t5;
|
|
1538
|
+
let t6;
|
|
1539
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1540
|
+
t5 = [.99, 1];
|
|
1541
|
+
t6 = {
|
|
1542
|
+
maximumFractionDigits: 2,
|
|
1543
|
+
style: "percent"
|
|
1544
|
+
};
|
|
1545
|
+
$[9] = t5;
|
|
1546
|
+
$[10] = t6;
|
|
1547
|
+
} else {
|
|
1548
|
+
t5 = $[9];
|
|
1549
|
+
t6 = $[10];
|
|
1550
|
+
}
|
|
1551
|
+
let t7;
|
|
1552
|
+
if ($[11] !== t0 || $[12] !== t1 || $[13] !== t4) {
|
|
1553
|
+
t7 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1554
|
+
caption: t0,
|
|
1555
|
+
categoryKey: "day",
|
|
1556
|
+
curve: "linear",
|
|
1557
|
+
data: DAYS$1,
|
|
1558
|
+
label: t1,
|
|
1559
|
+
labelOptions: t2,
|
|
1560
|
+
series: t4,
|
|
1561
|
+
valueDomain: t5,
|
|
1562
|
+
valueOptions: t6
|
|
1563
|
+
});
|
|
1564
|
+
$[11] = t0;
|
|
1565
|
+
$[12] = t1;
|
|
1566
|
+
$[13] = t4;
|
|
1567
|
+
$[14] = t7;
|
|
1568
|
+
} else t7 = $[14];
|
|
1569
|
+
return t7;
|
|
1570
|
+
}
|
|
1571
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n 0.9998, 0.9999, 0.9995, 1, 0.9997, 0.9999, 0.9994, 0.9998, 0.9999, 0.9971, 0.9992, 0.9998, 1,\n 0.9999,\n].map((availability, index) => ({\n availability,\n day: `2026-09-${String(index + 15)}`,\n}));\n\nexport function Uptime(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"uptime.caption\")}\n categoryKey=\"day\"\n curve=\"linear\"\n data={DAYS}\n label={t(\"uptime.label\")}\n labelOptions={{ day: \"numeric\", month: \"short\", timeZone: \"UTC\" }}\n series={[{ color: \"success\", key: \"availability\", label: t(\"uptime.availability\") }]}\n valueDomain={[0.99, 1]}\n valueOptions={{ maximumFractionDigits: 2, style: \"percent\" }}\n />\n );\n}\n";
|
|
1572
|
+
//#endregion
|
|
1573
|
+
//#region src/line-chart/examples/revenue.example.tsx
|
|
1574
|
+
var revenue_example_exports = /* @__PURE__ */ __exportAll({
|
|
1575
|
+
Revenue: () => Revenue,
|
|
1576
|
+
source: () => source
|
|
1577
|
+
});
|
|
1578
|
+
const DAYS = [
|
|
1579
|
+
{
|
|
1580
|
+
day: "2026-09-21",
|
|
1581
|
+
revenue: 18200
|
|
1582
|
+
},
|
|
1583
|
+
{
|
|
1584
|
+
day: "2026-09-22",
|
|
1585
|
+
revenue: 21400
|
|
1586
|
+
},
|
|
1587
|
+
{
|
|
1588
|
+
day: "2026-09-23",
|
|
1589
|
+
revenue: 20100
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
day: "2026-09-24",
|
|
1593
|
+
revenue: 24800
|
|
1594
|
+
},
|
|
1595
|
+
{
|
|
1596
|
+
day: "2026-09-25",
|
|
1597
|
+
revenue: 26300
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
day: "2026-09-26",
|
|
1601
|
+
revenue: 15900
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
day: "2026-09-27",
|
|
1605
|
+
revenue: 14700
|
|
1606
|
+
}
|
|
1607
|
+
];
|
|
1608
|
+
function Revenue() {
|
|
1609
|
+
const $ = c(14);
|
|
1610
|
+
const { t } = useWords("line-chart");
|
|
1611
|
+
let t0;
|
|
1612
|
+
if ($[0] !== t) {
|
|
1613
|
+
t0 = t("revenue.caption");
|
|
1614
|
+
$[0] = t;
|
|
1615
|
+
$[1] = t0;
|
|
1616
|
+
} else t0 = $[1];
|
|
1617
|
+
let t1;
|
|
1618
|
+
if ($[2] !== t) {
|
|
1619
|
+
t1 = t("revenue.label");
|
|
1620
|
+
$[2] = t;
|
|
1621
|
+
$[3] = t1;
|
|
1622
|
+
} else t1 = $[3];
|
|
1623
|
+
let t2;
|
|
1624
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1625
|
+
t2 = {
|
|
1626
|
+
timeZone: "UTC",
|
|
1627
|
+
weekday: "short"
|
|
1628
|
+
};
|
|
1629
|
+
$[4] = t2;
|
|
1630
|
+
} else t2 = $[4];
|
|
1631
|
+
let t3;
|
|
1632
|
+
if ($[5] !== t) {
|
|
1633
|
+
t3 = t("revenue.revenue");
|
|
1634
|
+
$[5] = t;
|
|
1635
|
+
$[6] = t3;
|
|
1636
|
+
} else t3 = $[6];
|
|
1637
|
+
let t4;
|
|
1638
|
+
if ($[7] !== t3) {
|
|
1639
|
+
t4 = [{
|
|
1640
|
+
key: "revenue",
|
|
1641
|
+
label: t3
|
|
1642
|
+
}];
|
|
1643
|
+
$[7] = t3;
|
|
1644
|
+
$[8] = t4;
|
|
1645
|
+
} else t4 = $[8];
|
|
1646
|
+
let t5;
|
|
1647
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
1648
|
+
t5 = {
|
|
1649
|
+
currency: "EUR",
|
|
1650
|
+
maximumFractionDigits: 0,
|
|
1651
|
+
style: "currency"
|
|
1652
|
+
};
|
|
1653
|
+
$[9] = t5;
|
|
1654
|
+
} else t5 = $[9];
|
|
1655
|
+
let t6;
|
|
1656
|
+
if ($[10] !== t0 || $[11] !== t1 || $[12] !== t4) {
|
|
1657
|
+
t6 = /* @__PURE__ */ jsx(LineChart$1, {
|
|
1658
|
+
caption: t0,
|
|
1659
|
+
categoryKey: "day",
|
|
1660
|
+
data: DAYS,
|
|
1661
|
+
label: t1,
|
|
1662
|
+
labelOptions: t2,
|
|
1663
|
+
series: t4,
|
|
1664
|
+
valueOptions: t5
|
|
1665
|
+
});
|
|
1666
|
+
$[10] = t0;
|
|
1667
|
+
$[11] = t1;
|
|
1668
|
+
$[12] = t4;
|
|
1669
|
+
$[13] = t6;
|
|
1670
|
+
} else t6 = $[13];
|
|
1671
|
+
return t6;
|
|
1672
|
+
}
|
|
1673
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { LineChart } from \"@stealthscale/component-charts\";\n\nconst DAYS = [\n { day: \"2026-09-21\", revenue: 18_200 },\n { day: \"2026-09-22\", revenue: 21_400 },\n { day: \"2026-09-23\", revenue: 20_100 },\n { day: \"2026-09-24\", revenue: 24_800 },\n { day: \"2026-09-25\", revenue: 26_300 },\n { day: \"2026-09-26\", revenue: 15_900 },\n { day: \"2026-09-27\", revenue: 14_700 },\n];\n\nexport function Revenue(): ReactElement {\n const { t } = useWords(\"line-chart\");\n\n return (\n <LineChart\n caption={t(\"revenue.caption\")}\n categoryKey=\"day\"\n data={DAYS}\n label={t(\"revenue.label\")}\n labelOptions={{ timeZone: \"UTC\", weekday: \"short\" }}\n series={[{ key: \"revenue\", label: t(\"revenue.revenue\") }]}\n valueOptions={{ currency: \"EUR\", maximumFractionDigits: 0, style: \"currency\" }}\n />\n );\n}\n";
|
|
1674
|
+
//#endregion
|
|
1675
|
+
//#region src/line-chart/line-chart.specimen.tsx
|
|
1676
|
+
/**
|
|
1677
|
+
* Catalogue page for the line chart.
|
|
1678
|
+
*
|
|
1679
|
+
* @remarks
|
|
1680
|
+
* The line chart has no recipe of its own: the chart's recipe styles its figure, so every scene
|
|
1681
|
+
* is hand-written. The scenes render revenue in euros, latency percentiles with a dashed target,
|
|
1682
|
+
* the tooltip open at the peak, the lines animated in with a replay, availability on a range of
|
|
1683
|
+
* its own, spend under a reference line, a legend the caller controls, retention by cohort,
|
|
1684
|
+
* releases and a freeze as annotations, flagged points, this week against last week, a crosshair,
|
|
1685
|
+
* the revenue at a phone's width, and a range without rows. Every scene renders a component from
|
|
1686
|
+
* `examples/` and shows that file as its source. The words are keys under `line-chart` in
|
|
1687
|
+
* `locales/en/specimen/line-chart.json`. The page imports the revenue example directly, because
|
|
1688
|
+
* the props reader follows a specimen's own imports and the example files they name, not an
|
|
1689
|
+
* examples barrel.
|
|
1690
|
+
*/
|
|
1691
|
+
/**
|
|
1692
|
+
* Hand-written scene for one series.
|
|
1693
|
+
*/
|
|
1694
|
+
const one = {
|
|
1695
|
+
about: "line-chart.revenue.about",
|
|
1696
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1697
|
+
size: "lg",
|
|
1698
|
+
children: /* @__PURE__ */ jsx(Revenue, {})
|
|
1699
|
+
}),
|
|
1700
|
+
example: revenue_example_exports,
|
|
1701
|
+
title: "line-chart.revenue.title"
|
|
1702
|
+
};
|
|
1703
|
+
/**
|
|
1704
|
+
* Hand-written scene for several series with a dashed target.
|
|
1705
|
+
*/
|
|
1706
|
+
const several = {
|
|
1707
|
+
about: "line-chart.latency.about",
|
|
1708
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1709
|
+
size: "lg",
|
|
1710
|
+
children: /* @__PURE__ */ jsx(Latency, {})
|
|
1711
|
+
}),
|
|
1712
|
+
example: latency_example_exports,
|
|
1713
|
+
title: "line-chart.latency.title"
|
|
1714
|
+
};
|
|
1715
|
+
/**
|
|
1716
|
+
* Hand-written scene for the tooltip open at a row.
|
|
1717
|
+
*/
|
|
1718
|
+
const tooltip = {
|
|
1719
|
+
about: "line-chart.peak.about",
|
|
1720
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1721
|
+
size: "lg",
|
|
1722
|
+
children: /* @__PURE__ */ jsx(Peak, {})
|
|
1723
|
+
}),
|
|
1724
|
+
example: peak_example_exports,
|
|
1725
|
+
title: "line-chart.peak.title"
|
|
1726
|
+
};
|
|
1727
|
+
/**
|
|
1728
|
+
* Hand-written scene for the lines animated in, with a replay.
|
|
1729
|
+
*/
|
|
1730
|
+
const animated = {
|
|
1731
|
+
about: "line-chart.replay.about",
|
|
1732
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1733
|
+
size: "lg",
|
|
1734
|
+
children: /* @__PURE__ */ jsx(Replay, {})
|
|
1735
|
+
}),
|
|
1736
|
+
example: replay_example_exports,
|
|
1737
|
+
title: "line-chart.replay.title"
|
|
1738
|
+
};
|
|
1739
|
+
/**
|
|
1740
|
+
* Hand-written scene for a value axis on a range of its own.
|
|
1741
|
+
*/
|
|
1742
|
+
const domain = {
|
|
1743
|
+
about: "line-chart.uptime.about",
|
|
1744
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1745
|
+
size: "lg",
|
|
1746
|
+
children: /* @__PURE__ */ jsx(Uptime, {})
|
|
1747
|
+
}),
|
|
1748
|
+
example: uptime_example_exports,
|
|
1749
|
+
title: "line-chart.uptime.title"
|
|
1750
|
+
};
|
|
1751
|
+
/**
|
|
1752
|
+
* Hand-written scene for a reference line inside the chart.
|
|
1753
|
+
*/
|
|
1754
|
+
const reference = {
|
|
1755
|
+
about: "line-chart.budget.about",
|
|
1756
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1757
|
+
size: "lg",
|
|
1758
|
+
children: /* @__PURE__ */ jsx(Budget, {})
|
|
1759
|
+
}),
|
|
1760
|
+
example: budget_example_exports,
|
|
1761
|
+
title: "line-chart.budget.title"
|
|
1762
|
+
};
|
|
1763
|
+
/**
|
|
1764
|
+
* Hand-written scene for hidden series the caller controls.
|
|
1765
|
+
*/
|
|
1766
|
+
const legend = {
|
|
1767
|
+
about: "line-chart.controlled.about",
|
|
1768
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1769
|
+
size: "lg",
|
|
1770
|
+
children: /* @__PURE__ */ jsx(Controlled, {})
|
|
1771
|
+
}),
|
|
1772
|
+
example: controlled_example_exports,
|
|
1773
|
+
title: "line-chart.controlled.title"
|
|
1774
|
+
};
|
|
1775
|
+
/**
|
|
1776
|
+
* Hand-written scene for retention by cohort.
|
|
1777
|
+
*/
|
|
1778
|
+
const cohorts = {
|
|
1779
|
+
about: "line-chart.retention.about",
|
|
1780
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1781
|
+
size: "2xl",
|
|
1782
|
+
children: /* @__PURE__ */ jsx(Retention, {})
|
|
1783
|
+
}),
|
|
1784
|
+
example: retention_example_exports,
|
|
1785
|
+
title: "line-chart.retention.title"
|
|
1786
|
+
};
|
|
1787
|
+
/**
|
|
1788
|
+
* Hand-written scene for moments and a period marked on the categories.
|
|
1789
|
+
*/
|
|
1790
|
+
const annotated = {
|
|
1791
|
+
about: "line-chart.releases.about",
|
|
1792
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1793
|
+
size: "lg",
|
|
1794
|
+
children: /* @__PURE__ */ jsx(Releases, {})
|
|
1795
|
+
}),
|
|
1796
|
+
example: releases_example_exports,
|
|
1797
|
+
title: "line-chart.releases.title"
|
|
1798
|
+
};
|
|
1799
|
+
/**
|
|
1800
|
+
* Hand-written scene for points flagged in the error and warning palettes.
|
|
1801
|
+
*/
|
|
1802
|
+
const flagged = {
|
|
1803
|
+
about: "line-chart.anomalies.about",
|
|
1804
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1805
|
+
size: "lg",
|
|
1806
|
+
children: /* @__PURE__ */ jsx(Anomalies, {})
|
|
1807
|
+
}),
|
|
1808
|
+
example: anomalies_example_exports,
|
|
1809
|
+
title: "line-chart.anomalies.title"
|
|
1810
|
+
};
|
|
1811
|
+
/**
|
|
1812
|
+
* Hand-written scene for this week against last week.
|
|
1813
|
+
*/
|
|
1814
|
+
const compared = {
|
|
1815
|
+
about: "line-chart.comparison.about",
|
|
1816
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1817
|
+
size: "lg",
|
|
1818
|
+
children: /* @__PURE__ */ jsx(Comparison, {})
|
|
1819
|
+
}),
|
|
1820
|
+
example: comparison_example_exports,
|
|
1821
|
+
title: "line-chart.comparison.title"
|
|
1822
|
+
};
|
|
1823
|
+
/**
|
|
1824
|
+
* Hand-written scene for a guide at the active row's value.
|
|
1825
|
+
*/
|
|
1826
|
+
const crosshair = {
|
|
1827
|
+
about: "line-chart.guide.about",
|
|
1828
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1829
|
+
size: "lg",
|
|
1830
|
+
children: /* @__PURE__ */ jsx(Guide, {})
|
|
1831
|
+
}),
|
|
1832
|
+
example: guide_example_exports,
|
|
1833
|
+
title: "line-chart.guide.title"
|
|
1834
|
+
};
|
|
1835
|
+
/**
|
|
1836
|
+
* Hand-written scene for one series at a phone's width.
|
|
1837
|
+
*/
|
|
1838
|
+
const narrow = {
|
|
1839
|
+
about: "line-chart.narrow.about",
|
|
1840
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1841
|
+
size: "xs",
|
|
1842
|
+
children: /* @__PURE__ */ jsx(Revenue, {})
|
|
1843
|
+
}),
|
|
1844
|
+
example: revenue_example_exports,
|
|
1845
|
+
title: "line-chart.narrow.title"
|
|
1846
|
+
};
|
|
1847
|
+
/**
|
|
1848
|
+
* Hand-written scene for a range without rows.
|
|
1849
|
+
*/
|
|
1850
|
+
const empty = {
|
|
1851
|
+
about: "line-chart.quiet.about",
|
|
1852
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1853
|
+
size: "md",
|
|
1854
|
+
children: /* @__PURE__ */ jsx(Quiet, {})
|
|
1855
|
+
}),
|
|
1856
|
+
example: quiet_example_exports,
|
|
1857
|
+
title: "line-chart.quiet.title"
|
|
1858
|
+
};
|
|
1859
|
+
var line_chart_specimen_default = specimen({
|
|
1860
|
+
about: "line-chart.about",
|
|
1861
|
+
id: "components/charts/line-chart",
|
|
1862
|
+
imports: "import { LineChart } from \"@stealthscale/component-charts\";",
|
|
1863
|
+
scenes: [
|
|
1864
|
+
one,
|
|
1865
|
+
several,
|
|
1866
|
+
tooltip,
|
|
1867
|
+
animated,
|
|
1868
|
+
domain,
|
|
1869
|
+
reference,
|
|
1870
|
+
legend,
|
|
1871
|
+
cohorts,
|
|
1872
|
+
annotated,
|
|
1873
|
+
flagged,
|
|
1874
|
+
compared,
|
|
1875
|
+
crosshair,
|
|
1876
|
+
narrow,
|
|
1877
|
+
empty
|
|
1878
|
+
],
|
|
1879
|
+
title: "line-chart.title"
|
|
1880
|
+
});
|
|
1881
|
+
//#endregion
|
|
1882
|
+
export { animated, annotated, cohorts, compared, crosshair, line_chart_specimen_default as default, domain, empty, flagged, legend, narrow, one, reference, several, tooltip };
|