ngwr 16.4.0 → 16.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/charts/bar-chart/styles/_index.scss +494 -305
  2. package/charts/boxplot-chart/styles/_index.scss +114 -48
  3. package/charts/bullet-chart/styles/_index.scss +113 -42
  4. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  5. package/charts/candlestick-chart/styles/_index.scss +61 -26
  6. package/charts/chart-legend/styles/_index.scss +119 -1
  7. package/charts/core/styles/_index.scss +201 -5
  8. package/charts/donut-chart/styles/_index.scss +76 -21
  9. package/charts/funnel-chart/styles/_index.scss +66 -38
  10. package/charts/gauge/styles/_index.scss +12 -1
  11. package/charts/heatmap-chart/styles/_index.scss +90 -53
  12. package/charts/line-chart/styles/_index.scss +143 -139
  13. package/charts/meter-group/styles/_index.scss +87 -25
  14. package/charts/radar-chart/styles/_index.scss +82 -40
  15. package/charts/scatter-chart/styles/_index.scss +117 -44
  16. package/charts/sparkline/styles/_index.scss +7 -1
  17. package/charts/treemap-chart/styles/_index.scss +94 -42
  18. package/charts/waterfall-chart/styles/_index.scss +150 -87
  19. package/color-picker/styles/_index.scss +7 -3
  20. package/copy-value/styles/_index.scss +21 -2
  21. package/date-stamp/styles/_index.scss +2 -1
  22. package/dialog/styles/_index.scss +6 -0
  23. package/drawer/styles/_index.scss +5 -1
  24. package/fesm2022/ngwr-carousel-testing.mjs +4 -1
  25. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  26. package/fesm2022/ngwr-carousel.mjs +21 -2
  27. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  28. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-cascader.mjs +48 -4
  30. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  31. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  32. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  33. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  34. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  35. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  36. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  37. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  38. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  39. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  40. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  41. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  42. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  43. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  44. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  45. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  46. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  47. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  48. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  49. package/fesm2022/ngwr-charts-core.mjs +299 -18
  50. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  51. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  52. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  53. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  54. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  55. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  56. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  57. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  58. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  59. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  60. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  61. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  62. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  63. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  64. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  65. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  66. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  67. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  68. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  69. package/fesm2022/ngwr-charts-meter-group.mjs +223 -31
  70. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  71. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  72. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  73. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  74. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  75. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  76. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  77. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  78. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  79. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  80. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  81. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  82. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  83. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  84. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  85. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  86. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  87. package/fesm2022/ngwr-color-picker.mjs +44 -4
  88. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  89. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  90. package/fesm2022/ngwr-context-menu.mjs +47 -19
  91. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  92. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  93. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  94. package/fesm2022/ngwr-copy-value.mjs +38 -2
  95. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  96. package/fesm2022/ngwr-date-picker.mjs +56 -8
  97. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  98. package/fesm2022/ngwr-dialog.mjs +13 -5
  99. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  100. package/fesm2022/ngwr-drawer.mjs +19 -3
  101. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  102. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  103. package/fesm2022/ngwr-dropdown.mjs +35 -6
  104. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  105. package/fesm2022/ngwr-editor.mjs +1 -0
  106. package/fesm2022/ngwr-editor.mjs.map +1 -1
  107. package/fesm2022/ngwr-graph.mjs +81 -13
  108. package/fesm2022/ngwr-graph.mjs.map +1 -1
  109. package/fesm2022/ngwr-i18n-ar.mjs +5 -0
  110. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  111. package/fesm2022/ngwr-i18n-cs.mjs +5 -0
  112. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  113. package/fesm2022/ngwr-i18n-de.mjs +5 -0
  114. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  115. package/fesm2022/ngwr-i18n-en.mjs +5 -0
  116. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  117. package/fesm2022/ngwr-i18n-es.mjs +5 -0
  118. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  119. package/fesm2022/ngwr-i18n-fr.mjs +5 -0
  120. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  121. package/fesm2022/ngwr-i18n-he.mjs +5 -0
  122. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  123. package/fesm2022/ngwr-i18n-hi.mjs +5 -0
  124. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  125. package/fesm2022/ngwr-i18n-id.mjs +5 -0
  126. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  127. package/fesm2022/ngwr-i18n-it.mjs +5 -0
  128. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  129. package/fesm2022/ngwr-i18n-ja.mjs +5 -0
  130. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  131. package/fesm2022/ngwr-i18n-ko.mjs +5 -0
  132. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  133. package/fesm2022/ngwr-i18n-nl.mjs +5 -0
  134. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  135. package/fesm2022/ngwr-i18n-pl.mjs +5 -0
  136. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  137. package/fesm2022/ngwr-i18n-pt.mjs +5 -0
  138. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  139. package/fesm2022/ngwr-i18n-ru.mjs +5 -0
  140. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  141. package/fesm2022/ngwr-i18n-sv.mjs +5 -0
  142. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  143. package/fesm2022/ngwr-i18n-tr.mjs +5 -0
  144. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  145. package/fesm2022/ngwr-i18n-uk.mjs +5 -0
  146. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  147. package/fesm2022/ngwr-i18n-vi.mjs +5 -0
  148. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  149. package/fesm2022/ngwr-i18n-zh-tw.mjs +5 -0
  150. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  151. package/fesm2022/ngwr-i18n-zh.mjs +5 -0
  152. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  153. package/fesm2022/ngwr-lightbox.mjs +20 -3
  154. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  155. package/fesm2022/ngwr-overlay.mjs +21 -2
  156. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  157. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  158. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  159. package/fesm2022/ngwr-popconfirm.mjs +41 -5
  160. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  161. package/fesm2022/ngwr-popover.mjs +67 -12
  162. package/fesm2022/ngwr-popover.mjs.map +1 -1
  163. package/fesm2022/ngwr-schema-form.mjs +2 -0
  164. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  165. package/fesm2022/ngwr-table.mjs +2 -0
  166. package/fesm2022/ngwr-table.mjs.map +1 -1
  167. package/fesm2022/ngwr-tour.mjs +14 -9
  168. package/fesm2022/ngwr-tour.mjs.map +1 -1
  169. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  170. package/fesm2022/ngwr-tree.mjs +49 -16
  171. package/fesm2022/ngwr-tree.mjs.map +1 -1
  172. package/fesm2022/ngwr-version.mjs +1 -1
  173. package/fesm2022/ngwr-version.mjs.map +1 -1
  174. package/fesm2022/ngwr-window.mjs +16 -9
  175. package/fesm2022/ngwr-window.mjs.map +1 -1
  176. package/i18n/ar.json +5 -0
  177. package/i18n/cs.json +5 -0
  178. package/i18n/de.json +5 -0
  179. package/i18n/en.json +5 -0
  180. package/i18n/es.json +5 -0
  181. package/i18n/fr.json +5 -0
  182. package/i18n/he.json +5 -0
  183. package/i18n/hi.json +5 -0
  184. package/i18n/id.json +5 -0
  185. package/i18n/it.json +5 -0
  186. package/i18n/ja.json +5 -0
  187. package/i18n/ko.json +5 -0
  188. package/i18n/nl.json +5 -0
  189. package/i18n/pl.json +5 -0
  190. package/i18n/pt.json +5 -0
  191. package/i18n/ru.json +5 -0
  192. package/i18n/sv.json +5 -0
  193. package/i18n/tr.json +5 -0
  194. package/i18n/uk.json +5 -0
  195. package/i18n/vi.json +5 -0
  196. package/i18n/zh-TW.json +5 -0
  197. package/i18n/zh.json +5 -0
  198. package/llms-full.txt +8 -8
  199. package/llms.txt +7 -3
  200. package/package.json +1 -1
  201. package/popconfirm/styles/_index.scss +6 -0
  202. package/popover/styles/_index.scss +24 -13
  203. package/schematics/use/symbol-map.json +1 -0
  204. package/skills/ngwr/references/catalog.md +1 -1
  205. package/tour/styles/_index.scss +6 -0
  206. package/types/ngwr-carousel-testing.d.ts +6 -4
  207. package/types/ngwr-carousel.d.ts +14 -3
  208. package/types/ngwr-cascader-testing.d.ts +4 -3
  209. package/types/ngwr-cascader.d.ts +27 -3
  210. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  211. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  212. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  213. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  214. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  215. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  216. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  217. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  218. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  219. package/types/ngwr-charts-core.d.ts +259 -21
  220. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  221. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  222. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  223. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  224. package/types/ngwr-charts-gauge.d.ts +72 -10
  225. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  226. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  227. package/types/ngwr-charts-line-chart.d.ts +215 -86
  228. package/types/ngwr-charts-meter-group.d.ts +96 -7
  229. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  230. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  231. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  232. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  233. package/types/ngwr-charts-sparkline.d.ts +26 -4
  234. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  235. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  236. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  237. package/types/ngwr-color-picker.d.ts +27 -0
  238. package/types/ngwr-context-menu-testing.d.ts +10 -9
  239. package/types/ngwr-context-menu.d.ts +17 -0
  240. package/types/ngwr-copy-value.d.ts +8 -0
  241. package/types/ngwr-date-picker.d.ts +34 -2
  242. package/types/ngwr-dialog.d.ts +30 -10
  243. package/types/ngwr-drawer.d.ts +32 -1
  244. package/types/ngwr-dropdown-testing.d.ts +8 -5
  245. package/types/ngwr-dropdown.d.ts +29 -6
  246. package/types/ngwr-graph.d.ts +22 -6
  247. package/types/ngwr-lightbox.d.ts +15 -0
  248. package/types/ngwr-overlay.d.ts +16 -1
  249. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  250. package/types/ngwr-popconfirm.d.ts +28 -1
  251. package/types/ngwr-popover.d.ts +59 -9
  252. package/types/ngwr-table.d.ts +1 -1
  253. package/types/ngwr-tour.d.ts +21 -2
  254. package/types/ngwr-tree-testing.d.ts +1 -2
  255. package/types/ngwr-tree.d.ts +33 -2
  256. package/types/ngwr-version.d.ts +1 -1
  257. package/types/ngwr-window.d.ts +14 -11
  258. package/window/styles/_index.scss +5 -10
