ngwr 16.3.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 (295) hide show
  1. package/carousel/styles/_index.scss +53 -1
  2. package/charts/bar-chart/styles/_index.scss +494 -305
  3. package/charts/boxplot-chart/styles/_index.scss +114 -48
  4. package/charts/bullet-chart/styles/_index.scss +113 -42
  5. package/charts/calendar-heatmap/styles/_index.scss +111 -20
  6. package/charts/candlestick-chart/styles/_index.scss +61 -26
  7. package/charts/chart-legend/styles/_index.scss +119 -1
  8. package/charts/core/styles/_index.scss +201 -5
  9. package/charts/donut-chart/styles/_index.scss +76 -21
  10. package/charts/funnel-chart/styles/_index.scss +66 -38
  11. package/charts/gauge/styles/_index.scss +12 -1
  12. package/charts/heatmap-chart/styles/_index.scss +90 -53
  13. package/charts/line-chart/styles/_index.scss +143 -139
  14. package/charts/meter-group/styles/_index.scss +87 -25
  15. package/charts/radar-chart/styles/_index.scss +82 -40
  16. package/charts/scatter-chart/styles/_index.scss +117 -44
  17. package/charts/sparkline/styles/_index.scss +7 -1
  18. package/charts/treemap-chart/styles/_index.scss +94 -42
  19. package/charts/waterfall-chart/styles/_index.scss +150 -87
  20. package/color-picker/styles/_index.scss +7 -3
  21. package/copy-value/styles/_index.scss +21 -2
  22. package/date-stamp/styles/_index.scss +2 -1
  23. package/dialog/styles/_index.scss +6 -0
  24. package/drawer/styles/_index.scss +5 -1
  25. package/fesm2022/ngwr-breadcrumbs.mjs +2 -2
  26. package/fesm2022/ngwr-breadcrumbs.mjs.map +1 -1
  27. package/fesm2022/ngwr-carousel-testing.mjs +27 -1
  28. package/fesm2022/ngwr-carousel-testing.mjs.map +1 -1
  29. package/fesm2022/ngwr-carousel.mjs +86 -4
  30. package/fesm2022/ngwr-carousel.mjs.map +1 -1
  31. package/fesm2022/ngwr-cascader-testing.mjs.map +1 -1
  32. package/fesm2022/ngwr-cascader.mjs +56 -25
  33. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  34. package/fesm2022/ngwr-charts-bar-chart-testing.mjs +16 -14
  35. package/fesm2022/ngwr-charts-bar-chart-testing.mjs.map +1 -1
  36. package/fesm2022/ngwr-charts-bar-chart.mjs +399 -141
  37. package/fesm2022/ngwr-charts-bar-chart.mjs.map +1 -1
  38. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs +19 -5
  39. package/fesm2022/ngwr-charts-boxplot-chart-testing.mjs.map +1 -1
  40. package/fesm2022/ngwr-charts-boxplot-chart.mjs +250 -56
  41. package/fesm2022/ngwr-charts-boxplot-chart.mjs.map +1 -1
  42. package/fesm2022/ngwr-charts-bullet-chart.mjs +118 -18
  43. package/fesm2022/ngwr-charts-bullet-chart.mjs.map +1 -1
  44. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +266 -46
  45. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  46. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs +21 -10
  47. package/fesm2022/ngwr-charts-candlestick-chart-testing.mjs.map +1 -1
  48. package/fesm2022/ngwr-charts-candlestick-chart.mjs +319 -72
  49. package/fesm2022/ngwr-charts-candlestick-chart.mjs.map +1 -1
  50. package/fesm2022/ngwr-charts-chart-legend.mjs +211 -9
  51. package/fesm2022/ngwr-charts-chart-legend.mjs.map +1 -1
  52. package/fesm2022/ngwr-charts-core.mjs +299 -18
  53. package/fesm2022/ngwr-charts-core.mjs.map +1 -1
  54. package/fesm2022/ngwr-charts-donut-chart-testing.mjs.map +1 -1
  55. package/fesm2022/ngwr-charts-donut-chart.mjs +206 -27
  56. package/fesm2022/ngwr-charts-donut-chart.mjs.map +1 -1
  57. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs +4 -4
  58. package/fesm2022/ngwr-charts-funnel-chart-testing.mjs.map +1 -1
  59. package/fesm2022/ngwr-charts-funnel-chart.mjs +113 -10
  60. package/fesm2022/ngwr-charts-funnel-chart.mjs.map +1 -1
  61. package/fesm2022/ngwr-charts-gauge-testing.mjs.map +1 -1
  62. package/fesm2022/ngwr-charts-gauge.mjs +98 -12
  63. package/fesm2022/ngwr-charts-gauge.mjs.map +1 -1
  64. package/fesm2022/ngwr-charts-heatmap-chart.mjs +226 -31
  65. package/fesm2022/ngwr-charts-heatmap-chart.mjs.map +1 -1
  66. package/fesm2022/ngwr-charts-line-chart-testing.mjs +16 -4
  67. package/fesm2022/ngwr-charts-line-chart-testing.mjs.map +1 -1
  68. package/fesm2022/ngwr-charts-line-chart.mjs +407 -172
  69. package/fesm2022/ngwr-charts-line-chart.mjs.map +1 -1
  70. package/fesm2022/ngwr-charts-meter-group-testing.mjs +4 -4
  71. package/fesm2022/ngwr-charts-meter-group-testing.mjs.map +1 -1
  72. package/fesm2022/ngwr-charts-meter-group.mjs +223 -31
  73. package/fesm2022/ngwr-charts-meter-group.mjs.map +1 -1
  74. package/fesm2022/ngwr-charts-radar-chart-testing.mjs +2 -1
  75. package/fesm2022/ngwr-charts-radar-chart-testing.mjs.map +1 -1
  76. package/fesm2022/ngwr-charts-radar-chart.mjs +255 -66
  77. package/fesm2022/ngwr-charts-radar-chart.mjs.map +1 -1
  78. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs +39 -18
  79. package/fesm2022/ngwr-charts-scatter-chart-testing.mjs.map +1 -1
  80. package/fesm2022/ngwr-charts-scatter-chart.mjs +431 -53
  81. package/fesm2022/ngwr-charts-scatter-chart.mjs.map +1 -1
  82. package/fesm2022/ngwr-charts-sparkline.mjs +19 -8
  83. package/fesm2022/ngwr-charts-sparkline.mjs.map +1 -1
  84. package/fesm2022/ngwr-charts-treemap-chart.mjs +253 -44
  85. package/fesm2022/ngwr-charts-treemap-chart.mjs.map +1 -1
  86. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs +15 -7
  87. package/fesm2022/ngwr-charts-waterfall-chart-testing.mjs.map +1 -1
  88. package/fesm2022/ngwr-charts-waterfall-chart.mjs +151 -23
  89. package/fesm2022/ngwr-charts-waterfall-chart.mjs.map +1 -1
  90. package/fesm2022/ngwr-color-picker.mjs +44 -4
  91. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  92. package/fesm2022/ngwr-context-menu-testing.mjs.map +1 -1
  93. package/fesm2022/ngwr-context-menu.mjs +60 -17
  94. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  95. package/fesm2022/ngwr-copy-value-testing.mjs +5 -1
  96. package/fesm2022/ngwr-copy-value-testing.mjs.map +1 -1
  97. package/fesm2022/ngwr-copy-value.mjs +38 -2
  98. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  99. package/fesm2022/ngwr-date-picker.mjs +56 -8
  100. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  101. package/fesm2022/ngwr-dialog.mjs +13 -5
  102. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  103. package/fesm2022/ngwr-drawer.mjs +19 -3
  104. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  105. package/fesm2022/ngwr-dropdown-testing.mjs.map +1 -1
  106. package/fesm2022/ngwr-dropdown.mjs +49 -6
  107. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  108. package/fesm2022/ngwr-editor.mjs +1 -0
  109. package/fesm2022/ngwr-editor.mjs.map +1 -1
  110. package/fesm2022/ngwr-file-upload.mjs +7 -3
  111. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  112. package/fesm2022/ngwr-graph-testing.mjs +27 -0
  113. package/fesm2022/ngwr-graph-testing.mjs.map +1 -1
  114. package/fesm2022/ngwr-graph.mjs +643 -14
  115. package/fesm2022/ngwr-graph.mjs.map +1 -1
  116. package/fesm2022/ngwr-i18n-ar.mjs +13 -4
  117. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  118. package/fesm2022/ngwr-i18n-cs.mjs +13 -4
  119. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  120. package/fesm2022/ngwr-i18n-de.mjs +13 -4
  121. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  122. package/fesm2022/ngwr-i18n-en.mjs +13 -4
  123. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  124. package/fesm2022/ngwr-i18n-es.mjs +13 -4
  125. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  126. package/fesm2022/ngwr-i18n-fr.mjs +13 -4
  127. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  128. package/fesm2022/ngwr-i18n-he.mjs +13 -4
  129. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  130. package/fesm2022/ngwr-i18n-hi.mjs +13 -4
  131. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  132. package/fesm2022/ngwr-i18n-id.mjs +13 -4
  133. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  134. package/fesm2022/ngwr-i18n-it.mjs +13 -4
  135. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  136. package/fesm2022/ngwr-i18n-ja.mjs +13 -4
  137. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  138. package/fesm2022/ngwr-i18n-ko.mjs +13 -4
  139. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  140. package/fesm2022/ngwr-i18n-nl.mjs +13 -4
  141. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  142. package/fesm2022/ngwr-i18n-pl.mjs +13 -4
  143. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  144. package/fesm2022/ngwr-i18n-pt.mjs +13 -4
  145. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  146. package/fesm2022/ngwr-i18n-ru.mjs +13 -4
  147. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  148. package/fesm2022/ngwr-i18n-sv.mjs +13 -4
  149. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  150. package/fesm2022/ngwr-i18n-tr.mjs +13 -4
  151. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  152. package/fesm2022/ngwr-i18n-uk.mjs +13 -4
  153. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  154. package/fesm2022/ngwr-i18n-vi.mjs +13 -4
  155. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  156. package/fesm2022/ngwr-i18n-zh-tw.mjs +13 -4
  157. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  158. package/fesm2022/ngwr-i18n-zh.mjs +13 -4
  159. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  160. package/fesm2022/ngwr-lightbox.mjs +22 -5
  161. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  162. package/fesm2022/ngwr-list.mjs +2 -2
  163. package/fesm2022/ngwr-list.mjs.map +1 -1
  164. package/fesm2022/ngwr-overlay.mjs +21 -2
  165. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  166. package/fesm2022/ngwr-pagination.mjs +1 -0
  167. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  168. package/fesm2022/ngwr-popconfirm-testing.mjs +4 -1
  169. package/fesm2022/ngwr-popconfirm-testing.mjs.map +1 -1
  170. package/fesm2022/ngwr-popconfirm.mjs +41 -5
  171. package/fesm2022/ngwr-popconfirm.mjs.map +1 -1
  172. package/fesm2022/ngwr-popover.mjs +67 -12
  173. package/fesm2022/ngwr-popover.mjs.map +1 -1
  174. package/fesm2022/ngwr-schema-form.mjs +3 -0
  175. package/fesm2022/ngwr-schema-form.mjs.map +1 -1
  176. package/fesm2022/ngwr-select.mjs +100 -3
  177. package/fesm2022/ngwr-select.mjs.map +1 -1
  178. package/fesm2022/ngwr-sortable-list.mjs +2 -2
  179. package/fesm2022/ngwr-sortable-list.mjs.map +1 -1
  180. package/fesm2022/ngwr-table-testing.mjs +71 -3
  181. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  182. package/fesm2022/ngwr-table.mjs +173 -11
  183. package/fesm2022/ngwr-table.mjs.map +1 -1
  184. package/fesm2022/ngwr-tour-testing.mjs +13 -1
  185. package/fesm2022/ngwr-tour-testing.mjs.map +1 -1
  186. package/fesm2022/ngwr-tour.mjs +25 -16
  187. package/fesm2022/ngwr-tour.mjs.map +1 -1
  188. package/fesm2022/ngwr-tree-testing.mjs.map +1 -1
  189. package/fesm2022/ngwr-tree.mjs +52 -8
  190. package/fesm2022/ngwr-tree.mjs.map +1 -1
  191. package/fesm2022/ngwr-utils.mjs +64 -1
  192. package/fesm2022/ngwr-utils.mjs.map +1 -1
  193. package/fesm2022/ngwr-version.mjs +1 -1
  194. package/fesm2022/ngwr-version.mjs.map +1 -1
  195. package/fesm2022/ngwr-window.mjs +16 -9
  196. package/fesm2022/ngwr-window.mjs.map +1 -1
  197. package/graph/styles/_index.scss +87 -0
  198. package/i18n/ar.json +13 -4
  199. package/i18n/cs.json +13 -4
  200. package/i18n/de.json +13 -4
  201. package/i18n/en.json +13 -4
  202. package/i18n/es.json +13 -4
  203. package/i18n/fr.json +13 -4
  204. package/i18n/he.json +13 -4
  205. package/i18n/hi.json +13 -4
  206. package/i18n/id.json +13 -4
  207. package/i18n/it.json +13 -4
  208. package/i18n/ja.json +13 -4
  209. package/i18n/ko.json +13 -4
  210. package/i18n/nl.json +13 -4
  211. package/i18n/pl.json +13 -4
  212. package/i18n/pt.json +13 -4
  213. package/i18n/ru.json +13 -4
  214. package/i18n/sv.json +13 -4
  215. package/i18n/tr.json +13 -4
  216. package/i18n/uk.json +13 -4
  217. package/i18n/vi.json +13 -4
  218. package/i18n/zh-TW.json +13 -4
  219. package/i18n/zh.json +13 -4
  220. package/llms-full.txt +12 -12
  221. package/llms.txt +64 -27
  222. package/package.json +1 -1
  223. package/popconfirm/styles/_index.scss +6 -0
  224. package/popover/styles/_index.scss +24 -13
  225. package/schematics/collection.json +5 -0
  226. package/schematics/eject/index.js +158 -0
  227. package/schematics/eject/schema.js +8 -0
  228. package/schematics/eject/schema.json +24 -0
  229. package/schematics/eject/source.js +295 -0
  230. package/schematics/use/symbol-map.json +2 -0
  231. package/select/styles/_index.scss +13 -0
  232. package/skills/ngwr/SKILL.md +30 -3
  233. package/skills/ngwr/references/catalog.md +2 -2
  234. package/table/styles/_index.scss +24 -0
  235. package/theme/styles/_focus.scss +11 -1
  236. package/tour/styles/_index.scss +6 -0
  237. package/types/ngwr-carousel-testing.d.ts +29 -6
  238. package/types/ngwr-carousel.d.ts +52 -5
  239. package/types/ngwr-cascader-testing.d.ts +4 -3
  240. package/types/ngwr-cascader.d.ts +29 -7
  241. package/types/ngwr-charts-bar-chart-testing.d.ts +15 -13
  242. package/types/ngwr-charts-bar-chart.d.ts +220 -48
  243. package/types/ngwr-charts-boxplot-chart-testing.d.ts +9 -2
  244. package/types/ngwr-charts-boxplot-chart.d.ts +110 -19
  245. package/types/ngwr-charts-bullet-chart.d.ts +72 -12
  246. package/types/ngwr-charts-calendar-heatmap.d.ts +119 -15
  247. package/types/ngwr-charts-candlestick-chart-testing.d.ts +19 -9
  248. package/types/ngwr-charts-candlestick-chart.d.ts +195 -62
  249. package/types/ngwr-charts-chart-legend.d.ts +142 -5
  250. package/types/ngwr-charts-core.d.ts +259 -21
  251. package/types/ngwr-charts-donut-chart-testing.d.ts +11 -5
  252. package/types/ngwr-charts-donut-chart.d.ts +124 -16
  253. package/types/ngwr-charts-funnel-chart.d.ts +62 -6
  254. package/types/ngwr-charts-gauge-testing.d.ts +5 -1
  255. package/types/ngwr-charts-gauge.d.ts +72 -10
  256. package/types/ngwr-charts-heatmap-chart.d.ts +103 -20
  257. package/types/ngwr-charts-line-chart-testing.d.ts +16 -2
  258. package/types/ngwr-charts-line-chart.d.ts +215 -86
  259. package/types/ngwr-charts-meter-group.d.ts +96 -7
  260. package/types/ngwr-charts-radar-chart-testing.d.ts +14 -3
  261. package/types/ngwr-charts-radar-chart.d.ts +148 -28
  262. package/types/ngwr-charts-scatter-chart-testing.d.ts +22 -10
  263. package/types/ngwr-charts-scatter-chart.d.ts +188 -18
  264. package/types/ngwr-charts-sparkline.d.ts +26 -4
  265. package/types/ngwr-charts-treemap-chart.d.ts +121 -23
  266. package/types/ngwr-charts-waterfall-chart-testing.d.ts +8 -1
  267. package/types/ngwr-charts-waterfall-chart.d.ts +108 -21
  268. package/types/ngwr-color-picker.d.ts +27 -0
  269. package/types/ngwr-context-menu-testing.d.ts +10 -9
  270. package/types/ngwr-context-menu.d.ts +19 -0
  271. package/types/ngwr-copy-value.d.ts +8 -0
  272. package/types/ngwr-date-picker.d.ts +34 -2
  273. package/types/ngwr-dialog.d.ts +30 -10
  274. package/types/ngwr-drawer.d.ts +32 -1
  275. package/types/ngwr-dropdown-testing.d.ts +8 -5
  276. package/types/ngwr-dropdown.d.ts +31 -6
  277. package/types/ngwr-file-upload.d.ts +8 -2
  278. package/types/ngwr-graph-testing.d.ts +28 -0
  279. package/types/ngwr-graph.d.ts +263 -91
  280. package/types/ngwr-lightbox.d.ts +15 -0
  281. package/types/ngwr-overlay.d.ts +16 -1
  282. package/types/ngwr-popconfirm-testing.d.ts +11 -2
  283. package/types/ngwr-popconfirm.d.ts +28 -1
  284. package/types/ngwr-popover.d.ts +59 -9
  285. package/types/ngwr-select.d.ts +37 -0
  286. package/types/ngwr-table-testing.d.ts +52 -1
  287. package/types/ngwr-table.d.ts +102 -10
  288. package/types/ngwr-tour-testing.d.ts +10 -0
  289. package/types/ngwr-tour.d.ts +32 -4
  290. package/types/ngwr-tree-testing.d.ts +1 -2
  291. package/types/ngwr-tree.d.ts +35 -2
  292. package/types/ngwr-utils.d.ts +79 -1
  293. package/types/ngwr-version.d.ts +1 -1
  294. package/types/ngwr-window.d.ts +14 -11
  295. package/window/styles/_index.scss +5 -10
