@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,124 @@
1
+ # Chart: Radar
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A radar compares several measures at once, for one or more items.
6
+
7
+ ## Radar
8
+
9
+ `radar` places a spoke for each category around a center and draws a shape for each series.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const SCORES = [
15
+ { skill: 'Speed', a: 82, b: 64 },
16
+ { skill: 'Battery', a: 58, b: 88 },
17
+ { skill: 'Camera', a: 90, b: 72 },
18
+ { skill: 'Screen', a: 76, b: 80 },
19
+ { skill: 'Sound', a: 64, b: 70 },
20
+ { skill: 'Price', a: 48, b: 84 }
21
+ ];
22
+
23
+ /** Several measures around a center, one shape for each series. */
24
+ export default function Radar() {
25
+ return (
26
+ <Chart
27
+ class="ch-radar"
28
+ title="Two phones compared"
29
+ data={SCORES}
30
+ xField="skill"
31
+ series={[
32
+ { type: 'radar', yField: 'a', name: 'Phone A', markers: true },
33
+ { type: 'radar', yField: 'b', name: 'Phone B', markers: true }
34
+ ]}
35
+ />
36
+ );
37
+ }
38
+ ```
39
+
40
+ ## Fixed scale and a target
41
+
42
+ Set `min` and `max` on the value axis so that shapes compare against the same scale. A target series gives a reference shape; the reader can hide series in the legend.
43
+
44
+ ```tsx
45
+ import { Chart } from '@motifx-community/ui';
46
+
47
+ const REVIEW = [
48
+ { skill: 'Delivery', target: 80, team: 86, last: 72 },
49
+ { skill: 'Quality', target: 85, team: 78, last: 74 },
50
+ { skill: 'Teamwork', target: 75, team: 88, last: 80 },
51
+ { skill: 'Planning', target: 70, team: 62, last: 55 },
52
+ { skill: 'Learning', target: 60, team: 74, last: 66 }
53
+ ];
54
+
55
+ /** A fixed scale from 0 to 100, so shapes compare fairly; hide a series in the legend to compare two. */
56
+ export default function RadarTarget() {
57
+ return (
58
+ <Chart
59
+ class="ch-radar-target"
60
+ title="Team review"
61
+ data={REVIEW}
62
+ xField="skill"
63
+ yAxis={{ min: 0, max: 100, tickCount: 5 }}
64
+ series={[
65
+ { type: 'radar', yField: 'target', name: 'Target' },
66
+ { type: 'radar', yField: 'team', name: 'This year', markers: true },
67
+ { type: 'radar', yField: 'last', name: 'Last year', markers: true }
68
+ ]}
69
+ />
70
+ );
71
+ }
72
+ ```
73
+
74
+ ## A year around the circle
75
+
76
+ A radar suits data that repeats in a cycle, such as the months of a year, because the last position joins the first.
77
+
78
+ ```tsx
79
+ import { Chart } from '@motifx-community/ui';
80
+
81
+ const RAIN = [
82
+ { month: 'Jan', north: 92, south: 110 },
83
+ { month: 'Feb', north: 74, south: 96 },
84
+ { month: 'Mar', north: 68, south: 72 },
85
+ { month: 'Apr', north: 52, south: 48 },
86
+ { month: 'May', north: 46, south: 30 },
87
+ { month: 'Jun', north: 38, south: 12 },
88
+ { month: 'Jul', north: 30, south: 4 },
89
+ { month: 'Aug', north: 34, south: 6 },
90
+ { month: 'Sep', north: 48, south: 22 },
91
+ { month: 'Oct', north: 70, south: 58 },
92
+ { month: 'Nov', north: 84, south: 92 },
93
+ { month: 'Dec', north: 98, south: 118 }
94
+ ];
95
+
96
+ /** Twelve months around the circle: a year that comes back to where it started. */
97
+ export default function RadarYear() {
98
+ return (
99
+ <Chart
100
+ class="ch-radar-year"
101
+ title="Rain over the year"
102
+ data={RAIN}
103
+ xField="month"
104
+ yAxis={{ format: { style: 'unit', unit: 'millimeter' } }}
105
+ series={[
106
+ { type: 'radar', yField: 'north', name: 'North coast' },
107
+ { type: 'radar', yField: 'south', name: 'South coast' }
108
+ ]}
109
+ />
110
+ );
111
+ }
112
+ ```
113
+
114
+ ## API reference
115
+
116
+ | Field | Type | Default | Description |
117
+ | --- | --- | --- | --- |
118
+ | `markers` | `boolean` | `false` | Marks each value on a line. |
119
+
120
+ Every other prop, member and event is on the [Overview](chart.md#api).
121
+
122
+ ## Feedback
123
+
124
+ Loading issues…
@@ -0,0 +1,127 @@
1
+ # Chart: Ranges
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ Ranges show a low and a high value for each position, as a band or as floating bars.
6
+
7
+ ## Ranges
8
+
9
+ `rangeArea` and `rangeBar` draw from `lowField` to `highField`, and other series share the axis.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const WEATHER = [
15
+ { month: 'Jan', low: 2, high: 9, mean: 5 },
16
+ { month: 'Feb', low: 3, high: 11, mean: 7 },
17
+ { month: 'Mar', low: 5, high: 14, mean: 9 },
18
+ { month: 'Apr', low: 8, high: 18, mean: 13 },
19
+ { month: 'May', low: 12, high: 23, mean: 17 },
20
+ { month: 'Jun', low: 16, high: 28, mean: 22 },
21
+ { month: 'Jul', low: 19, high: 31, mean: 25 },
22
+ { month: 'Aug', low: 19, high: 31, mean: 25 },
23
+ { month: 'Sep', low: 15, high: 26, mean: 21 },
24
+ { month: 'Oct', low: 11, high: 21, mean: 16 },
25
+ { month: 'Nov', low: 7, high: 15, mean: 11 },
26
+ { month: 'Dec', low: 4, high: 11, mean: 7 }
27
+ ];
28
+
29
+ /** A band from the lowest to the highest value, with a line through it. */
30
+ export default function Ranges() {
31
+ return (
32
+ <Chart
33
+ class="ch-range"
34
+ title="Temperature over the year"
35
+ data={WEATHER}
36
+ xField="month"
37
+ yAxis={{ format: { style: 'unit', unit: 'celsius' } }}
38
+ series={[
39
+ { type: 'rangeArea', lowField: 'low', highField: 'high', name: 'Range' },
40
+ { yField: 'mean', name: 'Mean', smooth: true }
41
+ ]}
42
+ />
43
+ );
44
+ }
45
+ ```
46
+
47
+ ## Forecast with a range
48
+
49
+ Each series can take rows of its own with `data`. Here the actual values, the forecast and its likely range share one category axis, and the band widens as the forecast goes further.
50
+
51
+ ```tsx
52
+ import { Chart } from '@motifx-community/ui';
53
+
54
+ const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
55
+ const SOLD = [420, 446, 470, 462, 498, 530, 548];
56
+
57
+ // The months give the axis; the series bring their own values.
58
+ const AXIS: Record<string, string | number>[] = MONTHS.map(month => ({ month }));
59
+ const ACTUAL = SOLD.map((units, i) => ({ month: MONTHS[i], units }));
60
+ // The forecast starts at the last real month and widens as it goes further.
61
+ const FORECAST = MONTHS.slice(SOLD.length - 1).map((month, i) => {
62
+ const units = SOLD[SOLD.length - 1] + i * 22;
63
+ return { month, units, low: units - i * 16, high: units + i * 16 };
64
+ });
65
+
66
+ /** Each series with rows of its own: what was sold, the forecast, and the band it may fall in. */
67
+ export default function RangesForecast() {
68
+ return (
69
+ <Chart
70
+ class="ch-range-forecast"
71
+ title="Units sold, and the forecast"
72
+ data={AXIS}
73
+ xField="month"
74
+ series={[
75
+ { type: 'rangeArea', data: FORECAST, lowField: 'low', highField: 'high', name: 'Likely range' },
76
+ { data: FORECAST, yField: 'units', name: 'Forecast', markers: true },
77
+ { data: ACTUAL, yField: 'units', name: 'Sold', markers: true }
78
+ ]}
79
+ />
80
+ );
81
+ }
82
+ ```
83
+
84
+ ## Timeline
85
+
86
+ `rangeBar` with `horizontal` lays out start and end values on their side, as in a project plan. A reference line marks the current week.
87
+
88
+ ```tsx
89
+ import { Chart } from '@motifx-community/ui';
90
+
91
+ const TASKS = [
92
+ { task: 'Research', start: 1, end: 4 },
93
+ { task: 'Design', start: 3, end: 8 },
94
+ { task: 'Build', start: 6, end: 16 },
95
+ { task: 'Test', start: 12, end: 18 },
96
+ { task: 'Launch', start: 18, end: 20 }
97
+ ];
98
+
99
+ /** Bars from a start to an end, laid on their side: a plan read week by week, with a line for this week. */
100
+ export default function RangesTimeline() {
101
+ return (
102
+ <Chart
103
+ class="ch-range-timeline"
104
+ title="Project plan"
105
+ data={TASKS}
106
+ xField="task"
107
+ horizontal
108
+ legend={false}
109
+ yAxis={{ title: 'Week', min: 0, max: 20 }}
110
+ references={[{ value: 9, label: 'This week' }]}
111
+ series={[{ type: 'rangeBar', lowField: 'start', highField: 'end', name: 'Weeks' }]}
112
+ />
113
+ );
114
+ }
115
+ ```
116
+
117
+ ## API reference
118
+
119
+ | Field | Type | Default | Description |
120
+ | --- | --- | --- | --- |
121
+ | `lowField, highField` | `string \| (row) => unknown` | | The ends of a range, and the lowest and highest price of a candle. |
122
+
123
+ Every other prop, member and event is on the [Overview](chart.md#api).
124
+
125
+ ## Feedback
126
+
127
+ Loading issues…
@@ -0,0 +1,126 @@
1
+ # Chart: References and selection
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ Reference lines and bands give the values a target, a limit or a period, and the reader can choose values to act on.
6
+
7
+ ## Reference lines and bands
8
+
9
+ `references` draws a line at a value or a position, or a band between two, with an optional label.
10
+
11
+ ```tsx
12
+ /** Twelve months of made-up figures, shared by the examples. */
13
+ export const SALES = [
14
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
15
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
16
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
17
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
18
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
19
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
20
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
21
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
22
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
23
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
24
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
25
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
26
+ ];
27
+ ```
28
+
29
+ ## Choosing values
30
+
31
+ `pointSelection` lets a click or Enter choose one value or several. `onSelectionChanged` gives the values chosen, `selectedPoints` reads them and `clearSelection()` lets them go.
32
+
33
+ ```tsx
34
+ /** Twelve months of made-up figures, shared by the examples. */
35
+ export const SALES = [
36
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
37
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
38
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
39
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
40
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
41
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
42
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
43
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
44
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
45
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
46
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
47
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
48
+ ];
49
+ ```
50
+
51
+ ## Feedback
52
+
53
+ Loading issues…
54
+
55
+ ## Example files
56
+
57
+ `References.tsx`
58
+
59
+ ```tsx
60
+ import { Chart } from '@motifx-community/ui';
61
+ import { SALES } from './sales';
62
+
63
+ /** A target across the values, and a period marked on the positions. */
64
+ export default function References() {
65
+ return (
66
+ <Chart
67
+ class="ch-refs"
68
+ title="Online sales against the target"
69
+ data={SALES}
70
+ xField="month"
71
+ references={[
72
+ { value: 8000, label: 'Target' },
73
+ { axis: 'x', from: 'Jun', to: 'Aug', label: 'Summer sale' }
74
+ ]}
75
+ series={[{ type: 'bar', yField: 'online', name: 'Online' }]}
76
+ />
77
+ );
78
+ }
79
+ ```
80
+
81
+ `sales.ts`
82
+
83
+ ```tsx
84
+ /** Twelve months of made-up figures, shared by the examples. */
85
+ export const SALES = [
86
+ { month: 'Jan', online: 4200, stores: 6100, returns: 310 },
87
+ { month: 'Feb', online: 4600, stores: 5800, returns: 280 },
88
+ { month: 'Mar', online: 5900, stores: 6400, returns: 420 },
89
+ { month: 'Apr', online: 6300, stores: 6000, returns: 390 },
90
+ { month: 'May', online: 7100, stores: 6600, returns: 450 },
91
+ { month: 'Jun', online: 7600, stores: 7000, returns: 520 },
92
+ { month: 'Jul', online: 8200, stores: 6800, returns: 610 },
93
+ { month: 'Aug', online: 8000, stores: 6500, returns: 580 },
94
+ { month: 'Sep', online: 8900, stores: 7200, returns: 640 },
95
+ { month: 'Oct', online: 9400, stores: 7600, returns: 700 },
96
+ { month: 'Nov', online: 11200, stores: 8800, returns: 930 },
97
+ { month: 'Dec', online: 12800, stores: 10100, returns: 1100 }
98
+ ];
99
+ ```
100
+
101
+ `Selection.tsx`
102
+
103
+ ```tsx
104
+ import { reactive } from '@motifx/core';
105
+ import { Chart, Stack } from '@motifx-community/ui';
106
+ import { SALES } from './sales';
107
+
108
+ /** A click, or Enter with the keyboard, chooses months; a second click lets one go. */
109
+ export default function Selection() {
110
+ const s = reactive({ chosen: 'Nothing chosen' });
111
+ return (
112
+ <Stack class="docs-wide" gap="sm">
113
+ <Chart
114
+ class="ch-select"
115
+ label="Online sales"
116
+ data={SALES.slice(0, 6)}
117
+ xField="month"
118
+ pointSelection="multiple"
119
+ series={[{ type: 'bar', yField: 'online', name: 'Online' }]}
120
+ onSelectionChanged={(e) => (s.chosen = e.points.length ? e.points.map((p) => p.xText).join(', ') : 'Nothing chosen')}
121
+ />
122
+ <output class="ch-select-told">{() => s.chosen}</output>
123
+ </Stack>
124
+ );
125
+ }
126
+ ```
@@ -0,0 +1,139 @@
1
+ # Chart: Scatter and bubble
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ Scatter and bubble charts place each row by two numbers, to show how they relate.
6
+
7
+ ## Scatter and bubble charts
8
+
9
+ `scatter` and `bubble` plot two numeric values. `sizeField` adds a third value to a bubble, represented by its area. The pointer selects the nearest point.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const CARS = [
15
+ { power: 66, weight: 980, price: 16 },
16
+ { power: 90, weight: 1120, price: 21 },
17
+ { power: 110, weight: 1240, price: 27 },
18
+ { power: 130, weight: 1320, price: 31 },
19
+ { power: 150, weight: 1450, price: 38 },
20
+ { power: 170, weight: 1510, price: 44 },
21
+ { power: 190, weight: 1600, price: 52 },
22
+ { power: 230, weight: 1680, price: 71 },
23
+ { power: 260, weight: 1760, price: 86 },
24
+ { power: 300, weight: 1850, price: 112 }
25
+ ];
26
+
27
+ /** Two numbers per dot, and a third as its size. The size counts by area. */
28
+ export default function Scatter() {
29
+ return (
30
+ <Chart
31
+ class="ch-scatter"
32
+ title="Power, weight and price"
33
+ data={CARS}
34
+ xField="power"
35
+ xAxis={{ title: 'Power (hp)' }}
36
+ yAxis={{ title: 'Weight (kg)', min: 800 }}
37
+ series={[{ type: 'bubble', yField: 'weight', sizeField: 'price', name: 'Cars' }]}
38
+ />
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Groups and reference lines
44
+
45
+ Each group is a series with rows of its own. References on both axes mark a mean on the horizontal axis and a threshold on the vertical one.
46
+
47
+ ```tsx
48
+ import { Chart } from '@motifx-community/ui';
49
+
50
+ // Hours studied and the exam score of two classes.
51
+ const CLASS_A = [2, 3, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11].map((hours, i) => ({ hours, score: Math.min(98, Math.round(42 + hours * 4.6 + ((i * 7) % 9) - 4)) }));
52
+ const CLASS_B = [1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 12].map((hours, i) => ({ hours, score: Math.min(98, Math.round(36 + hours * 5.1 + ((i * 5) % 11) - 5)) }));
53
+
54
+ const mean = (rows: { hours: number; score: number }[], key: 'hours' | 'score') => Math.round((rows.reduce((sum, r) => sum + r[key], 0) / rows.length) * 10) / 10;
55
+ const ALL = [...CLASS_A, ...CLASS_B];
56
+
57
+ /** Two groups of dots, each with rows of its own, and lines at the means of both axes. */
58
+ export default function ScatterGroups() {
59
+ return (
60
+ <Chart
61
+ class="ch-scatter-groups"
62
+ title="Study time and exam score"
63
+ xField="hours"
64
+ xAxis={{ title: 'Hours studied', min: 0 }}
65
+ yAxis={{ title: 'Score', min: 30, max: 100 }}
66
+ references={[
67
+ { axis: 'x', value: mean(ALL, 'hours'), label: 'Mean hours' },
68
+ { value: 70, label: 'Pass' }
69
+ ]}
70
+ series={[
71
+ { type: 'scatter', data: CLASS_A, yField: 'score', name: 'Class A' },
72
+ { type: 'scatter', data: CLASS_B, yField: 'score', name: 'Class B' }
73
+ ]}
74
+ />
75
+ );
76
+ }
77
+ ```
78
+
79
+ ## Choosing points
80
+
81
+ `pointSelection: 'multiple'` lets the reader choose several dots with clicks, or with the arrow keys and Enter. `onSelectionChanged` gives the chosen rows, and `tooltip.format` writes a tooltip of your own.
82
+
83
+ ```tsx
84
+ import { reactive } from '@motifx/core';
85
+ import { Chart, Stack } from '@motifx-community/ui';
86
+
87
+ const CITIES = [
88
+ { city: 'Lisbon', rent: 1350, salary: 1600 },
89
+ { city: 'Madrid', rent: 1250, salary: 2100 },
90
+ { city: 'Milan', rent: 1500, salary: 2300 },
91
+ { city: 'Vienna', rent: 1100, salary: 2900 },
92
+ { city: 'Prague', rent: 950, salary: 1900 },
93
+ { city: 'Warsaw', rent: 900, salary: 1700 },
94
+ { city: 'Berlin', rent: 1400, salary: 3300 },
95
+ { city: 'Athens', rent: 700, salary: 1200 },
96
+ { city: 'Dublin', rent: 2100, salary: 3500 },
97
+ { city: 'Helsinki', rent: 1150, salary: 3100 }
98
+ ];
99
+
100
+ /** Click dots, or move to them with the arrow keys and press Enter, to choose several; the page compares them. */
101
+ export default function ScatterChoose() {
102
+ const s = reactive({ told: 'Choose cities on the chart.' });
103
+ return (
104
+ <Stack class="docs-wide" gap="sm">
105
+ <Chart
106
+ class="ch-scatter-choose"
107
+ title="Rent and salary"
108
+ subtitle="Monthly, in euros"
109
+ data={CITIES}
110
+ xField="rent"
111
+ pointSelection="multiple"
112
+ xAxis={{ title: 'Rent of a flat' }}
113
+ yAxis={{ title: 'Salary after tax' }}
114
+ tooltip={{ format: c => (c.point ? `${c.point.row.city}: rent ${c.point.xText}, salary ${c.point.yText}` : c.title) }}
115
+ series={[{ type: 'scatter', yField: 'salary', name: 'Cities' }]}
116
+ onSelectionChanged={e =>
117
+ (s.told = e.points.length
118
+ ? e.points.map(p => `${p.row.city}: ${Math.round((p.row.rent / p.row.salary) * 100)}% of the salary`).join(' · ')
119
+ : 'Choose cities on the chart.')
120
+ }
121
+ />
122
+ <output class="ch-scatter-told">{() => s.told}</output>
123
+ </Stack>
124
+ );
125
+ }
126
+ ```
127
+
128
+ ## API reference
129
+
130
+ | Field | Type | Default | Description |
131
+ | --- | --- | --- | --- |
132
+ | `sizeField` | `string \| (row) => unknown` | | The size of a bubble. |
133
+ | `markers` | `boolean` | `false` | Marks each value on a line. |
134
+
135
+ Every other prop, member and event is on the [Overview](chart.md#api).
136
+
137
+ ## Feedback
138
+
139
+ Loading issues…
@@ -0,0 +1,111 @@
1
+ # Chart: Waterfall
2
+
3
+ > Charts · @motifx-community/ui 0.1.0-beta.7
4
+
5
+ A waterfall shows how a starting value becomes an end value through changes up and down.
6
+
7
+ ## Waterfall
8
+
9
+ `waterfall` adds each change to the last one, and a row with `totalField` set shows the total so far. A thin line carries the total from one step to the next.
10
+
11
+ ```tsx
12
+ import { Chart } from '@motifx-community/ui';
13
+
14
+ const BUDGET = [
15
+ { item: 'Start', change: 1200 },
16
+ { item: 'Sales', change: 860 },
17
+ { item: 'Services', change: 340 },
18
+ { item: 'Salaries', change: -690 },
19
+ { item: 'Rent', change: -240 },
20
+ { item: 'Half year', total: true },
21
+ { item: 'Taxes', change: -310 },
22
+ { item: 'End', total: true }
23
+ ];
24
+
25
+ /** Each step adds or takes away, and a total row shows where it stands. */
26
+ export default function Waterfall() {
27
+ return <Chart class="ch-waterfall" title="Cash over the year" data={BUDGET} xField="item" series={[{ type: 'waterfall', yField: 'change', totalField: 'total', name: 'Cash', labels: 'all' }]} />;
28
+ }
29
+ ```
30
+
31
+ ## On its side
32
+
33
+ `horizontal` gives long step names room to read in full. Labels follow the series `format`, here compact currency.
34
+
35
+ ```tsx
36
+ import { Chart } from '@motifx-community/ui';
37
+
38
+ const BRIDGE = [
39
+ { step: 'Profit last year', change: 4.2 },
40
+ { step: 'Higher prices', change: 1.1 },
41
+ { step: 'More units sold', change: 0.8 },
42
+ { step: 'Material costs', change: -1.4 },
43
+ { step: 'New staff', change: -0.6 },
44
+ { step: 'Exchange rates', change: -0.3 },
45
+ { step: 'Profit this year', total: true }
46
+ ];
47
+
48
+ /** On its side, so long step names read in full. */
49
+ export default function WaterfallBridge() {
50
+ return (
51
+ <Chart
52
+ class="ch-waterfall-bridge"
53
+ title="From last year's profit to this year's"
54
+ subtitle="In millions of euros"
55
+ data={BRIDGE}
56
+ xField="step"
57
+ horizontal
58
+ legend={false}
59
+ series={[{ type: 'waterfall', yField: 'change', totalField: 'total', name: 'Profit', labels: 'all', format: { style: 'currency', currency: 'EUR', notation: 'compact', maximumFractionDigits: 1 } }]}
60
+ />
61
+ );
62
+ }
63
+ ```
64
+
65
+ ## Subtotals
66
+
67
+ A row with `totalField` set shows the running total at that point, so a waterfall can close each period. `labels: 'extremes'` labels only the highest and lowest bars.
68
+
69
+ ```tsx
70
+ import { Chart } from '@motifx-community/ui';
71
+
72
+ const FLOW = [
73
+ { month: 'Opening', change: 50 },
74
+ { month: 'Jan', change: 12 },
75
+ { month: 'Feb', change: -8 },
76
+ { month: 'Mar', change: 15 },
77
+ { month: 'Q1', total: true },
78
+ { month: 'Apr', change: -21 },
79
+ { month: 'May', change: 9 },
80
+ { month: 'Jun', change: 18 },
81
+ { month: 'Q2', total: true }
82
+ ];
83
+
84
+ /** Totals between the steps show where the account stands at the end of each quarter; only the highest and lowest bars carry labels. */
85
+ export default function WaterfallQuarters() {
86
+ return (
87
+ <Chart
88
+ class="ch-waterfall-quarters"
89
+ title="Account balance, first half"
90
+ subtitle="In thousands of euros"
91
+ data={FLOW}
92
+ xField="month"
93
+ legend={false}
94
+ series={[{ type: 'waterfall', yField: 'change', totalField: 'total', name: 'Balance', labels: 'extremes' }]}
95
+ />
96
+ );
97
+ }
98
+ ```
99
+
100
+ ## API reference
101
+
102
+ | Field | Type | Default | Description |
103
+ | --- | --- | --- | --- |
104
+ | `totalField` | `string \| (row) => unknown` | | A row of a waterfall that shows the total so far. |
105
+ | `labels` | `'none' \| 'last' \| 'extremes' \| 'all'` | `'none'` | The values that show a label. A label that does not fit is omitted. |
106
+
107
+ Every other prop, member and event is on the [Overview](chart.md#api).
108
+
109
+ ## Feedback
110
+
111
+ Loading issues…