@@ -1,10 +1,10 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, LOCALE_ID, ViewEncapsulation, computed, effect, inject, input, isDevMode, viewChildren } from "@angular/core";
2
+ import { Component, ElementRef, LOCALE_ID, ViewEncapsulation, computed, effect, inject, input, isDevMode } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { wrCheckStyles } from "ngwr/utils";
5
5
  import { useI18nFormatter, useI18nText, wrReadI18nText } from "ngwr/i18n";
6
- import { WrChartTable, useChartNumbers, wrChartAxis } from "ngwr/charts/core";
7
- import { useChartTooltip } from "ngwr/popover";
6
+ import { WrChartState, WrChartTable, useChartHover, useChartNumbers, useChartState, wrChartAxis, wrChartColor, wrChartNumberFormat, wrChartRound } from "ngwr/charts/core";
7
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
8
8
  /**
9
9
  * @license
10
10
  *
@@ -12,31 +12,83 @@ import { useChartTooltip } from "ngwr/popover";
12
12
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
13
13
  */
14
14
  const FENCE = 1.5;
15
+ const DRAWN_PER_SIDE = 100;
16
+ function firstAtLeast(sorted, bound) {
17
+ let from = 0;
18
+ let to = sorted.length;
19
+ while (from < to) {
20
+ const middle = from + to >>> 1;
21
+ if (sorted[middle] < bound) from = middle + 1;
22
+ else to = middle;
23
+ }
24
+ return from;
25
+ }
26
+ function firstPast(sorted, bound) {
27
+ let from = 0;
28
+ let to = sorted.length;
29
+ while (from < to) {
30
+ const middle = from + to >>> 1;
31
+ if (sorted[middle] <= bound) from = middle + 1;
32
+ else to = middle;
33
+ }
34
+ return from;
35
+ }
36
+ function sample(run, start, end, limit, into) {
37
+ const count = end - start;
38
+ if (count <= limit) {
39
+ for (let i = start; i < end; i++) into.push(run[i]);
40
+ return;
41
+ }
42
+ for (let k = 0; k < limit; k++) into.push(run[start + Math.round(k * (count - 1) / (limit - 1))]);
43
+ }
15
44
  function quantile(sorted, p) {
16
45
  const position = (sorted.length - 1) * p;
17
46
  const below = Math.floor(position);
18
47
  const above = Math.ceil(position);
19
48
  return sorted[below] + (position - below) * (sorted[above] - sorted[below]);
20
49
  }