@@ -4,8 +4,76 @@ import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coerci
4
4
  import { isPlatformBrowser } from "@angular/common";
5
5
  import { wrCheckStyles, wrClamp } from "ngwr/utils";
6
6
  import { useI18nText, wrReadI18nText } from "ngwr/i18n";
7
- import { WrChartTable, useChartNumbers, wrChartAxis } from "ngwr/charts/core";
8
- import { useChartTooltip } from "ngwr/popover";
7
+ import { WrChartState, WrChartTable, useChartNumbers, useChartSize, useChartState, wrChartAxis, wrChartLongest, wrChartRound } from "ngwr/charts/core";
8
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
9
+ /**
10
+ * @license
11
+ *
12
+ * Use of this source code is governed by an MIT-style license that can be
13
+ * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
14
+ */
15
+ const DENSITY = 2;
16
+ const COLUMN = 2;
17
+ function drawable(d) {
18
+ return Number.isFinite(d.open) && Number.isFinite(d.high) && Number.isFinite(d.low) && Number.isFinite(d.close);
19
+ }
20
+ function fractionDigits(value) {
21
+ const [mantissa, exponent = "0"] = Math.abs(value).toString().split("e");
22
+ return Math.max(0, (mantissa.split(".")[1]?.length ?? 0) - Number(exponent));
23
+ }
24
+ function wrCandlestickPer(count, width) {
25
+ if (!(width > 0) || count <= width * DENSITY) return 1;
26
+ return Math.ceil(count / Math.max(1, Math.floor(width / COLUMN)));
27
+ }
28
+ function wrCandlestickMerge(data, per) {
29
+ const size = per > 1 ? Math.floor(per) : 1;
30
+ const merged = [];
31
+ for (let start = 0; start < data.length; start += size) {
32
+ const end = Math.min(data.length, start + size);
33
+ let open = NaN;
34
+ let close = NaN;
35
+ let high = Number.NEGATIVE_INFINITY;
36
+ let low = Number.POSITIVE_INFINITY;
37
+ let found = false;
38
+ for (let i = start; i < end; i++) {
39
+ const d = data[i];
40
+ if (!drawable(d)) continue;
41
+ if (!found) {
42
+ open = d.open;
43
+ found = true;
44
+ }
45
+ close = d.close;
46
+ if (d.high > high) high = d.high;
47
+ if (d.low < low) low = d.low;
48
+ }
49
+ if (found) merged.push({
50
+ start,
51
+ end,
52
+ open,
53
+ high,
54
+ low,
55
+ close
56
+ });
57
+ }
58
+ return merged;
59
+ }
60
+ function wrCandlestickDigits(data, least, most) {
61
+ let digits = Math.min(Math.max(0, least), most);
62
+ let factor = 10 ** digits;
63
+ const read = (price) => {
64
+ if (!Number.isFinite(price) || Math.round(price * factor) / factor === price) return;
65
+ digits = Math.min(most, Math.max(digits, fractionDigits(price)));
66
+ factor = 10 ** digits;
67
+ };
68
+ for (const d of data) {
69
+ if (digits >= most) return most;
70
+ read(d.open);
71
+ read(d.high);
72
+ read(d.low);
73
+ read(d.close);
74
+ }
75
+ return digits;
76
+ }
9
77
  /**
10
78
  * @license
11
79
  *
@@ -18,12 +86,11 @@ const BODY_MAX = 24;
18
86
  const DENSE_BELOW = 4;
19
87
  const CHAR_WIDTH = 7;
20
88
  const LABEL_GAP = 12;
21
- const percent = (value) => Math.round(value * 1e3) / 1e3;
89
+ const PROBES = 3;
90
+ const percent = (value) => wrChartRound(value, 3);
91
+ const INCREASE = "wr-candlestick-chart__candle wr-candlestick-chart__candle--increase";
92
+ const DECREASE = "wr-candlestick-chart__candle wr-candlestick-chart__candle--decrease";
22
93
  const MAX_PRICE_DIGITS = 10;
23
- function fractionDigits(value) {
24
- const [mantissa, exponent = "0"] = Math.abs(value).toString().split("e");
25
- return Math.max(0, (mantissa.split(".")[1]?.length ?? 0) - Number(exponent));
26
- }
27
94
  var WrCandlestickChart = class WrCandlestickChart {
28
95
  data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
29
96
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
@@ -40,9 +107,32 @@ var WrCandlestickChart = class WrCandlestickChart {
40
107
  ...ngDevMode ? { debugName: "showGrid" } : /* istanbul ignore next */ {},
