@nanahoshi/mona-ui 0.25.1 → 0.26.1

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 (233) hide show
  1. package/README.md +2 -0
  2. package/chart/README.md +2 -2
  3. package/command/package.json +4 -0
  4. package/docs/auto-complete.md +733 -0
  5. package/docs/avatar.md +220 -0
  6. package/docs/breadcrumb.md +320 -0
  7. package/docs/button-group.md +392 -0
  8. package/docs/button.md +256 -0
  9. package/docs/calendar.md +515 -0
  10. package/docs/card.md +292 -0
  11. package/docs/chart-bar.md +714 -0
  12. package/docs/chart-financial.md +567 -0
  13. package/docs/chart-funnel.md +546 -0
  14. package/docs/chart-heatmap.md +535 -0
  15. package/docs/chart-line-area.md +462 -0
  16. package/docs/chart-pie.md +645 -0
  17. package/docs/chart-radar.md +518 -0
  18. package/docs/chart-radial.md +658 -0
  19. package/docs/chart-scatter.md +479 -0
  20. package/docs/chart-treemap.md +651 -0
  21. package/docs/chart.md +2465 -0
  22. package/docs/checkbox.md +374 -0
  23. package/docs/chip.md +339 -0
  24. package/docs/circular-progress-bar.md +287 -0
  25. package/docs/collapsible.md +308 -0
  26. package/docs/color-gradient.md +336 -0
  27. package/docs/color-palette.md +317 -0
  28. package/docs/color-picker.md +387 -0
  29. package/docs/combo-box.md +764 -0
  30. package/docs/command.md +582 -0
  31. package/docs/contextmenu.md +530 -0
  32. package/docs/date-picker.md +251 -0
  33. package/docs/datetime-picker.md +284 -0
  34. package/docs/decimal-textbox.md +260 -0
  35. package/docs/dialog.md +822 -0
  36. package/docs/dropdown-button.md +507 -0
  37. package/docs/dropdown-list.md +779 -0
  38. package/docs/editor.md +374 -0
  39. package/docs/expansion-panel.md +348 -0
  40. package/docs/fieldset.md +217 -0
  41. package/docs/forms.md +162 -0
  42. package/docs/grid.md +2053 -0
  43. package/docs/input.md +197 -0
  44. package/docs/installation.md +54 -0
  45. package/docs/introduction.md +46 -0
  46. package/docs/label.md +340 -0
  47. package/docs/list-box.md +637 -0
  48. package/docs/list-view.md +584 -0
  49. package/docs/menubar.md +559 -0
  50. package/docs/multi-select.md +765 -0
  51. package/docs/notification.md +460 -0
  52. package/docs/numeric-textbox.md +301 -0
  53. package/docs/otp-input.md +539 -0
  54. package/docs/pager.md +513 -0
  55. package/docs/placeholder.md +176 -0
  56. package/docs/popover.md +423 -0
  57. package/docs/popup-menu.md +658 -0
  58. package/docs/popup.md +617 -0
  59. package/docs/progress-bar.md +368 -0
  60. package/docs/radio-button.md +451 -0
  61. package/docs/range-slider.md +367 -0
  62. package/docs/rating.md +518 -0
  63. package/docs/scroll-view.md +375 -0
  64. package/docs/segmented.md +434 -0
  65. package/docs/sheet.md +348 -0
  66. package/docs/sidebar.md +1126 -0
  67. package/docs/skeleton.md +181 -0
  68. package/docs/slider.md +423 -0
  69. package/docs/spinner.md +370 -0
  70. package/docs/split-button.md +522 -0
  71. package/docs/splitter.md +342 -0
  72. package/docs/stepper.md +539 -0
  73. package/docs/switch.md +340 -0
  74. package/docs/tabs.md +542 -0
  75. package/docs/textarea.md +196 -0
  76. package/docs/textbox.md +332 -0
  77. package/docs/theming.md +403 -0
  78. package/docs/time-picker.md +254 -0
  79. package/docs/tooltip-directive.md +340 -0
  80. package/docs/tooltip.md +321 -0
  81. package/docs/tree-view.md +1018 -0
  82. package/docs/window.md +663 -0
  83. package/fesm2022/nanahoshi-mona-ui-auto-complete.mjs +1 -1
  84. package/fesm2022/nanahoshi-mona-ui-breadcrumb.mjs +8 -0
  85. package/fesm2022/nanahoshi-mona-ui-button.mjs +12 -0
  86. package/fesm2022/nanahoshi-mona-ui-calendar.mjs +5 -2
  87. package/fesm2022/nanahoshi-mona-ui-chart.mjs +212 -66
  88. package/fesm2022/nanahoshi-mona-ui-check-box.mjs +4 -0
  89. package/fesm2022/nanahoshi-mona-ui-circular-progress-bar.mjs +4 -0
  90. package/fesm2022/nanahoshi-mona-ui-collapsible.mjs +16 -2
  91. package/fesm2022/nanahoshi-mona-ui-combo-box.mjs +1 -1
  92. package/fesm2022/nanahoshi-mona-ui-command.mjs +924 -0
  93. package/fesm2022/nanahoshi-mona-ui-common.mjs +4 -0
  94. package/fesm2022/nanahoshi-mona-ui-contextmenu.mjs +10 -6
  95. package/fesm2022/nanahoshi-mona-ui-date-picker.mjs +2 -1
  96. package/fesm2022/nanahoshi-mona-ui-datetime-picker.mjs +2 -1
  97. package/fesm2022/nanahoshi-mona-ui-dialog.mjs +9 -5
  98. package/fesm2022/nanahoshi-mona-ui-dropdown-button.mjs +9 -5
  99. package/fesm2022/nanahoshi-mona-ui-dropdowns.mjs +55 -1
  100. package/fesm2022/nanahoshi-mona-ui-editor.mjs +3 -2
  101. package/fesm2022/nanahoshi-mona-ui-expansion-panel.mjs +13 -0
  102. package/fesm2022/nanahoshi-mona-ui-fieldset.mjs +5 -0
  103. package/fesm2022/{nanahoshi-mona-ui-grid-grid-footer-row.component-2tVhD2hK.mjs → nanahoshi-mona-ui-grid-grid-footer-row.component-DjNnVxHE.mjs} +2 -2
  104. package/fesm2022/{nanahoshi-mona-ui-grid-grid-list.component-BAN70Wcn.mjs → nanahoshi-mona-ui-grid-grid-list.component-ihQIKeP-.mjs} +5 -5
  105. package/fesm2022/{nanahoshi-mona-ui-grid-grid-row.component-C_kCaA5b.mjs → nanahoshi-mona-ui-grid-grid-row.component-BpnybNcs.mjs} +18 -35
  106. package/fesm2022/{nanahoshi-mona-ui-grid-grid-virtual-list.component-BsNfrAHz.mjs → nanahoshi-mona-ui-grid-grid-virtual-list.component-CYlgfc7c.mjs} +5 -5
  107. package/fesm2022/{nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-CEfVa7eo.mjs → nanahoshi-mona-ui-grid-nanahoshi-mona-ui-grid-LCzfCYd3.mjs} +4653 -4529
  108. package/fesm2022/nanahoshi-mona-ui-grid.mjs +1 -1
  109. package/fesm2022/nanahoshi-mona-ui-i18n-icu.mjs +10 -0
  110. package/fesm2022/nanahoshi-mona-ui-internal-list.mjs +1 -0
  111. package/fesm2022/nanahoshi-mona-ui-internal-popup-menu.mjs +168 -0
  112. package/fesm2022/nanahoshi-mona-ui-internal-tree.mjs +19 -1
  113. package/fesm2022/nanahoshi-mona-ui-list-box.mjs +14 -0
  114. package/fesm2022/nanahoshi-mona-ui-list-view.mjs +32 -0
  115. package/fesm2022/nanahoshi-mona-ui-locales-ar-sa.mjs +10 -0
  116. package/fesm2022/nanahoshi-mona-ui-locales-de-de.mjs +10 -0
  117. package/fesm2022/nanahoshi-mona-ui-locales-es-es.mjs +10 -0
  118. package/fesm2022/nanahoshi-mona-ui-locales-fr-fr.mjs +10 -0
  119. package/fesm2022/nanahoshi-mona-ui-locales-id-id.mjs +10 -0
  120. package/fesm2022/nanahoshi-mona-ui-locales-it-it.mjs +10 -0
  121. package/fesm2022/nanahoshi-mona-ui-locales-ja-jp.mjs +10 -0
  122. package/fesm2022/nanahoshi-mona-ui-locales-ko-kr.mjs +10 -0
  123. package/fesm2022/nanahoshi-mona-ui-locales-pt-br.mjs +10 -0
  124. package/fesm2022/nanahoshi-mona-ui-locales-ru-ru.mjs +10 -0
  125. package/fesm2022/nanahoshi-mona-ui-locales-tr-tr.mjs +10 -0
  126. package/fesm2022/nanahoshi-mona-ui-locales-zh-cn.mjs +10 -0
  127. package/fesm2022/nanahoshi-mona-ui-locales-zh-tw.mjs +10 -0
  128. package/fesm2022/nanahoshi-mona-ui-menubar.mjs +15 -8
  129. package/fesm2022/nanahoshi-mona-ui-multi-select.mjs +8 -5
  130. package/fesm2022/nanahoshi-mona-ui-notification.mjs +9 -0
  131. package/fesm2022/nanahoshi-mona-ui-numeric-text-box.mjs +1 -1
  132. package/fesm2022/nanahoshi-mona-ui-otp-input.mjs +5 -0
  133. package/fesm2022/nanahoshi-mona-ui-pager.mjs +2 -1
  134. package/fesm2022/nanahoshi-mona-ui-popover.mjs +14 -6
  135. package/fesm2022/nanahoshi-mona-ui-popup-menu.mjs +48 -183
  136. package/fesm2022/nanahoshi-mona-ui-popup.mjs +16 -0
  137. package/fesm2022/nanahoshi-mona-ui-progress-bar.mjs +4 -0
  138. package/fesm2022/nanahoshi-mona-ui-rating.mjs +2 -0
  139. package/fesm2022/nanahoshi-mona-ui-segmented.mjs +1 -0
  140. package/fesm2022/nanahoshi-mona-ui-sheet.mjs +5 -5
  141. package/fesm2022/nanahoshi-mona-ui-sidebar.mjs +1 -1
  142. package/fesm2022/nanahoshi-mona-ui-slider.mjs +7 -2
  143. package/fesm2022/nanahoshi-mona-ui-split-button.mjs +9 -6
  144. package/fesm2022/nanahoshi-mona-ui-stepper.mjs +18 -21
  145. package/fesm2022/nanahoshi-mona-ui-tabs.mjs +11 -8
  146. package/fesm2022/nanahoshi-mona-ui-text-box.mjs +9 -1
  147. package/fesm2022/nanahoshi-mona-ui-time-picker.mjs +2 -1
  148. package/fesm2022/nanahoshi-mona-ui-tooltip.mjs +16 -5
  149. package/fesm2022/nanahoshi-mona-ui-tree-view.mjs +13 -11
  150. package/fesm2022/nanahoshi-mona-ui-window.mjs +12 -5
  151. package/i18n/catalogs/en-US.messages.json +10 -0
  152. package/internal/popup-menu/package.json +4 -0
  153. package/llms.txt +133 -0
  154. package/locales/ar-sa/ar-sa.messages.json +10 -0
  155. package/locales/de-de/de-de.messages.json +10 -0
  156. package/locales/es-es/es-es.messages.json +10 -0
  157. package/locales/fr-fr/fr-fr.messages.json +10 -0
  158. package/locales/id-id/id-id.messages.json +10 -0
  159. package/locales/it-it/it-it.messages.json +10 -0
  160. package/locales/ja-jp/ja-jp.messages.json +10 -0
  161. package/locales/ko-kr/ko-kr.messages.json +10 -0
  162. package/locales/pt-br/pt-br.messages.json +10 -0
  163. package/locales/ru-ru/ru-ru.messages.json +10 -0
  164. package/locales/tr-tr/tr-tr.messages.json +10 -0
  165. package/locales/zh-cn/zh-cn.messages.json +10 -0
  166. package/locales/zh-tw/zh-tw.messages.json +10 -0
  167. package/package.json +9 -1
  168. package/types/nanahoshi-mona-ui-auto-complete.d.ts +1 -1
  169. package/types/nanahoshi-mona-ui-breadcrumb.d.ts +8 -0
  170. package/types/nanahoshi-mona-ui-button.d.ts +12 -0
  171. package/types/nanahoshi-mona-ui-calendar.d.ts +3 -0
  172. package/types/nanahoshi-mona-ui-chart.d.ts +250 -20
  173. package/types/nanahoshi-mona-ui-check-box.d.ts +4 -0
  174. package/types/nanahoshi-mona-ui-circular-progress-bar.d.ts +4 -0
  175. package/types/nanahoshi-mona-ui-collapsible.d.ts +10 -0
  176. package/types/nanahoshi-mona-ui-combo-box.d.ts +1 -1
  177. package/types/nanahoshi-mona-ui-command.d.ts +253 -0
  178. package/types/nanahoshi-mona-ui-common.d.ts +17 -1
  179. package/types/nanahoshi-mona-ui-contextmenu.d.ts +5 -2
  180. package/types/nanahoshi-mona-ui-date-picker.d.ts +2 -1
  181. package/types/nanahoshi-mona-ui-datetime-picker.d.ts +2 -1
  182. package/types/nanahoshi-mona-ui-dialog.d.ts +58 -1
  183. package/types/nanahoshi-mona-ui-dropdown-button.d.ts +7 -3
  184. package/types/nanahoshi-mona-ui-dropdowns.d.ts +55 -1
  185. package/types/nanahoshi-mona-ui-editor.d.ts +31 -0
  186. package/types/nanahoshi-mona-ui-expansion-panel.d.ts +13 -0
  187. package/types/nanahoshi-mona-ui-fieldset.d.ts +5 -0
  188. package/types/nanahoshi-mona-ui-grid.d.ts +162 -35
  189. package/types/nanahoshi-mona-ui-i18n.d.ts +144 -1
  190. package/types/nanahoshi-mona-ui-internal-list.d.ts +16 -1
  191. package/types/nanahoshi-mona-ui-internal-popup-menu.d.ts +165 -0
  192. package/types/nanahoshi-mona-ui-internal-tree.d.ts +21 -2
  193. package/types/nanahoshi-mona-ui-internal.d.ts +4 -5
  194. package/types/nanahoshi-mona-ui-label.d.ts +1 -0
  195. package/types/nanahoshi-mona-ui-list-box.d.ts +27 -4
  196. package/types/nanahoshi-mona-ui-list-view.d.ts +34 -1
  197. package/types/nanahoshi-mona-ui-list.d.ts +1 -1
  198. package/types/nanahoshi-mona-ui-locales-ar-sa.d.ts +10 -0
  199. package/types/nanahoshi-mona-ui-locales-de-de.d.ts +10 -0
  200. package/types/nanahoshi-mona-ui-locales-es-es.d.ts +10 -0
  201. package/types/nanahoshi-mona-ui-locales-fr-fr.d.ts +10 -0
  202. package/types/nanahoshi-mona-ui-locales-id-id.d.ts +10 -0
  203. package/types/nanahoshi-mona-ui-locales-it-it.d.ts +10 -0
  204. package/types/nanahoshi-mona-ui-locales-ja-jp.d.ts +10 -0
  205. package/types/nanahoshi-mona-ui-locales-ko-kr.d.ts +10 -0
  206. package/types/nanahoshi-mona-ui-locales-pt-br.d.ts +10 -0
  207. package/types/nanahoshi-mona-ui-locales-ru-ru.d.ts +10 -0
  208. package/types/nanahoshi-mona-ui-locales-tr-tr.d.ts +10 -0
  209. package/types/nanahoshi-mona-ui-locales-zh-cn.d.ts +10 -0
  210. package/types/nanahoshi-mona-ui-locales-zh-tw.d.ts +10 -0
  211. package/types/nanahoshi-mona-ui-menubar.d.ts +10 -3
  212. package/types/nanahoshi-mona-ui-multi-select.d.ts +3 -3
  213. package/types/nanahoshi-mona-ui-notification.d.ts +9 -0
  214. package/types/nanahoshi-mona-ui-numeric-text-box.d.ts +1 -1
  215. package/types/nanahoshi-mona-ui-otp-input.d.ts +1 -0
  216. package/types/nanahoshi-mona-ui-pager.d.ts +5 -1
  217. package/types/nanahoshi-mona-ui-popover.d.ts +9 -1
  218. package/types/nanahoshi-mona-ui-popup-menu.d.ts +48 -161
  219. package/types/nanahoshi-mona-ui-popup.d.ts +16 -0
  220. package/types/nanahoshi-mona-ui-progress-bar.d.ts +4 -0
  221. package/types/nanahoshi-mona-ui-rating.d.ts +2 -0
  222. package/types/nanahoshi-mona-ui-segmented.d.ts +1 -0
  223. package/types/nanahoshi-mona-ui-sheet.d.ts +1 -1
  224. package/types/nanahoshi-mona-ui-slider.d.ts +2 -0
  225. package/types/nanahoshi-mona-ui-spinner.d.ts +7 -0
  226. package/types/nanahoshi-mona-ui-split-button.d.ts +7 -4
  227. package/types/nanahoshi-mona-ui-stepper.d.ts +11 -2
  228. package/types/nanahoshi-mona-ui-tabs.d.ts +4 -1
  229. package/types/nanahoshi-mona-ui-text-box.d.ts +9 -1
  230. package/types/nanahoshi-mona-ui-time-picker.d.ts +2 -1
  231. package/types/nanahoshi-mona-ui-tooltip.d.ts +10 -2
  232. package/types/nanahoshi-mona-ui-tree-view.d.ts +6 -5
  233. package/types/nanahoshi-mona-ui-window.d.ts +66 -1