50
+ function sortedFinite(values) {
51
+ const kept = new Float64Array(values.length);
52
+ let count = 0;
53
+ for (let i = 0; i < values.length; i++) {
54
+ const value = values[i];
55
+ if (Number.isFinite(value)) kept[count++] = value;
56
+ }
57
+ return kept.subarray(0, count).sort();
58
+ }
21
59
  function boxplotStats(values) {
22
- const sorted = values.filter((value) => Number.isFinite(value)).sort((a, b) => a - b);
60
+ const sorted = sortedFinite(values);
23
61
  if (sorted.length === 0) return null;
24
62
  const q1 = quantile(sorted, .25);
25
63
  const median = quantile(sorted, .5);
26
64
  const q3 = quantile(sorted, .75);
27
65
  const reach = FENCE * (q3 - q1);
28
- const low = q1 - reach;
29
- const high = q3 + reach;
30
- const inside = sorted.filter((value) => value >= low && value <= high);
66
+ const from = firstAtLeast(sorted, q1 - reach);
67
+ const to = firstPast(sorted, q3 + reach);
68
+ const min = Math.min(q1, sorted[from]);
69
+ const max = Math.max(q3, sorted[to - 1]);
70
+ const outliers = new Array(from + sorted.length - to);
71
+ for (let i = 0; i < from; i++) outliers[i] = sorted[i];
72
+ for (let i = to; i < sorted.length; i++) outliers[from + i - to] = sorted[i];
31
73
  return {
32
- min: Math.min(q1, inside[0] ?? q1),
74
+ min,
33
75
  q1,
34
76
  median,
35
77
  q3,
36
- max: Math.max(q3, inside.at(-1) ?? q3),
37
- outliers: sorted.filter((value) => value < low || value > high)
78
+ max,
79
+ outliers
38
80
  };
39
81
  }
82
+ function drawnOutliers(outliers, median, limit = DRAWN_PER_SIDE) {
83
+ if (outliers.length <= limit) return outliers;
84
+ let above = 0;
85
+ while (above < outliers.length && outliers[above] < median) above++;
86
+ if (above <= limit && outliers.length - above <= limit) return outliers;
87
+ const drawn = [];
88
+ sample(outliers, 0, above, limit, drawn);
89
+ sample(outliers, above, outliers.length, limit, drawn);
90
+ return drawn;
91
+ }
40
92
  /**
41
93
  * @license
42
94
  *
@@ -46,7 +98,8 @@ function boxplotStats(values) {
46
98
  const TICK_COUNT = 4;
47
99
  const TICK_ROOM = 40;
48
100
  const TOOLTIP_OUTLIERS = 3;
49
- const percent = (value) => Math.round(value * 1e3) / 1e3;
101
+ const TABLE_OUTLIERS = 50;
102
+ const percent = (value) => wrChartRound(value, 3);
50
103
  const span = (a, b) => ({
51
104
  top: Math.min(a, b),
52
105
  bottom: Math.max(a, b)
@@ -68,7 +121,7 @@ function summarise(group) {
68
121
  median,
69
122
  q3,
70
123
  max,
71
- outliers: (given.outliers ?? []).filter((value) => Number.isFinite(value)).sort((a, b) => a - b)
124
+ outliers: given.outliers ? Array.from(sortedFinite(given.outliers)) : []
72
125
  };
73
126
  }
74
127
  return group.values ? boxplotStats(group.values) : null;
@@ -89,13 +142,13 @@ var WrBoxplotChart = class WrBoxplotChart {
89
142
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
90
143
  numbers = useChartNumbers(this.valueFormat);
91
144
  locale = inject(LOCALE_ID);
92
- counts = new Intl.NumberFormat(this.locale);
145
+ counts = wrChartNumberFormat(this.locale);
93
146
  moreOutliers = useI18nFormatter("boxplotChart.moreOutliers", "+{{count}} more");
94
147
  list = new Intl.ListFormat(this.locale, {
95
148
  type: "conjunction",
96
149
  style: "narrow"
97
150
  });
98
- color = input("var(--wr-color-primary)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
151
+ color = input(wrChartColor(0), ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
99
152
  height = input(240, {
100
153
  ...ngDevMode ? { debugName: "height" } : /* istanbul ignore next */ {},
101
154
  transform: (v) => Math.max(80, coerceNumberProperty(v, 240))
@@ -104,15 +157,30 @@ var WrBoxplotChart = class WrBoxplotChart {
104
157
  ...ngDevMode ? { debugName: "showGrid" } : /* istanbul ignore next */ {},
105
158
  transform: coerceBooleanProperty
106
159
  });