41
108
  transform: coerceBooleanProperty
42
109
  });
110
+ showAxis = input(true, {
111
+ ...ngDevMode ? { debugName: "showAxis" } : /* istanbul ignore next */ {},
112
+ transform: coerceBooleanProperty
113
+ });
114
+ hollow = input(false, {
115
+ ...ngDevMode ? { debugName: "hollow" } : /* istanbul ignore next */ {},
116
+ transform: coerceBooleanProperty
117
+ });
118
+ decimate = input(true, {
119
+ ...ngDevMode ? { debugName: "decimate" } : /* istanbul ignore next */ {},
120
+ transform: coerceBooleanProperty
121
+ });
122
+ loading = input(false, {
123
+ ...ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {},
124
+ transform: coerceBooleanProperty
125
+ });
126
+ error = input(false, {
127
+ ...ngDevMode ? { debugName: "error" } : /* istanbul ignore next */ {},
128
+ transform: coerceBooleanProperty
129
+ });
130
+ emptyLabel = input(null, ...ngDevMode ? [{ debugName: "emptyLabel" }] : /* istanbul ignore next */ []);
131
+ loadingLabel = input(null, ...ngDevMode ? [{ debugName: "loadingLabel" }] : /* istanbul ignore next */ []);
132
+ errorLabel = input(null, ...ngDevMode ? [{ debugName: "errorLabel" }] : /* istanbul ignore next */ []);
43
133
  tooltip = input(true, {
44
134
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
45
- transform: coerceBooleanProperty
135
+ transform: wrCoerceChartTooltip
46
136
  });
