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,11 +1,69 @@
1
1
  import * as i0 from "@angular/core";
2
- import { Component, DestroyRef, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, effect, inject, input, model, signal, untracked, viewChild } from "@angular/core";
2
+ import { Component, DestroyRef, LOCALE_ID, PLATFORM_ID, ViewEncapsulation, afterNextRender, afterRenderEffect, computed, inject, input, model, signal, untracked, viewChild } from "@angular/core";
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
- import { DOCUMENT as DOCUMENT$1, isPlatformBrowser } from "@angular/common";
4
+ import { NgTemplateOutlet, isPlatformBrowser } from "@angular/common";
5
5
  import { wrCheckStyles, wrClamp } from "ngwr/utils";
6
6
  import { useI18nText } from "ngwr/i18n";
7
7
  import { WR_CHART_LEGEND_BLOCK, WrChartLegend } from "ngwr/charts/chart-legend";
8
- import { WrChartTable, useChartNumbers, wrChartAxis, wrChartColor, wrChartDash } from "ngwr/charts/core";
8
+ import { WrChartState, WrChartTable, useChartHover, useChartNumbers, useChartSize, useChartState, wrChartAxis, wrChartColor, wrChartDash, wrChartLongest, wrChartNumberFormat } from "ngwr/charts/core";
9
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
10
+ /**
11
+ * @license
12
+ *
13
+ * Use of this source code is governed by an MIT-style license that can be
14
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
15
+ */
16
+ const DENSITY = 2;
17
+ function wrLineChartKeep(values, columns) {
18
+ const count = values.length;
19
+ const cols = Math.floor(columns);
20
+ const every = !(cols > 0) || count <= cols * DENSITY;
21
+ const kept = [];
22
+ let column = -1;
23
+ let first = -1;
24
+ let low = -1;
25
+ let high = -1;
26
+ let last = -1;
27
+ const flush = () => {
28
+ if (first < 0) return;
29
+ kept.push(first);
30
+ const early = Math.min(low, high);
31
+ const late = Math.max(low, high);
32
+ if (early !== first && early !== last) kept.push(early);
33
+ if (late !== early && late !== first && late !== last) kept.push(late);
34
+ if (last !== first) kept.push(last);
35
+ first = -1;
36
+ };
37
+ for (let i = 0; i < count; i++) {
38
+ const value = values[i];
39
+ if (value === null) {
40
+ flush();
41
+ column = -1;
42
+ if (kept.length > 0 && kept[kept.length - 1] !== -1) kept.push(-1);
43
+ continue;
44
+ }
45
+ if (every) {
46
+ kept.push(i);
47
+ continue;
48
+ }
49
+ const at = Math.min(cols - 1, Math.floor(i * cols / count));
50
+ if (at !== column) {
51
+ flush();
52
+ column = at;
53
+ first = low = high = last = i;
54
+ continue;
55
+ }
56
+ if (value < values[low]) low = i;
57
+ if (value > values[high]) high = i;
58
+ last = i;
59
+ }
60
+ flush();
61
+ if (kept[kept.length - 1] === -1) kept.pop();
62
+ return kept;
63
+ }
64
+ function wrLineChartCrowded(count, width, spacing) {
65
+ return count > 1 && width > 0 && width / (count - 1) < spacing;
66
+ }
9
67
  /**
10
68
  * @license
11
69
  *
@@ -17,7 +75,9 @@ const ASSUMED_INSET = 16;
17
75
  const CHAR_WIDTH = 7;
18
76
  const LABEL_GAP = 8;
19
77
  const HOVER_RADIUS = 6;
20
- const BESIDE = 12;
78
+ const DOT_SPACING = 6;
79
+ const PROBES = 3;
80
+ const TOOLTIP_CLASS = "wr-line-chart__tooltip";
21
81
  var WrLineChart = class WrLineChart {
22
82
  series = input([], ...ngDevMode ? [{ debugName: "series" }] : /* istanbul ignore next */ []);
23
83
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
@@ -35,10 +95,26 @@ var WrLineChart = class WrLineChart {
35
95
  ...ngDevMode ? { debugName: "showGrid" } : /* istanbul ignore next */ {},
36
96
  transform: coerceBooleanProperty
37
97
  });