160
+ showAxis = input(true, {
161
+ ...ngDevMode ? { debugName: "showAxis" } : /* istanbul ignore next */ {},
162
+ transform: coerceBooleanProperty
163
+ });
164
+ loading = input(false, {
165
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
166
+ transform: coerceBooleanProperty
167
+ });
168
+ error = input(false, {
169
+ ...ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {},
170
+ transform: coerceBooleanProperty
171
+ });
172
+ emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
173
+ loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
174
+ errorLabel = input(null, ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
107
175
  tooltip = input(true, {
108
176
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
109
- transform: coerceBooleanProperty
177
+ transform: wrCoerceChartTooltip
110
178
  });
111
179
  dataTable = input(false, {
112
180
  ...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
113
181
  transform: coerceBooleanProperty
114
182
  });
115
- groupEls = viewChildren("group", ...ngDevMode ? [{ debugName: "groupEls" }] : /* istanbul ignore next */ []);
183
+ host = inject(ElementRef).nativeElement;
116
184
  resolvedGroups = computed(() => this.groups().map((group, index) => ({
117
185
  index,
118
186
  label: group.label,
@@ -124,13 +192,14 @@ var WrBoxplotChart = class WrBoxplotChart {
124
192
  let max = Number.NEGATIVE_INFINITY;
125
193
  for (const { stats } of this.resolvedGroups()) {
126
194
  if (!stats) continue;
195
+ const ends = stats.outliers.length > 0 ? [stats.outliers[0], stats.outliers[stats.outliers.length - 1]] : [];
127
196
  for (const value of [
128
197
  stats.min,
129
198
  stats.q1,
130
199
  stats.median,
131
200
  stats.q3,
132
201
  stats.max,
133
- ...stats.outliers
202
+ ...ends
134
203
  ]) {
135
204
  if (value < min) min = value;
136
205
  if (value > max) max = value;
@@ -142,7 +211,7 @@ var WrBoxplotChart = class WrBoxplotChart {
142
211
  tickCount
143
212
  });
144
213
  }, ...ngDevMode ? [{ debugName: "axis" }] : /* istanbul ignore next */ []);
145
- drawnGroups = computed(() => {
214
+ placedGroups = computed(() => {
146
215
  const groups = this.resolvedGroups();
147
216
  const { min, max } = this.axis();
148
217
  const top = (value) => percent((max - value) / (max - min) * 100);
@@ -151,18 +220,16 @@ var WrBoxplotChart = class WrBoxplotChart {
151
220
  const s = group.stats;
152
221
  let marks = null;
153
222
  if (s) {
154
- const outliers = s.outliers.map((value) => ({
223
+ const outliers = drawnOutliers(s.outliers, s.median).map((value) => ({
155
224
  value,
156
225
  top: top(value)
157
226
  }));
158
- const all = [
159
- s.max,
160
- s.q3,
161
- s.median,
162
- s.q1,
163
- s.min,
164
- ...s.outliers
165
- ].map(top);
227
+ let highest = Math.min(top(s.max), top(s.q3), top(s.median), top(s.q1), top(s.min));
228
+ let lowest = Math.max(top(s.max), top(s.q3), top(s.median), top(s.q1), top(s.min));
229
+ if (outliers.length > 0) {
230
+ highest = Math.min(highest, outliers[0].top, outliers[outliers.length - 1].top);
231
+ lowest = Math.max(lowest, outliers[0].top, outliers[outliers.length - 1].top);
232
+ }
166
233
  marks = {
167
234
  upper: span(top(s.max), top(s.q3)),
168
235
  lower: span(top(s.q1), top(s.min)),
@@ -172,31 +239,55 @@ var WrBoxplotChart = class WrBoxplotChart {
172
239
  min: top(s.min),
173
240
  outliers,
174
241
  extent: {
175
- top: Math.min(...all),
176
- bottom: Math.max(...all)
242
+ top: highest,
243
+ bottom: lowest
177
244
  }
178
245
  };
179
246
  }
247
+ const figures = s ? `${s.min} ${s.q1} ${s.median} ${s.q3} ${s.max}` : null;
180
248
  return {
181
249
  ...group,
182
250
  start: percent(group.index * slot),
183
251
  slot: percent(slot),
184
- marks
252
+ marks,
253
+ figures
185
254
  };
186
255
  });
256
+ }, ...ngDevMode ? [{ debugName: "placedGroups" }] : /* istanbul ignore next */ []);
257
+ drawnGroups = computed(() => {
258
+ const active = this.activeGroup();
259
+ return this.placedGroups().map((group) => ({
260
+ ...group,
261
+ classes: `wr-boxplot-chart__group${!group.marks ? " wr-boxplot-chart__group--empty" : active === group.index ? " wr-boxplot-chart__group--active" : ""}`
262
+ }));
187
263
  }, ...ngDevMode ? [{ debugName: "drawnGroups" }] : /* istanbul ignore next */ []);
188
264
  yTicks = computed(() => {
189
265
  const { min, max, step, ticks } = this.axis();
190
266
  const labels = this.numbers.ticks(ticks, step);
191
267
  return ticks.map((value, i) => ({
192
268
  label: labels[i],
193
- top: percent((max - value) / (max - min) * 100)
269
+ top: percent((max - value) / (max - min) * 100),
270
+ zero: value === 0
194
271
  }));
195
272
  }, ...ngDevMode ? [{ debugName: "yTicks" }] : /* istanbul ignore next */ []);
273
+ empty = computed(() => this.resolvedGroups().every((group) => !group.stats), ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
274
+ state = useChartState({
275
+ loading: this.loading,
276
+ error: this.error,
277
+ empty: this.empty,
278
+ emptyLabel: this.emptyLabel,
279
+ loadingLabel: this.loadingLabel,
280
+ errorLabel: this.errorLabel
281
+ });
282
+ slotsShown = computed(() => {
283
+ const kind = this.state()?.kind;
284
+ return kind !== "loading" && kind !== "error";
285
+ }, ...ngDevMode ? [{ debugName: "slotsShown" }] : /* istanbul ignore next */ []);
196
286
  tip = useChartTooltip(this.tooltip, (index) => {
197
- const group = this.drawnGroups()[index];
198
- const anchor = this.groupEls()[index]?.nativeElement.querySelector(".wr-boxplot-chart__extent") ?? null;
199
- if (!group?.stats || !anchor) return null;
287
+ const group = this.placedGroups()[index];
288
+ if (!group?.stats || !this.slotsShown()) return null;
289
+ const anchor = this.host.querySelector(`[data-wr-index="${index}"] .wr-boxplot-chart__extent`);
290
+ if (!anchor) return null;
200
291
  const { stats } = group;
201
292
  const rows = [
202
293
  {
@@ -221,7 +312,8 @@ var WrBoxplotChart = class WrBoxplotChart {
221
312
  }
222
313
  ];
223
314
  if (stats.outliers.length > 0) {
224
- const shown = stats.outliers.slice(0, TOOLTIP_OUTLIERS).map((value) => this.numbers.value(value));
315
+ const shown = [];
316
+ for (let i = 0; i < Math.min(TOOLTIP_OUTLIERS, stats.outliers.length); i++) shown.push(this.numbers.value(stats.outliers[i]));
225
317
  const rest = stats.outliers.length - shown.length;
226
318
  if (rest > 0) shown.push(this.moreOutliers({ count: this.counts.format(rest) }));
227
319
  shown.forEach((value, i) => rows.push({
@@ -241,7 +333,7 @@ var WrBoxplotChart = class WrBoxplotChart {
241
333
  });
242
334
  activeGroup = computed(() => {
243
335
  const index = this.tip.active();
244
- return index !== null && this.drawnGroups()[index]?.marks ? index : null;
336
+ return index !== null && this.placedGroups()[index]?.marks ? index : null;
245
337
  }, ...ngDevMode ? [{ debugName: "activeGroup" }] : /* istanbul ignore next */ []);
246
338
  tableData = computed(() => {
247
339
  const groups = this.resolvedGroups();
@@ -271,7 +363,7 @@ var WrBoxplotChart = class WrBoxplotChart {
271
363
  stats.q3,
272
364
  stats.max
273
365
  ].map(value);
274
- if (withOutliers) cells.push(this.list.format(stats.outliers.map(value)));
366
+ if (withOutliers) cells.push(this.outlierList(stats.outliers));
275
367
  return {
276
368
  header: label,
277
369
  cells
@@ -279,8 +371,23 @@ var WrBoxplotChart = class WrBoxplotChart {
279
371
  }) }]
280
372
  };
281
373
  }, ...ngDevMode ? [{ debugName: "tableData" }] : /* istanbul ignore next */ []);
374
+ outlierList(outliers) {
375
+ if (outliers.length <= TABLE_OUTLIERS) return this.list.format(outliers.map((v) => this.numbers.value(v)));
376
+ return this.list.format([
377
+ this.numbers.value(outliers[0]),
378
+ this.numbers.value(outliers[outliers.length - 1]),
379
+ this.moreOutliers({ count: this.counts.format(outliers.length - 2) })
380
+ ]);
381
+ }
282
382
  constructor() {
283
383
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("charts/boxplot-chart");
384
+ useChartHover({
385
+ enter: (index) => {
386
+ if (this.placedGroups()[index]?.marks) this.tip.enter(index);
387
+ else this.tip.leave();
388
+ },
389
+ leave: (event) => this.tip.leave(event)
390
+ });
284
391
  if (isDevMode()) {
285
392
  const warned = /* @__PURE__ */ new Set();
286
393
  effect(() => {
@@ -303,10 +410,6 @@ var WrBoxplotChart = class WrBoxplotChart {
303
410
  });
304
411
  }
305
412
  }
306
- onEnter(index, event) {
307
- if (this.drawnGroups()[index]?.marks) this.tip.enter(index);
308
- else this.tip.leave(event);
309
- }
310
413
  static ɵfac = i0.ɵɵngDeclareFactory({
311
414
  minVersion: "12.0.0",
312
415
  version: "22.2.6",
@@ -378,6 +481,48 @@ var WrBoxplotChart = class WrBoxplotChart {
378
481
  isRequired: false,
379
482
  transformFunction: null
380
483
  },
484
+ showAxis: {
485
+ classPropertyName: "showAxis",
486
+ publicName: "showAxis",
487
+ isSignal: true,
488
+ isRequired: false,
489
+ transformFunction: null
490
+ },
491
+ loading: {
492
+ classPropertyName: "loading",
493
+ publicName: "loading",
494
+ isSignal: true,
495
+ isRequired: false,
496
+ transformFunction: null
497
+ },
498
+ error: {
499
+ classPropertyName: "error",
500
+ publicName: "error",
501
+ isSignal: true,
502
+ isRequired: false,
503
+ transformFunction: null
504
+ },
505
+ emptyLabel: {
506
+ classPropertyName: "emptyLabel",
507
+ publicName: "emptyLabel",
508
+ isSignal: true,
509
+ isRequired: false,
510
+ transformFunction: null
511
+ },
512
+ loadingLabel: {
513
+ classPropertyName: "loadingLabel",
514
+ publicName: "loadingLabel",
515
+ isSignal: true,
516
+ isRequired: false,
517
+ transformFunction: null
518
+ },
519
+ errorLabel: {
520
+ classPropertyName: "errorLabel",
521
+ publicName: "errorLabel",
522
+ isSignal: true,
523
+ isRequired: false,
524
+ transformFunction: null
525
+ },
381
526
  tooltip: {
382
527
  classPropertyName: "tooltip",
383
528
  publicName: "tooltip",
@@ -393,16 +538,18 @@ var WrBoxplotChart = class WrBoxplotChart {
393
538
  transformFunction: null
394
539
  }
395
540
  },
396
- host: { classAttribute: "wr-boxplot-chart" },
397
- viewQueries: [{
398
- propertyName: "groupEls",
399
- predicate: ["group"],
400
- descendants: true,
401
- isSignal: true
402
- }],
541
+ host: {
542
+ properties: { "class.wr-boxplot-chart--axis": "showAxis()" },
543
+ classAttribute: "wr-boxplot-chart"
544
+ },
403
545
  ngImport: i0,
404
- template: "@let active = activeGroup();\n<!-- Two columns: the value axis' ticks at inline start and the drawing beside them, with\n the axis' name above and the group names under the drawing only, so their\n percentages are the drawing's. -->\n<div class=\"wr-boxplot-chart__body\">\n @if (yLabel()) {\n <div class=\"wr-boxplot-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showGrid()) {\n <!-- In flow, so the column is exactly as wide as the longest label; each one hands\n the stylesheet the y of its own gridline. Hidden, as the drawing is one image:\n its name is what is announced, and the numbers are the data table's. -->\n <div class=\"wr-boxplot-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__y-tick\" [style.--wr-boxplot-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-boxplot-chart__plot\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\" [style.height.px]=\"height()\">\n <!-- Every mark is an element placed by percentage of this box, its width in px or a\n share of its slot: a box keeps its width however tall the plot is, which an SVG\n stretched to the plot would not. Hidden as well as presentational, as the\n scatter's drawing is: `img` already makes it so. -->\n <div class=\"wr-boxplot-chart__drawing\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__grid-line\" [style.--wr-boxplot-chart-y]=\"tick.top\"></span>\n }\n }\n\n <!-- By position, not by label: two groups may share one. Each slot is the hover\n target for its group, top to bottom, so the pointer need not find a 2px\n whisker. It carries the group's numbers in `data-*`, beside the placement. -->\n @for (g of drawnGroups(); track g.index) {\n <div\n #group\n class=\"wr-boxplot-chart__group\"\n [class.wr-boxplot-chart__group--active]=\"active === g.index\"\n [class.wr-boxplot-chart__group--empty]=\"!g.marks\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n [style.--wr-boxplot-chart-group-color]=\"g.color\"\n [attr.data-min]=\"g.stats?.min\"\n [attr.data-q1]=\"g.stats?.q1\"\n [attr.data-median]=\"g.stats?.median\"\n [attr.data-q3]=\"g.stats?.q3\"\n [attr.data-max]=\"g.stats?.max\"\n (mouseenter)=\"onEnter(g.index, $event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @if (g.marks; as m) {\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--upper\"\n [style.--wr-boxplot-chart-top]=\"m.upper.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.upper.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--lower\"\n [style.--wr-boxplot-chart-top]=\"m.lower.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.lower.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--upper\"\n [style.--wr-boxplot-chart-y]=\"m.max\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--lower\"\n [style.--wr-boxplot-chart-y]=\"m.min\"\n ></span>\n <span\n class=\"wr-boxplot-chart__box\"\n [style.--wr-boxplot-chart-top]=\"m.box.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.box.bottom\"\n ></span>\n <span class=\"wr-boxplot-chart__median\" [style.--wr-boxplot-chart-y]=\"m.median\"></span>\n @for (o of m.outliers; track $index) {\n <span\n class=\"wr-boxplot-chart__outlier\"\n [style.--wr-boxplot-chart-y]=\"o.top\"\n [attr.data-value]=\"o.value\"\n ></span>\n }\n <!-- Paints nothing: the span from the topmost mark to the lowest, outliers\n included, which the tooltip points at so its chip covers none of them. -->\n <span\n class=\"wr-boxplot-chart__extent\"\n [style.--wr-boxplot-chart-top]=\"m.extent.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.extent.bottom\"\n ></span>\n }\n </div>\n }\n </div>\n </div>\n\n <!-- Each name is centred under its slot and ellipsised past it; the tooltip and the\n data table carry it whole. -->\n <div class=\"wr-boxplot-chart__x-axis\">\n @for (g of drawnGroups(); track g.index) {\n <span\n class=\"wr-boxplot-chart__x-label\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n >{{ g.label }}</span\n >\n }\n </div>\n\n @if (xLabel()) {\n <div class=\"wr-boxplot-chart__x-title\">{{ xLabel() }}</div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
546
+ template: "@let shown = state();\n<!-- Three columns: the value axis' name along it, its ticks, and the drawing beside them,\n with the group names under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-boxplot-chart__body\">\n @if (yLabel()) {\n <div class=\"wr-boxplot-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showAxis()) {\n <!-- In flow, so the column is exactly as wide as the longest label; each one hands\n the stylesheet the y of its own gridline. Hidden, as the drawing is one image:\n its name is what is announced, and the numbers are the data table's. -->\n <div class=\"wr-boxplot-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__y-tick\" [style.--wr-boxplot-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-boxplot-chart__plot\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\" [style.height.px]=\"height()\">\n <!-- Every mark is an element placed by percentage of this box, its width in px or a\n share of its slot: a box keeps its width however tall the plot is, which an SVG\n stretched to the plot would not. Hidden as well as presentational, as the\n scatter's drawing is: `img` already makes it so. -->\n <div class=\"wr-boxplot-chart__drawing\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <span\n class=\"wr-boxplot-chart__grid-line\"\n [class.wr-boxplot-chart__grid-line--zero]=\"tick.zero\"\n [style.--wr-boxplot-chart-y]=\"tick.top\"\n ></span>\n }\n }\n\n <!-- By position, not by label: two groups may share one. Each slot is the hover\n target for its group, top to bottom, so the pointer need not find a 2px\n whisker: `data-wr-index` is what the chart's one hover listener reads. Its five\n numbers ride in one attribute, for the harness. Under `loading` and `error`\n the slots give way to the message. -->\n @if (slotsShown()) {\n @for (g of drawnGroups(); track g.index) {\n <div\n [class]=\"g.classes\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n [style.--wr-boxplot-chart-group-color]=\"g.color\"\n [attr.data-wr-index]=\"g.index\"\n [attr.data-box]=\"g.figures\"\n >\n @if (g.marks; as m) {\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--upper\"\n [style.--wr-boxplot-chart-top]=\"m.upper.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.upper.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--lower\"\n [style.--wr-boxplot-chart-top]=\"m.lower.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.lower.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--upper\"\n [style.--wr-boxplot-chart-y]=\"m.max\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--lower\"\n [style.--wr-boxplot-chart-y]=\"m.min\"\n ></span>\n <span\n class=\"wr-boxplot-chart__box\"\n [style.--wr-boxplot-chart-top]=\"m.box.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.box.bottom\"\n ></span>\n <span class=\"wr-boxplot-chart__median\" [style.--wr-boxplot-chart-y]=\"m.median\"></span>\n @for (o of m.outliers; track $index) {\n <span\n class=\"wr-boxplot-chart__outlier\"\n [style.--wr-boxplot-chart-y]=\"o.top\"\n [attr.data-value]=\"o.value\"\n ></span>\n }\n <!-- Paints nothing: the span from the topmost mark to the lowest, outliers\n included, which the tooltip points at so its chip covers none of them. -->\n <span\n class=\"wr-boxplot-chart__extent\"\n [style.--wr-boxplot-chart-top]=\"m.extent.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.extent.bottom\"\n ></span>\n }\n </div>\n }\n }\n </div>\n </div>\n\n @if (shown) {\n <!-- Empty, loading or failed: the message, over the grid and the axis the chart keeps.\n Beside the plot in its grid cell, never inside it: `img` makes what it holds\n presentational, and the message is a live region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n <!-- Each name is centred under its slot and ellipsised past it; the tooltip and the\n data table carry it whole. -->\n <div class=\"wr-boxplot-chart__x-axis\">\n @for (g of drawnGroups(); track g.index) {\n <span\n class=\"wr-boxplot-chart__x-label\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n >{{ g.label }}</span\n >\n }\n </div>\n\n @if (xLabel()) {\n <div class=\"wr-boxplot-chart__x-title\">{{ xLabel() }}</div>\n }\n</div>\n\n@if (dataTable() && slotsShown()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
405
547
  dependencies: [{
548
+ kind: "component",
549
+ type: WrChartState,
550
+ selector: "wr-chart-state",
551
+ inputs: ["kind", "label"]
552
+ }, {
406
553
  kind: "component",
407
554
  type: WrChartTable,
408
555
  selector: "wr-chart-table",
@@ -421,9 +568,12 @@ i0.ɵɵngDeclareClassMetadata({
421
568
  args: [{
422
569
  selector: "wr-boxplot-chart",
423
570
  encapsulation: ViewEncapsulation.None,
424
- host: { class: "wr-boxplot-chart" },
425
- imports: [WrChartTable],
426
- template: "@let active = activeGroup();\n<!-- Two columns: the value axis' ticks at inline start and the drawing beside them, with\n the axis' name above and the group names under the drawing only, so their\n percentages are the drawing's. -->\n<div class=\"wr-boxplot-chart__body\">\n @if (yLabel()) {\n <div class=\"wr-boxplot-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showGrid()) {\n <!-- In flow, so the column is exactly as wide as the longest label; each one hands\n the stylesheet the y of its own gridline. Hidden, as the drawing is one image:\n its name is what is announced, and the numbers are the data table's. -->\n <div class=\"wr-boxplot-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__y-tick\" [style.--wr-boxplot-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-boxplot-chart__plot\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\" [style.height.px]=\"height()\">\n <!-- Every mark is an element placed by percentage of this box, its width in px or a\n share of its slot: a box keeps its width however tall the plot is, which an SVG\n stretched to the plot would not. Hidden as well as presentational, as the\n scatter's drawing is: `img` already makes it so. -->\n <div class=\"wr-boxplot-chart__drawing\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__grid-line\" [style.--wr-boxplot-chart-y]=\"tick.top\"></span>\n }\n }\n\n <!-- By position, not by label: two groups may share one. Each slot is the hover\n target for its group, top to bottom, so the pointer need not find a 2px\n whisker. It carries the group's numbers in `data-*`, beside the placement. -->\n @for (g of drawnGroups(); track g.index) {\n <div\n #group\n class=\"wr-boxplot-chart__group\"\n [class.wr-boxplot-chart__group--active]=\"active === g.index\"\n [class.wr-boxplot-chart__group--empty]=\"!g.marks\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n [style.--wr-boxplot-chart-group-color]=\"g.color\"\n [attr.data-min]=\"g.stats?.min\"\n [attr.data-q1]=\"g.stats?.q1\"\n [attr.data-median]=\"g.stats?.median\"\n [attr.data-q3]=\"g.stats?.q3\"\n [attr.data-max]=\"g.stats?.max\"\n (mouseenter)=\"onEnter(g.index, $event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n @if (g.marks; as m) {\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--upper\"\n [style.--wr-boxplot-chart-top]=\"m.upper.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.upper.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--lower\"\n [style.--wr-boxplot-chart-top]=\"m.lower.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.lower.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--upper\"\n [style.--wr-boxplot-chart-y]=\"m.max\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--lower\"\n [style.--wr-boxplot-chart-y]=\"m.min\"\n ></span>\n <span\n class=\"wr-boxplot-chart__box\"\n [style.--wr-boxplot-chart-top]=\"m.box.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.box.bottom\"\n ></span>\n <span class=\"wr-boxplot-chart__median\" [style.--wr-boxplot-chart-y]=\"m.median\"></span>\n @for (o of m.outliers; track $index) {\n <span\n class=\"wr-boxplot-chart__outlier\"\n [style.--wr-boxplot-chart-y]=\"o.top\"\n [attr.data-value]=\"o.value\"\n ></span>\n }\n <!-- Paints nothing: the span from the topmost mark to the lowest, outliers\n included, which the tooltip points at so its chip covers none of them. -->\n <span\n class=\"wr-boxplot-chart__extent\"\n [style.--wr-boxplot-chart-top]=\"m.extent.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.extent.bottom\"\n ></span>\n }\n </div>\n }\n </div>\n </div>\n\n <!-- Each name is centred under its slot and ellipsised past it; the tooltip and the\n data table carry it whole. -->\n <div class=\"wr-boxplot-chart__x-axis\">\n @for (g of drawnGroups(); track g.index) {\n <span\n class=\"wr-boxplot-chart__x-label\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n >{{ g.label }}</span\n >\n }\n </div>\n\n @if (xLabel()) {\n <div class=\"wr-boxplot-chart__x-title\">{{ xLabel() }}</div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
571
+ host: {
572
+ class: "wr-boxplot-chart",
573
+ "[class.wr-boxplot-chart--axis]": "showAxis()"
574
+ },
575
+ imports: [WrChartState, WrChartTable],
576
+ template: "@let shown = state();\n<!-- Three columns: the value axis' name along it, its ticks, and the drawing beside them,\n with the group names under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-boxplot-chart__body\">\n @if (yLabel()) {\n <div class=\"wr-boxplot-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showAxis()) {\n <!-- In flow, so the column is exactly as wide as the longest label; each one hands\n the stylesheet the y of its own gridline. Hidden, as the drawing is one image:\n its name is what is announced, and the numbers are the data table's. -->\n <div class=\"wr-boxplot-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-boxplot-chart__y-tick\" [style.--wr-boxplot-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div class=\"wr-boxplot-chart__plot\" role=\"img\" [attr.aria-label]=\"resolvedAriaLabel()\" [style.height.px]=\"height()\">\n <!-- Every mark is an element placed by percentage of this box, its width in px or a\n share of its slot: a box keeps its width however tall the plot is, which an SVG\n stretched to the plot would not. Hidden as well as presentational, as the\n scatter's drawing is: `img` already makes it so. -->\n <div class=\"wr-boxplot-chart__drawing\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <span\n class=\"wr-boxplot-chart__grid-line\"\n [class.wr-boxplot-chart__grid-line--zero]=\"tick.zero\"\n [style.--wr-boxplot-chart-y]=\"tick.top\"\n ></span>\n }\n }\n\n <!-- By position, not by label: two groups may share one. Each slot is the hover\n target for its group, top to bottom, so the pointer need not find a 2px\n whisker: `data-wr-index` is what the chart's one hover listener reads. Its five\n numbers ride in one attribute, for the harness. Under `loading` and `error`\n the slots give way to the message. -->\n @if (slotsShown()) {\n @for (g of drawnGroups(); track g.index) {\n <div\n [class]=\"g.classes\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n [style.--wr-boxplot-chart-group-color]=\"g.color\"\n [attr.data-wr-index]=\"g.index\"\n [attr.data-box]=\"g.figures\"\n >\n @if (g.marks; as m) {\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--upper\"\n [style.--wr-boxplot-chart-top]=\"m.upper.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.upper.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__whisker wr-boxplot-chart__whisker--lower\"\n [style.--wr-boxplot-chart-top]=\"m.lower.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.lower.bottom\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--upper\"\n [style.--wr-boxplot-chart-y]=\"m.max\"\n ></span>\n <span\n class=\"wr-boxplot-chart__cap wr-boxplot-chart__cap--lower\"\n [style.--wr-boxplot-chart-y]=\"m.min\"\n ></span>\n <span\n class=\"wr-boxplot-chart__box\"\n [style.--wr-boxplot-chart-top]=\"m.box.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.box.bottom\"\n ></span>\n <span class=\"wr-boxplot-chart__median\" [style.--wr-boxplot-chart-y]=\"m.median\"></span>\n @for (o of m.outliers; track $index) {\n <span\n class=\"wr-boxplot-chart__outlier\"\n [style.--wr-boxplot-chart-y]=\"o.top\"\n [attr.data-value]=\"o.value\"\n ></span>\n }\n <!-- Paints nothing: the span from the topmost mark to the lowest, outliers\n included, which the tooltip points at so its chip covers none of them. -->\n <span\n class=\"wr-boxplot-chart__extent\"\n [style.--wr-boxplot-chart-top]=\"m.extent.top\"\n [style.--wr-boxplot-chart-bottom]=\"m.extent.bottom\"\n ></span>\n }\n </div>\n }\n }\n </div>\n </div>\n\n @if (shown) {\n <!-- Empty, loading or failed: the message, over the grid and the axis the chart keeps.\n Beside the plot in its grid cell, never inside it: `img` makes what it holds\n presentational, and the message is a live region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n <!-- Each name is centred under its slot and ellipsised past it; the tooltip and the\n data table carry it whole. -->\n <div class=\"wr-boxplot-chart__x-axis\">\n @for (g of drawnGroups(); track g.index) {\n <span\n class=\"wr-boxplot-chart__x-label\"\n [style.--wr-boxplot-chart-slot-start]=\"g.start\"\n [style.--wr-boxplot-chart-slot-width]=\"g.slot\"\n >{{ g.label }}</span\n >\n }\n </div>\n\n @if (xLabel()) {\n <div class=\"wr-boxplot-chart__x-title\">{{ xLabel() }}</div>\n }\n</div>\n\n@if (dataTable() && slotsShown()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
427
577
  }]
428
578
  }],
429
579
  ctorParameters: () => [],
@@ -492,6 +642,54 @@ i0.ɵɵngDeclareClassMetadata({
492
642
  required: false
493
643
  }]
494
644
  }],
645
+ showAxis: [{
646
+ type: i0.Input,
647
+ args: [{
648
+ isSignal: true,
649
+ alias: "showAxis",
650
+ required: false
651
+ }]
652
+ }],
653
+ loading: [{
654
+ type: i0.Input,
655
+ args: [{
656
+ isSignal: true,
657
+ alias: "loading",
658
+ required: false
659
+ }]
660
+ }],
661
+ error: [{
662
+ type: i0.Input,
663
+ args: [{
664
+ isSignal: true,
665
+ alias: "error",
666
+ required: false
667
+ }]
668
+ }],
669
+ emptyLabel: [{
670
+ type: i0.Input,
671
+ args: [{
672
+ isSignal: true,
673
+ alias: "emptyLabel",
674
+ required: false
675
+ }]
676
+ }],
677
+ loadingLabel: [{
678
+ type: i0.Input,
679
+ args: [{
680
+ isSignal: true,
681
+ alias: "loadingLabel",
682
+ required: false
683
+ }]
684
+ }],
685
+ errorLabel: [{
686
+ type: i0.Input,
687
+ args: [{
688
+ isSignal: true,
689
+ alias: "errorLabel",
690
+ required: false
691
+ }]
692
+ }],
495
693
  tooltip: [{
496
694
  type: i0.Input,
497
695
  args: [{
@@ -507,10 +705,6 @@ i0.ɵɵngDeclareClassMetadata({
507
705
  alias: "dataTable",
508
706
  required: false
509
707
  }]
510
- }],
511
- groupEls: [{
512
- type: i0.ViewChildren,
513
- args: ["group", { isSignal: true }]
514
708
  }]
515
709
  }
516
710
  });