47
137
  dataTable = input(false, {
48
138
  ...ngDevMode ? { debugName: "dataTable" } : /* istanbul ignore next */ {},
@@ -57,30 +147,39 @@ var WrCandlestickChart = class WrCandlestickChart {
57
147
  probe = viewChild("probe", ...ngDevMode ? [{ debugName: "probe" }] : /* istanbul ignore next */ []);
58
148
  candleEls = viewChildren("candleEl", ...ngDevMode ? [{ debugName: "candleEls" }] : /* istanbul ignore next */ []);
59
149
  measured = signal(null, ...ngDevMode ? [{ debugName: "measured" }] : /* istanbul ignore next */ []);
150
+ drawingSize = useChartSize(this.drawing);
60
151
  constructor() {
61
152
  if (typeof ngDevMode === "undefined" || ngDevMode) wrCheckStyles("charts/candlestick-chart");
62
153
  if (!isPlatformBrowser(inject(PLATFORM_ID))) return;
63
154
  const destroyRef = inject(DestroyRef);
64
155
  afterRenderEffect(() => {
65
- this.candles();
66
- this.probeText();
156
+ this.probes();
157
+ this.drawnSlots();
158
+ this.drawingSize();
67
159
  untracked(() => this.measure());
68
160
  });
69
161
  afterNextRender(() => {
70
- const drawing = this.drawing()?.nativeElement;
71
- if (!drawing || typeof ResizeObserver === "undefined") return;
72
- const observer = new ResizeObserver(() => this.measure());
73
- observer.observe(drawing);
74
- destroyRef.onDestroy(() => observer.disconnect());
162
+ const plot = this.plot()?.nativeElement;
163
+ if (!plot) return;
164
+ const move = (event) => this.onPointerMove(event);
165
+ const leave = (event) => this.tip.leave(event);
166
+ plot.addEventListener("mousemove", move);
167
+ plot.addEventListener("mouseleave", leave);
168
+ destroyRef.onDestroy(() => {
169
+ plot.removeEventListener("mousemove", move);
170
+ plot.removeEventListener("mouseleave", leave);
171
+ });
75
172
  });
76
173
  }
77
174
  slots = computed(() => this.data().length, ...ngDevMode ? [{ debugName: "slots" }] : /* istanbul ignore next */ []);
78
- slot = computed(() => this.slots() === 0 ? 100 : percent(100 / this.slots()), ...ngDevMode ? [{ debugName: "slot" }] : /* istanbul ignore next */ []);
175
+ per = computed(() => this.decimate() ? wrCandlestickPer(this.slots(), this.measured()?.width ?? ASSUMED_WIDTH) : 1, ...ngDevMode ? [{ debugName: "per" }] : /* istanbul ignore next */ []);
176
+ merged = computed(() => wrCandlestickMerge(this.data(), this.per()), ...ngDevMode ? [{ debugName: "merged" }] : /* istanbul ignore next */ []);
177
+ drawnSlots = computed(() => Math.ceil(this.slots() / this.per()), ...ngDevMode ? [{ debugName: "drawnSlots" }] : /* istanbul ignore next */ []);
178
+ slot = computed(() => this.slots() === 0 ? 100 : percent(100 * this.per() / this.slots()), ...ngDevMode ? [{ debugName: "slot" }] : /* istanbul ignore next */ []);
79
179
  axis = computed(() => {
80
180
  let lo = Number.POSITIVE_INFINITY;
81
181
  let hi = Number.NEGATIVE_INFINITY;
82
- for (const d of this.data()) {
83
- if (!WrCandlestickChart.drawable(d)) continue;
182
+ for (const d of this.merged()) {
84
183
  lo = Math.min(lo, d.low, d.open, d.close);
85
184
  hi = Math.max(hi, d.high, d.open, d.close);
86
185
  }
@@ -89,47 +188,53 @@ var WrCandlestickChart = class WrCandlestickChart {
89
188
  candles = computed(() => {
90
189
  const { min, max } = this.axis();
91
190
  const slots = this.slots();
92
- const y = (value) => (max - value) / (max - min) * 100;
93
- return this.data().flatMap((d, index) => {
94
- if (!WrCandlestickChart.drawable(d)) return [];
191
+ const range = max - min;
192
+ return this.merged().map((d) => {
95
193
  const top = Math.max(d.high, d.open, d.close);
96
194
  const bottom = Math.min(d.low, d.open, d.close);
97
195
  const span = top - bottom;
98
- const share = (value) => span > 0 ? percent(value / span * 100) : 0;
99
- return [{
100
- index,
101
- label: d.label,
102
- open: d.open,
103
- high: d.high,
104
- low: d.low,
105
- close: d.close,
106
- increase: d.close >= d.open,
107
- left: percent((index + .5) / slots * 100),
108
- top: percent(y(top)),
109
- height: percent(y(bottom) - y(top)),
110
- upper: share(top - Math.max(d.open, d.close)),
111
- lower: share(Math.min(d.open, d.close) - bottom)
112
- }];
196
+ const y = (max - top) / range * 100;
197
+ return {
198
+ index: d.start,
199
+ classes: d.close >= d.open ? INCREASE : DECREASE,
200
+ figures: `${d.start} ${d.open} ${d.high} ${d.low} ${d.close}`,
201
+ left: percent((d.start + d.end) / 2 / slots * 100),
202
+ top: percent(y),
203
+ height: percent((max - bottom) / range * 100 - y),
204
+ upper: span > 0 ? percent((top - Math.max(d.open, d.close)) / span * 100) : 0,
205
+ lower: span > 0 ? percent((Math.min(d.open, d.close) - bottom) / span * 100) : 0
206
+ };
113
207
  });
114
208
  }, ...ngDevMode ? [{ debugName: "candles" }] : /* istanbul ignore next */ []);
115
- positions = computed(() => new Map(this.candles().map((candle, position) => [candle.index, position])), ...ngDevMode ? [{ debugName: "positions" }] : /* istanbul ignore next */ []);
116
- slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()), ...ngDevMode ? [{ debugName: "slotPx" }] : /* istanbul ignore next */ []);
209
+ positions = computed(() => {
210
+ const per = this.per();
211
+ const positions = new Int32Array(this.drawnSlots()).fill(-1);
212
+ this.merged().forEach((candle, position) => positions[Math.floor(candle.start / per)] = position);
213
+ return positions;
214
+ }, ...ngDevMode ? [{ debugName: "positions" }] : /* istanbul ignore next */ []);
215
+ drawnAt(index) {
216
+ const d = this.data()[index];
217
+ if (!d || !WrCandlestickChart.drawable(d)) return -1;
218
+ return this.positions()[Math.floor(index / this.per())] ?? -1;
219
+ }
220
+ slotPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.drawnSlots()), ...ngDevMode ? [{ debugName: "slotPx" }] : /* istanbul ignore next */ []);
221
+ periodPx = computed(() => (this.measured()?.width ?? ASSUMED_WIDTH) / Math.max(1, this.slots()), ...ngDevMode ? [{ debugName: "periodPx" }] : /* istanbul ignore next */ []);
117
222
  dense = computed(() => {
118
223
  if (this.candles().length === 0) return false;
119
224
  const measured = this.measured()?.body ?? 0;
120
225
  return (measured > 0 ? measured : wrClamp(this.slotPx() * BODY_SHARE, 1, BODY_MAX)) < DENSE_BELOW;
121
226
  }, ...ngDevMode ? [{ debugName: "dense" }] : /* istanbul ignore next */ []);
122
227
  longestLabel = computed(() => this.data().reduce((longest, d) => d.label.length > longest.length ? d.label : longest, ""), ...ngDevMode ? [{ debugName: "longestLabel" }] : /* istanbul ignore next */ []);
123
- probeText = computed(() => [...new Set(this.data().map((d) => d.label.replace(/\r\n?|\n/g, " ")))].join("\n"), ...ngDevMode ? [{ debugName: "probeText" }] : /* istanbul ignore next */ []);
228
+ probes = computed(() => wrChartLongest(this.data().map((d) => d.label.replace(/\r\n?|\n/g, " ")), PROBES).join("\n"), ...ngDevMode ? [{ debugName: "probes" }] : /* istanbul ignore next */ []);
124
229
  labelPx = computed(() => {
125
230
  const measured = this.measured()?.label ?? 0;
126
231
  return measured > 0 ? measured : this.longestLabel().length * CHAR_WIDTH;
127
232
  }, ...ngDevMode ? [{ debugName: "labelPx" }] : /* istanbul ignore next */ []);
128
- labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.slotPx())), ...ngDevMode ? [{ debugName: "labelEvery" }] : /* istanbul ignore next */ []);
233
+ labelEvery = computed(() => Math.max(1, Math.ceil((this.labelPx() + LABEL_GAP) / this.periodPx())), ...ngDevMode ? [{ debugName: "labelEvery" }] : /* istanbul ignore next */ []);
129
234
  xLabels = computed(() => {
130
235
  const every = this.labelEvery();
131
236
  const slots = this.slots();
132
- const slotPx = this.slotPx();
237
+ const slotPx = this.periodPx();
133
238
  const width = slotPx * slots;
134
239
  const label = Math.min(this.labelPx(), width);
135
240
  const data = this.data();
@@ -150,34 +255,34 @@ var WrCandlestickChart = class WrCandlestickChart {
150
255
  }
151
256
  return labels;
152
257
  }, ...ngDevMode ? [{ debugName: "xLabels" }] : /* istanbul ignore next */ []);
153
- xSlot = computed(() => Math.min(100, percent(this.slot() * this.labelEvery())), ...ngDevMode ? [{ debugName: "xSlot" }] : /* istanbul ignore next */ []);
258
+ xSlot = computed(() => Math.min(100, percent((this.slots() === 0 ? 100 : percent(100 / this.slots())) * this.labelEvery())), ...ngDevMode ? [{ debugName: "xSlot" }] : /* istanbul ignore next */ []);
154
259
  yTicks = computed(() => {
155
260
  const { min, max, step, ticks } = this.axis();
156
- const labels = this.numbers.ticks(ticks, step);
261
+ const labels = this.showAxis() ? this.numbers.ticks(ticks, step) : [];
157
262
  return ticks.map((value, i) => ({
158
- label: labels[i],
159
- top: percent((max - value) / (max - min) * 100)
263
+ label: labels[i] ?? "",
264
+ top: percent((max - value) / (max - min) * 100),
265
+ zero: value === 0
160
266
  }));
161
267
  }, ...ngDevMode ? [{ debugName: "yTicks" }] : /* istanbul ignore next */ []);
162
- priceDigits = computed(() => {
163
- let digits = fractionDigits(this.axis().step);
164
- for (const d of this.data()) for (const price of [
165
- d.open,
166
- d.high,
167
- d.low,
168
- d.close
169
- ]) if (Number.isFinite(price)) digits = Math.max(digits, fractionDigits(price));
170
- return Math.min(digits, MAX_PRICE_DIGITS);
171
- }, ...ngDevMode ? [{ debugName: "priceDigits" }] : /* istanbul ignore next */ []);
268
+ stepDigits = computed(() => {
269
+ const step = this.axis().step;
270
+ return wrCandlestickDigits([{
271
+ open: step,
272
+ high: step,
273
+ low: step,
274
+ close: step
275
+ }], 0, MAX_PRICE_DIGITS);
276
+ }, ...ngDevMode ? [{ debugName: "stepDigits" }] : /* istanbul ignore next */ []);
277
+ priceDigits = computed(() => wrCandlestickDigits(this.data(), this.stepDigits(), MAX_PRICE_DIGITS), ...ngDevMode ? [{ debugName: "priceDigits" }] : /* istanbul ignore next */ []);
172
278
  price(value) {
173
279
  return this.numbers.exact(value, this.priceDigits());
174
280
  }
175
281
  tip = useChartTooltip(this.tooltip, (index) => {
176
- const position = this.positions().get(index);
177
- if (position === void 0) return null;
178
- const candle = this.candles()[position];
282
+ const position = this.drawnAt(index);
283
+ const candle = this.data()[index];
179
284
  const anchor = this.candleEls()[position]?.nativeElement;
180
- if (!candle || !anchor) return null;
285
+ if (position < 0 || !candle || !anchor || this.state()) return null;
181
286
  return {
182
287
  datum: {
183
288
  label: candle.label,
@@ -206,8 +311,19 @@ var WrCandlestickChart = class WrCandlestickChart {
206
311
  }, (x, y) => this.slotAt(x, y));
207
312
  activeSlot = computed(() => {
208
313
  const index = this.tip.active();
209
- return index === null ? null : { left: percent(index / Math.max(1, this.slots()) * 100) };
314
+ if (index === null) return null;
315
+ const per = this.per();
316
+ return { left: percent(Math.floor(index / per) * per / Math.max(1, this.slots()) * 100) };
210
317
  }, ...ngDevMode ? [{ debugName: "activeSlot" }] : /* istanbul ignore next */ []);
318
+ empty = computed(() => this.merged().length === 0, ...ngDevMode ? [{ debugName: "empty" }] : /* istanbul ignore next */ []);
319
+ state = useChartState({
320
+ loading: this.loading,
321
+ error: this.error,
322
+ empty: this.empty,
323
+ emptyLabel: this.emptyLabel,
324
+ loadingLabel: this.loadingLabel,
325
+ errorLabel: this.errorLabel
326
+ });
211
327
  tableData = computed(() => {
212
328
  const cell = (value) => Number.isFinite(value) ? this.price(value) : "";
213
329
  return {
@@ -230,36 +346,38 @@ var WrCandlestickChart = class WrCandlestickChart {
230
346
  };
231
347
  }, ...ngDevMode ? [{ debugName: "tableData" }] : /* istanbul ignore next */ []);
232
348
  onPointerMove(event) {
233
- if (!this.tooltip()) return;
349
+ if (!this.tooltip() || this.tip.active() !== null) return;
234
350
  const index = this.slotAt(event.clientX, event.clientY);
235
351
  if (index === null) this.tip.leave(event);
236
352
  else this.tip.enter(index);
237
353
  }
238
354
  slotAt(clientX, clientY) {
239
355
  const drawing = this.drawing()?.nativeElement;
240
- const plot = this.plot()?.nativeElement;
241
356
  const slots = this.slots();
242
- if (!drawing || !plot || slots === 0) return null;
357
+ if (!drawing || slots === 0 || this.state()) return null;
243
358
  const box = drawing.getBoundingClientRect();
244
- const frame = plot.getBoundingClientRect();
245
359
  if (box.width <= 0 || box.height <= 0) return null;
246
- if (clientX < box.left || clientX > box.right || clientY < frame.top || clientY > frame.bottom) return null;
360
+ const inset = this.measured()?.inset ?? box.top - (this.plot()?.nativeElement.getBoundingClientRect().top ?? box.top);
361
+ if (clientX < box.left || clientX > box.right || clientY < box.top - inset || clientY > box.bottom + inset) return null;
247
362
  const index = wrClamp(Math.floor((clientX - box.left) / box.width * slots), 0, slots - 1);
248
- return this.positions().has(index) ? index : null;
363
+ return this.drawnAt(index) < 0 ? null : index;
249
364
  }
250
365
  measure() {
251
366
  const drawing = this.drawing()?.nativeElement;
252
367
  if (!drawing) return;
253
- const width = drawing.getBoundingClientRect().width;
368
+ const box = drawing.getBoundingClientRect();
369
+ const width = box.width;
254
370
  if (width <= 0) return;
255
371
  const label = this.probe()?.nativeElement.getBoundingClientRect().width ?? 0;
256
372
  const body = this.candleEls()[0]?.nativeElement.getBoundingClientRect().width ?? 0;
373
+ const inset = Math.max(0, box.top - (this.plot()?.nativeElement.getBoundingClientRect().top ?? box.top));
257
374
  const last = this.measured();
258
- if (last?.width === width && last.label === label && last.body === body) return;
375
+ if (last?.width === width && last.label === label && last.body === body && last.inset === inset) return;
259
376
  this.measured.set({
260
377
  width,
261
378
  label,
262
- body
379
+ body,
380
+ inset
263
381
  });
264
382
  }
265
383
  static drawable(d) {
@@ -329,6 +447,62 @@ var WrCandlestickChart = class WrCandlestickChart {
329
447
  isRequired: false,
330
448
  transformFunction: null
331
449
  },
450
+ showAxis: {
451
+ classPropertyName: "showAxis",
452
+ publicName: "showAxis",
453
+ isSignal: true,
454
+ isRequired: false,
455
+ transformFunction: null
456
+ },
457
+ hollow: {
458
+ classPropertyName: "hollow",
459
+ publicName: "hollow",
460
+ isSignal: true,
461
+ isRequired: false,
462
+ transformFunction: null
463
+ },
464
+ decimate: {
465
+ classPropertyName: "decimate",
466
+ publicName: "decimate",
467
+ isSignal: true,
468
+ isRequired: false,
469
+ transformFunction: null
470
+ },
471
+ loading: {
472
+ classPropertyName: "loading",
473
+ publicName: "loading",
474
+ isSignal: true,
475
+ isRequired: false,
476
+ transformFunction: null
477
+ },
478
+ error: {
479
+ classPropertyName: "error",
480
+ publicName: "error",
481
+ isSignal: true,
482
+ isRequired: false,
483
+ transformFunction: null
484
+ },
485
+ emptyLabel: {
486
+ classPropertyName: "emptyLabel",
487
+ publicName: "emptyLabel",
488
+ isSignal: true,
489
+ isRequired: false,
490
+ transformFunction: null
491
+ },
492
+ loadingLabel: {
493
+ classPropertyName: "loadingLabel",
494
+ publicName: "loadingLabel",
495
+ isSignal: true,
496
+ isRequired: false,
497
+ transformFunction: null
498
+ },
499
+ errorLabel: {
500
+ classPropertyName: "errorLabel",
501
+ publicName: "errorLabel",
502
+ isSignal: true,
503
+ isRequired: false,
504
+ transformFunction: null
505
+ },
332
506
  tooltip: {
333
507
  classPropertyName: "tooltip",
334
508
  publicName: "tooltip",
@@ -346,6 +520,8 @@ var WrCandlestickChart = class WrCandlestickChart {
346
520
  },
347
521
  host: {
348
522
  properties: {
523
+ "class.wr-candlestick-chart--axis": "showAxis()",
524
+ "class.wr-candlestick-chart--hollow": "hollow()",
349
525
  "class.wr-candlestick-chart--dense": "dense()",
350
526
  "style.--wr-candlestick-chart-input-increase-color": "increaseColor()",
351
527
  "style.--wr-candlestick-chart-input-decrease-color": "decreaseColor()"
@@ -382,8 +558,13 @@ var WrCandlestickChart = class WrCandlestickChart {
382
558
  }
383
559
  ],
384
560
  ngImport: i0,
385
- template: "@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\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",
561
+ template: "@let active = activeSlot();\n@let shown = state();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showAxis()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div\n class=\"wr-candlestick-chart__grid-line\"\n [class.wr-candlestick-chart__grid-line--zero]=\"tick.zero\"\n [style.top.%]=\"tick.top\"\n ></div>\n }\n }\n\n @if (!shown) {\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The\n wicks are its two pseudo-elements, above and below the body, so a hollow\n body is empty rather than crossed by the wick. One class binding for its\n class and its direction, and one attribute for the figures the test harness reads: a\n chart of thousands pays for every binding thousands of times. -->\n <div\n #candleEl\n [class]=\"candle.classes\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-candle]=\"candle.figures\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\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\n keeps. Beside the plot in its own grid cell rather than inside it: the plot is\n an `img`, which makes everything it holds presentational, and this is a live\n region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of the longest few, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probes() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable() && (!shown || shown.kind === 'empty')) {\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. Kept with nothing to draw: a\n period with one price missing draws no candle and still has three to read. Not\n while loading or failed, when the figures are not the chart's to give. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n",
386
562
  dependencies: [{
563
+ kind: "component",
564
+ type: WrChartState,
565
+ selector: "wr-chart-state",
566
+ inputs: ["kind", "label"]
567
+ }, {
387
568
  kind: "component",
388
569
  type: WrChartTable,
389
570
  selector: "wr-chart-table",
@@ -404,12 +585,14 @@ i0.ɵɵngDeclareClassMetadata({
404
585
  encapsulation: ViewEncapsulation.None,
405
586
  host: {
406
587
  class: "wr-candlestick-chart",
588
+ "[class.wr-candlestick-chart--axis]": "showAxis()",
589
+ "[class.wr-candlestick-chart--hollow]": "hollow()",
407
590
  "[class.wr-candlestick-chart--dense]": "dense()",
408
591
  "[style.--wr-candlestick-chart-input-increase-color]": "increaseColor()",
409
592
  "[style.--wr-candlestick-chart-input-decrease-color]": "decreaseColor()"
410
593
  },
411
- imports: [WrChartTable],
412
- template: "@let active = activeSlot();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showGrid()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div class=\"wr-candlestick-chart__grid-line\" [style.top.%]=\"tick.top\"></div>\n }\n }\n\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The wicks\n are its two pseudo-elements, above and below the body, so a hollow body is\n empty rather than crossed by the wick. -->\n <div\n #candleEl\n class=\"wr-candlestick-chart__candle\"\n [class.wr-candlestick-chart__candle--increase]=\"candle.increase\"\n [class.wr-candlestick-chart__candle--decrease]=\"!candle.increase\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-index]=\"candle.index\"\n [attr.data-open]=\"candle.open\"\n [attr.data-high]=\"candle.high\"\n [attr.data-low]=\"candle.low\"\n [attr.data-close]=\"candle.close\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\n </div>\n }\n </div>\n </div>\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of every label, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probeText() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\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"
594
+ imports: [WrChartState, WrChartTable],
595
+ template: "@let active = activeSlot();\n@let shown = state();\n<!-- Two columns: the y tick labels at inline start and the plot beside them, with the\n period labels under the plot only, so their percentages are the drawing's. -->\n<div class=\"wr-candlestick-chart__body\">\n @if (showAxis()) {\n <!-- HTML beside the drawing, in flow, so the column is exactly as wide as the longest\n label; each one hands the stylesheet the y of its own gridline. Hidden, as the\n drawing is one image: its name is what is announced, and the prices are the data\n table's. -->\n <div class=\"wr-candlestick-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-candlestick-chart__y-tick\" [style.--wr-candlestick-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n #plot\n class=\"wr-candlestick-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- Boxes placed by percentage rather than an SVG stretched to the plot: a body's\n width is a share of its slot held between 1px and a ceiling, which CSS can say\n and a stretched viewBox cannot. Hidden as well as presentational: `img` already\n makes it so, and a tree of hundreds of empty boxes is work for nothing. -->\n <div #drawing class=\"wr-candlestick-chart__drawing\" aria-hidden=\"true\" [style.--wr-candlestick-chart-slot]=\"slot()\">\n @if (active) {\n <!-- The slot being read, behind its candle, so the reading is marked by more than\n the tooltip's arrow. Before the gridlines, so they are drawn over it. -->\n <div class=\"wr-candlestick-chart__cursor\" [style.left.%]=\"active.left\"></div>\n }\n\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <div\n class=\"wr-candlestick-chart__grid-line\"\n [class.wr-candlestick-chart__grid-line--zero]=\"tick.zero\"\n [style.top.%]=\"tick.top\"\n ></div>\n }\n }\n\n @if (!shown) {\n @for (candle of candles(); track candle.index) {\n <!-- The candle's box runs from its high to its low, as wide as its body. The\n wicks are its two pseudo-elements, above and below the body, so a hollow\n body is empty rather than crossed by the wick. One class binding for its\n class and its direction, and one attribute for the figures the test harness reads: a\n chart of thousands pays for every binding thousands of times. -->\n <div\n #candleEl\n [class]=\"candle.classes\"\n [style.left.%]=\"candle.left\"\n [style.top.%]=\"candle.top\"\n [style.height.%]=\"candle.height\"\n [style.--wr-candlestick-chart-upper]=\"candle.upper\"\n [style.--wr-candlestick-chart-lower]=\"candle.lower\"\n [attr.data-candle]=\"candle.figures\"\n >\n <div class=\"wr-candlestick-chart__candle-body\"></div>\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\n keeps. Beside the plot in its own grid cell rather than inside it: the plot is\n an `img`, which makes everything it holds presentational, and this is a live\n region. -->\n <wr-chart-state [kind]=\"shown.kind\" [label]=\"shown.label\" />\n }\n\n <!-- The time axis, with or without the grid: the strip is as wide as the plot, and hands\n the stylesheet the room each label has; each label hands it the x of its candle, as\n a percentage of the drawing's width. The hidden copy of the longest few, a line each, is\n what that room is measured against: it is as wide as the widest. -->\n <div class=\"wr-candlestick-chart__x-axis\" aria-hidden=\"true\" [style.--wr-candlestick-chart-x-slot]=\"xSlot()\">\n <span #probe class=\"wr-candlestick-chart__x-probe\">{{ probes() }}</span>\n @for (label of xLabels(); track label.index) {\n <span class=\"wr-candlestick-chart__x-label\" [style.--wr-candlestick-chart-x]=\"label.left\">{{ label.label }}</span>\n }\n </div>\n</div>\n\n@if (dataTable() && (!shown || shown.kind === 'empty')) {\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. Kept with nothing to draw: a\n period with one price missing draws no candle and still has three to read. Not\n while loading or failed, when the figures are not the chart's to give. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"
413
596
  }]
414
597
  }],
415
598
  ctorParameters: () => [],
@@ -470,6 +653,70 @@ i0.ɵɵngDeclareClassMetadata({
470
653
  required: false
471
654
  }]
472
655
  }],
656
+ showAxis: [{
657
+ type: i0.Input,
658
+ args: [{
659
+ isSignal: true,
660
+ alias: "showAxis",
661
+ required: false
662
+ }]
663
+ }],
664
+ hollow: [{
665
+ type: i0.Input,
666
+ args: [{
667
+ isSignal: true,
668
+ alias: "hollow",
669
+ required: false
670
+ }]
671
+ }],
672
+ decimate: [{
673
+ type: i0.Input,
674
+ args: [{
675
+ isSignal: true,
676
+ alias: "decimate",
677
+ required: false
678
+ }]
679
+ }],
680
+ loading: [{
681
+ type: i0.Input,
682
+ args: [{
683
+ isSignal: true,
684
+ alias: "loading",
685
+ required: false
686
+ }]
687
+ }],
688
+ error: [{
689
+ type: i0.Input,
690
+ args: [{
691
+ isSignal: true,
692
+ alias: "error",
693
+ required: false
694
+ }]
695
+ }],
696
+ emptyLabel: [{
697
+ type: i0.Input,
698
+ args: [{
699
+ isSignal: true,
700
+ alias: "emptyLabel",
701
+ required: false
702
+ }]
703
+ }],
704
+ loadingLabel: [{
705
+ type: i0.Input,
706
+ args: [{
707
+ isSignal: true,
708
+ alias: "loadingLabel",
709
+ required: false
710
+ }]
711
+ }],
712
+ errorLabel: [{
713
+ type: i0.Input,
714
+ args: [{
715
+ isSignal: true,
716
+ alias: "errorLabel",
717
+ required: false
718
+ }]
719
+ }],
473
720
  tooltip: [{
474
721
  type: i0.Input,
475
722
  args: [{