@@ -0,0 +1,645 @@
1
+ # Pie & Donut
2
+
3
+ > Pie and donut series for the parts of a whole, with slice labels and a donut center.
4
+
5
+ Entry point: `@nanahoshi/mona-ui/chart`
6
+
7
+ **Selectors:** `mona-pie-series`, `mona-donut-series`
8
+
9
+ Pie and donut series show how a whole splits into parts. Each row of data becomes a slice whose angle is its share of the total, and a donut leaves a hole in the middle for a total or a short summary. They go inside a `mona-chart` without axes, take one slice label per slice inside or outside the circle, and let the legend hide slices one by one.
10
+
11
+ ## Overview
12
+
13
+ Pick the series by what else the chart has to say.
14
+
15
+ | Series | Use it for | Reads |
16
+ | :--- | :--- | :--- |
17
+ | `mona-pie-series` | A few parts of one whole, where the reader should see at a glance which part is largest. | `field`, `categoryField` |
18
+ | `mona-donut-series` | The same, with the total or a summary in the hole, through `ng-template[monaChartCenterTemplate]`. | `field`, `categoryField` |
19
+
20
+ **Use something else when:**
21
+
22
+ - There are more than five or six parts, or they're close in size. Angles are hard to compare, and bars show small differences better, see [Bar & Waterfall](chart-bar.md).
23
+ - You need to compare the parts of several wholes, such as each year's split. A chart takes one pie or donut, so use stacked bars with `stackMode="percent"`, see [Bar & Waterfall](chart-bar.md).
24
+ - The parts form a hierarchy. Use a [Treemap](chart-treemap.md).
25
+ - The values are stages that narrow, such as a sign-up flow. Use a [Funnel](chart-funnel.md).
26
+ - You want to show one value against a target. Use a gauge, see [Radial](chart-radial.md).
27
+
28
+ The chart, legend, tooltip and templates these series sit in are described on [Chart Overview](chart.md).
29
+
30
+ ## Import & Quick Start
31
+
32
+ ```typescript
33
+ import { ChartComponent, ChartLegendComponent, ChartTooltipComponent, PieSeriesComponent } from "@nanahoshi/mona-ui/chart";
34
+ ```
35
+
36
+ ```html
37
+ <mona-chart aria-label="Visits by traffic source" class="h-72 w-full" [data]="sources">
38
+ <mona-pie-series categoryField="source" field="visits" name="Visits" />
39
+ <mona-chart-legend position="end" />
40
+ <mona-chart-tooltip />
41
+ </mona-chart>
42
+ ```
43
+
44
+ Give the chart a height. It fills its host, and a host without a height has none. Pie and donut charts have no axes, so leave out `mona-chart-x-axis` and `mona-chart-y-axis`, and the chart's `xField`.
45
+
46
+ ## Anatomy
47
+
48
+ Each row of data is one slice. The series reads its rows from the chart's `data`, unless it has its own `data`, and takes the value from `field` and the slice's name from `categoryField`. A field is a property name or an accessor, `(row, index) => value`. The defaults are `"value"` and `"category"`, so rows shaped `{ category, value }` need neither.
49
+
50
+ | Input | Pie | Donut | What it reads or sets |
51
+ | :--- | :---: | :---: | :--- |
52
+ | `field`, `categoryField` | ✓ | ✓ | The value and the name of each slice. |
53
+ | `colorField`, `colors` | ✓ | ✓ | The color of each slice. |
54
+ | `keyField` | ✓ | ✓ | A stable identity for each row, so slices animate as the same slice when the data changes. |
55
+ | `valueFormatter`, `categoryFormatter` | ✓ | ✓ | How values and names read in the tooltip, labels, legend and announcements. |
56
+ | `startAngle`, `endAngle`, `padAngle`, `cornerRadius`, `outerRadiusRatio` | ✓ | ✓ | The shape of the circle and its slices. |
57
+ | `innerRadiusRatio` | | ✓ | The size of the hole. |
58
+ | `showLabels`, `labelPosition`, `labelContent`, `minLabelAngle` | ✓ | ✓ | The slice labels. |
59
+ | `fillMode`, `fillOpacity`, `strokeColor`, `strokeWidth` | ✓ | ✓ | The fill and the lines between slices. |
60
+ | `[(hiddenIndices)]`, `[(visible)]` | ✓ | ✓ | Which slices are hidden, and whether the series is shown. |
61
+
62
+ A chart takes one pie or donut series. With a second one, the chart draws neither and logs a development warning. They also can't share a chart with Cartesian series, such as lines or bars.
63
+
64
+ ### Templates
65
+
66
+ - `ng-template[monaChartSliceLabelTemplate]`, inside either series, replaces the text of each slice label. The context is a `ChartSliceLabelTemplateContext`: the slice is `$implicit` and `slice`, and its fields, such as `formattedCategory`, `formattedValue`, `formattedPercentage`, `percentage`, `color`, `dataIndex` and `datum`, are also on the context itself. Turn `showLabels` on as well.
67
+ - `ng-template[monaChartCenterTemplate]`, inside a donut, fills the hole. The context is a `ChartCenterTemplateContext`, with `total` (also `$implicit`), `formattedTotal`, `visibleSliceCount`, `seriesId` and `seriesName`.
68
+ - The chart, legend and tooltip templates are described on [Chart Overview](chart.md).
69
+
70
+ ## Examples
71
+
72
+ ### Donut
73
+
74
+ A donut with the total in its hole. The rows are shaped `{ category, value }`, so the series needs no fields, and `padAngle` leaves a small gap between slices.
75
+
76
+ `donut-example.component.ts`
77
+
78
+ ```typescript
79
+ import { Component } from "@angular/core";
80
+ import {
81
+ ChartCenterTemplateDirective,
82
+ ChartComponent,
83
+ ChartLegendComponent,
84
+ DonutSeriesComponent
85
+ } from "@nanahoshi/mona-ui/chart";
86
+
87
+ @Component({
88
+ selector: "app-chart-pie-donut-example",
89
+ imports: [ChartCenterTemplateDirective, ChartComponent, ChartLegendComponent, DonutSeriesComponent],
90
+ templateUrl: "./donut-example.component.html"
91
+ })
92
+ export class ChartDonutExampleComponent {
93
+ protected readonly sources = [
94
+ { category: "Search", value: 4200 },
95
+ { category: "Direct", value: 2600 },
96
+ { category: "Social", value: 1500 },
97
+ { category: "Email", value: 900 }
98
+ ];
99
+ }
100
+ ```
101
+
102
+ `donut-example.component.html`
103
+
104
+ ```html
105
+ <mona-chart aria-label="Visits by traffic source" class="h-72 w-full" [data]="sources">
106
+ <mona-donut-series name="Visits" [padAngle]="1">
107
+ <ng-template monaChartCenterTemplate let-formattedTotal="formattedTotal">
108
+ <div class="flex flex-col items-center">
109
+ <span class="text-xs">Total visits</span>
110
+ <span class="text-lg font-semibold">{{ formattedTotal }}</span>
111
+ </div>
112
+ </ng-template>
113
+ </mona-donut-series>
114
+ <mona-chart-legend position="end" />
115
+ </mona-chart>
116
+ ```
117
+
118
+ ### Outside labels
119
+
120
+ `showLabels` writes a label beside each slice, joined to it by a leader line. `labelContent="category-percentage"` names the slice and gives its share, so this pie needs no legend. `strokeColor` set to the surface color draws a gap between the slices, and `valueFormatter` adds the unit to the tooltip.
121
+
122
+ `outside-labels-example.component.ts`
123
+
124
+ ```typescript
125
+ import { Component } from "@angular/core";
126
+ import { ChartComponent, ChartTooltipComponent, PieSeriesComponent } from "@nanahoshi/mona-ui/chart";
127
+ import type { ChartValueFormatter } from "@nanahoshi/mona-ui/chart";
128
+
129
+ @Component({
130
+ selector: "app-chart-pie-outside-labels-example",
131
+ imports: [ChartComponent, ChartTooltipComponent, PieSeriesComponent],
132
+ templateUrl: "./outside-labels-example.component.html"
133
+ })
134
+ export class ChartPieOutsideLabelsExampleComponent {
135
+ protected readonly browsers = [
136
+ { browser: "Chrome", views: 61200 },
137
+ { browser: "Safari", views: 18400 },
138
+ { browser: "Edge", views: 9800 },
139
+ { browser: "Firefox", views: 6100 },
140
+ { browser: "Other", views: 4500 }
141
+ ];
142
+ protected readonly views: ChartValueFormatter = value => `${Number(value).toLocaleString("en")} views`;
143
+ }
144
+ ```
145
+
146
+ `outside-labels-example.component.html`
147
+
148
+ ```html
149
+ <mona-chart aria-label="Page views by browser" class="h-80 w-full" [data]="browsers">
150
+ <mona-pie-series
151
+ categoryField="browser"
152
+ field="views"
153
+ labelContent="category-percentage"
154
+ name="Page views"
155
+ strokeColor="var(--color-surface)"
156
+ [showLabels]="true"
157
+ [strokeWidth]="2"
158
+ [valueFormatter]="views" />
159
+ <mona-chart-tooltip />
160
+ </mona-chart>
161
+ ```
162
+
163
+ ### Hiding slices
164
+
165
+ `[(hiddenIndices)]` holds the indices of the hidden rows. The legend and the buttons above the chart change the same list, and the center shows how many regions are left and their total.
166
+
167
+ `hidden-slices-example.component.ts`
168
+
169
+ ```typescript
170
+ import { Component, signal } from "@angular/core";
171
+ import { ButtonDirective } from "@nanahoshi/mona-ui/button";
172
+ import {
173
+ ChartCenterTemplateDirective,
174
+ ChartComponent,
175
+ ChartLegendComponent,
176
+ ChartTooltipComponent,
177
+ DonutSeriesComponent
178
+ } from "@nanahoshi/mona-ui/chart";
179
+ import type { ChartValueFormatter } from "@nanahoshi/mona-ui/chart";
180
+
181
+ const euros = new Intl.NumberFormat("en", { currency: "EUR", maximumFractionDigits: 0, style: "currency" });
182
+
183
+ @Component({
184
+ selector: "app-chart-pie-hidden-slices-example",
185
+ imports: [
186
+ ButtonDirective,
187
+ ChartCenterTemplateDirective,
188
+ ChartComponent,
189
+ ChartLegendComponent,
190
+ ChartTooltipComponent,
191
+ DonutSeriesComponent
192
+ ],
193
+ templateUrl: "./hidden-slices-example.component.html"
194
+ })
195
+ export class ChartPieHiddenSlicesExampleComponent {
196
+ protected readonly hidden = signal<readonly number[]>([3]);
197
+ protected readonly regions = [
198
+ { region: "Europe", revenue: 412000 },
199
+ { region: "North America", revenue: 356000 },
200
+ { region: "Asia Pacific", revenue: 228000 },
201
+ { region: "Latin America", revenue: 94000 },
202
+ { region: "Middle East & Africa", revenue: 61000 }
203
+ ];
204
+ protected readonly currency: ChartValueFormatter = value => euros.format(Number(value));
205
+
206
+ protected isShown(index: number): boolean {
207
+ return !this.hidden().includes(index);
208
+ }
209
+
210
+ protected setShown(index: number, shown: boolean): void {
211
+ this.hidden.update(hidden => (shown ? hidden.filter(other => other !== index) : [...hidden, index]));
212
+ }
213
+ }
214
+ ```
215
+
216
+ `hidden-slices-example.component.html`
217
+
218
+ ```html
219
+ <div class="flex flex-col gap-4">
220
+ <div aria-label="Regions in the chart" class="flex flex-wrap gap-2" role="group">
221
+ @for (row of regions; track row.region; let index = $index) {
222
+ <button
223
+ monaButton
224
+ size="small"
225
+ [selected]="isShown(index)"
226
+ [toggleable]="true"
227
+ (selectedChange)="setShown(index, $event)">
228
+ {{ row.region }}
229
+ </button>
230
+ }
231
+ </div>
232
+ <mona-chart aria-label="Revenue by region" class="h-72 w-full" [data]="regions">
233
+ <mona-donut-series
234
+ categoryField="region"
235
+ field="revenue"
236
+ name="Revenue"
237
+ [valueFormatter]="currency"
238
+ [(hiddenIndices)]="hidden">
239
+ <ng-template monaChartCenterTemplate let-count="visibleSliceCount" let-formattedTotal="formattedTotal">
240
+ <div class="flex flex-col items-center">
241
+ <span class="text-xs">{{ count }} of {{ regions.length }} regions</span>
242
+ <span class="text-lg font-semibold">{{ formattedTotal }}</span>
243
+ </div>
244
+ </ng-template>
245
+ </mona-donut-series>
246
+ <mona-chart-legend position="end" />
247
+ <mona-chart-tooltip />
248
+ </mona-chart>
249
+ </div>
250
+ ```
251
+
252
+ ### Slice label template
253
+
254
+ With `labelPosition="inside"`, a template puts the name and the share on each slice. `colorField` takes each slice's color from its row. A slice narrower than `minLabelAngle`, here Training, gets no label, and the legend and tooltip still name it.
255
+
256
+ `slice-template-example.component.ts`
257
+
258
+ ```typescript
259
+ import { Component } from "@angular/core";
260
+ import {
261
+ ChartComponent,
262
+ ChartLegendComponent,
263
+ ChartSliceLabelTemplateDirective,
264
+ ChartTooltipComponent,
265
+ PieSeriesComponent
266
+ } from "@nanahoshi/mona-ui/chart";
267
+
268
+ @Component({
269
+ selector: "app-chart-pie-slice-template-example",
270
+ imports: [
271
+ ChartComponent,
272
+ ChartLegendComponent,
273
+ ChartSliceLabelTemplateDirective,
274
+ ChartTooltipComponent,
275
+ PieSeriesComponent
276
+ ],
277
+ templateUrl: "./slice-template-example.component.html"
278
+ })
279
+ export class ChartPieSliceTemplateExampleComponent {
280
+ protected readonly budget = [
281
+ { amount: 540, color: "#1d4ed8", item: "Salaries" },
282
+ { amount: 210, color: "#047857", item: "Infrastructure" },
283
+ { amount: 150, color: "#b45309", item: "Marketing" },
284
+ { amount: 60, color: "#be185d", item: "Travel" },
285
+ { amount: 40, color: "#6d28d9", item: "Training" }
286
+ ];
287
+ }
288
+ ```
289
+
290
+ `slice-template-example.component.html`
291
+
292
+ ```html
293
+ <mona-chart aria-label="Budget by item, in thousands of euros" class="h-80 w-full" [data]="budget">
294
+ <mona-pie-series
295
+ categoryField="item"
296
+ colorField="color"
297
+ field="amount"
298
+ labelPosition="inside"
299
+ name="Budget"
300
+ [cornerRadius]="4"
301
+ [minLabelAngle]="20"
302
+ [padAngle]="1.5"
303
+ [showLabels]="true">
304
+ <ng-template monaChartSliceLabelTemplate let-slice>
305
+ <span class="flex flex-col items-center leading-tight">
306
+ <span>{{ slice.formattedCategory }}</span>
307
+ <span class="text-sm">{{ slice.formattedPercentage }}</span>
308
+ </span>
309
+ </ng-template>
310
+ </mona-pie-series>
311
+ <mona-chart-legend position="end" />
312
+ <mona-chart-tooltip />
313
+ </mona-chart>
314
+ ```
315
+
316
+ ## Appearance & Styling
317
+
318
+ ### Shape
319
+
320
+ | Input | Values | Effect |
321
+ | :--- | :--- | :--- |
322
+ | `startAngle`, `endAngle` | Degrees, default `0` and `360` | Where the slices begin and end, clockwise from 12 o'clock. `-90` to `90` draws a half circle across the top. When `endAngle` isn't after `startAngle`, the span wraps around, so `270` to `90` is also a half circle. A span is never more than a full circle. |
323
+ | `padAngle` | Degrees, default `0` | The gap between neighboring slices. All the gaps together never take more than 35% of the span, and a single visible slice has none. |
324
+ | `cornerRadius` | Pixels | Rounds the corners of each slice. It's capped at half the ring's thickness, or half the radius for a pie. |
325
+ | `outerRadiusRatio` | `0.1` to `1`, default `0.9` | The radius, as a share of the room the chart has for it. |
326
+ | `innerRadiusRatio` | `0` to `0.95`, default `0.6` | Donut only. The radius of the hole, as a share of the outer radius. `0` draws a pie. |
327
+
328
+ Values outside a range are clamped to it.
329
+
330
+ ### Color and fill
331
+
332
+ | Input | Values | Effect |
333
+ | :--- | :--- | :--- |
334
+ | `colorField` | A field returning a CSS color | The color of each slice, read from its row. A row without one falls back to `colors`. |
335
+ | `colors` | CSS colors | The slice colors in order, repeated when there are more slices than colors. |
336
+ | `fillMode` | `"solid"`, `"gradient"` | A gradient is a translucent radial wash that grows stronger toward the outer edge. |
337
+ | `fillOpacity` | `0` to `1` | The opacity of the fill. A gradient is translucent already, and gets lighter still. |
338
+ | `strokeColor` | A CSS color | The color of the line around each slice. Set it to the background, such as `var(--color-surface)`, to separate the slices. |
339
+ | `strokeWidth` | Pixels, default `1` | The width of that line. `0` removes it. |
340
+
341
+ Without `colorField` or `colors`, slices take `--color-chart-1` to `--color-chart-5` in order, and the sixth slice starts over. Colors can be CSS colors or theme variables, written `var(--name)` or `--name`. Without `strokeColor`, each slice's outline is its own color, so the slices meet without a visible line.
342
+
343
+ ### Slice labels
344
+
345
+ Slice labels are off by default. `showLabels` turns them on, in either position.
346
+
347
+ | Input | Values | Effect |
348
+ | :--- | :--- | :--- |
349
+ | `labelPosition` | `"outside"`, `"inside"` | Outside labels sit beside the circle, with a leader line to their slice. Inside labels sit on the slice. |
350
+ | `labelContent` | `"percentage"`, `"value"`, `"category"`, `"category-percentage"` | What a label says when there's no template. `"category-percentage"` reads as `Search: 42%`. |
351
+ | `minLabelAngle` | Degrees, default `12` | Inside labels only. A slice narrower than this gets no label. |
352
+
353
+ - **Outside labels take room.** The chart keeps space for them on the left and the right, so the circle gets smaller. Labels on each side are spread out so they don't overlap. When a side has more labels than height, the labels of the smallest slices are dropped first, and a label that would run past the edge of the plot is dropped too.
354
+ - **Inside labels pick their own text color**, white or dark, whichever contrasts more with the slice. They're centered a little past the middle of the ring.
355
+ - **Percentages are shares of what's visible.** When a slice is hidden, the others' labels and tooltips are worked out again from the slices that are left. They're formatted for the chart locale, with at most one decimal.
356
+
357
+ ## Theming
358
+
359
+ These variables set the slice style without an input. They're read from the series element, so set them on the chart or on the series with a class. An input wins over its variable.
360
+
361
+ | Variable | Default | Sets |
362
+ | :--- | :--- | :--- |
363
+ | `--mona-chart-slice-stroke-color` | Each slice's own color | The line around each slice, like `strokeColor`. |
364
+ | `--mona-chart-slice-stroke-width` | `1` | Its width in pixels, like `strokeWidth`. |
365
+ | `--mona-chart-slice-fill-opacity` | `1` | The fill opacity, like `fillOpacity`. |
366
+ | `--mona-chart-slice-hover-overlay` | A translucent white | The color laid over the slice under the pointer. |
367
+ | `--mona-chart-label-line-color` | `--color-muted-foreground` | The leader lines of outside labels. |
368
+
369
+ The slice palette is `--color-chart-1` to `--color-chart-5`, shared with every chart, and the keyboard focus ring uses `--color-focus-indicator`.
370
+
371
+ ## Behavior
372
+
373
+ ### Values that draw no slice
374
+
375
+ A row whose value is `null`, `undefined`, zero, negative or not a finite number draws no slice and gets no legend entry. A numeric string, such as `"42"`, counts as its number. Negative and non-finite values log a development warning, and so does a series with no value above zero. A row without a name is called "Item" and its position, such as `Item 3`. The data can also be plain numbers, `[42, 18, 7]`, with those names.
376
+
377
+ ### Hiding slices
378
+
379
+ - The legend lists each slice, and toggling an entry hides or shows that slice. It doesn't hide the series, so the chart's `seriesVisibilityChange` doesn't fire. The series emits `sliceVisibilityChange` instead, with the slice's `dataIndex`, `category`, `datum` and whether it's now `visible`.
380
+ - `[(hiddenIndices)]` holds the hidden slices as indices into the data, counting every row, including rows that draw no slice. The legend writes to it, and the series drops indices past the end of the data when the data gets shorter. Because they're positions, a hidden index stays with the position, not the item, when rows are reordered.
381
+ - `toggleSlice(dataIndex)`, a method on the series, shows or hides a slice from code, and returns whether it's now visible.
382
+ - A hidden slice leaves its room to the others, and the percentages, the donut's total and `visibleSliceCount` follow. In a legend item template, `percentage` is each slice's share of the whole total, hidden slices included, so it doesn't change as slices come and go.
383
+ - When every slice is hidden, the chart shows its no data state, and the legend stays so the user can bring them back.
384
+
385
+ ### The donut center
386
+
387
+ The center template is drawn in the middle of the hole and limited to a box a little smaller than it. It appears only while the donut has a visible slice. `total` is the sum of the visible slices, and `formattedTotal` is that sum formatted by `valueFormatter`, called with the index `-1`, or by the chart locale without one.
388
+
389
+ ### Value formatting
390
+
391
+ `valueFormatter` formats the values in the tooltip, value labels, screen reader announcements and the donut's `formattedTotal`. `categoryFormatter` formats the slice names in the legend, labels, tooltip and announcements. Both receive the value and the row's index.
392
+
393
+ ### Two-way binding
394
+
395
+ `[(visible)]` holds whether the whole series is shown. The legend toggles slices, not the series, so it doesn't change `visible`. `[(hiddenIndices)]` is described under [Hiding slices](#hiding-slices).
396
+
397
+ ## Accessibility
398
+
399
+ The chart is the focusable element, and these series add no roles of their own. When a slice gets focus, the chart announces the series name, the slice's name and formatted value, its percentage, and its position, such as 2 of 5. Give the series a `name`, and use `valueFormatter` to add a unit.
400
+
401
+ - **Name the chart.** Give it an `aria-label` or a `title`, as for any chart, see [Chart Overview](chart.md).
402
+ - **Don't rely on color alone.** Keep the legend, or turn on labels that name the slices with `labelContent="category"` or `"category-percentage"`. Slice colors next to each other should differ in lightness, and a `strokeColor` that matches the background helps tell them apart.
403
+ - **Labels are hidden from screen readers**, since the announcements already carry the same values. The content of the donut center template isn't hidden, so screen readers can reach it. Keep it short, and make its text meet contrast against the chart background.
404
+ - **The tooltip shows one slice at a time.** The tooltip's `shared` input has no effect on these series.
405
+
406
+ ### Keyboard Navigation
407
+
408
+ | Key | Action |
409
+ | :--- | :--- |
410
+ | `ArrowRight` / `ArrowDown` | Move to the next slice, clockwise. After the last slice, go back to the first. |
411
+ | `ArrowLeft` / `ArrowUp` | Move to the previous slice. Before the first slice, go to the last. |
412
+ | `Home` / `End` | Move to the first or last visible slice. |
413
+ | `Enter` / `Space` | Activate the focused slice, which emits the chart's `pointClick`. |
414
+
415
+ The focused slice gets a ring in `--color-focus-indicator`. The legend's entries are buttons, toggled with `Enter` or `Space`. The rest of the chart's keys are listed on [Chart Overview](chart.md).
416
+
417
+ ## API
418
+
419
+ Everything below is imported from `@nanahoshi/mona-ui/chart`.
420
+
421
+ ### `DonutSeriesComponent`
422
+
423
+ Renders a full or partial donut. Use `ng-template[monaChartCenterTemplate]` for the center.
424
+
425
+ **Selector:** `mona-donut-series`
426
+
427
+ #### Inputs
428
+
429
+ | Name | Type | Default | Description |
430
+ | --- | --- | --- | --- |
431
+ | `categoryField` | `ChartField` | `"category"` | Property key or accessor extracting the category label for each slice. |
432
+ | `categoryFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Formatter callback for slice category labels. |
433
+ | `class` | `string` | `""` | Additional CSS classes applied to the series. |
434
+ | `colorField` | `ChartField \| undefined` | `undefined` | Accessor function or property key extracting an explicit color for each slice. |
435
+ | `colors` | `readonly string[] \| undefined` | `undefined` | Explicit array of colors used to fill successive slices. |
436
+ | `cornerRadius` | `number \| undefined` | `undefined` | Corner radius in pixels applied to slice arc boundaries. |
437
+ | `data` | `readonly unknown[] \| undefined` | `undefined` | Series-specific dataset overriding root chart data. |
438
+ | `endAngle` | `number` | `360` | Ending angle in degrees (clockwise from 12 o'clock). |
439
+ | `field` | `ChartField` | `"value"` | Property key or accessor extracting the numeric slice value. |
440
+ | `fillMode` | `ChartPolarFillMode` | `"solid"` | Fill style applied to slices ("solid" or radial "gradient" from center to arc). |
441
+ | `fillOpacity` | `number \| undefined` | `undefined` | Opacity of slice fills (between 0 and 1). |
442
+ | `hiddenIndices` (two-way) | `readonly number[]` | `[]` | The hidden data indices. Bind `[(hiddenIndices)]` for two-way binding; legend toggles write to it. |
443
+ | `innerRadiusRatio` | `number` | `0.6` | Ratio of the inner hole radius relative to the outer radius (0 to 0.95). |
444
+ | `keyField` | `ChartField \| undefined` | `undefined` | Property key or accessor extracting a stable datum identity across updates. |
445
+ | `labelContent` | `ChartPolarLabelContent` | `"percentage"` | Content to display in default slice data labels. |
446
+ | `labelPosition` | `ChartPolarLabelPosition` | `"outside"` | Placement position for slice data labels ("outside" with leader lines or "inside" slice bounds). |
447
+ | `minLabelAngle` | `number` | `12` | Minimum slice arc angle in degrees required to render an inside data label. |
448
+ | `name` | `string` | `"Donut"` | Series name used in tooltips and accessibility announcements. |
449
+ | `outerRadiusRatio` | `number` | `0.9` | Outer radius ratio relative to available plot bounds (0.1 to 1). |
450
+ | `padAngle` | `number` | `0` | Angular padding in degrees between adjacent slices. |
451
+ | `showLabels` | `boolean` | `false` | Whether to display slice labels, inside or outside as `labelPosition` sets. |
452
+ | `startAngle` | `number` | `0` | Starting angle in degrees (0 is 12 o'clock, clockwise). |
453
+ | `strokeColor` | `string` | `""` | Color of slice separator strokes. |
454
+ | `strokeWidth` | `number \| undefined` | `undefined` | Stroke width in pixels for slice separators. |
455
+ | `valueFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Formatter callback for slice numeric values. |
456
+ | `visible` (two-way) | `boolean` | `true` | Two-way bindable visibility of the series. |
457
+
458
+ #### Outputs
459
+
460
+ | Name | Type | Description |
461
+ | --- | --- | --- |
462
+ | `hiddenIndicesChange` | `readonly number[]` | Emitted when `hiddenIndices` changes. |
463
+ | `sliceVisibilityChange` | `ChartSliceVisibilityEvent` | Emits when an individual slice's visibility is toggled via the legend. |
464
+ | `visibleChange` | `boolean` | Emitted when `visible` changes. |
465
+
466
+ #### Methods
467
+
468
+ | Signature | Description |
469
+ | --- | --- |
470
+ | `toggleSlice(dataIndex: number): boolean` | Shows or hides the slice at `dataIndex`, and returns whether it's now visible. |
471
+
472
+ ### `PieSeriesComponent`
473
+
474
+ Renders a full or partial pie.
475
+
476
+ **Selector:** `mona-pie-series`
477
+
478
+ #### Inputs
479
+
480
+ | Name | Type | Default | Description |
481
+ | --- | --- | --- | --- |
482
+ | `categoryField` | `ChartField` | `"category"` | Property key or accessor extracting the category label for each slice. |
483
+ | `categoryFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Formatter callback for slice category labels. |
484
+ | `class` | `string` | `""` | Additional CSS classes applied to the series. |
485
+ | `colorField` | `ChartField \| undefined` | `undefined` | Accessor function or property key extracting an explicit color for each slice. |
486
+ | `colors` | `readonly string[] \| undefined` | `undefined` | Explicit array of colors used to fill successive slices. |
487
+ | `cornerRadius` | `number \| undefined` | `undefined` | Corner radius in pixels applied to slice arc boundaries. |
488
+ | `data` | `readonly unknown[] \| undefined` | `undefined` | Series-specific dataset overriding root chart data. |
489
+ | `endAngle` | `number` | `360` | Ending angle in degrees (clockwise from 12 o'clock). |
490
+ | `field` | `ChartField` | `"value"` | Property key or accessor extracting the numeric slice value. |
491
+ | `fillMode` | `ChartPolarFillMode` | `"solid"` | Fill style applied to slices ("solid" or radial "gradient" from center to arc). |
492
+ | `fillOpacity` | `number \| undefined` | `undefined` | Opacity of slice fills (between 0 and 1). |
493
+ | `hiddenIndices` (two-way) | `readonly number[]` | `[]` | The hidden data indices. Bind `[(hiddenIndices)]` for two-way binding; legend toggles write to it. |
494
+ | `keyField` | `ChartField \| undefined` | `undefined` | Property key or accessor extracting a stable datum identity across updates. |
495
+ | `labelContent` | `ChartPolarLabelContent` | `"percentage"` | Content to display in default slice data labels. |
496
+ | `labelPosition` | `ChartPolarLabelPosition` | `"outside"` | Placement position for slice data labels ("outside" with leader lines or "inside" slice bounds). |
497
+ | `minLabelAngle` | `number` | `12` | Minimum slice arc angle in degrees required to render an inside data label. |
498
+ | `name` | `string` | `"Pie"` | Series name used in tooltips and accessibility announcements. |
499
+ | `outerRadiusRatio` | `number` | `0.9` | Outer radius ratio relative to available plot bounds (0.1 to 1). |
500
+ | `padAngle` | `number` | `0` | Angular padding in degrees between adjacent slices. |
501
+ | `showLabels` | `boolean` | `false` | Whether to display slice labels, inside or outside as `labelPosition` sets. |
502
+ | `startAngle` | `number` | `0` | Starting angle in degrees (0 is 12 o'clock, clockwise). |
503
+ | `strokeColor` | `string` | `""` | Color of slice separator strokes. |
504
+ | `strokeWidth` | `number \| undefined` | `undefined` | Stroke width in pixels for slice separators. |
505
+ | `valueFormatter` | `ChartValueFormatter \| undefined` | `undefined` | Formatter callback for slice numeric values. |
506
+ | `visible` (two-way) | `boolean` | `true` | Two-way bindable visibility of the series. |
507
+
508
+ #### Outputs
509
+
510
+ | Name | Type | Description |
511
+ | --- | --- | --- |
512
+ | `hiddenIndicesChange` | `readonly number[]` | Emitted when `hiddenIndices` changes. |
513
+ | `sliceVisibilityChange` | `ChartSliceVisibilityEvent` | Emits when an individual slice's visibility is toggled via the legend. |
514
+ | `visibleChange` | `boolean` | Emitted when `visible` changes. |
515
+
516
+ #### Methods
517
+
518
+ | Signature | Description |
519
+ | --- | --- |
520
+ | `toggleSlice(dataIndex: number): boolean` | Shows or hides the slice at `dataIndex`, and returns whether it's now visible. |
521
+
522
+ ### `ChartCenterTemplateDirective`
523
+
524
+ **Selector:** `ng-template[monaChartCenterTemplate]`
525
+
526
+ #### Template context
527
+
528
+ | Name | Type |
529
+ | --- | --- |
530
+ | `$implicit` | `number` |
531
+ | `formattedTotal` | `string` |
532
+ | `seriesId` | `string` |
533
+ | `seriesName` | `string` |
534
+ | `total` | `number` |
535
+ | `visibleSliceCount` | `number` |
536
+
537
+ ### `ChartSliceLabelTemplateDirective`
538
+
539
+ **Selector:** `ng-template[monaChartSliceLabelTemplate]`
540
+
541
+ #### Template context
542
+
543
+ | Name | Type |
544
+ | --- | --- |
545
+ | `$implicit` | `ChartSliceContext` |
546
+ | `category` | `unknown` |
547
+ | `color` | `string` |
548
+ | `dataIndex` | `number` |
549
+ | `datum` | `unknown` |
550
+ | `formattedCategory` | `string` |
551
+ | `formattedPercentage` | `string` |
552
+ | `formattedValue` | `string` |
553
+ | `percentage` | `number` |
554
+ | `seriesId` | `string` |
555
+ | `seriesName` | `string` |
556
+ | `seriesType` | `"donut" \| "pie"` |
557
+ | `slice` | `ChartSliceContext` |
558
+ | `value` | `number` |
559
+
560
+ ### Types
561
+
562
+ #### `ChartCenterTemplateContext`
563
+
564
+ | Name | Type |
565
+ | --- | --- |
566
+ | `$implicit` | `number` |
567
+ | `formattedTotal` | `string` |
568
+ | `seriesId` | `string` |
569
+ | `seriesName` | `string` |
570
+ | `total` | `number` |
571
+ | `visibleSliceCount` | `number` |
572
+
573
+ #### `ChartSliceContext`
574
+
575
+ | Name | Type |
576
+ | --- | --- |
577
+ | `category` | `unknown` |
578
+ | `color` | `string` |
579
+ | `dataIndex` | `number` |
580
+ | `datum` | `unknown` |
581
+ | `formattedCategory` | `string` |
582
+ | `formattedPercentage` | `string` |
583
+ | `formattedValue` | `string` |
584
+ | `percentage` | `number` |
585
+ | `seriesId` | `string` |
586
+ | `seriesName` | `string` |
587
+ | `seriesType` | `"donut" \| "pie"` |
588
+ | `value` | `number` |
589
+
590
+ #### `ChartSliceLabelTemplateContext`
591
+
592
+ | Name | Type |
593
+ | --- | --- |
594
+ | `$implicit` | `ChartSliceContext` |
595
+ | `category` | `unknown` |
596
+ | `color` | `string` |
597
+ | `dataIndex` | `number` |
598
+ | `datum` | `unknown` |
599
+ | `formattedCategory` | `string` |
600
+ | `formattedPercentage` | `string` |
601
+ | `formattedValue` | `string` |
602
+ | `percentage` | `number` |
603
+ | `seriesId` | `string` |
604
+ | `seriesName` | `string` |
605
+ | `seriesType` | `"donut" \| "pie"` |
606
+ | `slice` | `ChartSliceContext` |
607
+ | `value` | `number` |
608
+
609
+ #### `ChartSliceVisibilityEvent`
610
+
611
+ | Name | Type |
612
+ | --- | --- |
613
+ | `category` | `unknown` |
614
+ | `dataIndex` | `number` |
615
+ | `datum` | `unknown` |
616
+ | `seriesId` | `string` |
617
+ | `seriesName` | `string` |
618
+ | `seriesType` | `"donut" \| "pie"` |
619
+ | `visible` | `boolean` |
620
+
621
+ #### `ChartPolarFillMode`
622
+
623
+ ```typescript
624
+ type ChartPolarFillMode = "gradient" | "solid";
625
+ ```
626
+
627
+ #### `ChartPolarLabelContent`
628
+
629
+ ```typescript
630
+ type ChartPolarLabelContent = "category" | "category-percentage" | "percentage" | "value";
631
+ ```
632
+
633
+ #### `ChartPolarLabelPosition`
634
+
635
+ ```typescript
636
+ type ChartPolarLabelPosition = "inside" | "outside";
637
+ ```
638
+
639
+ #### `ChartPolarLabelSide`
640
+
641
+ ```typescript
642
+ type ChartPolarLabelSide = "left" | "right";
643
+ ```
644
+
645
+ **Documented elsewhere:** [`ChartField`](chart.md), [`ChartValueFormatter`](chart.md)