@motifx-community/ui 0.1.0-beta.5 → 0.1.0-beta.7

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.
Files changed (277) hide show
  1. package/CHANGELOG.md +101 -0
  2. package/README.md +7 -4
  3. package/dist/components/appbar/AppBar.d.ts +88 -0
  4. package/dist/components/appbar/app-bar-navigation-click-event-args.d.ts +9 -0
  5. package/dist/components/appbar/app-bar-navigation.d.ts +2 -0
  6. package/dist/components/appbar/app-bar-position.d.ts +2 -0
  7. package/dist/components/appbar/app-bar-props.d.ts +49 -0
  8. package/dist/components/appbar/app-bar-scroll-behavior.d.ts +2 -0
  9. package/dist/components/appbar/app-bar-title-align.d.ts +2 -0
  10. package/dist/components/appbar/app-bar-tone.d.ts +2 -0
  11. package/dist/components/appbar/index.d.ts +8 -0
  12. package/dist/components/barcode/Barcode.d.ts +62 -0
  13. package/dist/components/barcode/barcode-export-options.d.ts +9 -0
  14. package/dist/components/barcode/barcode-failed-event-args.d.ts +9 -0
  15. package/dist/components/barcode/barcode-props.d.ts +25 -0
  16. package/dist/components/barcode/index.d.ts +5 -0
  17. package/dist/components/bargauge/BarGauge.d.ts +120 -0
  18. package/dist/components/bargauge/bar-gauge-props.d.ts +38 -0
  19. package/dist/components/bargauge/index.d.ts +2 -0
  20. package/dist/components/bottomnavigation/BottomNavigation.d.ts +101 -0
  21. package/dist/components/bottomnavigation/bottom-navigation-item-click-event-args.d.ts +9 -0
  22. package/dist/components/bottomnavigation/bottom-navigation-item.d.ts +35 -0
  23. package/dist/components/bottomnavigation/bottom-navigation-label-mode.d.ts +2 -0
  24. package/dist/components/bottomnavigation/bottom-navigation-position.d.ts +2 -0
  25. package/dist/components/bottomnavigation/bottom-navigation-props.d.ts +31 -0
  26. package/dist/components/bottomnavigation/bottom-navigation-selecting-event-args.d.ts +5 -0
  27. package/dist/components/bottomnavigation/bottom-navigation-selection-changed-event-args.d.ts +11 -0
  28. package/dist/components/bottomnavigation/index.d.ts +8 -0
  29. package/dist/components/chart/Chart.d.ts +229 -0
  30. package/dist/components/chart/ChartLegend.d.ts +24 -0
  31. package/dist/components/chart/ChartPlot.d.ts +161 -0
  32. package/dist/components/chart/ChartTable.d.ts +68 -0
  33. package/dist/components/chart/ChartTooltip.d.ts +22 -0
  34. package/dist/components/chart/PartsPlot.d.ts +39 -0
  35. package/dist/components/chart/RadarPlot.d.ts +34 -0
  36. package/dist/components/chart/chart-axis-kind.d.ts +2 -0
  37. package/dist/components/chart/chart-axis.d.ts +31 -0
  38. package/dist/components/chart/chart-data-error-event-args.d.ts +7 -0
  39. package/dist/components/chart/chart-export-options.d.ts +7 -0
  40. package/dist/components/chart/chart-export.d.ts +12 -0
  41. package/dist/components/chart/chart-field.d.ts +2 -0
  42. package/dist/components/chart/chart-labels.d.ts +2 -0
  43. package/dist/components/chart/chart-legend-options.d.ts +10 -0
  44. package/dist/components/chart/chart-legend-position.d.ts +2 -0
  45. package/dist/components/chart/chart-look.d.ts +25 -0
  46. package/dist/components/chart/chart-mode-changed-event-args.d.ts +7 -0
  47. package/dist/components/chart/chart-mode.d.ts +2 -0
  48. package/dist/components/chart/chart-model.d.ts +105 -0
  49. package/dist/components/chart/chart-point-event-args.d.ts +9 -0
  50. package/dist/components/chart/chart-point-selection.d.ts +2 -0
  51. package/dist/components/chart/chart-point.d.ts +23 -0
  52. package/dist/components/chart/chart-props.d.ts +76 -0
  53. package/dist/components/chart/chart-reference.d.ts +12 -0
  54. package/dist/components/chart/chart-selection-changed-event-args.d.ts +8 -0
  55. package/dist/components/chart/chart-series-toggled-event-args.d.ts +10 -0
  56. package/dist/components/chart/chart-series-type.d.ts +6 -0
  57. package/dist/components/chart/chart-series.d.ts +55 -0
  58. package/dist/components/chart/chart-stacked.d.ts +2 -0
  59. package/dist/components/chart/chart-tooltip-context.d.ts +10 -0
  60. package/dist/components/chart/chart-tooltip-options.d.ts +10 -0
  61. package/dist/components/chart/chart-zoom-changed-event-args.d.ts +8 -0
  62. package/dist/components/chart/index.d.ts +21 -0
  63. package/dist/components/chart/legend-entry.d.ts +13 -0
  64. package/dist/components/chart/plot-text.d.ts +10 -0
  65. package/dist/components/chart/plot-view.d.ts +61 -0
  66. package/dist/components/datagrid/grid-lookup.d.ts +3 -3
  67. package/dist/components/datagrid/grid-settings.d.ts +3 -3
  68. package/dist/components/datagrid/model/GridData.d.ts +22 -3
  69. package/dist/components/datagrid/model/GridModel.d.ts +2 -0
  70. package/dist/components/gauge/Gauge.d.ts +179 -0
  71. package/dist/components/gauge/gauge-mark.d.ts +9 -0
  72. package/dist/components/gauge/gauge-marker.d.ts +2 -0
  73. package/dist/components/gauge/gauge-needle-shape.d.ts +2 -0
  74. package/dist/components/gauge/gauge-orientation.d.ts +2 -0
  75. package/dist/components/gauge/gauge-props.d.ts +58 -0
  76. package/dist/components/gauge/gauge-range.d.ts +11 -0
  77. package/dist/components/gauge/gauge-scale.d.ts +2 -0
  78. package/dist/components/gauge/gauge-shape.d.ts +43 -0
  79. package/dist/components/gauge/gauge-type.d.ts +2 -0
  80. package/dist/components/gauge/index.d.ts +9 -0
  81. package/dist/components/listbox/list-rows.d.ts +2 -0
  82. package/dist/components/otpinput/OtpInput.d.ts +73 -0
  83. package/dist/components/otpinput/index.d.ts +4 -0
  84. package/dist/components/otpinput/otp-charset.d.ts +2 -0
  85. package/dist/components/otpinput/otp-completed-event-args.d.ts +8 -0
  86. package/dist/components/otpinput/otp-input-props.d.ts +32 -0
  87. package/dist/components/qrcode/QRCode.d.ts +58 -0
  88. package/dist/components/qrcode/index.d.ts +5 -0
  89. package/dist/components/qrcode/qr-code-export-options.d.ts +9 -0
  90. package/dist/components/qrcode/qr-code-failed-event-args.d.ts +7 -0
  91. package/dist/components/qrcode/qr-code-props.d.ts +23 -0
  92. package/dist/components/signature/Signature.d.ts +100 -0
  93. package/dist/components/signature/index.d.ts +5 -0
  94. package/dist/components/signature/signature-draw.d.ts +15 -0
  95. package/dist/components/signature/signature-export-options.d.ts +11 -0
  96. package/dist/components/signature/signature-props.d.ts +30 -0
  97. package/dist/components/signature/signature-stroke-event-args.d.ts +9 -0
  98. package/dist/components/signature/signature-stroke.d.ts +11 -0
  99. package/dist/components/sparkline/Sparkline.d.ts +85 -0
  100. package/dist/components/sparkline/index.d.ts +4 -0
  101. package/dist/components/sparkline/sparkline-highlight.d.ts +2 -0
  102. package/dist/components/sparkline/sparkline-props.d.ts +34 -0
  103. package/dist/components/sparkline/sparkline-type.d.ts +2 -0
  104. package/dist/components/validationsummary/ValidationSummary.d.ts +1 -0
  105. package/dist/core/fonts-loaded.d.ts +2 -0
  106. package/dist/core/scroll-watch.d.ts +13 -0
  107. package/dist/core/ui-strings.d.ts +38 -0
  108. package/dist/generated/tokens.d.ts +3023 -863
  109. package/dist/index.d.ts +10 -0
  110. package/dist/index.js +55933 -47186
  111. package/dist/index.js.map +1 -1
  112. package/dist/locales/en.json +37 -1
  113. package/dist/locales/tr.json +37 -1
  114. package/dist/parts/chart/chart-paths.d.ts +30 -0
  115. package/dist/parts/chart/chart-scale.d.ts +13 -0
  116. package/dist/parts/chart/chart-text.d.ts +12 -0
  117. package/dist/parts/chart/nice-ticks.d.ts +6 -0
  118. package/dist/parts/chart/svg-parts.d.ts +12 -0
  119. package/dist/parts/chart/thin-out.d.ts +6 -0
  120. package/dist/parts/chart/time-ticks.d.ts +7 -0
  121. package/dist/parts/chart/token-lengths.d.ts +16 -0
  122. package/dist/parts/chart/value-motion.d.ts +16 -0
  123. package/dist/parts/code/barcode-encode.d.ts +23 -0
  124. package/dist/parts/code/code-image.d.ts +35 -0
  125. package/dist/parts/code/qr-encode.d.ts +10 -0
  126. package/dist/parts/data/DataItems.d.ts +2 -0
  127. package/dist/parts/data/KeyedItems.d.ts +1 -0
  128. package/dist/parts/field/Field.d.ts +2 -0
  129. package/dist/parts/list/OptionList.d.ts +6 -0
  130. package/dist/parts/list/item-source.d.ts +4 -0
  131. package/dist/styles.css +3043 -9
  132. package/dist/tokens/index.d.ts +3212 -967
  133. package/dist/tokens/index.js +3023 -863
  134. package/dist/tokens/index.js.map +1 -1
  135. package/dist/{tr-C5IXRzAH.js → tr-DhIFcH3c.js} +75 -3
  136. package/dist/{tr-C5IXRzAH.js.map → tr-DhIFcH3c.js.map} +1 -1
  137. package/docs/accordion.md +1 -1
  138. package/docs/actionsheet.md +1 -1
  139. package/docs/appbar.md +194 -0
  140. package/docs/avatar.md +1 -1
  141. package/docs/badge.md +1 -1
  142. package/docs/bar-gauge-angles.md +87 -0
  143. package/docs/bar-gauge-data.md +122 -0
  144. package/docs/bar-gauge-labels.md +78 -0
  145. package/docs/bar-gauge.md +98 -0
  146. package/docs/barcode.md +193 -0
  147. package/docs/bottomnavigation.md +258 -0
  148. package/docs/bottomsheet.md +1 -1
  149. package/docs/breadcrumb.md +1 -1
  150. package/docs/button.md +1 -1
  151. package/docs/buttongroup.md +1 -1
  152. package/docs/buttons.md +169 -0
  153. package/docs/calendar.md +1 -1
  154. package/docs/card.md +1 -1
  155. package/docs/chart-bars.md +142 -0
  156. package/docs/chart-candles.md +164 -0
  157. package/docs/chart-funnel.md +115 -0
  158. package/docs/chart-heatmap.md +93 -0
  159. package/docs/chart-lines.md +128 -0
  160. package/docs/chart-live.md +62 -0
  161. package/docs/chart-pie.md +125 -0
  162. package/docs/chart-radar.md +124 -0
  163. package/docs/chart-ranges.md +127 -0
  164. package/docs/chart-references.md +126 -0
  165. package/docs/chart-scatter.md +139 -0
  166. package/docs/chart-waterfall.md +111 -0
  167. package/docs/chart-zoom.md +95 -0
  168. package/docs/chart.md +427 -0
  169. package/docs/checkbox.md +1 -1
  170. package/docs/chip.md +1 -1
  171. package/docs/choice.md +151 -0
  172. package/docs/colorbox.md +1 -1
  173. package/docs/combobox.md +1 -1
  174. package/docs/control.md +1 -1
  175. package/docs/data.md +127 -0
  176. package/docs/datagrid-api.md +1 -1
  177. package/docs/datagrid-bands.md +1 -1
  178. package/docs/datagrid-drag-select.md +1 -1
  179. package/docs/datagrid-drag.md +1 -1
  180. package/docs/datagrid-editing.md +1 -1
  181. package/docs/datagrid-filtering.md +1 -1
  182. package/docs/datagrid-forms.md +1 -1
  183. package/docs/datagrid-grouping.md +62 -2
  184. package/docs/datagrid-layout.md +2 -2
  185. package/docs/datagrid-lookups.md +2 -2
  186. package/docs/datagrid-master-detail.md +1 -1
  187. package/docs/datagrid-scrolling.md +1 -1
  188. package/docs/datagrid-selection.md +1 -1
  189. package/docs/datagrid.md +1 -1
  190. package/docs/datebox.md +1 -1
  191. package/docs/daterangebox.md +1 -1
  192. package/docs/display.md +148 -0
  193. package/docs/draggable.md +1 -1
  194. package/docs/drawer.md +1 -1
  195. package/docs/dropdown.md +1 -1
  196. package/docs/editors.md +157 -0
  197. package/docs/feedback.md +138 -0
  198. package/docs/fileuploader.md +1 -1
  199. package/docs/filterbuilder.md +1 -1
  200. package/docs/formlayout.md +1 -1
  201. package/docs/foundations.md +79 -0
  202. package/docs/gallery.md +1 -1
  203. package/docs/gauge-base.md +78 -0
  204. package/docs/gauge-circular.md +101 -0
  205. package/docs/gauge-dashboards.md +134 -0
  206. package/docs/gauge-linear.md +84 -0
  207. package/docs/gauge-markers.md +135 -0
  208. package/docs/gauge-marks.md +108 -0
  209. package/docs/gauge-ranges.md +133 -0
  210. package/docs/gauge-scales.md +117 -0
  211. package/docs/gauge.md +152 -0
  212. package/docs/home.md +1 -1
  213. package/docs/keyboard.md +1 -1
  214. package/docs/language.md +1 -1
  215. package/docs/layout.md +1 -1
  216. package/docs/listbox.md +1 -1
  217. package/docs/loadpanel.md +1 -1
  218. package/docs/lookup.md +1 -1
  219. package/docs/menus.md +1 -1
  220. package/docs/multiview.md +1 -1
  221. package/docs/navigation.md +143 -0
  222. package/docs/numberbox.md +1 -1
  223. package/docs/otpinput.md +197 -0
  224. package/docs/pagination.md +1 -1
  225. package/docs/popover.md +1 -1
  226. package/docs/progress.md +1 -1
  227. package/docs/qrcode.md +179 -0
  228. package/docs/radiogroup.md +1 -1
  229. package/docs/rating.md +1 -1
  230. package/docs/resizable.md +1 -1
  231. package/docs/scheduler-agenda.md +1 -1
  232. package/docs/scheduler-big-data.md +1 -1
  233. package/docs/scheduler-editing.md +1 -1
  234. package/docs/scheduler-form.md +1 -1
  235. package/docs/scheduler-icalendar.md +1 -1
  236. package/docs/scheduler-mobile.md +1 -1
  237. package/docs/scheduler-recurrence.md +1 -1
  238. package/docs/scheduler-resources.md +1 -1
  239. package/docs/scheduler-timeline.md +1 -1
  240. package/docs/scheduler.md +1 -1
  241. package/docs/scrollview.md +1 -1
  242. package/docs/showcase-home.md +31 -0
  243. package/docs/showcase.md +1 -1
  244. package/docs/signature.md +208 -0
  245. package/docs/skeleton.md +1 -1
  246. package/docs/slider.md +1 -1
  247. package/docs/sortable.md +1 -1
  248. package/docs/sparkline.md +119 -0
  249. package/docs/speeddial.md +1 -1
  250. package/docs/splitter.md +1 -1
  251. package/docs/stepper.md +1 -1
  252. package/docs/switch.md +1 -1
  253. package/docs/tabdocs-dock.md +1 -1
  254. package/docs/tabdocs-drag.md +1 -1
  255. package/docs/tabdocs-menus.md +1 -1
  256. package/docs/tabdocs-mobile.md +1 -1
  257. package/docs/tabdocs-tabs.md +1 -1
  258. package/docs/tabdocs-windows.md +1 -1
  259. package/docs/tabdocs-workspace.md +1 -1
  260. package/docs/tabdocs.md +1 -1
  261. package/docs/tabs.md +1 -1
  262. package/docs/tagbox.md +1 -1
  263. package/docs/textarea.md +1 -1
  264. package/docs/textbox.md +1 -1
  265. package/docs/tileview.md +1 -1
  266. package/docs/timeline.md +1 -1
  267. package/docs/toast.md +1 -1
  268. package/docs/tokens.md +450 -1
  269. package/docs/toolbar.md +1 -1
  270. package/docs/tooltip.md +1 -1
  271. package/docs/treeview.md +1 -1
  272. package/docs/validationsummary.md +1 -1
  273. package/docs/window.md +1 -1
  274. package/docs/wizard.md +1 -1
  275. package/llms-full.txt +6725 -99
  276. package/llms.txt +50 -1
  277. package/package.json +5 -5
