@krizaka/charts 0.3.0 → 0.4.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 +1 -1
- package/dist/actions-5VG352VZ.js +53 -0
- package/dist/actions-5VG352VZ.js.map +1 -0
- package/dist/bar.d.ts +3 -3
- package/dist/bar.js +7 -6
- package/dist/candlestick.d.ts +2 -2
- package/dist/candlestick.js +6 -5
- package/dist/card.d.ts +52 -0
- package/dist/card.js +19 -0
- package/dist/card.js.map +1 -0
- package/dist/{cartesian-BRhNQ3ib.d.ts → cartesian-CEY_wwe_.d.ts} +12 -2
- package/dist/chart.d.ts +2 -2
- package/dist/chart.js +5 -4
- package/dist/{chunk-BV4DBGN7.js → chunk-7W4T255Q.js} +4 -4
- package/dist/{chunk-W5ILLSPK.js → chunk-AGSSNMK5.js} +5 -5
- package/dist/{chunk-VKZZY2QD.js → chunk-FE4LUGAE.js} +5 -5
- package/dist/{chunk-ARARFMNE.js → chunk-FIQHMJZK.js} +5 -5
- package/dist/chunk-FIQHMJZK.js.map +1 -0
- package/dist/{chunk-ANUCSRUN.js → chunk-GD7TWEN3.js} +3 -3
- package/dist/chunk-GRRFPI27.js +89 -0
- package/dist/chunk-GRRFPI27.js.map +1 -0
- package/dist/{chunk-SLEJDQ3A.js → chunk-HH65IEUV.js} +3 -3
- package/dist/{chunk-OIRHLJBC.js → chunk-IJTI6VJD.js} +3 -3
- package/dist/{chunk-WVTIKOII.js → chunk-IURCLBUQ.js} +2 -2
- package/dist/{chunk-CVWSMUUB.js → chunk-JST4HJC3.js} +33 -15
- package/dist/chunk-JST4HJC3.js.map +1 -0
- package/dist/{chunk-IKQV3NSL.js → chunk-KERGFVSN.js} +3 -3
- package/dist/{chunk-XDDALY4C.js → chunk-KMQ7RANJ.js} +5 -5
- package/dist/{chunk-NCIQMRV3.js → chunk-LLUQEK5J.js} +5 -5
- package/dist/{chunk-AA5EWWYV.js → chunk-LZPZWBBY.js} +2 -2
- package/dist/{chunk-PBQV3B6O.js → chunk-MK2ZFUWM.js} +31 -16
- package/dist/chunk-MK2ZFUWM.js.map +1 -0
- package/dist/{chunk-CSSZLFLO.js → chunk-MRGMLDNS.js} +5 -5
- package/dist/{chunk-I3D7KUGN.js → chunk-NLTZWJLV.js} +3 -3
- package/dist/{chunk-PWMMXRMC.js → chunk-NV52AKHG.js} +3 -3
- package/dist/{chunk-MXLITIGU.js → chunk-NWJ5VDN7.js} +5 -5
- package/dist/{chunk-3CJHBJXA.js → chunk-OVASCEGF.js} +12 -73
- package/dist/chunk-OVASCEGF.js.map +1 -0
- package/dist/{chunk-EQLC2QVN.js → chunk-OZOAKP5F.js} +4 -4
- package/dist/chunk-OZOAKP5F.js.map +1 -0
- package/dist/{chunk-KNDHO67X.js → chunk-P2NK5L3B.js} +3 -3
- package/dist/{chunk-JTKR7ZWP.js → chunk-P6RS2L23.js} +140 -36
- package/dist/chunk-P6RS2L23.js.map +1 -0
- package/dist/{chunk-W5FX4TU3.js → chunk-PGD6SH5I.js} +30 -2
- package/dist/chunk-PGD6SH5I.js.map +1 -0
- package/dist/{chunk-4LBXEAGC.js → chunk-PWZHIGPO.js} +5 -5
- package/dist/{chunk-L2EKYWVI.js → chunk-VEOJNMPF.js} +3 -3
- package/dist/chunk-YHQFW2PR.js +71 -0
- package/dist/chunk-YHQFW2PR.js.map +1 -0
- package/dist/{chunk-C4MFZLJM.js → chunk-Z4T3JFNU.js} +2 -2
- package/dist/{chunk-EEP7PS2L.js → chunk-ZF7LVQTR.js} +3 -3
- package/dist/{context-BgYUymEO.d.ts → context-DNW7bJYw.d.ts} +19 -0
- package/dist/credits.d.ts +1 -1
- package/dist/credits.js +7 -6
- package/dist/earnings.d.ts +3 -3
- package/dist/earnings.js +8 -7
- package/dist/{frame-I7_xYGy5.d.ts → frame-B1HDNm7c.d.ts} +9 -5
- package/dist/funnel.d.ts +2 -2
- package/dist/funnel.js +6 -5
- package/dist/gauge.d.ts +2 -2
- package/dist/gauge.js +4 -3
- package/dist/geo.d.ts +2 -2
- package/dist/geo.js +5 -4
- package/dist/globe.d.ts +2 -2
- package/dist/globe.js +4 -3
- package/dist/goal.d.ts +2 -2
- package/dist/goal.js +5 -4
- package/dist/heatmap.d.ts +2 -2
- package/dist/heatmap.js +6 -5
- package/dist/index.d.ts +5 -3
- package/dist/index.js +45 -37
- package/dist/latency.d.ts +3 -3
- package/dist/latency.js +8 -7
- package/dist/line.d.ts +3 -3
- package/dist/line.js +7 -6
- package/dist/native.d.ts +19 -0
- package/dist/native.js +13 -1
- package/dist/native.js.map +1 -1
- package/dist/pie.d.ts +2 -2
- package/dist/pie.js +6 -5
- package/dist/provider.d.ts +2 -2
- package/dist/provider.js +4 -2
- package/dist/radar.d.ts +2 -2
- package/dist/radar.js +6 -5
- package/dist/sankey.d.ts +2 -2
- package/dist/sankey.js +6 -5
- package/dist/scatter.d.ts +2 -2
- package/dist/scatter.js +6 -5
- package/dist/sparkline.d.ts +2 -2
- package/dist/sparkline.js +6 -5
- package/dist/table-sheet-CQBIAV5N.js +36 -0
- package/dist/table-sheet-CQBIAV5N.js.map +1 -0
- package/dist/throughput.d.ts +3 -3
- package/dist/throughput.js +8 -7
- package/dist/ticker.d.ts +3 -3
- package/dist/ticker.js +8 -7
- package/dist/treemap.d.ts +2 -2
- package/dist/treemap.js +7 -6
- package/package.json +295 -53
- package/registry/area-chart.json +82 -12
- package/registry/bar-chart.json +82 -12
- package/registry/calendar-heatmap.json +46 -18
- package/registry/candlestick.json +46 -18
- package/registry/chart-card.json +235 -0
- package/registry/chart.json +40 -12
- package/registry/charts-provider.json +2 -2
- package/registry/earnings-chart.json +82 -12
- package/registry/examples/chart-card/before-after.d.ts +4 -0
- package/registry/examples/chart-card/before-after.js +22 -0
- package/registry/examples/chart-card/before-after.tsx +22 -0
- package/registry/examples/chart-card/jobs-activity.d.ts +4 -0
- package/registry/examples/chart-card/jobs-activity.js +20 -0
- package/registry/examples/chart-card/jobs-activity.tsx +20 -0
- package/registry/examples/chart-card/sparse-and-empty.d.ts +4 -0
- package/registry/examples/chart-card/sparse-and-empty.js +16 -0
- package/registry/examples/chart-card/sparse-and-empty.tsx +18 -0
- package/registry/examples/chart-card/usage-donut.d.ts +4 -0
- package/registry/examples/chart-card/usage-donut.js +18 -0
- package/registry/examples/chart-card/usage-donut.tsx +18 -0
- package/registry/examples/charts-provider/french-orazaka.js +1 -1
- package/registry/examples/charts-provider/french-orazaka.tsx +1 -1
- package/registry/examples/kpi-stat/dashboard-row.d.ts +4 -0
- package/registry/examples/kpi-stat/dashboard-row.js +19 -0
- package/registry/examples/kpi-stat/dashboard-row.tsx +17 -0
- package/registry/examples/kpi-stat/single.d.ts +4 -0
- package/registry/examples/kpi-stat/single.js +11 -0
- package/registry/examples/kpi-stat/single.tsx +6 -0
- package/registry/funnel.json +46 -18
- package/registry/gauge.json +42 -14
- package/registry/geo-map.json +46 -18
- package/registry/globe.json +40 -12
- package/registry/goal-progress.json +36 -8
- package/registry/heatmap.json +46 -18
- package/registry/index.json +49 -1
- package/registry/job-throughput.json +82 -12
- package/registry/kpi-stat.json +296 -0
- package/registry/latency-chart.json +82 -12
- package/registry/line-chart.json +82 -12
- package/registry/pie-chart.json +92 -36
- package/registry/price-ticker.json +82 -12
- package/registry/radar-chart.json +46 -18
- package/registry/sankey.json +46 -18
- package/registry/scatter-chart.json +46 -18
- package/registry/sparkline.json +38 -10
- package/registry/treemap.json +40 -12
- package/dist/chunk-3CJHBJXA.js.map +0 -1
- package/dist/chunk-ARARFMNE.js.map +0 -1
- package/dist/chunk-CVWSMUUB.js.map +0 -1
- package/dist/chunk-EQLC2QVN.js.map +0 -1
- package/dist/chunk-JTKR7ZWP.js.map +0 -1
- package/dist/chunk-PBQV3B6O.js.map +0 -1
- package/dist/chunk-W5FX4TU3.js.map +0 -1
- /package/dist/{chunk-BV4DBGN7.js.map → chunk-7W4T255Q.js.map} +0 -0
- /package/dist/{chunk-W5ILLSPK.js.map → chunk-AGSSNMK5.js.map} +0 -0
- /package/dist/{chunk-VKZZY2QD.js.map → chunk-FE4LUGAE.js.map} +0 -0
- /package/dist/{chunk-ANUCSRUN.js.map → chunk-GD7TWEN3.js.map} +0 -0
- /package/dist/{chunk-SLEJDQ3A.js.map → chunk-HH65IEUV.js.map} +0 -0
- /package/dist/{chunk-OIRHLJBC.js.map → chunk-IJTI6VJD.js.map} +0 -0
- /package/dist/{chunk-WVTIKOII.js.map → chunk-IURCLBUQ.js.map} +0 -0
- /package/dist/{chunk-IKQV3NSL.js.map → chunk-KERGFVSN.js.map} +0 -0
- /package/dist/{chunk-XDDALY4C.js.map → chunk-KMQ7RANJ.js.map} +0 -0
- /package/dist/{chunk-NCIQMRV3.js.map → chunk-LLUQEK5J.js.map} +0 -0
- /package/dist/{chunk-AA5EWWYV.js.map → chunk-LZPZWBBY.js.map} +0 -0
- /package/dist/{chunk-CSSZLFLO.js.map → chunk-MRGMLDNS.js.map} +0 -0
- /package/dist/{chunk-I3D7KUGN.js.map → chunk-NLTZWJLV.js.map} +0 -0
- /package/dist/{chunk-PWMMXRMC.js.map → chunk-NV52AKHG.js.map} +0 -0
- /package/dist/{chunk-MXLITIGU.js.map → chunk-NWJ5VDN7.js.map} +0 -0
- /package/dist/{chunk-KNDHO67X.js.map → chunk-P2NK5L3B.js.map} +0 -0
- /package/dist/{chunk-4LBXEAGC.js.map → chunk-PWZHIGPO.js.map} +0 -0
- /package/dist/{chunk-L2EKYWVI.js.map → chunk-VEOJNMPF.js.map} +0 -0
- /package/dist/{chunk-C4MFZLJM.js.map → chunk-Z4T3JFNU.js.map} +0 -0
- /package/dist/{chunk-EEP7PS2L.js.map → chunk-ZF7LVQTR.js.map} +0 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chart-card",
|
|
3
|
+
"package": "@krizaka/charts",
|
|
4
|
+
"type": "chart",
|
|
5
|
+
"title": "Chart card",
|
|
6
|
+
"summary": "The frame of a chart: title, one line of insight, the chart, a footer, and the actions menu (view as table, download, copy) — used everywhere a chart is shown.",
|
|
7
|
+
"description": "The frame of a chart: title, one line of insight, the chart, a footer, and the actions menu (view as table, download, copy) — used everywhere a chart is shown.",
|
|
8
|
+
"status": "beta",
|
|
9
|
+
"category": "charts",
|
|
10
|
+
"platforms": "web",
|
|
11
|
+
"engine": null,
|
|
12
|
+
"tier": "ready-made",
|
|
13
|
+
"whenToUse": [
|
|
14
|
+
"Every chart of a dashboard or a usage page: the same frame, the same hierarchy, the same actions.",
|
|
15
|
+
"A chart that needs a period switch or a filter beside its actions menu."
|
|
16
|
+
],
|
|
17
|
+
"whenNotToUse": [
|
|
18
|
+
{
|
|
19
|
+
"when": "A figure with its trend.",
|
|
20
|
+
"use": "kpi-stat"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"when": "A chart that sits inside running text.",
|
|
24
|
+
"use": "sparkline"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"when": "On React Native: the native charts draw their own frame."
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"bestPractices": [
|
|
31
|
+
"Write the insight from the data, in one line: the figure first, then the change (`100 jobs · +100 % vs last week`).",
|
|
32
|
+
"Leave the chart without a title: the card hands it its own, which stays the chart's accessible name.",
|
|
33
|
+
"Zoom the time axis on the period that has data with `autoRange` rather than drawing empty days.",
|
|
34
|
+
"Keep the footer for the source and the freshness; never a second insight."
|
|
35
|
+
],
|
|
36
|
+
"accessibility": {
|
|
37
|
+
"keyboard": [],
|
|
38
|
+
"notes": [
|
|
39
|
+
"The chart keeps its data table in the page, its written summary and its keyboard walk inside the card.",
|
|
40
|
+
"The actions menu is a real menu: arrow keys, Escape, focus returned to the ⋯ button; the table opens in a sheet with a focus trap.",
|
|
41
|
+
"Legend chips are toggle buttons (`aria-pressed`); the last visible series cannot be switched off."
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"related": [
|
|
45
|
+
"kpi-stat",
|
|
46
|
+
"line-chart",
|
|
47
|
+
"bar-chart",
|
|
48
|
+
"pie-chart",
|
|
49
|
+
"sparkline"
|
|
50
|
+
],
|
|
51
|
+
"source": "packages/charts/src/meta/chart-card.ts",
|
|
52
|
+
"install": {
|
|
53
|
+
"web": "npm install @krizaka/charts",
|
|
54
|
+
"native": "npx expo install react-native-svg\nnpm install @krizaka/charts"
|
|
55
|
+
},
|
|
56
|
+
"web": {
|
|
57
|
+
"entry": "@krizaka/charts/card",
|
|
58
|
+
"import": "import { ChartCard } from \"@krizaka/charts/card\";",
|
|
59
|
+
"props": [
|
|
60
|
+
{
|
|
61
|
+
"component": "ChartCard",
|
|
62
|
+
"description": "The frame of a chart: title, insight, actions, chart, footer — used everywhere a chart is shown.",
|
|
63
|
+
"props": [
|
|
64
|
+
{
|
|
65
|
+
"name": "children",
|
|
66
|
+
"type": "ReactNode",
|
|
67
|
+
"default": null,
|
|
68
|
+
"description": "The chart (`LineChart`, `BarChart`, `DonutChart`…), without its own title.",
|
|
69
|
+
"required": true
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "title",
|
|
73
|
+
"type": "string",
|
|
74
|
+
"default": null,
|
|
75
|
+
"description": "What the chart shows, in a few words (a heading and the chart's accessible name).",
|
|
76
|
+
"required": true
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "actions",
|
|
80
|
+
"type": "ReactNode",
|
|
81
|
+
"default": null,
|
|
82
|
+
"description": "Controls beside the actions menu: a period switch, a filter.",
|
|
83
|
+
"required": false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "className",
|
|
87
|
+
"type": "string",
|
|
88
|
+
"default": null,
|
|
89
|
+
"description": "A class on the card (layout: grid placement).",
|
|
90
|
+
"required": false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "description",
|
|
94
|
+
"type": "ReactNode",
|
|
95
|
+
"default": null,
|
|
96
|
+
"description": "The period, the unit, the source — under the insight.",
|
|
97
|
+
"required": false
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "footer",
|
|
101
|
+
"type": "ReactNode",
|
|
102
|
+
"default": null,
|
|
103
|
+
"description": "A line under the chart: the source, the freshness, a link.",
|
|
104
|
+
"required": false
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "id",
|
|
108
|
+
"type": "string",
|
|
109
|
+
"default": null,
|
|
110
|
+
"description": "The id of the card.",
|
|
111
|
+
"required": false
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "insight",
|
|
115
|
+
"type": "ReactNode",
|
|
116
|
+
"default": null,
|
|
117
|
+
"description": "One line that says what the chart shows: “100 jobs · +100 % vs last week”. Written by the app, from its data.",
|
|
118
|
+
"required": false
|
|
119
|
+
}
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
"examples": [
|
|
124
|
+
{
|
|
125
|
+
"name": "jobs-activity",
|
|
126
|
+
"title": "Jobs per day",
|
|
127
|
+
"description": "Stacked bars by outcome, an insight, a footer and the actions menu.",
|
|
128
|
+
"path": "examples/chart-card/jobs-activity.tsx",
|
|
129
|
+
"module": "@krizaka/charts/registry/examples/chart-card/jobs-activity",
|
|
130
|
+
"code": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartCard } from \"@krizaka/charts/card\";\n\nconst days = [\"2026-10-03\", \"2026-10-04\", \"2026-10-05\", \"2026-10-06\", \"2026-10-07\", \"2026-10-08\", \"2026-10-09\", \"2026-10-10\"];\nconst completed = [12, 18, 9, 22, 31, 27, 35, 41];\nconst failed = [1, 0, 2, 1, 3, 0, 1, 2];\nconst data = days.map((day, i) => ({ day, completed: completed[i], failed: failed[i] }));\nconst series = [\n { key: \"completed\", label: \"Completed\", color: \"accent\" },\n { key: \"failed\", label: \"Failed\", color: \"danger\" },\n] as const;\n\n// The card hands the chart its title and insight; the ⋯ menu (table, CSV, PNG, SVG, copy) comes with it.\nexport default function JobsActivity() {\n return (\n <ChartCard title=\"Jobs per day\" insight=\"195 jobs · +24 % vs the week before\" footer=\"Read from your own jobs — nothing estimated.\">\n <BarChart data={data} x=\"day\" xFormat=\"day\" xLabel=\"Day\" series={series} stacked format=\"integer\" height={220} autoRange />\n </ChartCard>\n );\n}\n"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"name": "usage-donut",
|
|
134
|
+
"title": "What you made",
|
|
135
|
+
"description": "A donut whose legend chips carry values and filter the ring.",
|
|
136
|
+
"path": "examples/chart-card/usage-donut.tsx",
|
|
137
|
+
"module": "@krizaka/charts/registry/examples/chart-card/usage-donut",
|
|
138
|
+
"code": "import { ChartCard } from \"@krizaka/charts/card\";\nimport { DonutChart } from \"@krizaka/charts/pie\";\n\nconst kinds = [\n { kind: \"Images\", jobs: 96 },\n { kind: \"Video\", jobs: 41 },\n { kind: \"Audio\", jobs: 33 },\n { kind: \"Text\", jobs: 25 },\n];\n\n// Legend chips carry the value and the share, and switch a part off: click “Video” and the ring re-measures.\nexport default function UsageDonut() {\n return (\n <ChartCard title=\"What you made\" insight=\"195 jobs, most of them images\" description=\"Jobs by kind, last 7 days.\">\n <DonutChart data={kinds} label=\"kind\" value=\"jobs\" labelHeader=\"Kind\" valueHeader=\"Jobs\" centerLabel=\"jobs\" format=\"integer\" height={220} />\n </ChartCard>\n );\n}\n"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "sparse-and-empty",
|
|
142
|
+
"title": "Sparse and empty",
|
|
143
|
+
"description": "The time axis zoomed on the active period, and a calm empty state.",
|
|
144
|
+
"path": "examples/chart-card/sparse-and-empty.tsx",
|
|
145
|
+
"module": "@krizaka/charts/registry/examples/chart-card/sparse-and-empty",
|
|
146
|
+
"code": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartCard } from \"@krizaka/charts/card\";\n\nconst days = Array.from({ length: 30 }, (_, i) => ({ day: `2026-09-${String(i + 1).padStart(2, \"0\")}`, jobs: i === 27 ? 100 : 0 }));\n\n// 29 empty days and one bar: `autoRange` zooms on the active period and says how sparse it is. No data: a calm state.\nexport default function SparseAndEmpty() {\n return (\n <div style={{ display: \"grid\", gap: 16, gridTemplateColumns: \"repeat(auto-fit, minmax(280px, 1fr))\" }}>\n <ChartCard title=\"Jobs per day\" insight=\"100 jobs on Sep 28\">\n <BarChart data={days} x=\"day\" xFormat=\"day\" y=\"jobs\" yLabel=\"Jobs\" format=\"integer\" height={180} autoRange />\n </ChartCard>\n <ChartCard title=\"Failed jobs\" insight=\"Nothing failed yet\">\n <BarChart data={[]} x=\"day\" y=\"jobs\" yLabel=\"Jobs\" height={180} />\n </ChartCard>\n </div>\n );\n}\n"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "before-after",
|
|
150
|
+
"title": "Before and after",
|
|
151
|
+
"description": "The same chart bare, then in a ChartCard.",
|
|
152
|
+
"path": "examples/chart-card/before-after.tsx",
|
|
153
|
+
"module": "@krizaka/charts/registry/examples/chart-card/before-after",
|
|
154
|
+
"code": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartCard } from \"@krizaka/charts/card\";\n\nconst data = [\"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\", \"Sun\"].map((day, i) => ({ day, jobs: [12, 18, 9, 22, 31, 27, 35][i] }));\n\n// Before: a bare chart, “Show data” and the exports as text buttons. After: the same chart in a ChartCard.\nexport default function BeforeAfter() {\n return (\n <div style={{ display: \"grid\", gap: 16, gridTemplateColumns: \"repeat(auto-fit, minmax(280px, 1fr))\" }}>\n <div>\n <p style={{ margin: \"0 0 8px\", fontSize: 12, color: \"var(--kz-text-secondary)\" }}>Before</p>\n <BarChart title=\"Jobs per day\" data={data} x=\"day\" y=\"jobs\" yLabel=\"Jobs\" height={180} actionsMenu={false} exportable />\n </div>\n <div>\n <p style={{ margin: \"0 0 8px\", fontSize: 12, color: \"var(--kz-text-secondary)\" }}>After</p>\n <ChartCard title=\"Jobs per day\" insight=\"154 jobs · busiest on Sunday\" footer=\"Source: your own jobs.\">\n <BarChart data={data} x=\"day\" y=\"jobs\" yLabel=\"Jobs\" height={180} />\n </ChartCard>\n </div>\n </div>\n );\n}\n"
|
|
155
|
+
}
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"native": null,
|
|
159
|
+
"files": [],
|
|
160
|
+
"dependencies": [
|
|
161
|
+
"@krizaka/intl@workspace:^",
|
|
162
|
+
"d3-geo@^3.1.1",
|
|
163
|
+
"echarts@^6.1.0",
|
|
164
|
+
"topojson-client@^3.1.0"
|
|
165
|
+
],
|
|
166
|
+
"registryDependencies": [],
|
|
167
|
+
"demo": {
|
|
168
|
+
"path": "examples/chart-card/jobs-activity.tsx",
|
|
169
|
+
"content": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartCard } from \"@krizaka/charts/card\";\n\nconst days = [\"2026-10-03\", \"2026-10-04\", \"2026-10-05\", \"2026-10-06\", \"2026-10-07\", \"2026-10-08\", \"2026-10-09\", \"2026-10-10\"];\nconst completed = [12, 18, 9, 22, 31, 27, 35, 41];\nconst failed = [1, 0, 2, 1, 3, 0, 1, 2];\nconst data = days.map((day, i) => ({ day, completed: completed[i], failed: failed[i] }));\nconst series = [\n { key: \"completed\", label: \"Completed\", color: \"accent\" },\n { key: \"failed\", label: \"Failed\", color: \"danger\" },\n] as const;\n\n// The card hands the chart its title and insight; the ⋯ menu (table, CSV, PNG, SVG, copy) comes with it.\nexport default function JobsActivity() {\n return (\n <ChartCard title=\"Jobs per day\" insight=\"195 jobs · +24 % vs the week before\" footer=\"Read from your own jobs — nothing estimated.\">\n <BarChart data={data} x=\"day\" xFormat=\"day\" xLabel=\"Day\" series={series} stacked format=\"integer\" height={220} autoRange />\n </ChartCard>\n );\n}\n"
|
|
170
|
+
},
|
|
171
|
+
"props": [
|
|
172
|
+
{
|
|
173
|
+
"component": "ChartCard",
|
|
174
|
+
"description": "The frame of a chart: title, insight, actions, chart, footer — used everywhere a chart is shown.",
|
|
175
|
+
"props": [
|
|
176
|
+
{
|
|
177
|
+
"name": "children",
|
|
178
|
+
"type": "ReactNode",
|
|
179
|
+
"default": null,
|
|
180
|
+
"description": "The chart (`LineChart`, `BarChart`, `DonutChart`…), without its own title.",
|
|
181
|
+
"required": true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "title",
|
|
185
|
+
"type": "string",
|
|
186
|
+
"default": null,
|
|
187
|
+
"description": "What the chart shows, in a few words (a heading and the chart's accessible name).",
|
|
188
|
+
"required": true
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "actions",
|
|
192
|
+
"type": "ReactNode",
|
|
193
|
+
"default": null,
|
|
194
|
+
"description": "Controls beside the actions menu: a period switch, a filter.",
|
|
195
|
+
"required": false
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "className",
|
|
199
|
+
"type": "string",
|
|
200
|
+
"default": null,
|
|
201
|
+
"description": "A class on the card (layout: grid placement).",
|
|
202
|
+
"required": false
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "description",
|
|
206
|
+
"type": "ReactNode",
|
|
207
|
+
"default": null,
|
|
208
|
+
"description": "The period, the unit, the source — under the insight.",
|
|
209
|
+
"required": false
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "footer",
|
|
213
|
+
"type": "ReactNode",
|
|
214
|
+
"default": null,
|
|
215
|
+
"description": "A line under the chart: the source, the freshness, a link.",
|
|
216
|
+
"required": false
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "id",
|
|
220
|
+
"type": "string",
|
|
221
|
+
"default": null,
|
|
222
|
+
"description": "The id of the card.",
|
|
223
|
+
"required": false
|
|
224
|
+
},
|
|
225
|
+
{
|
|
226
|
+
"name": "insight",
|
|
227
|
+
"type": "ReactNode",
|
|
228
|
+
"default": null,
|
|
229
|
+
"description": "One line that says what the chart shows: “100 jobs · +100 % vs last week”. Written by the app, from its data.",
|
|
230
|
+
"required": false
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
]
|
|
235
|
+
}
|
package/registry/chart.json
CHANGED
|
@@ -89,11 +89,11 @@
|
|
|
89
89
|
"required": true
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
"name": "
|
|
93
|
-
"type": "
|
|
92
|
+
"name": "actionsMenu",
|
|
93
|
+
"type": "boolean",
|
|
94
94
|
"default": null,
|
|
95
|
-
"description": "
|
|
96
|
-
"required":
|
|
95
|
+
"description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
|
|
96
|
+
"required": false
|
|
97
97
|
},
|
|
98
98
|
{
|
|
99
99
|
"name": "brand",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"name": "dataTable",
|
|
114
114
|
"type": "boolean",
|
|
115
115
|
"default": null,
|
|
116
|
-
"description": "
|
|
116
|
+
"description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
|
|
117
117
|
"required": false
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
"name": "exportable",
|
|
142
142
|
"type": "boolean | readonly ExportFormat[]",
|
|
143
143
|
"default": null,
|
|
144
|
-
"description": "
|
|
144
|
+
"description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
|
|
145
145
|
"required": false
|
|
146
146
|
},
|
|
147
147
|
{
|
|
@@ -165,6 +165,13 @@
|
|
|
165
165
|
"description": "The id of the figure.",
|
|
166
166
|
"required": false
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
"name": "insight",
|
|
170
|
+
"type": "ReactNode",
|
|
171
|
+
"default": null,
|
|
172
|
+
"description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
|
|
173
|
+
"required": false
|
|
174
|
+
},
|
|
168
175
|
{
|
|
169
176
|
"name": "items",
|
|
170
177
|
"type": "readonly WalkItem[]",
|
|
@@ -234,6 +241,13 @@
|
|
|
234
241
|
"default": null,
|
|
235
242
|
"description": "The written summary: read by screen readers only (`\"hidden\"`, default), or shown under the chart (`\"visible\"`).",
|
|
236
243
|
"required": false
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "title",
|
|
247
|
+
"type": "string",
|
|
248
|
+
"default": null,
|
|
249
|
+
"description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
|
|
250
|
+
"required": false
|
|
237
251
|
}
|
|
238
252
|
]
|
|
239
253
|
}
|
|
@@ -289,11 +303,11 @@
|
|
|
289
303
|
"required": true
|
|
290
304
|
},
|
|
291
305
|
{
|
|
292
|
-
"name": "
|
|
293
|
-
"type": "
|
|
306
|
+
"name": "actionsMenu",
|
|
307
|
+
"type": "boolean",
|
|
294
308
|
"default": null,
|
|
295
|
-
"description": "
|
|
296
|
-
"required":
|
|
309
|
+
"description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
|
|
310
|
+
"required": false
|
|
297
311
|
},
|
|
298
312
|
{
|
|
299
313
|
"name": "brand",
|
|
@@ -313,7 +327,7 @@
|
|
|
313
327
|
"name": "dataTable",
|
|
314
328
|
"type": "boolean",
|
|
315
329
|
"default": null,
|
|
316
|
-
"description": "
|
|
330
|
+
"description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
|
|
317
331
|
"required": false
|
|
318
332
|
},
|
|
319
333
|
{
|
|
@@ -341,7 +355,7 @@
|
|
|
341
355
|
"name": "exportable",
|
|
342
356
|
"type": "boolean | readonly ExportFormat[]",
|
|
343
357
|
"default": null,
|
|
344
|
-
"description": "
|
|
358
|
+
"description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
|
|
345
359
|
"required": false
|
|
346
360
|
},
|
|
347
361
|
{
|
|
@@ -365,6 +379,13 @@
|
|
|
365
379
|
"description": "The id of the figure.",
|
|
366
380
|
"required": false
|
|
367
381
|
},
|
|
382
|
+
{
|
|
383
|
+
"name": "insight",
|
|
384
|
+
"type": "ReactNode",
|
|
385
|
+
"default": null,
|
|
386
|
+
"description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
|
|
387
|
+
"required": false
|
|
388
|
+
},
|
|
368
389
|
{
|
|
369
390
|
"name": "items",
|
|
370
391
|
"type": "readonly WalkItem[]",
|
|
@@ -434,6 +455,13 @@
|
|
|
434
455
|
"default": null,
|
|
435
456
|
"description": "The written summary: read by screen readers only (`\"hidden\"`, default), or shown under the chart (`\"visible\"`).",
|
|
436
457
|
"required": false
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"name": "title",
|
|
461
|
+
"type": "string",
|
|
462
|
+
"default": null,
|
|
463
|
+
"description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
|
|
464
|
+
"required": false
|
|
437
465
|
}
|
|
438
466
|
]
|
|
439
467
|
}
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"description": "Figures and dates in French, the Orazaka palette, the words translated.",
|
|
80
80
|
"path": "examples/charts-provider/french-orazaka.tsx",
|
|
81
81
|
"module": "@krizaka/charts/registry/examples/charts-provider/french-orazaka",
|
|
82
|
-
"code": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartsProvider } from \"@krizaka/charts/provider\";\n\nconst months = [\n { month: \"2026-06\", credits: 412_000 },\n { month: \"2026-07\", credits: 468_500 },\n { month: \"2026-08\", credits: 391_200 },\n { month: \"2026-09\", credits: 523_900 },\n];\n\n// Once near the app's root: the locale, the brand's palette, the words from the app's catalogue.\nexport default function FrenchOrazaka() {\n return (\n <ChartsProvider\n locale=\"fr-FR\"\n brand=\"orazaka\"\n labels={{
|
|
82
|
+
"code": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartsProvider } from \"@krizaka/charts/provider\";\n\nconst months = [\n { month: \"2026-06\", credits: 412_000 },\n { month: \"2026-07\", credits: 468_500 },\n { month: \"2026-08\", credits: 391_200 },\n { month: \"2026-09\", credits: 523_900 },\n];\n\n// Once near the app's root: the locale, the brand's palette, the words from the app's catalogue.\nexport default function FrenchOrazaka() {\n return (\n <ChartsProvider\n locale=\"fr-FR\"\n brand=\"orazaka\"\n labels={{ actions: \"Actions du graphique\", viewTable: \"Voir en tableau\", downloadCsv: \"Télécharger le CSV\", copyData: \"Copier les données\", empty: \"Pas encore de données.\", kinds: { bar: \"Histogramme\" } }}\n >\n <BarChart title=\"Crédits consommés par mois\" data={months} x=\"month\" xLabel=\"Mois\" y=\"credits\" yLabel=\"Crédits\" format=\"compact\" />\n </ChartsProvider>\n );\n}\n"
|
|
83
83
|
}
|
|
84
84
|
]
|
|
85
85
|
},
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"registryDependencies": [],
|
|
158
158
|
"demo": {
|
|
159
159
|
"path": "examples/charts-provider/french-orazaka.tsx",
|
|
160
|
-
"content": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartsProvider } from \"@krizaka/charts/provider\";\n\nconst months = [\n { month: \"2026-06\", credits: 412_000 },\n { month: \"2026-07\", credits: 468_500 },\n { month: \"2026-08\", credits: 391_200 },\n { month: \"2026-09\", credits: 523_900 },\n];\n\n// Once near the app's root: the locale, the brand's palette, the words from the app's catalogue.\nexport default function FrenchOrazaka() {\n return (\n <ChartsProvider\n locale=\"fr-FR\"\n brand=\"orazaka\"\n labels={{
|
|
160
|
+
"content": "import { BarChart } from \"@krizaka/charts/bar\";\nimport { ChartsProvider } from \"@krizaka/charts/provider\";\n\nconst months = [\n { month: \"2026-06\", credits: 412_000 },\n { month: \"2026-07\", credits: 468_500 },\n { month: \"2026-08\", credits: 391_200 },\n { month: \"2026-09\", credits: 523_900 },\n];\n\n// Once near the app's root: the locale, the brand's palette, the words from the app's catalogue.\nexport default function FrenchOrazaka() {\n return (\n <ChartsProvider\n locale=\"fr-FR\"\n brand=\"orazaka\"\n labels={{ actions: \"Actions du graphique\", viewTable: \"Voir en tableau\", downloadCsv: \"Télécharger le CSV\", copyData: \"Copier les données\", empty: \"Pas encore de données.\", kinds: { bar: \"Histogramme\" } }}\n >\n <BarChart title=\"Crédits consommés par mois\" data={months} x=\"month\" xLabel=\"Mois\" y=\"credits\" yLabel=\"Crédits\" format=\"compact\" />\n </ChartsProvider>\n );\n}\n"
|
|
161
161
|
},
|
|
162
162
|
"props": [
|
|
163
163
|
{
|
|
@@ -90,11 +90,18 @@
|
|
|
90
90
|
"required": true
|
|
91
91
|
},
|
|
92
92
|
{
|
|
93
|
-
"name": "
|
|
94
|
-
"type": "
|
|
93
|
+
"name": "actionsMenu",
|
|
94
|
+
"type": "boolean",
|
|
95
95
|
"default": null,
|
|
96
|
-
"description": "
|
|
97
|
-
"required":
|
|
96
|
+
"description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
|
|
97
|
+
"required": false
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "autoRange",
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"default": null,
|
|
103
|
+
"description": "Zoom the time axis on the period that has data: the empty days before the first and after the last value are\nleft out (never fewer than `minPoints`), and a sparse period says so under the chart instead of drawing 13 empty\ndays around one bar. Default false.",
|
|
104
|
+
"required": false
|
|
98
105
|
},
|
|
99
106
|
{
|
|
100
107
|
"name": "brand",
|
|
@@ -114,7 +121,7 @@
|
|
|
114
121
|
"name": "dataTable",
|
|
115
122
|
"type": "boolean",
|
|
116
123
|
"default": null,
|
|
117
|
-
"description": "
|
|
124
|
+
"description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
|
|
118
125
|
"required": false
|
|
119
126
|
},
|
|
120
127
|
{
|
|
@@ -142,7 +149,14 @@
|
|
|
142
149
|
"name": "exportable",
|
|
143
150
|
"type": "boolean | readonly ExportFormat[]",
|
|
144
151
|
"default": null,
|
|
145
|
-
"description": "
|
|
152
|
+
"description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
|
|
153
|
+
"required": false
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "filterable",
|
|
157
|
+
"type": "boolean",
|
|
158
|
+
"default": null,
|
|
159
|
+
"description": "The legend chips switch the series on and off. Default true.",
|
|
146
160
|
"required": false
|
|
147
161
|
},
|
|
148
162
|
{
|
|
@@ -180,6 +194,13 @@
|
|
|
180
194
|
"description": "The id of the figure.",
|
|
181
195
|
"required": false
|
|
182
196
|
},
|
|
197
|
+
{
|
|
198
|
+
"name": "insight",
|
|
199
|
+
"type": "ReactNode",
|
|
200
|
+
"default": null,
|
|
201
|
+
"description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
|
|
202
|
+
"required": false
|
|
203
|
+
},
|
|
183
204
|
{
|
|
184
205
|
"name": "labels",
|
|
185
206
|
"type": "Partial<EarningsLabels>",
|
|
@@ -222,6 +243,13 @@
|
|
|
222
243
|
"description": "Vertical markers at a category: a launch, an incident.",
|
|
223
244
|
"required": false
|
|
224
245
|
},
|
|
246
|
+
{
|
|
247
|
+
"name": "minPoints",
|
|
248
|
+
"type": "number",
|
|
249
|
+
"default": null,
|
|
250
|
+
"description": "With `autoRange`, the fewest categories to keep so a short burst still has a time scale. Default 7.",
|
|
251
|
+
"required": false
|
|
252
|
+
},
|
|
225
253
|
{
|
|
226
254
|
"name": "onSelect",
|
|
227
255
|
"type": "((datum: T, index: number) => void)",
|
|
@@ -264,6 +292,13 @@
|
|
|
264
292
|
"description": "Your own summary instead of the generated one (still read first by screen readers).",
|
|
265
293
|
"required": false
|
|
266
294
|
},
|
|
295
|
+
{
|
|
296
|
+
"name": "title",
|
|
297
|
+
"type": "string",
|
|
298
|
+
"default": null,
|
|
299
|
+
"description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
|
|
300
|
+
"required": false
|
|
301
|
+
},
|
|
267
302
|
{
|
|
268
303
|
"name": "x",
|
|
269
304
|
"type": "string | ((datum: T, index: number) => unknown)",
|
|
@@ -502,11 +537,18 @@
|
|
|
502
537
|
"required": true
|
|
503
538
|
},
|
|
504
539
|
{
|
|
505
|
-
"name": "
|
|
506
|
-
"type": "
|
|
540
|
+
"name": "actionsMenu",
|
|
541
|
+
"type": "boolean",
|
|
507
542
|
"default": null,
|
|
508
|
-
"description": "
|
|
509
|
-
"required":
|
|
543
|
+
"description": "The ⋯ actions menu of the kit. `false`: the former “Show data” and export buttons, drawn in line. Default true.",
|
|
544
|
+
"required": false
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
"name": "autoRange",
|
|
548
|
+
"type": "boolean",
|
|
549
|
+
"default": null,
|
|
550
|
+
"description": "Zoom the time axis on the period that has data: the empty days before the first and after the last value are\nleft out (never fewer than `minPoints`), and a sparse period says so under the chart instead of drawing 13 empty\ndays around one bar. Default false.",
|
|
551
|
+
"required": false
|
|
510
552
|
},
|
|
511
553
|
{
|
|
512
554
|
"name": "brand",
|
|
@@ -526,7 +568,7 @@
|
|
|
526
568
|
"name": "dataTable",
|
|
527
569
|
"type": "boolean",
|
|
528
570
|
"default": null,
|
|
529
|
-
"description": "
|
|
571
|
+
"description": "“View as table” in the actions menu (the table is in the page for screen readers either way). Default true.",
|
|
530
572
|
"required": false
|
|
531
573
|
},
|
|
532
574
|
{
|
|
@@ -554,7 +596,14 @@
|
|
|
554
596
|
"name": "exportable",
|
|
555
597
|
"type": "boolean | readonly ExportFormat[]",
|
|
556
598
|
"default": null,
|
|
557
|
-
"description": "
|
|
599
|
+
"description": "The downloads of the actions menu: all three by default, or the formats you want, or `false` for none.",
|
|
600
|
+
"required": false
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
"name": "filterable",
|
|
604
|
+
"type": "boolean",
|
|
605
|
+
"default": null,
|
|
606
|
+
"description": "The legend chips switch the series on and off. Default true.",
|
|
558
607
|
"required": false
|
|
559
608
|
},
|
|
560
609
|
{
|
|
@@ -592,6 +641,13 @@
|
|
|
592
641
|
"description": "The id of the figure.",
|
|
593
642
|
"required": false
|
|
594
643
|
},
|
|
644
|
+
{
|
|
645
|
+
"name": "insight",
|
|
646
|
+
"type": "ReactNode",
|
|
647
|
+
"default": null,
|
|
648
|
+
"description": "One line that says what the chart shows, between the title and the chart: “100 jobs · +100 % vs last week”.",
|
|
649
|
+
"required": false
|
|
650
|
+
},
|
|
595
651
|
{
|
|
596
652
|
"name": "labels",
|
|
597
653
|
"type": "Partial<EarningsLabels>",
|
|
@@ -634,6 +690,13 @@
|
|
|
634
690
|
"description": "Vertical markers at a category: a launch, an incident.",
|
|
635
691
|
"required": false
|
|
636
692
|
},
|
|
693
|
+
{
|
|
694
|
+
"name": "minPoints",
|
|
695
|
+
"type": "number",
|
|
696
|
+
"default": null,
|
|
697
|
+
"description": "With `autoRange`, the fewest categories to keep so a short burst still has a time scale. Default 7.",
|
|
698
|
+
"required": false
|
|
699
|
+
},
|
|
637
700
|
{
|
|
638
701
|
"name": "onSelect",
|
|
639
702
|
"type": "((datum: T, index: number) => void)",
|
|
@@ -676,6 +739,13 @@
|
|
|
676
739
|
"description": "Your own summary instead of the generated one (still read first by screen readers).",
|
|
677
740
|
"required": false
|
|
678
741
|
},
|
|
742
|
+
{
|
|
743
|
+
"name": "title",
|
|
744
|
+
"type": "string",
|
|
745
|
+
"default": null,
|
|
746
|
+
"description": "What the chart shows, in a few words: its accessible name, and its heading unless `hideTitle`. Inside a `ChartCard`, the card's title is the default.",
|
|
747
|
+
"required": false
|
|
748
|
+
},
|
|
679
749
|
{
|
|
680
750
|
"name": "x",
|
|
681
751
|
"type": "string | ((datum: T, index: number) => unknown)",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/chart-card/before-after.tsx
|
|
4
|
+
import { BarChart } from "@krizaka/charts/bar";
|
|
5
|
+
import { ChartCard } from "@krizaka/charts/card";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var data = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((day, i) => ({ day, jobs: [12, 18, 9, 22, 31, 27, 35][i] }));
|
|
8
|
+
function BeforeAfter() {
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { style: { display: "grid", gap: 16, gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))" }, children: [
|
|
10
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
11
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 8px", fontSize: 12, color: "var(--kz-text-secondary)" }, children: "Before" }),
|
|
12
|
+
/* @__PURE__ */ jsx(BarChart, { title: "Jobs per day", data, x: "day", y: "jobs", yLabel: "Jobs", height: 180, actionsMenu: false, exportable: true })
|
|
13
|
+
] }),
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
15
|
+
/* @__PURE__ */ jsx("p", { style: { margin: "0 0 8px", fontSize: 12, color: "var(--kz-text-secondary)" }, children: "After" }),
|
|
16
|
+
/* @__PURE__ */ jsx(ChartCard, { title: "Jobs per day", insight: "154 jobs \xB7 busiest on Sunday", footer: "Source: your own jobs.", children: /* @__PURE__ */ jsx(BarChart, { data, x: "day", y: "jobs", yLabel: "Jobs", height: 180 }) })
|
|
17
|
+
] })
|
|
18
|
+
] });
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
BeforeAfter as default
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BarChart } from "@krizaka/charts/bar";
|
|
2
|
+
import { ChartCard } from "@krizaka/charts/card";
|
|
3
|
+
|
|
4
|
+
const data = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((day, i) => ({ day, jobs: [12, 18, 9, 22, 31, 27, 35][i] }));
|
|
5
|
+
|
|
6
|
+
// Before: a bare chart, “Show data” and the exports as text buttons. After: the same chart in a ChartCard.
|
|
7
|
+
export default function BeforeAfter() {
|
|
8
|
+
return (
|
|
9
|
+
<div style={{ display: "grid", gap: 16, gridTemplateColumns: "repeat(auto-fit, minmax(280px, 1fr))" }}>
|
|
10
|
+
<div>
|
|
11
|
+
<p style={{ margin: "0 0 8px", fontSize: 12, color: "var(--kz-text-secondary)" }}>Before</p>
|
|
12
|
+
<BarChart title="Jobs per day" data={data} x="day" y="jobs" yLabel="Jobs" height={180} actionsMenu={false} exportable />
|
|
13
|
+
</div>
|
|
14
|
+
<div>
|
|
15
|
+
<p style={{ margin: "0 0 8px", fontSize: 12, color: "var(--kz-text-secondary)" }}>After</p>
|
|
16
|
+
<ChartCard title="Jobs per day" insight="154 jobs · busiest on Sunday" footer="Source: your own jobs.">
|
|
17
|
+
<BarChart data={data} x="day" y="jobs" yLabel="Jobs" height={180} />
|
|
18
|
+
</ChartCard>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// registry/examples/chart-card/jobs-activity.tsx
|
|
4
|
+
import { BarChart } from "@krizaka/charts/bar";
|
|
5
|
+
import { ChartCard } from "@krizaka/charts/card";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
var days = ["2026-10-03", "2026-10-04", "2026-10-05", "2026-10-06", "2026-10-07", "2026-10-08", "2026-10-09", "2026-10-10"];
|
|
8
|
+
var completed = [12, 18, 9, 22, 31, 27, 35, 41];
|
|
9
|
+
var failed = [1, 0, 2, 1, 3, 0, 1, 2];
|
|
10
|
+
var data = days.map((day, i) => ({ day, completed: completed[i], failed: failed[i] }));
|
|
11
|
+
var series = [
|
|
12
|
+
{ key: "completed", label: "Completed", color: "accent" },
|
|
13
|
+
{ key: "failed", label: "Failed", color: "danger" }
|
|
14
|
+
];
|
|
15
|
+
function JobsActivity() {
|
|
16
|
+
return /* @__PURE__ */ jsx(ChartCard, { title: "Jobs per day", insight: "195 jobs \xB7 +24 % vs the week before", footer: "Read from your own jobs \u2014 nothing estimated.", children: /* @__PURE__ */ jsx(BarChart, { data, x: "day", xFormat: "day", xLabel: "Day", series, stacked: true, format: "integer", height: 220, autoRange: true }) });
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
JobsActivity as default
|
|
20
|
+
};
|