38
- showLegend = input(true, {
98
+ showAxis = input(true, {
99
+ ...ngDevMode ? { debugName: "showAxis" } : /* istanbul ignore next */ {},
100
+ transform: coerceBooleanProperty
101
+ });
102
+ showLegend = input("auto", {
39
103
  ...ngDevMode ? { debugName: "showLegend" } : /* istanbul ignore next */ {},
104
+ transform: (value) => value === "auto" ? "auto" : coerceBooleanProperty(value)
105
+ });
106
+ legendPosition = input("bottom", ...ngDevMode ? [{ debugName: "legendPosition" }] : /* istanbul ignore next */ []);
107
+ loading = input(false, {
108
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
40
109
  transform: coerceBooleanProperty
41
110
  });
111
+ error = input(false, {
112
+ ...ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {},
113
+ transform: coerceBooleanProperty
114
+ });
115
+ emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
116
+ loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
117
+ errorLabel = input(null, ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
42
118
  toggleableLegend = input(false, {
43
119
  ...ngDevMode ? { debugName: "toggleableLegend" } : /* istanbul ignore next */ {},
44
120
  transform: coerceBooleanProperty
@@ -48,6 +124,10 @@ var WrLineChart = class WrLineChart {
48
124
  ...ngDevMode ? { debugName: "showDots" } : /* istanbul ignore next */ {},
49
125
  transform: coerceBooleanProperty
50
126
  });
127
+ decimate = input(true, {
128
+ ...ngDevMode ? { debugName: "decimate" } : /* istanbul ignore next */ {},
129
+ transform: coerceBooleanProperty
130
+ });
51
131
  showArea = input(false, {
52
132
  ...ngDevMode ? { debugName: "showArea" } : /* istanbul ignore next */ {},
53
133
  transform: coerceBooleanProperty
@@ -62,50 +142,39 @@ var WrLineChart = class WrLineChart {
62
142
  });
63
143
  tooltip = input(true, {
64
144
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
65
- transform: coerceBooleanProperty
145
+ transform: wrCoerceChartTooltip
66
146
  });
67
147
  vbW = 600;
68
148
  vbH = 300;
69
149
  svg = viewChild.required("svg", ...ngDevMode ? [{ debugName: "svg" }] : /* istanbul ignore next */ []);
70
150
  plot = viewChild.required("plot", ...ngDevMode ? [{ debugName: "plot" }] : /* istanbul ignore next */ []);
71
151
  probe = viewChild("probe", ...ngDevMode ? [{ debugName: "probe" }] : /* istanbul ignore next */ []);
72
- tooltipEl = viewChild("tooltip", ...ngDevMode ? [{ debugName: "tooltipEl" }] : /* istanbul ignore next */ []);
73
- ordinals = new Intl.NumberFormat(inject(LOCALE_ID));
152
+ ordinals = wrChartNumberFormat(inject(LOCALE_ID));
74
153
  measured = signal(null, ...ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []);
75
- tooltipPlacement = signal("top", ...ngDevMode ? [{ debugName: "tooltipPlacement" }] : /* istanbul ignore next */ []);
76
- hoveredIndex = signal(null, ...ngDevMode ? [{ debugName: "hoveredIndex" }] : /* istanbul ignore next */ []);
77
- activeIndex = computed(() => this.tooltip() ? this.hoveredIndex() : null, ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
78
- dismissed = null;
154
+ drawingSize = useChartSize(this.svg);
79
155
  constructor() {
80
156
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("charts/line-chart");
81
- const document = inject(DOCUMENT$1);
82
- effect((onCleanup) => {
83
- if (this.activeIndex() === null) return;
84
- const onKeydown = (event) => {
85
- if (event.key !== "Escape") return;
86
- this.dismissed = this.hoveredIndex();
87
- this.hoveredIndex.set(null);
88
- };
89
- document.addEventListener("keydown", onKeydown);
90
- onCleanup(() => document.removeEventListener("keydown", onKeydown));
157
+ useChartHover({
158
+ enter: () => void 0,
159
+ leave: () => void 0
91
160
  });
92
161
  if (!isPlatformBrowser(inject(PLATFORM_ID))) return;
93
162
  const destroyRef = inject(DestroyRef);
94
163
  afterRenderEffect(() => {
95
164
  this.probeText();
165
+ this.drawingSize();
96
166
  untracked(() => this.measure());
97
167
  });
98
- afterRenderEffect(() => {
99
- const points = this.hoverPoints();
100
- const tooltip = this.tooltipEl()?.nativeElement;
101
- if (points.length === 0 || !tooltip) return;
102
- untracked(() => this.placeTooltip(points, tooltip));
103
- });
104
168
  afterNextRender(() => {
105
- if (typeof ResizeObserver === "undefined") return;
106
- const observer = new ResizeObserver(() => this.measure());
107
- observer.observe(this.svg().nativeElement);
108
- destroyRef.onDestroy(() => observer.disconnect());
169
+ const plot = this.plot().nativeElement;
170
+ const move = (event) => this.onPointerMove(event);
171
+ const leave = (event) => this.tip.leave(event);
172
+ plot.addEventListener("mousemove", move);
173
+ plot.addEventListener("mouseleave", leave);
174
+ destroyRef.onDestroy(() => {
175
+ plot.removeEventListener("mousemove", move);
176
+ plot.removeEventListener("mouseleave", leave);
177
+ });
109
178
  });
110
179
  }
111
180
  resolvedSeries = computed(() => this.series().map((s, i) => ({
@@ -120,6 +189,29 @@ var WrLineChart = class WrLineChart {
120
189
  color,
121
190
  dash
122
191
  })), ...ngDevMode ? [{ debugName: "legendItems" }] : /* istanbul ignore next */ []);
192
+ legendShown = computed(() => {
193
+ const show = this.showLegend();
194
+ const rows = this.legendItems().length;
195
+ if (show === false || rows === 0 || this.legendPosition() === "none") return false;
196
+ return show === true || rows > 1;
197
+ }, ...ngDevMode ? [{ debugName: "legendShown" }] : /* istanbul ignore next */ []);
198
+ legendFirst = computed(() => {
199
+ const position = this.legendPosition();
200
+ return position === "top" || position === "start";
201
+ }, ...ngDevMode ? [{ debugName: "legendFirst" }] : /* istanbul ignore next */ []);
202
+ legendSide = computed(() => {
203
+ const position = this.legendPosition();
204
+ return position === "start" || position === "end";
205
+ }, ...ngDevMode ? [{ debugName: "legendSide" }] : /* istanbul ignore next */ []);
206
+ empty = computed(() => this.resolvedSeries().every((s) => s.data.length === 0), ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
207
+ state = useChartState({
208
+ loading: this.loading,
209
+ error: this.error,
210
+ empty: this.empty,
211
+ emptyLabel: this.emptyLabel,
212
+ loadingLabel: this.loadingLabel,
213
+ errorLabel: this.errorLabel
214
+ });
123
215
  visibleSeries = computed(() => {
124
216
  const hidden = new Set(this.hiddenSeries());
125
217
  return this.resolvedSeries().filter((s) => !hidden.has(s.index));
@@ -175,77 +267,90 @@ var WrLineChart = class WrLineChart {
175
267
  const { min, max, ticks } = this.bounds();
176
268
  return ticks.map((value) => ({
177
269
  value,
270
+ zero: value === 0,
178
271
  y: (max - value) / (max - min) * this.vbH
179
272
  }));
180
273
  }, ...ngDevMode ? [{ debugName: "yTicks" }] : /* istanbul ignore next */ []);
181
- pathFor(values) {
182
- const { min, max } = this.bounds();
183
- const commands = [];
274
+ columns = computed(() => {
275
+ if (!this.decimate()) return 0;
276
+ const width = Math.round(this.measured()?.width ?? ASSUMED_WIDTH);
277
+ return this.pointCount() > width * 2 ? width : 0;
278
+ }, ...ngDevMode ? [{ debugName: "columns" }] : /* istanbul ignore next */ []);
279
+ dotsShown = computed(() => {
280
+ if (!this.showDots()) return false;
281
+ if (!this.decimate()) return true;
282
+ return !wrLineChartCrowded(this.pointCount(), this.measured()?.width ?? ASSUMED_WIDTH, DOT_SPACING);
283
+ }, ...ngDevMode ? [{ debugName: "dotsShown" }] : /* istanbul ignore next */ []);
284
+ keptSeries = computed(() => {
285
+ const columns = this.columns();
286
+ return this.plottedSeries().map((s) => ({
287
+ ...s,
288
+ kept: wrLineChartKeep(s.tops, columns)
289
+ }));
290
+ }, ...ngDevMode ? [{ debugName: "keptSeries" }] : /* istanbul ignore next */ []);
291
+ linePath(values, kept) {
292
+ let d = "";
184
293
  let run = 0;
185
294
  let last = "";
186
295
  const closeRun = () => {
187
- if (run === 1) commands.push(`L ${last}`);
296
+ if (run === 1) d += ` L ${last}`;
188
297
  run = 0;
189
298
  };
190
- values.forEach((v, i) => {
191
- if (v === null) {
299
+ for (const i of kept) {
300
+ if (i === -1) {
192
301
  closeRun();
193
- return;
302
+ continue;
194
303
  }
195
- const x = this.pointX(i);
196
- const y = (max - v) / (max - min) * this.vbH;
197
- last = `${x.toFixed(2)} ${y.toFixed(2)}`;
198
- commands.push(`${run === 0 ? "M" : "L"} ${last}`);
304
+ last = `${this.pointX(i).toFixed(2)} ${this.pointY(values[i] ?? 0).toFixed(2)}`;
305
+ d += `${d ? " " : ""}${run === 0 ? "M" : "L"} ${last}`;
199
306
  run++;
200
- });
307
+ }
201
308
  closeRun();
202
- return commands.join(" ");
309
+ return d;
203
310
  }
204
311
  drawn = computed(() => {
205
- const dots = this.showDots();
206
- return this.plottedSeries().map((s) => ({
312
+ const dots = this.dotsShown();
313
+ return this.keptSeries().map((s) => ({
207
314
  index: s.index,
208
315
  color: s.color,
209
316
  dash: s.dash,
210
- d: this.pathFor(s.tops),
211
- dots: dots ? this.dotsFor(s.tops) : ""
317
+ d: this.linePath(s.tops, s.kept),
318
+ dots: dots ? this.dotsFor(s.tops, s.kept) : ""
212
319
  }));
213
320
  }, ...ngDevMode ? [{ debugName: "drawn" }] : /* istanbul ignore next */ []);
214
- dotsFor(values) {
215
- const { min, max } = this.bounds();
216
- const commands = [];
217
- for (let i = 0; i < values.length; i++) {
218
- const v = values[i];
219
- if (v !== null) commands.push(this.dotPath(this.pointX(i), (max - v) / (max - min) * this.vbH));
321
+ dotsFor(values, kept) {
322
+ let d = "";
323
+ for (const i of kept) {
324
+ if (i === -1) continue;
325
+ d += `${d ? " " : ""}${this.dotPath(this.pointX(i), this.pointY(values[i] ?? 0))}`;
220
326
  }
221
- return commands.join(" ");
327
+ return d;
222
328
  }
223
329
  areas = computed(() => {
224
330
  if (!this.showArea() || this.pointCount() <= 1) return [];
225
- return this.plottedSeries().flatMap((s) => {
331
+ return this.keptSeries().flatMap((s) => {
226
332
  const fills = [];
227
- let start = -1;
228
- const close = (end) => {
229
- if (start >= 0 && end - start >= 2) fills.push({
230
- key: `${s.index}:${start}`,
333
+ let run = [];
334
+ const close = () => {
335
+ if (run.length >= 2) fills.push({
336
+ key: `${s.index}:${run[0]}`,
337
+ series: s.index,
231
338
  color: s.color,
232
- d: this.areaPath(s, start, end)
339
+ d: this.areaPath(s, run)
233
340
  });
234
- start = -1;
341
+ run = [];
235
342
  };
236
- s.tops.forEach((v, i) => {
237
- if (v === null) close(i);
238
- else if (start < 0) start = i;
239
- });
240
- close(s.tops.length);
343
+ for (const i of s.kept) if (i === -1) close();
344
+ else run.push(i);
345
+ close();
241
346
  return fills;
242
347
  });
243
348
  }, ...ngDevMode ? [{ debugName: "areas" }] : /* istanbul ignore next */ []);
244
- areaPath(series, start, end) {
349
+ areaPath(series, run) {
245
350
  const at = (i, value) => `${this.pointX(i).toFixed(2)} ${this.pointY(value).toFixed(2)}`;
246
351
  const commands = [];
247
- for (let i = start; i < end; i++) commands.push(`${i === start ? "M" : "L"} ${at(i, series.tops[i] ?? 0)}`);
248
- for (let i = end - 1; i >= start; i--) commands.push(`L ${at(i, series.bases?.[i] ?? 0)}`);
352
+ for (let k = 0; k < run.length; k++) commands.push(`${k === 0 ? "M" : "L"} ${at(run[k], series.tops[run[k]] ?? 0)}`);
353
+ for (let k = run.length - 1; k >= 0; k--) commands.push(`L ${at(run[k], series.bases?.[run[k]] ?? 0)}`);
249
354
  commands.push("Z");
250
355
  return commands.join(" ");
251
356
  }
@@ -265,7 +370,7 @@ var WrLineChart = class WrLineChart {
265
370
  const count = this.pointCount();
266
371
  return count <= 1 ? 100 : Math.min(100, 100 * this.xAxis().every / (count - 1));
267
372
  }, ...ngDevMode ? [{ debugName: "xSlot" }] : /* istanbul ignore next */ []);
268
- probeText = computed(() => [...new Set(this.xLabels().map((label) => label.replace(/\r\n?|\n/g, " ")))].join("\n"), ...ngDevMode ? [{ debugName: "probeText" }] : /* istanbul ignore next */ []);
373
+ probeText = computed(() => wrChartLongest(this.xLabels().map((label) => label.replace(/\r\n?|\n/g, " ")), PROBES).join("\n"), ...ngDevMode ? [{ debugName: "probeText" }] : /* istanbul ignore next */ []);
269
374
  xAxis = computed(() => {
270
375
  const labels = this.xLabels();
271
376
  const count = this.pointCount();
@@ -297,9 +402,7 @@ var WrLineChart = class WrLineChart {
297
402
  ticks
298
403
  };
299
404
  }, ...ngDevMode ? [{ debugName: "xAxis" }] : /* istanbul ignore next */ []);
300
- hoverPoints = computed(() => {
301
- const i = this.activeIndex();
302
- if (i === null) return [];
405
+ pointsAt(i) {
303
406
  return this.plottedSeries().flatMap((s) => {
304
407
  const value = s.data[i];
305
408
  const plotted = s.tops[i];
@@ -315,26 +418,63 @@ var WrLineChart = class WrLineChart {
315
418
  y: this.pointY(plotted)
316
419
  }];
317
420
  });
318
- }, ...ngDevMode ? [{ debugName: "hoverPoints" }] : /* istanbul ignore next */ []);
319
- hoverLabel = computed(() => {
421
+ }
422
+ tip = useChartTooltip(this.tooltip, (index) => this.readout(index), (x, y) => this.indexAt(x, y));
423
+ activeIndex = computed(() => this.state() ? null : this.tip.active(), ...ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []);
424
+ hoverPoints = computed(() => {
320
425
  const i = this.activeIndex();
321
- if (i === null) return "";
322
- return this.xLabels()[i] ?? this.ordinals.format(i + 1);
323
- }, ...ngDevMode ? [{ debugName: "hoverLabel" }] : /* istanbul ignore next */ []);
426
+ return i === null ? [] : this.pointsAt(i);
427
+ }, ...ngDevMode ? [{ debugName: "hoverPoints" }] : /* istanbul ignore next */ []);
428
+ readout(index) {
429
+ if (this.state()) return null;
430
+ const points = this.pointsAt(index);
431
+ if (points.length === 0) return null;
432
+ const box = this.svg().nativeElement.getBoundingClientRect();
433
+ const x = box.left + points[0].x / this.vbW * box.width;
434
+ let top = Number.POSITIVE_INFINITY;
435
+ let bottom = Number.NEGATIVE_INFINITY;
436
+ for (const point of points) {
437
+ const y = box.top + point.y / this.vbH * box.height;
438
+ if (y < top) top = y;
439
+ if (y > bottom) bottom = y;
440
+ }
441
+ return {
442
+ datum: {
443
+ label: this.xLabels()[index] ?? this.ordinals.format(index + 1),
444
+ value: "",
445
+ rows: points.map(({ label, text, color }) => ({
446
+ label,
447
+ value: text,
448
+ color
449
+ })),
450
+ className: TOOLTIP_CLASS
451
+ },
452
+ anchor: {
453
+ x: x - HOVER_RADIUS,
454
+ y: top - HOVER_RADIUS,
455
+ width: 12,
456
+ height: bottom - top + 12
457
+ }
458
+ };
459
+ }
324
460
  onPointerMove(event) {
325
- if (!this.tooltip()) return;
461
+ if (!this.tooltip() || this.tip.active() !== null) return;
462
+ const index = this.indexAt(event.clientX, event.clientY);
463
+ if (index === null) this.tip.leave(event);
464
+ else this.tip.enter(index);
465
+ }
466
+ indexAt(clientX, clientY) {
326
467
  const count = this.pointCount();
468
+ if (count === 0 || this.state()) return null;
327
469
  const box = this.svg().nativeElement.getBoundingClientRect();
328
- if (count === 0 || box.width <= 0) return;
329
- const ratio = (event.clientX - box.left) / box.width;
330
- const i = count === 1 ? 0 : wrClamp(Math.round(ratio * (count - 1)), 0, count - 1);
331
- if (i === this.dismissed) return;
332
- this.dismissed = null;
333
- this.hoveredIndex.set(i);
334
- }
335
- onPointerLeave() {
336
- this.dismissed = null;
337
- this.hoveredIndex.set(null);
470
+ if (box.width <= 0) return null;
471
+ const measured = this.measured();
472
+ if (measured && box.height > 0) {
473
+ const { inset, insetY } = measured;
474
+ if (clientX < box.left - inset || clientX > box.right + inset || clientY < box.top - insetY || clientY > box.bottom + insetY) return null;
475
+ }
476
+ const ratio = (clientX - box.left) / box.width;
477
+ return count === 1 ? 0 : wrClamp(Math.round(ratio * (count - 1)), 0, count - 1);
338
478
  }
339
479
  dotPath(x, y) {
340
480
  return `M ${x.toFixed(2)} ${y.toFixed(2)} h 0`;
@@ -342,62 +482,19 @@ var WrLineChart = class WrLineChart {
342
482
  measure() {
343
483
  const box = this.svg().nativeElement.getBoundingClientRect();
344
484
  if (box.width <= 0) return;
345
- const inset = box.left - this.plot().nativeElement.getBoundingClientRect().left;
485
+ const plot = this.plot().nativeElement.getBoundingClientRect();
486
+ const inset = box.left - plot.left;
487
+ const insetY = Math.max(0, box.top - plot.top);
346
488
  const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;
347
489
  const last = this.measured();
348
- if (last?.width === box.width && last.inset === inset && last.label === label) return;
490
+ if (last?.width === box.width && last.inset === inset && last.insetY === insetY && last.label === label) return;
349
491
  this.measured.set({
350
492
  width: box.width,
351
493
  inset,
494
+ insetY,
352
495
  label
353
496
  });
354
497
  }
355
- placeTooltip(points, tooltip) {
356
- const box = this.svg().nativeElement.getBoundingClientRect();
357
- const plot = this.plot().nativeElement.getBoundingClientRect();
358
- const rect = tooltip.getBoundingClientRect();
359
- if (box.height <= 0 || rect.height <= 0 || rect.width <= 0) return;
360
- const current = this.tooltipPlacement();
361
- const inset = current === "below" ? box.bottom - rect.bottom : rect.top - box.top;
362
- const { width, height } = rect;
363
- const x = box.left + points[0].x / this.vbW * box.width;
364
- const ys = points.map((p) => box.top + p.y / this.vbH * box.height);
365
- const across = (left) => wrClamp(left, plot.left, plot.right - width);
366
- const top = box.top + inset;
367
- const candidates = [
368
- {
369
- placement: "top",
370
- left: across(x - width / 2),
371
- top
372
- },
373
- {
374
- placement: "below",
375
- left: across(x - width / 2),
376
- top: box.bottom - inset - height
377
- },
378
- x - plot.left > plot.right - x ? {
379
- placement: "left",
380
- left: across(x - BESIDE - width),
381
- top
382
- } : {
383
- placement: "right",
384
- left: across(x + BESIDE),
385
- top
386
- }
387
- ];
388
- const covers = (c) => x + HOVER_RADIUS > c.left && x - HOVER_RADIUS < c.left + width ? ys.filter((y) => y + HOVER_RADIUS > c.top && y - HOVER_RADIUS < c.top + height).length : 0;
389
- let best = candidates[0];
390
- let fewest = covers(best);
391
- for (const candidate of candidates.slice(1)) {
392
- if (fewest === 0) break;
393
- const count = covers(candidate);
394
- if (count < fewest) {
395
- best = candidate;
396
- fewest = count;
397
- }
398
- }
399
- if (best.placement !== current) this.tooltipPlacement.set(best.placement);
400
- }
401
498
  tickLabels = computed(() => this.numbers.ticks(this.yTicks().map((tick) => tick.value), this.bounds().step), ...ngDevMode ? [{ debugName: "tickLabels" }] : /* istanbul ignore next */ []);
402
499
  yAxis = computed(() => {
403
500
  const labels = this.tickLabels();
@@ -480,6 +577,13 @@ var WrLineChart = class WrLineChart {
480
577
  isRequired: false,
481
578
  transformFunction: null
482
579
  },
580
+ showAxis: {
581
+ classPropertyName: "showAxis",
582
+ publicName: "showAxis",
583
+ isSignal: true,
584
+ isRequired: false,
585
+ transformFunction: null
586
+ },
483
587
  showLegend: {
484
588
  classPropertyName: "showLegend",
485
589
  publicName: "showLegend",
@@ -487,6 +591,48 @@ var WrLineChart = class WrLineChart {
487
591
  isRequired: false,
488
592
  transformFunction: null
489
593
  },
594
+ legendPosition: {
595
+ classPropertyName: "legendPosition",
596
+ publicName: "legendPosition",
597
+ isSignal: true,
598
+ isRequired: false,
599
+ transformFunction: null
600
+ },
601
+ loading: {
602
+ classPropertyName: "loading",
603
+ publicName: "loading",
604
+ isSignal: true,
605
+ isRequired: false,
606
+ transformFunction: null
607
+ },
608
+ error: {
609
+ classPropertyName: "error",
610
+ publicName: "error",
611
+ isSignal: true,
612
+ isRequired: false,
613
+ transformFunction: null
614
+ },
615
+ emptyLabel: {
616
+ classPropertyName: "emptyLabel",
617
+ publicName: "emptyLabel",
618
+ isSignal: true,
619
+ isRequired: false,
620
+ transformFunction: null
621
+ },
622
+ loadingLabel: {
623
+ classPropertyName: "loadingLabel",
624
+ publicName: "loadingLabel",
625
+ isSignal: true,
626
+ isRequired: false,
627
+ transformFunction: null
628
+ },
629
+ errorLabel: {
630
+ classPropertyName: "errorLabel",
631
+ publicName: "errorLabel",
632
+ isSignal: true,
633
+ isRequired: false,
634
+ transformFunction: null
635
+ },
490
636
  toggleableLegend: {
491
637
  classPropertyName: "toggleableLegend",
492
638
  publicName: "toggleableLegend",
@@ -508,6 +654,13 @@ var WrLineChart = class WrLineChart {
508
654
  isRequired: false,
509
655
  transformFunction: null
510
656
  },
657
+ decimate: {
658
+ classPropertyName: "decimate",
659
+ publicName: "decimate",
660
+ isSignal: true,
661
+ isRequired: false,
662
+ transformFunction: null
663
+ },
511
664
  showArea: {
512
665
  classPropertyName: "showArea",
513
666
  publicName: "showArea",
@@ -540,10 +693,12 @@ var WrLineChart = class WrLineChart {
540
693
  outputs: { hiddenSeries: "hiddenSeriesChange" },
541
694
  host: {
542
695
  properties: {
696
+ "class.wr-chart--legend-side": "legendShown() && legendSide()",
697
+ "class.wr-line-chart--axis": "showAxis()",
543
698
  "class.wr-line-chart--area": "showArea()",
544
699
  "class.wr-line-chart--stacked": "stacked()"
545
700
  },
546
- classAttribute: "wr-line-chart"
701
+ classAttribute: "wr-line-chart wr-chart--legend"
547
702
  },
548
703
  viewQueries: [
549
704
  {
@@ -566,35 +721,48 @@ var WrLineChart = class WrLineChart {
566
721
  predicate: ["probe"],
567
722
  descendants: true,
568
723
  isSignal: true
724
+ }
725
+ ],
726
+ ngImport: i0,
727
+ template: "@let hovered = activeIndex();\n@let shown = state();\n\n<!-- The legend, drawn before the body or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. Every\n row keys its series by the series' own dash rather than a solid block: a coloured\n square leaves the reader to match it to the LINE, and matching by colour is the step\n the patterns exist to remove. Rows are tracked by position, so two series that share\n a label are two rows. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-line-chart__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n ></ul>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Two columns: the y-axis labels at inline start, the drawing beside them, and the\n x labels under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-line-chart__body\">\n @if (showAxis()) {\n <!-- The tick labels are HTML beside the drawing rather than `<text>` inside it: the\n drawing stretches with `preserveAspectRatio=\"none\"` and its type stretched with\n it. In flow, so the column is exactly as wide as the longest label; each one\n hands the stylesheet the y of its own gridline, as the x labels hand it their x.\n Hidden, as they were inside the plot's `img`: the plot's name is what is\n announced. -->\n <div class=\"wr-line-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yAxis(); track $index) {\n <span class=\"wr-line-chart__tick\" [style.--wr-line-chart-y]=\"tick.y\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <!-- The pointer is heard on the plot by one native listener pair the component adds,\n and an x is found by position. -->\n <div\n #plot\n class=\"wr-line-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- Named, where it was the only unnamed element in the component. The legend\n swatch is an `<svg>` too now, so `querySelector('svg')` no longer means\n \"the chart\" — and a plot that nothing can address by name is one a\n consumer's stylesheet and a spec both have to reach by position. -->\n <svg #svg class=\"wr-line-chart__svg\" [attr.viewBox]=\"viewBox()\" preserveAspectRatio=\"none\">\n @if (showGrid()) {\n @for (tick of yTicks(); track tick.value) {\n <!-- The colour is the stylesheet's, from `--wr-line-chart-grid-color`, so forced\n colors can swap it for the system's own; the line at zero takes the\n stronger `--wr-line-chart-zero-color`. -->\n <line\n class=\"wr-line-chart__grid-line\"\n [class.wr-line-chart__grid-line--zero]=\"tick.zero\"\n x1=\"0\"\n [attr.x2]=\"vbW\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n @if (!shown) {\n <!-- Every fill before every line, so the lines and their dashes stay on top where\n the fills overlap and the series are still told apart by shape. The opacity is\n the stylesheet's, from `--wr-line-chart-area-opacity`. `data-wr-series` is the\n series' row in the legend, which the shared hover dims by. -->\n @for (area of areas(); track area.key) {\n <path\n class=\"wr-line-chart__area\"\n [attr.d]=\"area.d\"\n [attr.fill]=\"area.color\"\n [attr.data-wr-series]=\"area.series\"\n stroke=\"none\"\n />\n }\n\n <!-- By position, not by label: two series may share one, and a duplicate key\n makes Angular re-create rows it cannot tell apart. Each is drawn at its\n plotted values, which under `stacked` are the tops of its band. Every path is\n built once per data change (`drawn`), so hovering rebuilds none of them. The\n width is the stylesheet's, from `--wr-line-chart-line-width`. -->\n @for (s of drawn(); track s.index) {\n <path\n class=\"wr-line-chart__line\"\n [attr.d]=\"s.d\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.stroke-dasharray]=\"s.dash || null\"\n [attr.data-wr-series]=\"s.index\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- Every dot of the series in one path, a subpath each, so a long series costs\n one element rather than one per point. A hole in the data gets no dot. A dot\n is a zero-length line with a round cap and a non-scaling stroke, which stays\n a circle however the drawing stretches; a `<circle>` scaled with it, into\n a 3 × 5px oval on a phone and a 9 × 5px one at 1920px. Its size is the\n stylesheet's, from `--wr-line-chart-dot-size`. -->\n @if (s.dots) {\n <path\n class=\"wr-line-chart__dot\"\n [attr.d]=\"s.dots\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.data-wr-series]=\"s.index\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n }\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <line\n class=\"wr-line-chart__crosshair\"\n [attr.x1]=\"pointX(hovered)\"\n [attr.x2]=\"pointX(hovered)\"\n y1=\"0\"\n [attr.y2]=\"vbH\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- A marker in the series' colour inside a ring of the surface, drawn the way a\n dot is and for the same reason: the ring first, a wider stroke under the\n marker's. The ring's colour is the stylesheet's, from\n `--wr-line-chart-hover-center`. -->\n @for (p of hoverPoints(); track p.index) {\n <path\n class=\"wr-line-chart__hover-dot-ring\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n class=\"wr-line-chart__hover-dot\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n [attr.stroke]=\"p.color\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n </svg>\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, and not inside it: the plot is an `img`, which\n makes everything it holds presentational, and the message is a live region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n @if (xLabels().length > 0) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two printed labels; each label hands it the x of the point it names. Both are\n percentages of the drawing's width, so they track the drawing at any size: the\n stylesheet centres a label on its point and ellipsises it past its slot. Laying the\n labels out as equal centred flex slots instead is bar-chart geometry: only the\n middle label landed on its dot, and the outer ones sat up to half a column away.\n The hidden copy of the longest few labels, a line each, is what the room they\n need is measured against: it is as wide as the widest of them. -->\n <div class=\"wr-line-chart__x-labels\" [style.--wr-line-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-line-chart__x-probe\" aria-hidden=\"true\">{{ probeText() }}</span>\n @for (tick of xAxis().ticks; track tick.index) {\n <span class=\"wr-line-chart__x-label\" [style.--wr-line-chart-x]=\"tick.x\">{{ tick.label }}</span>\n }\n </div>\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\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",
728
+ dependencies: [
729
+ {
730
+ kind: "directive",
731
+ type: NgTemplateOutlet,
732
+ selector: "[ngTemplateOutlet]",
733
+ inputs: [
734
+ "ngTemplateOutletContext",
735
+ "ngTemplateOutlet",
736
+ "ngTemplateOutletInjector"
737
+ ]
569
738
  },
570
739
  {
571
- propertyName: "tooltipEl",
572
- first: true,
573
- predicate: ["tooltip"],
574
- descendants: true,
575
- isSignal: true
740
+ kind: "component",
741
+ type: WrChartLegend,
742
+ selector: "ul[wr-chart-legend]",
743
+ inputs: [
744
+ "items",
745
+ "position",
746
+ "toggleable",
747
+ "hiddenSeries",
748
+ "ariaLabel",
749
+ "hiddenLabel"
750
+ ],
751
+ outputs: ["hiddenSeriesChange", "toggled"]
752
+ },
753
+ {
754
+ kind: "component",
755
+ type: WrChartState,
756
+ selector: "wr-chart-state",
757
+ inputs: ["kind", "label"]
758
+ },
759
+ {
760
+ kind: "component",
761
+ type: WrChartTable,
762
+ selector: "wr-chart-table",
763
+ inputs: ["data"]
576
764
  }
577
765
  ],
578
- ngImport: i0,
579
- template: "@let hovered = activeIndex();\n@if (showLegend() && resolvedSeries().length > 0) {\n <!-- Every row keys its series by the series' own dash rather than a solid block: a\n coloured square leaves the reader to match it to the LINE, and matching by colour\n is the step the patterns exist to remove. Rows are tracked by position, so two\n series that share a label are two rows. -->\n <ul\n wr-chart-legend\n class=\"wr-line-chart__legend\"\n [items]=\"legendItems()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n ></ul>\n}\n\n<!-- Two columns: the y-axis labels at inline start, the drawing beside them, and the\n x labels under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-line-chart__body\">\n @if (showGrid()) {\n <!-- The tick labels are HTML beside the drawing rather than `<text>` inside it: the\n drawing stretches with `preserveAspectRatio=\"none\"` and its type stretched with\n it. In flow, so the column is exactly as wide as the longest label; each one\n hands the stylesheet the y of its own gridline, as the x labels hand it their x.\n Hidden, as they were inside the plot's `img`: the plot's name is what is\n announced. -->\n <div class=\"wr-line-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yAxis(); track $index) {\n <span class=\"wr-line-chart__tick\" [style.--wr-line-chart-y]=\"tick.y\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-line-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"onPointerLeave()\"\n >\n <!-- Named, where it was the only unnamed element in the component. The legend\n swatch is an `<svg>` too now, so `querySelector('svg')` no longer means\n \"the chart\" — and a plot that nothing can address by name is one a\n consumer's stylesheet and a spec both have to reach by position. -->\n <svg #svg class=\"wr-line-chart__svg\" [attr.viewBox]=\"viewBox()\" preserveAspectRatio=\"none\">\n @if (showGrid()) {\n @for (tick of yTicks(); track tick.value) {\n <!-- The colour is the stylesheet's, from `--wr-line-chart-grid-color`, so forced\n colors can swap it for the system's own. -->\n <line\n class=\"wr-line-chart__grid-line\"\n x1=\"0\"\n [attr.x2]=\"vbW\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n <!-- Every fill before every line, so the lines and their dashes stay on top where\n the fills overlap and the series are still told apart by shape. The opacity is\n the stylesheet's, from `--wr-line-chart-area-opacity`. -->\n @for (area of areas(); track area.key) {\n <path class=\"wr-line-chart__area\" [attr.d]=\"area.d\" [attr.fill]=\"area.color\" stroke=\"none\" />\n }\n\n <!-- By position, not by label: two series may share one, and a duplicate key\n makes Angular re-create rows it cannot tell apart. Each is drawn at its\n plotted values, which under `stacked` are the tops of its band. Every path is\n built once per data change (`drawn`), so hovering rebuilds none of them. -->\n @for (s of drawn(); track s.index) {\n <path\n class=\"wr-line-chart__line\"\n [attr.d]=\"s.d\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.stroke-dasharray]=\"s.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- Every dot of the series in one path, a subpath each, so a long series costs\n one element rather than one per point. A hole in the data gets no dot. A dot\n is a zero-length line with a round cap and a non-scaling stroke, which stays\n a 6px circle however the drawing stretches; a `<circle>` scaled with it, into\n a 3 × 5px oval on a phone and a 9 × 5px one at 1920px. -->\n @if (s.dots) {\n <path\n class=\"wr-line-chart__dot\"\n [attr.d]=\"s.dots\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n stroke-width=\"6\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <line\n class=\"wr-line-chart__crosshair\"\n [attr.x1]=\"pointX(hovered)\"\n [attr.x2]=\"pointX(hovered)\"\n y1=\"0\"\n [attr.y2]=\"vbH\"\n stroke-width=\"1\"\n stroke-dasharray=\"3 3\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- A ring of the series' colour round a surface-coloured centre, drawn the way a\n dot is and for the same reason. The centre's colour is the stylesheet's, from\n `--wr-line-chart-hover-center`. -->\n @for (p of hoverPoints(); track p.index) {\n <path\n class=\"wr-line-chart__hover-dot\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n [attr.stroke]=\"p.color\"\n stroke-width=\"12\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n class=\"wr-line-chart__hover-dot-center\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n stroke-width=\"8\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n </svg>\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <!-- The layer covers the plot and is what the tooltip's `cqw` measures. It is out of\n flow, so the containment it turns on costs the plot's own sizing nothing. The\n tooltip takes the same `--wr-line-chart-x` the x labels take, and the same\n clamp: centred on its point, never past either end. At the top of the plot, or\n where that would cover a marker it reads, at the bottom (`--below`) or beside the\n crosshair (`--left`, `--right`). -->\n <div class=\"wr-line-chart__tooltip-layer\">\n <div\n #tooltip\n class=\"wr-line-chart__tooltip\"\n [class.wr-line-chart__tooltip--below]=\"tooltipPlacement() === 'below'\"\n [class.wr-line-chart__tooltip--left]=\"tooltipPlacement() === 'left'\"\n [class.wr-line-chart__tooltip--right]=\"tooltipPlacement() === 'right'\"\n [style.--wr-line-chart-x]=\"xPercent(hovered)\"\n >\n <div class=\"wr-line-chart__tooltip-label\">{{ hoverLabel() }}</div>\n @for (p of hoverPoints(); track p.index) {\n <div class=\"wr-line-chart__tooltip-row\">\n <span class=\"wr-line-chart__swatch\" [style.background]=\"p.color\"></span>\n <span class=\"wr-line-chart__tooltip-name\">{{ p.label }}</span>\n <span class=\"wr-line-chart__tooltip-value\">{{ p.text }}</span>\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (xLabels().length > 0) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two printed labels; each label hands it the x of the point it names. Both are\n percentages of the drawing's width, so they track the drawing at any size: the\n stylesheet centres a label on its point and ellipsises it past its slot. Laying the\n labels out as equal centred flex slots instead is bar-chart geometry: only the\n middle label landed on its dot, and the outer ones sat up to half a column away.\n The hidden copy of every label, a line each, is what the room they need is\n measured against: it is as wide as the widest. -->\n <div class=\"wr-line-chart__x-labels\" [style.--wr-line-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-line-chart__x-probe\" aria-hidden=\"true\">{{ probeText() }}</span>\n @for (tick of xAxis().ticks; track tick.index) {\n <span class=\"wr-line-chart__x-label\" [style.--wr-line-chart-x]=\"tick.x\">{{ tick.label }}</span>\n }\n </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",
580
- dependencies: [{
581
- kind: "component",
582
- type: WrChartLegend,
583
- selector: "ul[wr-chart-legend]",
584
- inputs: [
585
- "items",
586
- "toggleable",
587
- "hiddenSeries",
588
- "ariaLabel",
589
- "hiddenLabel"
590
- ],
591
- outputs: ["hiddenSeriesChange", "toggled"]
592
- }, {
593
- kind: "component",
594
- type: WrChartTable,
595
- selector: "wr-chart-table",
596
- inputs: ["data"]
597
- }],
598
766
  viewProviders: [{
599
767
  provide: WR_CHART_LEGEND_BLOCK,
600
768
  useValue: "wr-line-chart"
@@ -613,16 +781,23 @@ i0.ɵɵngDeclareClassMetadata({
613
781
  selector: "wr-line-chart",
614
782
  encapsulation: ViewEncapsulation.None,
615
783
  host: {
616
- class: "wr-line-chart",
784
+ class: "wr-line-chart wr-chart--legend",
785
+ "[class.wr-chart--legend-side]": "legendShown() && legendSide()",
786
+ "[class.wr-line-chart--axis]": "showAxis()",
617
787
  "[class.wr-line-chart--area]": "showArea()",
618
788
  "[class.wr-line-chart--stacked]": "stacked()"
619
789
  },
620
- imports: [WrChartLegend, WrChartTable],
790
+ imports: [
791
+ NgTemplateOutlet,
792
+ WrChartLegend,
793
+ WrChartState,
794
+ WrChartTable
795
+ ],
621
796
  viewProviders: [{
622
797
  provide: WR_CHART_LEGEND_BLOCK,
623
798
  useValue: "wr-line-chart"
624
799
  }],
625
- template: "@let hovered = activeIndex();\n@if (showLegend() && resolvedSeries().length > 0) {\n <!-- Every row keys its series by the series' own dash rather than a solid block: a\n coloured square leaves the reader to match it to the LINE, and matching by colour\n is the step the patterns exist to remove. Rows are tracked by position, so two\n series that share a label are two rows. -->\n <ul\n wr-chart-legend\n class=\"wr-line-chart__legend\"\n [items]=\"legendItems()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n ></ul>\n}\n\n<!-- Two columns: the y-axis labels at inline start, the drawing beside them, and the\n x labels under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-line-chart__body\">\n @if (showGrid()) {\n <!-- The tick labels are HTML beside the drawing rather than `<text>` inside it: the\n drawing stretches with `preserveAspectRatio=\"none\"` and its type stretched with\n it. In flow, so the column is exactly as wide as the longest label; each one\n hands the stylesheet the y of its own gridline, as the x labels hand it their x.\n Hidden, as they were inside the plot's `img`: the plot's name is what is\n announced. -->\n <div class=\"wr-line-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yAxis(); track $index) {\n <span class=\"wr-line-chart__tick\" [style.--wr-line-chart-y]=\"tick.y\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-line-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"onPointerLeave()\"\n >\n <!-- Named, where it was the only unnamed element in the component. The legend\n swatch is an `<svg>` too now, so `querySelector('svg')` no longer means\n \"the chart\" — and a plot that nothing can address by name is one a\n consumer's stylesheet and a spec both have to reach by position. -->\n <svg #svg class=\"wr-line-chart__svg\" [attr.viewBox]=\"viewBox()\" preserveAspectRatio=\"none\">\n @if (showGrid()) {\n @for (tick of yTicks(); track tick.value) {\n <!-- The colour is the stylesheet's, from `--wr-line-chart-grid-color`, so forced\n colors can swap it for the system's own. -->\n <line\n class=\"wr-line-chart__grid-line\"\n x1=\"0\"\n [attr.x2]=\"vbW\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\"\n stroke-width=\"1\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n <!-- Every fill before every line, so the lines and their dashes stay on top where\n the fills overlap and the series are still told apart by shape. The opacity is\n the stylesheet's, from `--wr-line-chart-area-opacity`. -->\n @for (area of areas(); track area.key) {\n <path class=\"wr-line-chart__area\" [attr.d]=\"area.d\" [attr.fill]=\"area.color\" stroke=\"none\" />\n }\n\n <!-- By position, not by label: two series may share one, and a duplicate key\n makes Angular re-create rows it cannot tell apart. Each is drawn at its\n plotted values, which under `stacked` are the tops of its band. Every path is\n built once per data change (`drawn`), so hovering rebuilds none of them. -->\n @for (s of drawn(); track s.index) {\n <path\n class=\"wr-line-chart__line\"\n [attr.d]=\"s.d\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.stroke-dasharray]=\"s.dash || null\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- Every dot of the series in one path, a subpath each, so a long series costs\n one element rather than one per point. A hole in the data gets no dot. A dot\n is a zero-length line with a round cap and a non-scaling stroke, which stays\n a 6px circle however the drawing stretches; a `<circle>` scaled with it, into\n a 3 × 5px oval on a phone and a 9 × 5px one at 1920px. -->\n @if (s.dots) {\n <path\n class=\"wr-line-chart__dot\"\n [attr.d]=\"s.dots\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n stroke-width=\"6\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <line\n class=\"wr-line-chart__crosshair\"\n [attr.x1]=\"pointX(hovered)\"\n [attr.x2]=\"pointX(hovered)\"\n y1=\"0\"\n [attr.y2]=\"vbH\"\n stroke-width=\"1\"\n stroke-dasharray=\"3 3\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- A ring of the series' colour round a surface-coloured centre, drawn the way a\n dot is and for the same reason. The centre's colour is the stylesheet's, from\n `--wr-line-chart-hover-center`. -->\n @for (p of hoverPoints(); track p.index) {\n <path\n class=\"wr-line-chart__hover-dot\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n [attr.stroke]=\"p.color\"\n stroke-width=\"12\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n class=\"wr-line-chart__hover-dot-center\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n stroke-width=\"8\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n </svg>\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <!-- The layer covers the plot and is what the tooltip's `cqw` measures. It is out of\n flow, so the containment it turns on costs the plot's own sizing nothing. The\n tooltip takes the same `--wr-line-chart-x` the x labels take, and the same\n clamp: centred on its point, never past either end. At the top of the plot, or\n where that would cover a marker it reads, at the bottom (`--below`) or beside the\n crosshair (`--left`, `--right`). -->\n <div class=\"wr-line-chart__tooltip-layer\">\n <div\n #tooltip\n class=\"wr-line-chart__tooltip\"\n [class.wr-line-chart__tooltip--below]=\"tooltipPlacement() === 'below'\"\n [class.wr-line-chart__tooltip--left]=\"tooltipPlacement() === 'left'\"\n [class.wr-line-chart__tooltip--right]=\"tooltipPlacement() === 'right'\"\n [style.--wr-line-chart-x]=\"xPercent(hovered)\"\n >\n <div class=\"wr-line-chart__tooltip-label\">{{ hoverLabel() }}</div>\n @for (p of hoverPoints(); track p.index) {\n <div class=\"wr-line-chart__tooltip-row\">\n <span class=\"wr-line-chart__swatch\" [style.background]=\"p.color\"></span>\n <span class=\"wr-line-chart__tooltip-name\">{{ p.label }}</span>\n <span class=\"wr-line-chart__tooltip-value\">{{ p.text }}</span>\n </div>\n }\n </div>\n </div>\n }\n </div>\n\n @if (xLabels().length > 0) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two printed labels; each label hands it the x of the point it names. Both are\n percentages of the drawing's width, so they track the drawing at any size: the\n stylesheet centres a label on its point and ellipsises it past its slot. Laying the\n labels out as equal centred flex slots instead is bar-chart geometry: only the\n middle label landed on its dot, and the outer ones sat up to half a column away.\n The hidden copy of every label, a line each, is what the room they need is\n measured against: it is as wide as the widest. -->\n <div class=\"wr-line-chart__x-labels\" [style.--wr-line-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-line-chart__x-probe\" aria-hidden=\"true\">{{ probeText() }}</span>\n @for (tick of xAxis().ticks; track tick.index) {\n <span class=\"wr-line-chart__x-label\" [style.--wr-line-chart-x]=\"tick.x\">{{ tick.label }}</span>\n }\n </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"
800
+ template: "@let hovered = activeIndex();\n@let shown = state();\n\n<!-- The legend, drawn before the body or after it so it is in the DOM where it is on\n screen: a toggleable legend's rows are tab stops, and their order follows it. Every\n row keys its series by the series' own dash rather than a solid block: a coloured\n square leaves the reader to match it to the LINE, and matching by colour is the step\n the patterns exist to remove. Rows are tracked by position, so two series that share\n a label are two rows. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-line-chart__legend\"\n [items]=\"legendItems()\"\n [position]=\"legendPosition()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n ></ul>\n</ng-template>\n\n@if (legendShown() && legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n<!-- Two columns: the y-axis labels at inline start, the drawing beside them, and the\n x labels under the drawing only, so their percentages are the drawing's. -->\n<div class=\"wr-line-chart__body\">\n @if (showAxis()) {\n <!-- The tick labels are HTML beside the drawing rather than `<text>` inside it: the\n drawing stretches with `preserveAspectRatio=\"none\"` and its type stretched with\n it. In flow, so the column is exactly as wide as the longest label; each one\n hands the stylesheet the y of its own gridline, as the x labels hand it their x.\n Hidden, as they were inside the plot's `img`: the plot's name is what is\n announced. -->\n <div class=\"wr-line-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yAxis(); track $index) {\n <span class=\"wr-line-chart__tick\" [style.--wr-line-chart-y]=\"tick.y\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <!-- The pointer is heard on the plot by one native listener pair the component adds,\n and an x is found by position. -->\n <div\n #plot\n class=\"wr-line-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- Named, where it was the only unnamed element in the component. The legend\n swatch is an `<svg>` too now, so `querySelector('svg')` no longer means\n \"the chart\" — and a plot that nothing can address by name is one a\n consumer's stylesheet and a spec both have to reach by position. -->\n <svg #svg class=\"wr-line-chart__svg\" [attr.viewBox]=\"viewBox()\" preserveAspectRatio=\"none\">\n @if (showGrid()) {\n @for (tick of yTicks(); track tick.value) {\n <!-- The colour is the stylesheet's, from `--wr-line-chart-grid-color`, so forced\n colors can swap it for the system's own; the line at zero takes the\n stronger `--wr-line-chart-zero-color`. -->\n <line\n class=\"wr-line-chart__grid-line\"\n [class.wr-line-chart__grid-line--zero]=\"tick.zero\"\n x1=\"0\"\n [attr.x2]=\"vbW\"\n [attr.y1]=\"tick.y\"\n [attr.y2]=\"tick.y\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n\n @if (!shown) {\n <!-- Every fill before every line, so the lines and their dashes stay on top where\n the fills overlap and the series are still told apart by shape. The opacity is\n the stylesheet's, from `--wr-line-chart-area-opacity`. `data-wr-series` is the\n series' row in the legend, which the shared hover dims by. -->\n @for (area of areas(); track area.key) {\n <path\n class=\"wr-line-chart__area\"\n [attr.d]=\"area.d\"\n [attr.fill]=\"area.color\"\n [attr.data-wr-series]=\"area.series\"\n stroke=\"none\"\n />\n }\n\n <!-- By position, not by label: two series may share one, and a duplicate key\n makes Angular re-create rows it cannot tell apart. Each is drawn at its\n plotted values, which under `stacked` are the tops of its band. Every path is\n built once per data change (`drawn`), so hovering rebuilds none of them. The\n width is the stylesheet's, from `--wr-line-chart-line-width`. -->\n @for (s of drawn(); track s.index) {\n <path\n class=\"wr-line-chart__line\"\n [attr.d]=\"s.d\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.stroke-dasharray]=\"s.dash || null\"\n [attr.data-wr-series]=\"s.index\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- Every dot of the series in one path, a subpath each, so a long series costs\n one element rather than one per point. A hole in the data gets no dot. A dot\n is a zero-length line with a round cap and a non-scaling stroke, which stays\n a circle however the drawing stretches; a `<circle>` scaled with it, into\n a 3 × 5px oval on a phone and a 9 × 5px one at 1920px. Its size is the\n stylesheet's, from `--wr-line-chart-dot-size`. -->\n @if (s.dots) {\n <path\n class=\"wr-line-chart__dot\"\n [attr.d]=\"s.dots\"\n fill=\"none\"\n [attr.stroke]=\"s.color\"\n [attr.data-wr-series]=\"s.index\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n }\n\n @if (hovered !== null && hoverPoints().length > 0) {\n <line\n class=\"wr-line-chart__crosshair\"\n [attr.x1]=\"pointX(hovered)\"\n [attr.x2]=\"pointX(hovered)\"\n y1=\"0\"\n [attr.y2]=\"vbH\"\n vector-effect=\"non-scaling-stroke\"\n />\n <!-- A marker in the series' colour inside a ring of the surface, drawn the way a\n dot is and for the same reason: the ring first, a wider stroke under the\n marker's. The ring's colour is the stylesheet's, from\n `--wr-line-chart-hover-center`. -->\n @for (p of hoverPoints(); track p.index) {\n <path\n class=\"wr-line-chart__hover-dot-ring\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n <path\n class=\"wr-line-chart__hover-dot\"\n [attr.d]=\"dotPath(p.x, p.y)\"\n fill=\"none\"\n [attr.stroke]=\"p.color\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n }\n </svg>\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, and not inside it: the plot is an `img`, which\n makes everything it holds presentational, and the message is a live region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n @if (xLabels().length > 0) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two printed labels; each label hands it the x of the point it names. Both are\n percentages of the drawing's width, so they track the drawing at any size: the\n stylesheet centres a label on its point and ellipsises it past its slot. Laying the\n labels out as equal centred flex slots instead is bar-chart geometry: only the\n middle label landed on its dot, and the outer ones sat up to half a column away.\n The hidden copy of the longest few labels, a line each, is what the room they\n need is measured against: it is as wide as the widest of them. -->\n <div class=\"wr-line-chart__x-labels\" [style.--wr-line-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-line-chart__x-probe\" aria-hidden=\"true\">{{ probeText() }}</span>\n @for (tick of xAxis().ticks; track tick.index) {\n <span class=\"wr-line-chart__x-label\" [style.--wr-line-chart-x]=\"tick.x\">{{ tick.label }}</span>\n }\n </div>\n }\n</div>\n\n@if (legendShown() && !legendFirst()) {\n <ng-container [ngTemplateOutlet]=\"legend\" />\n}\n\n@if (dataTable() && !shown) {\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"
626
801
  }]
627
802
  }],
628
803
  ctorParameters: () => [],
@@ -675,6 +850,14 @@ i0.ɵɵngDeclareClassMetadata({
675
850
  required: false
676
851
  }]
677
852
  }],
853
+ showAxis: [{
854
+ type: i0.Input,
855
+ args: [{
856
+ isSignal: true,
857
+ alias: "showAxis",
858
+ required: false
859
+ }]
860
+ }],
678
861
  showLegend: [{
679
862
  type: i0.Input,
680
863
  args: [{
@@ -683,6 +866,54 @@ i0.ɵɵngDeclareClassMetadata({
683
866
  required: false
684
867
  }]
685
868
  }],
869
+ legendPosition: [{
870
+ type: i0.Input,
871
+ args: [{
872
+ isSignal: true,
873
+ alias: "legendPosition",
874
+ required: false
875
+ }]
876
+ }],
877
+ loading: [{
878
+ type: i0.Input,
879
+ args: [{
880
+ isSignal: true,
881
+ alias: "loading",
882
+ required: false
883
+ }]
884
+ }],
885
+ error: [{
886
+ type: i0.Input,
887
+ args: [{
888
+ isSignal: true,
889
+ alias: "error",
890
+ required: false
891
+ }]
892
+ }],
893
+ emptyLabel: [{
894
+ type: i0.Input,
895
+ args: [{
896
+ isSignal: true,
897
+ alias: "emptyLabel",
898
+ required: false
899
+ }]
900
+ }],
901
+ loadingLabel: [{
902
+ type: i0.Input,
903
+ args: [{
904
+ isSignal: true,
905
+ alias: "loadingLabel",
906
+ required: false
907
+ }]
908
+ }],
909
+ errorLabel: [{
910
+ type: i0.Input,
911
+ args: [{
912
+ isSignal: true,
913
+ alias: "errorLabel",
914
+ required: false
915
+ }]
916
+ }],
686
917
  toggleableLegend: [{
687
918
  type: i0.Input,
688
919
  args: [{
@@ -710,6 +941,14 @@ i0.ɵɵngDeclareClassMetadata({
710
941
  required: false
711
942
  }]
712
943
  }],
944
+ decimate: [{
945
+ type: i0.Input,
946
+ args: [{
947
+ isSignal: true,
948
+ alias: "decimate",
949
+ required: false
950
+ }]
951
+ }],
713
952
  showArea: [{
714
953
  type: i0.Input,
715
954
  args: [{
@@ -753,10 +992,6 @@ i0.ɵɵngDeclareClassMetadata({
753
992
  probe: [{
754
993
  type: i0.ViewChild,
755
994
  args: ["probe", { isSignal: true }]
756
- }],
757
- tooltipEl: [{
758
- type: i0.ViewChild,
759
- args: ["tooltip", { isSignal: true }]
760
995
  }]
761
996
  }
762
997
  });