@@ -0,0 +1,164 @@
1
+ # Chart: Candles
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ Candles show the first, highest, lowest and last price for each position.
6
+
7
+ ## Candles
8
+
9
+ `candlestick` and `ohlc` show four prices for each position: `openField`, `highField`, `lowField` and `closeField`. Rising and falling take the design language's colors for good and bad, and a rising candle is hollow as well.
10
+
11
+ ```tsx
12
+ import { reactive } from '@motifx/core';
13
+ import { ButtonGroup, Chart, Stack, type ChartSeriesType } from '@motifx-community/ui';
14
+
15
+ const PRICES = Array.from({ length: 24 }, (_, i) => {
16
+ const open = 100 + Math.round(Math.sin(i / 3) * 12 + i * 0.8);
17
+ const close = open + Math.round(Math.cos(i * 1.7) * 6);
18
+ return { day: new Date(2026, 9, i + 1), open, close, high: Math.max(open, close) + 2 + (i % 3), low: Math.min(open, close) - 2 - (i % 4) };
19
+ });
20
+
21
+ /** Four prices a day. A rising candle is hollow and a falling one filled, so they read apart without their colors. */
22
+ export default function Candles() {
23
+ const s = reactive({ type: 'candlestick' as ChartSeriesType });
24
+ return (
25
+ <Stack class="docs-wide" gap="md">
26
+ <ButtonGroup
27
+ label="Shape"
28
+ x-model={() => s.type}
29
+ items={[
30
+ { value: 'candlestick', text: 'Candles' },
31
+ { value: 'ohlc', text: 'OHLC bars' }
32
+ ]}
33
+ />
34
+ <Chart
35
+ class="ch-candles"
36
+ title="Share price in October"
37
+ data={PRICES}
38
+ xField="day"
39
+ xAxis={{ format: { day: 'numeric' } }}
40
+ series={() => [{ type: s.type, openField: 'open', highField: 'high', lowField: 'low', closeField: 'close', name: 'Price' }]}
41
+ />
42
+ </Stack>
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Price and volume
48
+
49
+ Prices and the volume traded have different units, so they go in two charts on the same time axis instead of on two scales of one plot. A reference line marks the average close.
50
+
51
+ ```tsx
52
+ import { Chart, Stack } from '@motifx-community/ui';
53
+
54
+ const DAYS = Array.from({ length: 30 }, (_, i) => {
55
+ const open = 48 + Math.round((Math.sin(i / 4) * 5 + i * 0.3) * 10) / 10;
56
+ const close = Math.round((open + Math.cos(i * 1.3) * 2.4) * 10) / 10;
57
+ const high = Math.round((Math.max(open, close) + 0.6 + (i % 3) * 0.4) * 10) / 10;
58
+ const low = Math.round((Math.min(open, close) - 0.6 - (i % 4) * 0.3) * 10) / 10;
59
+ return { day: new Date(2026, 8, i + 1), open, close, high, low, volume: Math.round(1.2e6 + Math.abs(close - open) * 6e5 + (i % 5) * 1.5e5) };
60
+ });
61
+
62
+ const average = Math.round((DAYS.reduce((sum, d) => sum + d.close, 0) / DAYS.length) * 100) / 100;
63
+
64
+ /** Prices and the volume traded: two charts on one time line, never two scales on one plot. A line marks the month's average close. */
65
+ export default function CandlesVolume() {
66
+ return (
67
+ <Stack class="docs-wide" gap="sm">
68
+ <Chart
69
+ class="ch-candles-price"
70
+ title="Share price in September"
71
+ data={DAYS}
72
+ xField="day"
73
+ height={260}
74
+ xAxis={{ format: { day: 'numeric' } }}
75
+ yAxis={{ format: { style: 'currency', currency: 'EUR' } }}
76
+ references={[{ value: average, label: 'Average close' }]}
77
+ series={[{ type: 'candlestick', openField: 'open', highField: 'high', lowField: 'low', closeField: 'close', name: 'Price' }]}
78
+ />
79
+ <Chart
80
+ class="ch-candles-volume"
81
+ label="Volume traded in September"
82
+ data={DAYS}
83
+ xField="day"
84
+ height={200}
85
+ xAxis={{ format: { day: 'numeric' } }}
86
+ yAxis={{ format: { notation: 'compact' } }}
87
+ series={[{ type: 'bar', yField: 'volume', name: 'Volume' }]}
88
+ />
89
+ </Stack>
90
+ );
91
+ }
92
+ ```
93
+
94
+ ## Periods
95
+
96
+ With `zoom` on, `zoomTo()` shows a stretch of time, for example the latest month, and `resetZoom()` shows all of it again. The reader can still drag across the plot, and `onZoomChanged` reports every change.
97
+
98
+ ```tsx
99
+ import { reactive } from '@motifx/core';
100
+ import { ButtonGroup, Chart, Stack } from '@motifx-community/ui';
101
+
102
+ const START = new Date(2026, 0, 1).getTime();
103
+ const DAY = 24 * 60 * 60 * 1000;
104
+
105
+ const YEAR = Array.from({ length: 260 }, (_, i) => {
106
+ const open = Math.round((120 + Math.sin(i / 18) * 14 + i * 0.12 + Math.sin(i * 2.1) * 2) * 10) / 10;
107
+ const close = Math.round((open + Math.cos(i * 1.7) * 3) * 10) / 10;
108
+ return { day: new Date(START + i * DAY), open, close, high: Math.max(open, close) + 1 + (i % 3) * 0.5, low: Math.min(open, close) - 1 - (i % 4) * 0.4 };
109
+ });
110
+
111
+ const LAST = YEAR[YEAR.length - 1].day.getTime();
112
+
113
+ /** A year of prices with zoom on; the buttons zoom to the latest stretch with `zoomTo`, and dragging across the plot still works. */
114
+ export default function CandlesPeriods() {
115
+ const s = reactive({ period: 'all' });
116
+ let chart!: Chart;
117
+ // A zoom of the reader's own, by dragging or the wheel, leaves no button chosen.
118
+ let moving = false;
119
+ const show = (period: string) => {
120
+ const days = { month: 30, quarter: 91 }[period];
121
+ moving = true;
122
+ if (days) chart.zoomTo(new Date(LAST - days * DAY), new Date(LAST));
123
+ else chart.resetZoom();
124
+ moving = false;
125
+ };
126
+ return (
127
+ <Stack class="docs-wide" gap="md">
128
+ <ButtonGroup
129
+ label="Period"
130
+ x-model={() => s.period}
131
+ onValueChanged={e => e.byUser && show(e.value as string)}
132
+ items={[
133
+ { value: 'month', text: '1 month' },
134
+ { value: 'quarter', text: '3 months' },
135
+ { value: 'all', text: 'All' }
136
+ ]}
137
+ />
138
+ <Chart
139
+ ref={(x: Chart) => (chart = x)}
140
+ class="ch-candles-periods"
141
+ title="Share price this year"
142
+ data={YEAR}
143
+ xField="day"
144
+ zoom
145
+ series={[{ type: 'candlestick', openField: 'open', highField: 'high', lowField: 'low', closeField: 'close', name: 'Price' }]}
146
+ onZoomChanged={e => !moving && (s.period = e.from ? '' : 'all')}
147
+ />
148
+ </Stack>
149
+ );
150
+ }
151
+ ```
152
+
153
+ ## API reference
154
+
155
+ | Field | Type | Default | Description |
156
+ | --- | --- | --- | --- |
157
+ | `lowField, highField` | `string \| (row) => unknown` | | The ends of a range, and the lowest and highest price of a candle. |
158
+ | `openField, closeField` | `string \| (row) => unknown` | | The first and the last price of a candle. |
159
+
160
+ Every other prop, member and event is on the [Overview](chart.md#api).
161
+
162
+ ## Feedback
163
+
164
+ Loading issues…
@@ -0,0 +1,115 @@
1
+ # Chart: Funnel
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A funnel follows a quantity through stages in order, and shows how much of it is left at each one.
6
+
7
+ ## Funnel
8
+
9
+ `funnel` shows stages in the order of the rows, each with the share of the first stage that is left. The stages take one hue, darker towards the first, as they are in order.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const STEPS = [
15
+ { step: 'Visited the shop', people: 12000 },
16
+ { step: 'Viewed a product', people: 7400 },
17
+ { step: 'Added to the cart', people: 2900 },
18
+ { step: 'Started to pay', people: 1650 },
19
+ { step: 'Paid', people: 1180 }
20
+ ];
21
+
22
+ /** Stages in order, each with what is left of the first one. */
23
+ export default function Funnel() {
24
+ return <Chart class="ch-funnel" title="From visit to order" data={STEPS} xField="step" legend={false} series={[{ type: 'funnel', yField: 'people', name: 'People' }]} />;
25
+ }
26
+ ```
27
+
28
+ ## Values and clicks
29
+
30
+ `labels: 'all'` writes the value on every stage. `onPointClick` gives the stage that was clicked, for a detail of your own such as the conversion from the first stage.
31
+
32
+ ```tsx
33
+ import { reactive } from '@motifx/core';
34
+ import { Chart, Stack } from '@motifx-community/ui';
35
+
36
+ const STEPS = [
37
+ { step: 'Applied', people: 840 },
38
+ { step: 'Screened', people: 410 },
39
+ { step: 'Interviewed', people: 126 },
40
+ { step: 'Offered', people: 34 },
41
+ { step: 'Hired', people: 21 }
42
+ ];
43
+
44
+ /** Every stage with its count; a click on a stage tells how many of the first stage got that far. */
45
+ export default function FunnelLabels() {
46
+ const s = reactive({ told: 'Click a stage.' });
47
+ return (
48
+ <Stack class="docs-wide" gap="sm">
49
+ <Chart
50
+ class="ch-funnel-labels"
51
+ title="Hiring this year"
52
+ data={STEPS}
53
+ xField="step"
54
+ legend={false}
55
+ series={[{ type: 'funnel', yField: 'people', name: 'People', labels: 'all' }]}
56
+ onPointClick={e => (s.told = `${e.point.xText}: ${e.point.yText} people, ${Math.round((e.point.y / STEPS[0].people) * 1000) / 10}% of those who applied`)}
57
+ />
58
+ <output class="ch-funnel-told">{() => s.told}</output>
59
+ </Stack>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ## Another period
65
+
66
+ New rows redraw the funnel, and the stages animate to their new sizes. Use this to compare periods or segments with the same stages.
67
+
68
+ ```tsx
69
+ import { reactive } from '@motifx/core';
70
+ import { ButtonGroup, Chart, Stack } from '@motifx-community/ui';
71
+
72
+ const PERIODS = {
73
+ march: [
74
+ { step: 'Opened the email', people: 5200 },
75
+ { step: 'Clicked the link', people: 1900 },
76
+ { step: 'Signed up', people: 640 },
77
+ { step: 'Bought', people: 180 }
78
+ ],
79
+ april: [
80
+ { step: 'Opened the email', people: 6100 },
81
+ { step: 'Clicked the link', people: 2600 },
82
+ { step: 'Signed up', people: 1020 },
83
+ { step: 'Bought', people: 310 }
84
+ ]
85
+ };
86
+
87
+ /** The same stages for another period: new rows, and the stages move to their new sizes. */
88
+ export default function FunnelPeriods() {
89
+ const s = reactive({ period: 'march' as keyof typeof PERIODS });
90
+ return (
91
+ <Stack class="docs-wide" gap="md">
92
+ <ButtonGroup
93
+ label="Period"
94
+ x-model={() => s.period}
95
+ items={[
96
+ { value: 'march', text: 'March' },
97
+ { value: 'april', text: 'April' }
98
+ ]}
99
+ />
100
+ <Chart
101
+ class="ch-funnel-periods"
102
+ title="Spring campaign"
103
+ data={() => PERIODS[s.period]}
104
+ xField="step"
105
+ legend={false}
106
+ series={[{ type: 'funnel', yField: 'people', name: 'People', labels: 'all' }]}
107
+ />
108
+ </Stack>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ## Feedback
114
+
115
+ Loading issues…
@@ -0,0 +1,93 @@
1
+ # Chart: Heat map
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A heat map shows a value for each pair of two categories as a color.
6
+
7
+ ## Heat map
8
+
9
+ `heatmap` places a cell at each pair of `xField` and `yField`, colored by `valueField` in seven steps of one hue. Values on both sides of zero take two hues that meet in a neutral middle.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
15
+ const HOURS = ['8', '10', '12', '14', '16', '18', '20'];
16
+ const LOAD = DAYS.flatMap((day, d) => HOURS.map((hour, h) => ({ day, hour, orders: Math.round(20 + 60 * Math.sin(((h + 1) / 8) * Math.PI) * (d < 5 ? 1 : 0.55) + d * 3) })));
17
+
18
+ /** A value for each pair, as a color in seven steps. The legend gives each step its values. */
19
+ export default function Heatmap() {
20
+ return <Chart class="ch-heat" title="Orders by day and hour" data={LOAD} xField="hour" series={[{ type: 'heatmap', yField: 'day', valueField: 'orders', name: 'Orders', labels: 'all' }]} />;
21
+ }
22
+ ```
23
+
24
+ ## Calendar
25
+
26
+ Any two categories make the grid, here weeks and weekdays. The series `format` controls how cell labels and tooltips read; compact numbers fit small cells.
27
+
28
+ ```tsx
29
+ import { Chart } from '@motifx-community/ui';
30
+
31
+ const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
32
+
33
+ // Five weeks of steps walked, more at the weekend.
34
+ const STEPS = Array.from({ length: 5 }, (_, w) => `Week ${w + 1}`).flatMap((week, w) =>
35
+ DAYS.map((day, d) => ({ week, day, steps: Math.round(5200 + (d >= 5 ? 4200 : 0) + Math.sin(w * 2 + d) * 1800 + w * 350) }))
36
+ );
37
+
38
+ /** A calendar of weeks and days: each cell's label reads in the series' own format, short enough to fit. */
39
+ export default function HeatmapCalendar() {
40
+ return (
41
+ <Chart
42
+ class="ch-heat-calendar"
43
+ title="Steps walked"
44
+ data={STEPS}
45
+ xField="day"
46
+ series={[{ type: 'heatmap', yField: 'week', valueField: 'steps', name: 'Steps', labels: 'all', format: { notation: 'compact', maximumFractionDigits: 1 } }]}
47
+ />
48
+ );
49
+ }
50
+ ```
51
+
52
+ ## Many cells
53
+
54
+ In a dense grid, leave `labels` off. The color steps show the pattern, and the tooltip and the table view show each value.
55
+
56
+ ```tsx
57
+ import { Chart } from '@motifx-community/ui';
58
+
59
+ const DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
60
+ const HOURS = Array.from({ length: 24 }, (_, h) => String(h).padStart(2, '0'));
61
+
62
+ // How long the server takes to answer, slower in working hours.
63
+ const TIMES = DAYS.flatMap((day, d) =>
64
+ HOURS.map((hour, h) => ({ day, hour, ms: Math.round(90 + (d < 5 ? 1 : 0.4) * 160 * Math.max(0, Math.sin(((h - 6) / 14) * Math.PI)) + ((h * 7 + d * 3) % 11) * 4) }))
65
+ );
66
+
67
+ /** Many cells and no labels: the colors carry the pattern, the tooltip and the table carry the values. */
68
+ export default function HeatmapHours() {
69
+ return (
70
+ <Chart
71
+ class="ch-heat-hours"
72
+ title="Response time by hour"
73
+ data={TIMES}
74
+ xField="hour"
75
+ xAxis={{ title: 'Hour of the day' }}
76
+ series={[{ type: 'heatmap', yField: 'day', valueField: 'ms', name: 'Response time', format: { style: 'unit', unit: 'millisecond', maximumFractionDigits: 0 } }]}
77
+ />
78
+ );
79
+ }
80
+ ```
81
+
82
+ ## API reference
83
+
84
+ | Field | Type | Default | Description |
85
+ | --- | --- | --- | --- |
86
+ | `valueField` | `string \| (row) => unknown` | | The value a heat map shows as a color. |
87
+ | `labels` | `'none' \| 'last' \| 'extremes' \| 'all'` | `'none'` | The values that show a label. A label that does not fit is omitted. |
88
+
89
+ Every other prop, member and event is on the [Overview](chart.md#api).
90
+
91
+ ## Feedback
92
+
93
+ Loading issues…
@@ -0,0 +1,128 @@
1
+ # Chart: Lines and areas
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ Lines and areas show how values change along an axis: over time, or from one category to the next.
6
+
7
+ ## Lines
8
+
9
+ A line is the default series type. `smooth` curves the line without adding a peak that is not in the data, and `labels` shows selected values on the chart. Point to a position to read every series at that position.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+ import { SALES } from './sales';
14
+
15
+ /** Two series, the second one smoothed and with its last value labeled. */
16
+ export default function Lines() {
17
+ return (
18
+ <Chart
19
+ class="ch-lines"
20
+ title="Sales by channel"
21
+ data={SALES}
22
+ xField="month"
23
+ series={[
24
+ { yField: 'online', name: 'Online', labels: 'last' },
25
+ { yField: 'stores', name: 'Stores', smooth: true, labels: 'last' }
26
+ ]}
27
+ />
28
+ );
29
+ }
30
+ ```
31
+
32
+ ## Areas
33
+
34
+ `stacked` adds the areas together, so that the top line shows the total.
35
+
36
+ ```tsx
37
+ import { Chart } from '@motifx-community/ui';
38
+ import { SALES } from './sales';
39
+
40
+ /** Areas stacked on each other: the top line is the total. */
41
+ export default function Areas() {
42
+ return (
43
+ <Chart
44
+ class="ch-areas"
45
+ title="Total sales"
46
+ data={SALES}
47
+ xField="month"
48
+ stacked="normal"
49
+ series={[
50
+ { type: 'area', yField: 'stores', name: 'Stores' },
51
+ { type: 'area', yField: 'online', name: 'Online' }
52
+ ]}
53
+ />
54
+ );
55
+ }
56
+ ```
57
+
58
+ ## Dates
59
+
60
+ Date values produce a time axis, with marks on round days and months in the language of the page. Long series are reduced to what the width can display, and their peaks are preserved.
61
+
62
+ ```tsx
63
+ import { Chart } from '@motifx-community/ui';
64
+
65
+ const DAY = 24 * 60 * 60 * 1000;
66
+ const START = new Date(2026, 0, 1).getTime();
67
+ const VISITS = Array.from({ length: 180 }, (_, i) => ({
68
+ day: new Date(START + i * DAY),
69
+ visits: Math.round(900 + i * 6 + Math.sin(i / 6) * 180 + (i % 7 === 0 ? -160 : 0))
70
+ }));
71
+
72
+ /** Dates place themselves on round days and months. */
73
+ export default function TimeAxis() {
74
+ return <Chart class="ch-time" title="Daily visits" data={VISITS} xField="day" series={[{ type: 'area', yField: 'visits', name: 'Visits' }]} />;
75
+ }
76
+ ```
77
+
78
+ ## Missing values
79
+
80
+ A missing value breaks the line, because nothing was measured at that position. `gaps` connects across it or treats it as zero, and `step` draws a stepped line.
81
+
82
+ ```tsx
83
+ import { Chart } from '@motifx-community/ui';
84
+
85
+ const READINGS = [
86
+ { hour: '08:00', room: 19 },
87
+ { hour: '09:00', room: 20 },
88
+ { hour: '10:00', room: null },
89
+ { hour: '11:00', room: 22 },
90
+ { hour: '12:00', room: 23 },
91
+ { hour: '13:00', room: null },
92
+ { hour: '14:00', room: 24 },
93
+ { hour: '15:00', room: null },
94
+ { hour: '16:00', room: 22 }
95
+ ];
96
+
97
+ /** An empty value breaks a line, as nothing was measured. `gaps` can join past it instead. */
98
+ export default function Gaps() {
99
+ return (
100
+ <Chart
101
+ class="ch-gaps"
102
+ title="Room temperature"
103
+ data={READINGS}
104
+ xField="hour"
105
+ series={[
106
+ { yField: 'room', name: 'Broken', markers: true },
107
+ { yField: (row: { room: number | null }) => (row.room === null ? null : row.room + 4), name: 'Joined', gaps: 'connect', step: 'middle' }
108
+ ]}
109
+ />
110
+ );
111
+ }
112
+ ```
113
+
114
+ ## API reference
115
+
116
+ | Field | Type | Default | Description |
117
+ | --- | --- | --- | --- |
118
+ | `smooth` | `boolean` | `false` | Curves the line without passing the values it connects. |
119
+ | `step` | `'start' \| 'middle' \| 'end'` | | Draws a stepped line, and sets where the value changes. |
120
+ | `markers` | `boolean` | `false` | Marks each value on a line. |
121
+ | `labels` | `'none' \| 'last' \| 'extremes' \| 'all'` | `'none'` | The values that show a label. A label that does not fit is omitted. |
122
+ | `gaps` | `'break' \| 'connect' \| 'zero'` | `'break'` | How a line treats a missing value. |
123
+
124
+ Every other prop, member and event is on the [Overview](chart.md#api).
125
+
126
+ ## Feedback
127
+
128
+ Loading issues…
@@ -0,0 +1,62 @@
1
+ # Chart: Live data
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A chart follows its data: reactive values redraw it, and live data moves along with the latest values.
6
+
7
+ ## Live data
8
+
9
+ `span` on the position axis shows only the latest stretch: a time in milliseconds, a number, or a count of categories. When the values change, the marks move from where they were, over the design language's motion.
10
+
11
+ ```tsx
12
+ import { reactive } from '@motifx/core';
13
+ import { Button, Chart, Stack } from '@motifx-community/ui';
14
+
15
+ const SECOND = 1000;
16
+
17
+ /** New values arrive every second, and the chart shows the last 30 seconds. The marks move from where they were. */
18
+ export default function Streaming() {
19
+ const now = Date.now();
20
+ const s = reactive({ running: true, points: Array.from({ length: 30 }, (_, i) => ({ time: new Date(now - (30 - i) * SECOND), value: 40 + Math.round(Math.random() * 20) })) });
21
+ const timer = setInterval(() => {
22
+ if (!s.running) return;
23
+ const last = s.points[s.points.length - 1];
24
+ const next = { time: new Date(last.time.getTime() + SECOND), value: Math.max(5, Math.min(95, last.value + Math.round(Math.random() * 14 - 7))) };
25
+ s.points = [...s.points.slice(-120), next];
26
+ }, SECOND);
27
+ return (
28
+ <Stack class="docs-wide" gap="sm" onDisposing={() => clearInterval(timer)}>
29
+ <Chart class="ch-stream" label="Requests a second" data={() => s.points} xField="time" xAxis={{ span: 30 * SECOND }} yAxis={{ min: 0, max: 100 }} series={[{ yField: 'value', name: 'Requests', labels: 'last' }]} />
30
+ <Button text={() => (s.running ? 'Pause' : 'Go on')} variant="outline" onclick={() => (s.running = !s.running)} />
31
+ </Stack>
32
+ );
33
+ }
34
+ ```
35
+
36
+ ## Reactive data
37
+
38
+ A function prop follows reactive data. For plain data, call `reState()`, or `refresh()` after an in-place change.
39
+
40
+ ```tsx
41
+ import { reactive } from '@motifx/core';
42
+ import { Button, Chart, Stack } from '@motifx-community/ui';
43
+
44
+ /** A function prop follows reactive data. */
45
+ export default function Live() {
46
+ const s = reactive({ points: [12, 18, 15, 21, 19].map((value, i) => ({ step: i + 1, value })) });
47
+ const add = () => {
48
+ const last = s.points[s.points.length - 1];
49
+ s.points = [...s.points, { step: last.step + 1, value: Math.max(2, last.value + Math.round(Math.random() * 12 - 6)) }];
50
+ };
51
+ return (
52
+ <Stack class="docs-wide" gap="md">
53
+ <Chart class="ch-live" label="A growing series" data={() => s.points} xField="step" series={[{ yField: 'value', name: 'Value', markers: true }]} />
54
+ <Button text="Add a value" variant="outline" onclick={add} />
55
+ </Stack>
56
+ );
57
+ }
58
+ ```
59
+
60
+ ## Feedback
61
+
62
+ Loading issues…
@@ -0,0 +1,125 @@
1
+ # Chart: Pie and donut
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A pie or a donut splits one whole into its parts, for a share seen at a glance.
6
+
7
+ ## Pie and donut
8
+
9
+ `pie` and `donut` split one whole into its parts. Shares are written inside the slices that have room for them, the legend names every part, and a donut shows the total in its middle. For close values, bars compare more exactly.
10
+
11
+ ```tsx
12
+ import { reactive } from '@motifx/core';
13
+ import { ButtonGroup, Chart, Stack, type ChartSeriesType } from '@motifx-community/ui';
14
+
15
+ const TRAFFIC = [
16
+ { source: 'Search', visits: 4820 },
17
+ { source: 'Direct', visits: 2610 },
18
+ { source: 'Social', visits: 1480 },
19
+ { source: 'Email', visits: 920 },
20
+ { source: 'Referral', visits: 540 }
21
+ ];
22
+
23
+ /** One whole and its parts. Hide a part in the legend: the others share the whole again, and keep their colors. */
24
+ export default function Parts() {
25
+ const s = reactive({ type: 'donut' as ChartSeriesType });
26
+ return (
27
+ <Stack class="docs-wide" gap="md">
28
+ <ButtonGroup
29
+ label="Shape"
30
+ x-model={() => s.type}
31
+ items={[
32
+ { value: 'donut', text: 'Donut' },
33
+ { value: 'pie', text: 'Pie' }
34
+ ]}
35
+ />
36
+ <Chart class="ch-parts" title="Visits by source" data={TRAFFIC} xField="source" series={() => [{ type: s.type, yField: 'visits', name: 'Visits' }]} />
37
+ </Stack>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Labels and starting angle
43
+
44
+ `labels: 'all'` writes a value on every part that has room for it, in the series' `format`. `startAngle` turns the first part to another position, and `innerRadius` sets the width of the ring.
45
+
46
+ ```tsx
47
+ import { Chart } from '@motifx-community/ui';
48
+
49
+ const DISK = [
50
+ { kind: 'Photos', size: 182 },
51
+ { kind: 'Videos', size: 124 },
52
+ { kind: 'Apps', size: 64 },
53
+ { kind: 'Documents', size: 22 },
54
+ { kind: 'System', size: 38 }
55
+ ];
56
+
57
+ /** A thin ring that starts at the right, with every share written on its part. */
58
+ export default function PieLabels() {
59
+ return (
60
+ <Chart
61
+ class="ch-pie-labels"
62
+ title="Disk use"
63
+ subtitle="430 GB of 512 GB"
64
+ data={DISK}
65
+ xField="kind"
66
+ series={[{ type: 'donut', yField: 'size', name: 'Size', innerRadius: 0.72, startAngle: 90, labels: 'all', format: { style: 'unit', unit: 'gigabyte' } }]}
67
+ />
68
+ );
69
+ }
70
+ ```
71
+
72
+ ## Choosing a part
73
+
74
+ `pointSelection` lets the reader choose a part with a click or with Enter. `onSelectionChanged` gives the chosen point, with its `share` of the whole.
75
+
76
+ ```tsx
77
+ import { reactive } from '@motifx/core';
78
+ import { Chart, Stack } from '@motifx-community/ui';
79
+
80
+ const SPENDING = [
81
+ { item: 'Rent', amount: 1200 },
82
+ { item: 'Food', amount: 540 },
83
+ { item: 'Transport', amount: 210 },
84
+ { item: 'Bills', amount: 180 },
85
+ { item: 'Leisure', amount: 260 }
86
+ ];
87
+
88
+ const money = new Intl.NumberFormat(undefined, { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 });
89
+
90
+ /** A click, or Enter, chooses a part; the page tells what it is and how much of the whole it takes. */
91
+ export default function PieChoose() {
92
+ const s = reactive({ told: 'Choose a part of the pie.' });
93
+ return (
94
+ <Stack class="docs-wide" gap="sm">
95
+ <Chart
96
+ class="ch-pie-choose"
97
+ title="Spending in March"
98
+ data={SPENDING}
99
+ xField="item"
100
+ pointSelection="single"
101
+ series={[{ type: 'pie', yField: 'amount', name: 'Amount', format: { style: 'currency', currency: 'EUR', maximumFractionDigits: 0 } }]}
102
+ onSelectionChanged={e => {
103
+ const p = e.points[0];
104
+ s.told = p ? `${p.xText}: ${money.format(p.y)}, ${Math.round((p.share ?? 0) * 100)}% of the month` : 'Choose a part of the pie.';
105
+ }}
106
+ />
107
+ <output class="ch-pie-told">{() => s.told}</output>
108
+ </Stack>
109
+ );
110
+ }
111
+ ```
112
+
113
+ ## API reference
114
+
115
+ | Field | Type | Default | Description |
116
+ | --- | --- | --- | --- |
117
+ | `innerRadius` | `number` | From the design language | The hole of a donut, as a share of its radius. |
118
+ | `startAngle` | `number` | `0` | Where the first slice starts, in degrees from the top, clockwise. |
119
+ | `labels` | `'none' \| 'last' \| 'extremes' \| 'all'` | `'none'` | The values that show a label. A label that does not fit is omitted. |
120
+
121
+ Every other prop, member and event is on the [Overview](chart.md#api).
122
+
123
+ ## Feedback
124
+
125
+ Loading issues…