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 +1 @@
1
- {"version":3,"file":"ngwr-charts-scatter-chart.mjs","names":[],"sources":["../../../projects/lib/charts/scatter-chart/scatter-chart.ts","../../../projects/lib/charts/scatter-chart/scatter-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartLegend, type WrChartLegendItem } from 'ngwr/charts/chart-legend';\nimport {\n type WrChartAxis,\n type WrChartMarkerExtent,\n type WrChartMarkerShape,\n WrChartTable,\n type WrChartTableData,\n wrChartAxis,\n wrChartColor,\n wrChartMarker,\n wrChartMarkerExtent,\n wrChartMarkerPath,\n useChartNumbers,\n} from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip } from 'ngwr/popover';\nimport { wrRound, wrCheckStyles } from 'ngwr/utils';\n\nimport type { WrScatterAxis, WrScatterSeries } from './types';\n\n/** The radius, in px, of a point with no `size`: a marker as large as a 10px circle. */\nconst POINT_RADIUS = 5;\n\n/** The smallest radius a sized point is drawn at, in px, however small its size: still a mark, still hoverable. */\nconst MIN_RADIUS = 4;\n\n/** How far from a marker's centre, in px, the pointer still reads that point — or as far as the marker reaches, if farther. */\nconst HIT_RADIUS = 16;\n\n/** How far outside its marker the hovered point's ring is drawn, in px. */\nconst HALO_GAP = 3;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => Math.round(value * 1000) / 1000;\n\n/** One point as the chart draws it: its data, where it sits and how large it is. */\ninterface DrawnPoint {\n /** Its series' position and its own position in that series' `data`, which no other point shares. */\n readonly key: string;\n /** Its series' position in `series`. */\n readonly series: number;\n readonly seriesLabel: string;\n readonly color: string;\n readonly marker: WrChartMarkerShape;\n /** Its position in its series' `data`, from 1: the row header of a point with no `label`. */\n readonly n: number;\n readonly x: number;\n readonly y: number;\n readonly size: number | null;\n readonly label: string | null;\n /** Its centre, as percentages of the drawing's width from the left and height from the top. */\n readonly left: number;\n readonly top: number;\n /** Its radius in px. */\n readonly r: number;\n /** Its marker's path about the origin. */\n readonly d: string;\n /** How far its hover ring reaches from its centre, in px: what the tooltip points at and the pointer reads. */\n readonly halo: WrChartMarkerExtent;\n}\n\n/**\n * Points on two numeric axes: one series per marker shape, and an optional third value\n * drawn as each point's area, which makes it a bubble chart. SVG-only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-scatter-chart\n * xLabel=\"Price\"\n * yLabel=\"Rating\"\n * [series]=\"[\n * { label: 'Laptops', data: [{ x: 899, y: 4.1 }, { x: 1299, y: 4.6 }] },\n * { label: 'Tablets', data: [{ x: 329, y: 3.9 }, { x: 599, y: 4.4 }] }\n * ]\"\n * />\n * ```\n *\n * Each series is told apart by its marker's SHAPE as well as its colour — a circle, a\n * square, a triangle, a diamond, a cross, a downward triangle — since the palette's\n * colours sit too close in lightness to be read alone. Neither axis is forced to include\n * zero: each is fitted to its data and snapped outward to a readable step, so no point\n * lands exactly on the frame, and a single value sits in the middle with a step either\n * side. A point can still sit a hair inside the frame, so the plot's padding grows to\n * the largest marker drawn, and a bubble at the edge stays inside the chart's own box.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip is pointer\n * only. `dataTable` renders every value as a table only assistive technology reaches.\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), and with\n * `toggleableLegend` its rows show and hide their series through `hiddenSeries`.\n *\n * Hovering finds the nearest point by measuring every one, so a chart meant for more\n * than a few thousand points is better served by binning them first.\n *\n * @see https://ngwr.dev/charts/scatter-chart\n */\n@Component({\n selector: 'wr-scatter-chart',\n templateUrl: './scatter-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-scatter-chart',\n // A bubble chart's markers overlap as a rule, so they are drawn see-through.\n '[class.wr-scatter-chart--bubbles]': 'sized()',\n // How far the largest marker reaches, ring included: the stylesheet grows the plot's\n // padding to it, so a marker on the frame stays inside the plot.\n '[style.--wr-scatter-chart-reach-x]': 'reach().x',\n '[style.--wr-scatter-chart-reach-y]': 'reach().y',\n },\n imports: [WrChartLegend, WrChartTable],\n})\nexport class WrScatterChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/scatter-chart');\n }\n\n /**\n * One entry per series. A series with no `color` takes the next entry from the chart's\n * palette, and every series takes the next marker shape, so several series are told\n * apart unconfigured.\n */\n readonly series = input<readonly WrScatterSeries[]>([]);\n\n /**\n * Accessible name of the chart. The legend carries the series NAMES only — the values\n * are nowhere in text unless `dataTable` puts them there — so say what the chart shows.\n * Falls back to `scatterChart.label` (\"Scatter chart\").\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'scatterChart.label', 'Scatter chart');\n\n /**\n * The x axis' name. Drawn under the axis only when given; either way it names the x\n * row of the tooltip and the x column of the data table, which fall back to\n * `scatterChart.x` (\"X\").\n */\n readonly xLabel = input<string | null>(null);\n\n /**\n * The y axis' name. Drawn above the axis only when given; either way it names the y\n * row of the tooltip and the y column of the data table, which fall back to\n * `scatterChart.y` (\"Y\").\n */\n readonly yLabel = input<string | null>(null);\n\n /**\n * What a point's `size` measures. It names the size row of the tooltip and the size\n * column of the data table, which appear only when a point has a size, and falls back\n * to `scatterChart.size` (\"Size\").\n */\n readonly sizeLabel = input<string | null>(null);\n\n protected readonly xName = useI18nText(this.xLabel, 'scatterChart.x', 'X');\n protected readonly yName = useI18nText(this.yLabel, 'scatterChart.y', 'Y');\n protected readonly sizeName = useI18nText(this.sizeLabel, 'scatterChart.size', 'Size');\n\n /**\n * Writes every number the chart shows — the axis ticks, the tooltip and the data table —\n * and is told which number it is writing: `'x'`, `'y'` or `'size'`, so the two axes can\n * carry different units. A `(value) => string` written for another chart fits too. `null`\n * uses `Intl.NumberFormat` in `LOCALE_ID`, with compact ticks (`1.2K`, `3.4M`) unless the\n * full numbers are shorter.\n */\n readonly valueFormat = input<((value: number, axis: WrScatterAxis) => string) | null>(null);\n\n /** The exact figures and the axes' compact ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers<[WrScatterAxis]>(this.valueFormat);\n\n /** The row headers of points with no `label`, which number them in the reader's own digits. */\n private readonly ordinals = new Intl.NumberFormat(inject(LOCALE_ID));\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /** Show the gridlines and the tick labels of both axes. @default true */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /** Show the legend above the chart. @default true */\n readonly showLegend = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Make each legend row a toggle button that shows and hides its series, through\n * `hiddenSeries`. A row is a `<button aria-pressed>`, pressed while its series is\n * shown, so the legend becomes one tab stop per series. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `series` of the series that are hidden. Positions rather than\n * labels, since two series may share a label. A toggleable legend writes it, and a host\n * may bind it with or without one: `[(hiddenSeries)]`.\n *\n * A hidden series is left out of everything that reads its values: it draws no points,\n * the tooltip cannot land on them, the data table drops its rows, and both axes and the\n * bubble scale are fitted to the series still shown, so hiding an outlier lets the rest\n * fill the plot. Its legend row stays, struck through, so it can be shown again. With\n * every series hidden the plot is the empty 0 to 1 frame. A position past the end of\n * `series` is kept and ignored.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /** Show a tooltip with the series, x, y and size of the point under the pointer. Pointer only. @default true */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Render every point's values as a table only assistive technology reaches, beside the\n * drawing: one group of rows per series shown, headed by the series' name, a row per\n * point, and a column for x, for y and, when a point has one, for size. The drawing is\n * one named image, so without it the values are nowhere a screen reader can walk.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The radius, in px, the largest `size` shown is drawn at. Every other sized point is\n * scaled by AREA against it — a point of half the size has half the area, not half the\n * radius — and none is drawn under 4px. At least 4. @default 20\n */\n readonly maxRadius = input(20, {\n transform: (v: unknown): number => Math.max(MIN_RADIUS, coerceNumberProperty(v, 20)),\n });\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n /**\n * Every series, resolved: its palette colour, its marker shape, and its points with\n * every one dropped whose `x` or `y` is not a finite number. Hidden ones included, since\n * the legend lists them.\n *\n * A point that cannot be placed is left out rather than kept: one NaN in the pooled\n * minimum makes every coordinate in every series NaN, and the whole chart vanishes\n * instead of one point. A point keeps its position in its series' `data` all the same,\n * so the data table numbers the rest as the consumer numbered them.\n */\n protected readonly resolvedSeries = computed(() =>\n this.series().map((s, index) => ({\n index,\n label: s.label,\n color: s.color ?? wrChartColor(index),\n marker: wrChartMarker(index),\n points: s.data.flatMap((p, i) =>\n Number.isFinite(p.x) && Number.isFinite(p.y)\n ? [\n {\n n: i + 1,\n x: p.x,\n y: p.y,\n size: typeof p.size === 'number' && Number.isFinite(p.size) && p.size >= 0 ? p.size : null,\n label: p.label ?? null,\n },\n ]\n : []\n ),\n }))\n );\n\n /** The legend's rows: every series, keyed by its own marker. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.resolvedSeries().map(({ label, color, marker }) => ({ label, color, marker }))\n );\n\n /** The series drawn, read and fitted to: every one `hiddenSeries` does not name. */\n protected readonly visibleSeries = computed(() => {\n const hidden = new Set(this.hiddenSeries());\n return this.resolvedSeries().filter(s => !hidden.has(s.index));\n });\n\n /** The largest `size` among the points shown, or `null` when none has one — a plain scatter. */\n private readonly maxSize = computed(() => {\n let max: number | null = null;\n for (const s of this.visibleSeries())\n for (const p of s.points) if (p.size !== null) max = Math.max(max ?? 0, p.size);\n return max;\n });\n\n /** Whether any point shown has a size, which adds the size row and column. */\n protected readonly sized = computed(() => this.maxSize() !== null);\n\n /**\n * The x axis, from `wrChartAxis` over the points shown: fitted to the data with no zero\n * forced in, since a scatter has no baseline, snapped outward at both ends and lifted a\n * step at EITHER end a point would sit on (`symmetric`), so no point lands exactly on\n * the frame. A single value — one point, or a column of them — is centred with a step\n * either side. With nothing to fit, the 0 to 1 frame.\n */\n protected readonly xAxis = computed(() => this.fit(p => p.x));\n\n /** The y axis, fitted the way {@link xAxis} is. */\n protected readonly yAxis = computed(() => this.fit(p => p.y));\n\n /**\n * The points as drawn: placed by percentage on both axes, sized, and ordered LARGEST\n * FIRST so a small bubble is never buried under a large one. Points of equal size keep\n * the series' order, so a plain scatter draws series by series.\n */\n protected readonly points = computed<readonly DrawnPoint[]>(() => {\n const x = this.xAxis();\n const y = this.yAxis();\n const maxSize = this.maxSize();\n const maxRadius = this.maxRadius();\n const drawn = this.visibleSeries().flatMap(s =>\n s.points.map(p => {\n const r =\n p.size === null || maxSize === null\n ? POINT_RADIUS\n : Math.max(MIN_RADIUS, maxRadius * Math.sqrt(maxSize > 0 ? p.size / maxSize : 0));\n const halo = wrChartMarkerExtent(s.marker, r + HALO_GAP);\n return {\n key: `${s.index}:${p.n}`,\n series: s.index,\n seriesLabel: s.label,\n color: s.color,\n marker: s.marker,\n n: p.n,\n x: p.x,\n y: p.y,\n size: p.size,\n label: p.label,\n left: percent(((p.x - x.min) / (x.max - x.min)) * 100),\n top: percent(((y.max - p.y) / (y.max - y.min)) * 100),\n r,\n d: wrChartMarkerPath(s.marker, r),\n halo,\n };\n })\n );\n return drawn.sort((a, b) => b.r - a.r);\n });\n\n /**\n * How far the largest marker drawn reaches past its centre, in px, sideways and up or\n * down — its hover ring included, so hovering moves nothing. The axes keep a point\n * off the frame only when it lands exactly on it, and one a fraction of a step inside\n * sits a few px from it; the stylesheet takes the larger of this and the plot's inset\n * tokens as the plot's padding, so the marker stays inside the plot rather than over\n * the tick labels or past the chart's own box. By SHAPE, not radius: a triangle's\n * point reaches 1.56 times its radius up. The ring's stroke is the stylesheet's.\n *\n * Up or down it is held to a quarter of `height`, so a short plot with a large\n * `maxRadius` keeps half its height for the drawing and lets the marker overhang.\n */\n protected readonly reach = computed(() => {\n let x = 0;\n let y = 0;\n for (const { halo } of this.points()) {\n x = Math.max(x, halo.side);\n y = Math.max(y, halo.top, halo.bottom);\n }\n return { x: wrRound(x, 3), y: wrRound(Math.min(y, this.height() / 4), 3) };\n });\n\n /** The y ticks, top to bottom: each value's label and its gridline's distance from the top, in percent. */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.yAxis();\n const labels = this.numbers.ticks(ticks, step, 'y');\n return ticks.map((value, i) => ({ label: labels[i], top: percent(((max - value) / (max - min)) * 100) }));\n });\n\n /** The x ticks, left to right: each value's label and its gridline's distance from the left, in percent. */\n protected readonly xTicks = computed(() => {\n const { min, max, step, ticks } = this.xAxis();\n const values = [...ticks].reverse();\n const labels = this.numbers.ticks(values, step, 'x');\n return values.map((value, i) => ({ label: labels[i], left: percent(((value - min) / (max - min)) * 100) }));\n });\n\n /**\n * How far apart two neighbouring x ticks are, as a percentage of the drawing's width —\n * the room each tick label has, half on either side of its gridline, which the\n * stylesheet bounds it to and ellipsises past.\n */\n protected readonly xSlot = computed(() => {\n const count = this.xTicks().length;\n return count <= 1 ? 100 : percent(100 / (count - 1));\n });\n\n /**\n * One tooltip for the point under the pointer: the series' swatch and name with the\n * point's own label as its heading, then a row each for x, y and size. It points at\n * the box of the marker's hover ring from above, so the chip clears a large bubble and\n * a triangle's point rather than sitting on its centre.\n *\n * Points are found by POSITION — the nearest within 16px of the pointer, or anywhere a\n * larger marker reaches — so a point under the open chip can still be reached by\n * moving onto it, the way a sparkline is scrubbed.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const point = this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg) return null;\n const box = svg.getBoundingClientRect();\n const x = box.left + (point.left / 100) * box.width;\n const y = box.top + (point.top / 100) * box.height;\n const rows: WrChartTooltipRow[] = [\n { label: this.xName(), value: this.numbers.value(point.x, 'x') },\n { label: this.yName(), value: this.numbers.value(point.y, 'y') },\n ];\n if (point.size !== null) rows.push({ label: this.sizeName(), value: this.numbers.value(point.size, 'size') });\n return {\n datum: { label: point.seriesLabel, value: point.label ?? '', color: point.color, rows },\n anchor: {\n x: x - point.halo.side,\n y: y - point.halo.top,\n width: point.halo.side * 2,\n height: point.halo.top + point.halo.bottom,\n },\n };\n },\n (x, y) => this.pointAt(x, y)\n );\n\n /** The point the tooltip is reading, ringed in the drawing. */\n protected readonly activePoint = computed(() => {\n const index = this.tip.active();\n return index === null ? null : (this.points()[index] ?? null);\n });\n\n /** The ring round the hovered point: its own shape, a little larger. */\n protected readonly haloPath = computed(() => {\n const point = this.activePoint();\n return point ? wrChartMarkerPath(point.marker, point.r + HALO_GAP) : '';\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, one group per series\n * shown and headed by its name, and a row per point headed by the point's `label` or\n * its position in the series. Every value is written as the tooltip writes it; a point\n * with no size has an empty size cell in a chart where others have one.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const sized = this.sized();\n const value = (v: number, axis: WrScatterAxis): string => this.numbers.value(v, axis);\n return {\n caption: this.resolvedAriaLabel(),\n columns: sized ? [this.xName(), this.yName(), this.sizeName()] : [this.xName(), this.yName()],\n groups: this.visibleSeries().map(s => ({\n header: s.label,\n rows: s.points.map(p => {\n const cells = [value(p.x, 'x'), value(p.y, 'y')];\n if (sized) cells.push(p.size === null ? '' : value(p.size, 'size'));\n return { header: p.label ?? this.ordinals.format(p.n), cells };\n }),\n })),\n };\n });\n\n /**\n * The point under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Off every point, the open tooltip\n * starts its grace period.\n */\n protected onPointerMove(event: MouseEvent): void {\n if (!this.tooltip()) return;\n const index = this.pointAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The point nearest a viewport position: within 16px of its centre, or within the\n * circle its hover ring fits in where that is larger — a triangle's point or a\n * diamond's tips reach past its radius — and the nearest centre where several qualify.\n * A drawing with no box (nothing laid out yet) answers nothing.\n */\n private pointAt(clientX: number, clientY: number): number | null {\n const svg = this.svg()?.nativeElement;\n if (!svg) return null;\n const box = svg.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n let best: number | null = null;\n let nearest = Number.POSITIVE_INFINITY;\n this.points().forEach((point, index) => {\n const distance = Math.hypot(\n box.left + (point.left / 100) * box.width - clientX,\n box.top + (point.top / 100) * box.height - clientY\n );\n if (distance <= Math.max(HIT_RADIUS, point.halo.radius) && distance < nearest) {\n nearest = distance;\n best = index;\n }\n });\n return best;\n }\n\n /** One axis over the points shown: `wrChartAxis` with both ends kept off the data, and one value centred. */\n private fit(read: (point: { readonly x: number; readonly y: number }) => number): WrChartAxis {\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n for (const s of this.visibleSeries()) {\n for (const p of s.points) {\n const v = read(p);\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n // No point at all leaves both infinite, which `wrChartAxis` answers with the empty frame;\n // one value, or a column of them, it centres between a step on either side.\n return wrChartAxis(min, max, { symmetric: true });\n }\n}\n\nexport type { WrScatterAxis, WrScatterPoint, WrScatterSeries } from './types';\n","@let active = activePoint();\n@if (showLegend() && resolvedSeries().length > 0) {\n <!-- Every row keys its series by the series' own marker shape, the channel that tells\n the points apart where the colours do not. 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-scatter-chart__legend\"\n [items]=\"legendItems()\"\n [toggleable]=\"toggleableLegend()\"\n [(hiddenSeries)]=\"hiddenSeries\"\n ></ul>\n}\n\n<!-- Two columns: the y tick labels at inline start and the drawing beside them, with the\n y axis' name above and the x tick labels and the x axis' name under the drawing\n only, so their percentages are the drawing's. -->\n<div class=\"wr-scatter-chart__body\">\n @if (yLabel()) {\n <div class=\"wr-scatter-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showGrid()) {\n <!-- HTML beside the drawing rather than `<text>` inside it, in flow, so the column is\n exactly as wide as the longest label; each one hands the stylesheet the y of its\n own gridline. Hidden, as the drawing is one image: its name is what is announced,\n and the values are the data table's. -->\n <div class=\"wr-scatter-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-scatter-chart__y-tick\" [style.--wr-scatter-chart-y]=\"tick.top\">{{ tick.label }}</span>\n }\n </div>\n }\n\n <div\n class=\"wr-scatter-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 <!-- No viewBox: every position is a PERCENTAGE of the drawing, so nothing stretches.\n A viewBox with `preserveAspectRatio=\"none\"` would squash each marker with the\n drawing, a circle into an oval and a square into a bar, and a scatter's marker is\n its series' only channel besides colour. -->\n <!-- Hidden as well as presentational: `img` already makes it so, but every point is\n an `<svg>` of its own, and a tree that holds a node per point for thousands of\n them is work for nothing. -->\n <svg #svg class=\"wr-scatter-chart__svg\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <line\n class=\"wr-scatter-chart__grid-line\"\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"`${tick.top}%`\"\n [attr.y2]=\"`${tick.top}%`\"\n />\n }\n @for (tick of xTicks(); track $index) {\n <line\n class=\"wr-scatter-chart__grid-line wr-scatter-chart__grid-line--x\"\n [attr.x1]=\"`${tick.left}%`\"\n [attr.x2]=\"`${tick.left}%`\"\n y1=\"0\"\n y2=\"100%\"\n />\n }\n }\n\n @for (p of points(); track p.key) {\n <!-- A nested `<svg>` placed by percentage, its marker drawn about its origin in\n px: an SVG's `x` and `y` take a percentage where a `transform` does not, so\n the marker sits on its point at any size and keeps its own. Its viewport is\n the drawing's whole box, painted nowhere, and `overflow` lets the marker\n reach outside it. -->\n <svg\n class=\"wr-scatter-chart__point\"\n [attr.x]=\"`${p.left}%`\"\n [attr.y]=\"`${p.top}%`\"\n overflow=\"visible\"\n [attr.data-series]=\"p.series\"\n [attr.data-x]=\"p.x\"\n [attr.data-y]=\"p.y\"\n [attr.data-size]=\"p.size\"\n [attr.data-radius]=\"p.r\"\n [attr.data-marker]=\"p.marker\"\n >\n <path class=\"wr-scatter-chart__marker\" [attr.d]=\"p.d\" [attr.fill]=\"p.color\" />\n </svg>\n }\n\n @if (active) {\n <!-- A ring of the point's own shape just outside it, so the reading is marked by\n outline as well as by the tooltip's arrow. -->\n <svg class=\"wr-scatter-chart__halo\" [attr.x]=\"`${active.left}%`\" [attr.y]=\"`${active.top}%`\" overflow=\"visible\">\n <path [attr.d]=\"haloPath()\" fill=\"none\" [attr.stroke]=\"active.color\" />\n </svg>\n }\n </svg>\n </div>\n\n @if (showGrid()) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two ticks; each label hands it the x of its gridline, as a percentage of the\n drawing's width. -->\n <div class=\"wr-scatter-chart__x-axis\" aria-hidden=\"true\" [style.--wr-scatter-chart-x-slot]=\"xSlot()\">\n @for (tick of xTicks(); track $index) {\n <span class=\"wr-scatter-chart__x-tick\" [style.--wr-scatter-chart-x]=\"tick.left\">{{ tick.label }}</span>\n }\n </div>\n }\n\n @if (xLabel()) {\n <div class=\"wr-scatter-chart__x-title\">{{ xLabel() }}</div>\n }\n</div>\n\n@if (dataTable()) {\n <!-- The figures for a screen reader, beside the plot's `img` and never inside it:\n `img` makes everything it holds presentational. Clipped to nothing by its own\n stylesheet, so it takes no room and draws nothing. -->\n <wr-chart-table [data]=\"tableData()\" />\n}\n"],"mappings":";;;;;;;;;;;;;;AAyCA,MAAM,eAAe;AAGrB,MAAM,aAAa;AAGnB,MAAM,aAAa;AAGnB,MAAM,WAAW;AAGjB,MAAM,WAAW,UAA0B,KAAK,MAAM,QAAQ,GAAI,IAAI;AA8EtE,IAAa,iBAAb,MAAa,eAAc;CACzB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,sBAAsB;CACzF;CAOS,SAAS,MAAkC,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAO9C,YAAY,MAAqB,MAAK,GAA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A,WAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,KAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,OAAK,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"ngwr-charts-scatter-chart.mjs","names":[],"sources":["../../../projects/lib/charts/scatter-chart/internal/hit.ts","../../../projects/lib/charts/scatter-chart/internal/markers.ts","../../../projects/lib/charts/scatter-chart/scatter-chart.ts","../../../projects/lib/charts/scatter-chart/scatter-chart.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\n/** The most cells along one side of the grid: past it a cell is under half a percent of the drawing. */\nconst MAX_SIDE = 256;\n\nconst cellOf = (percent: number, side: number): number =>\n Math.min(side - 1, Math.max(0, Math.floor((percent / 100) * side)));\n\n/** A point as the index needs it: where its centre is, and how far from it the pointer still reads it. */\nexport interface WrScatterHitPoint {\n /** Its centre, as percentages of the drawing's width from the left and height from the top. */\n readonly left: number;\n readonly top: number;\n /** How far from its centre the pointer still reads it, in px. */\n readonly reach: number;\n}\n\n/**\n * The points of a scatter chart, bucketed for {@link wrScatterHit}: a uniform grid over\n * the drawing in PERCENT, so it is built once per change to the points and survives every\n * resize, with each cell's points in one flat array.\n */\nexport interface WrScatterIndex {\n readonly columns: number;\n readonly rows: number;\n /** Where each cell's points start in `items`: cell `c` holds `items[starts[c]]` up to `items[starts[c + 1]]`. */\n readonly starts: Int32Array;\n /** The points' positions in the list the index was built from, cell by cell. */\n readonly items: Int32Array;\n readonly lefts: Float64Array;\n readonly tops: Float64Array;\n readonly reaches: Float64Array;\n /** The farthest any point reaches, in px: how far round the pointer a search has to look. */\n readonly reach: number;\n}\n\n/**\n * Buckets `points` into a grid of about one point a cell.\n *\n * Finding the point under the pointer by measuring every one cost 25 ms a move at a\n * hundred thousand points; a search that looks only in the cells the pointer can reach\n * looks at a few hundred of them.\n */\nexport function wrScatterIndex(points: readonly WrScatterHitPoint[]): WrScatterIndex {\n const count = points.length;\n const side = Math.min(MAX_SIDE, Math.max(1, Math.ceil(Math.sqrt(count))));\n const lefts = new Float64Array(count);\n const tops = new Float64Array(count);\n const reaches = new Float64Array(count);\n const cells = new Int32Array(count);\n const starts = new Int32Array(side * side + 1);\n let reach = 0;\n for (let i = 0; i < count; i++) {\n const point = points[i];\n lefts[i] = point.left;\n tops[i] = point.top;\n reaches[i] = point.reach;\n if (point.reach > reach) reach = point.reach;\n const cell = cellOf(point.top, side) * side + cellOf(point.left, side);\n cells[i] = cell;\n starts[cell + 1]++;\n }\n for (let cell = 0; cell < side * side; cell++) starts[cell + 1] += starts[cell];\n const items = new Int32Array(count);\n const next = starts.slice(0, side * side);\n for (let i = 0; i < count; i++) items[next[cells[i]]++] = i;\n return { columns: side, rows: side, starts, items, lefts, tops, reaches, reach };\n}\n\n/**\n * The point nearest a position in the drawing, among those whose reach takes it in, or\n * `null`: the position is in percent of the drawing, as the points are, and the drawing's\n * size in px turns the distance into the px a reach is measured in. Of two points equally\n * near, the one earlier in the list, as a scan of the whole list would answer.\n */\nexport function wrScatterHit(\n index: WrScatterIndex,\n left: number,\n top: number,\n width: number,\n height: number\n): number | null {\n if (!(width > 0) || !(height > 0) || index.items.length === 0) return null;\n const { columns, rows, starts, items, lefts, tops, reaches } = index;\n const acrossReach = (index.reach / width) * 100;\n const downReach = (index.reach / height) * 100;\n const firstColumn = cellOf(left - acrossReach, columns);\n const lastColumn = cellOf(left + acrossReach, columns);\n const firstRow = cellOf(top - downReach, rows);\n const lastRow = cellOf(top + downReach, rows);\n let best: number | null = null;\n let nearest = Number.POSITIVE_INFINITY;\n for (let row = firstRow; row <= lastRow; row++) {\n for (let column = firstColumn; column <= lastColumn; column++) {\n const cell = row * columns + column;\n for (let k = starts[cell]; k < starts[cell + 1]; k++) {\n const i = items[k];\n const distance = Math.hypot(((lefts[i] - left) / 100) * width, ((tops[i] - top) / 100) * height);\n if (distance > reaches[i]) continue;\n if (distance < nearest || (distance === nearest && best !== null && i < best)) {\n nearest = distance;\n best = i;\n }\n }\n }\n }\n return best;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport {\n type WrChartMarkerExtent,\n type WrChartMarkerShape,\n wrChartMarkerExtent,\n wrChartMarkerPath,\n wrChartRound,\n} from 'ngwr/charts/core';\n\n/** The most markers a cache holds before it starts over: a bubble chart has a radius per size. */\nconst CACHE_LIMIT = 4096;\n\n/** How many numbers follow each command `wrChartMarkerPath` writes. */\nconst ARGUMENTS: Readonly<Record<string, number>> = { M: 2, L: 2, A: 7, Z: 0 };\n\nconst write = (value: number): string => String(wrChartRound(value, 3));\n\n/** What a marker of one shape and one radius is drawn and measured with. */\nexport interface WrScatterMarker {\n /** Its path about the origin. */\n readonly d: string;\n /** The same path in relative commands from its centre: what follows an `M` to the centre in a path of many markers. */\n readonly relative: string;\n /** How far it reaches from its centre, in px. */\n readonly extent: WrChartMarkerExtent;\n}\n\n/**\n * A marker path in relative commands: `M -3 0 A 3 3 0 1 0 3 0 …` as `m-3 0a3 3 0 1 0 6 0…`.\n * After an `M` to a point, it draws the marker about that point, so a thousand markers\n * are a thousand short prefixes on one cached string rather than a thousand paths. Reads\n * the `M`, `L`, `A` and `Z` the shared marker paths are written in.\n */\nexport function wrScatterRelativePath(d: string): string {\n const tokens = d.split(/\\s+/).filter(Boolean);\n let out = '';\n let x = 0;\n let y = 0;\n for (let at = 0; at < tokens.length;) {\n const command = tokens[at++];\n const count = ARGUMENTS[command];\n if (count === undefined) return '';\n const values = tokens.slice(at, at + count).map(Number);\n at += count;\n if (command === 'Z') {\n out += 'z';\n continue;\n }\n const toX = values[count - 2];\n const toY = values[count - 1];\n const lead = command === 'A' ? `${values.slice(0, 5).map(write).join(' ')} ` : '';\n out += `${command.toLowerCase()}${lead}${write(toX - x)} ${write(toY - y)}`;\n x = toX;\n y = toY;\n }\n return out;\n}\n\n/**\n * The marker for each (shape, radius), built once. A plain scatter has one radius per\n * series and built the same path and the same extent for every point of it.\n */\nexport function wrScatterMarkerCache(): (shape: WrChartMarkerShape, r: number) => WrScatterMarker {\n const cache = new Map<string, WrScatterMarker>();\n return (shape, r) => {\n const key = `${shape}:${r}`;\n let marker = cache.get(key);\n if (!marker) {\n const d = wrChartMarkerPath(shape, r);\n marker = { d, relative: wrScatterRelativePath(d), extent: wrChartMarkerExtent(shape, r) };\n if (cache.size >= CACHE_LIMIT) cache.clear();\n cache.set(key, marker);\n }\n return marker;\n };\n}\n\n/** One marker of a path of many: its centre in percent of the drawing, and its relative path. */\nexport interface WrScatterDensePoint {\n readonly left: number;\n readonly top: number;\n readonly relative: string;\n}\n\n/**\n * Every marker of one series as ONE path, a subpath each, in px of a drawing `width` by\n * `height`: a centre is a percentage, which a path cannot take, so the path is written\n * for a size and written again when the size changes.\n */\nexport function wrScatterDensePath(points: readonly WrScatterDensePoint[], width: number, height: number): string {\n let d = '';\n for (const point of points) {\n d += `M${wrChartRound((point.left / 100) * width, 1)} ${wrChartRound((point.top / 100) * height, 1)}${point.relative}`;\n }\n return d;\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { NgTemplateOutlet } from '@angular/common';\nimport {\n Component,\n DestroyRef,\n type ElementRef,\n LOCALE_ID,\n ViewEncapsulation,\n afterNextRender,\n computed,\n inject,\n input,\n model,\n viewChild,\n} from '@angular/core';\n\nimport { WrChartLegend, type WrChartLegendItem, type WrChartLegendPosition } from 'ngwr/charts/chart-legend';\nimport {\n type WrChartAxis,\n type WrChartMarkerExtent,\n type WrChartMarkerShape,\n WrChartState,\n WrChartTable,\n type WrChartTableData,\n useChartHover,\n useChartNumbers,\n useChartSize,\n useChartState,\n wrChartAxis,\n wrChartColor,\n wrChartMarker,\n wrChartNumberFormat,\n wrChartRound,\n} from 'ngwr/charts/core';\nimport { useI18nText } from 'ngwr/i18n';\nimport { type WrChartTooltipRow, useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { wrScatterHit, wrScatterIndex } from './internal/hit';\nimport { wrScatterDensePath, wrScatterMarkerCache } from './internal/markers';\nimport type { WrScatterAxis, WrScatterSeries } from './types';\n\n/**\n * The radius, in px, of a point with no `size`: a marker as large as a 6px circle, the\n * chart theme's `--wr-chart-marker`. A length in the script rather than the token, since\n * the marker's path, its reach and the pointer's hit test are all worked out from it.\n */\nconst POINT_RADIUS = 3;\n\n/** The smallest radius a sized point is drawn at, in px, however small its size: still a mark, still hoverable. */\nconst MIN_RADIUS = 4;\n\n/** How far from a marker's centre, in px, the pointer still reads that point — or as far as the marker reaches, if farther. */\nconst HIT_RADIUS = 16;\n\n/** How much larger the hovered point is drawn, in px of radius: a plain 6px point reads at 8px. */\nconst HOVER_GROW = 1;\n\n/**\n * How far past its marker the hovered point reaches, in px: what it grows by, and the\n * 2px ring of the surface round it (`--wr-scatter-chart-halo-width`).\n */\nconst HALO_GAP = HOVER_GROW + 2;\n\n/**\n * How many points shown the chart draws a node each for. Past it every series is ONE\n * path holding a subpath per marker: ten thousand points were twenty thousand elements,\n * and are as many paths as there are series.\n */\nconst DENSE_FROM = 2000;\n\n/** The drawing's width in CSS px, assumed until a browser has measured it: what a path of many markers is first written for. */\nconst ASSUMED_WIDTH = 560;\n\n/** A percentage to three decimals, so an attribute stays short. */\nconst percent = (value: number): number => wrChartRound(value, 3);\n\n/** One point as the chart draws it: its data, where it sits and how large it is. */\ninterface DrawnPoint {\n /** Its series' position and its own position in that series' `data`, which no other point shares. */\n readonly key: string;\n /** Its series' position in `series`. */\n readonly series: number;\n readonly seriesLabel: string;\n readonly color: string;\n readonly marker: WrChartMarkerShape;\n /** Its position in its series' `data`, from 1: the row header of a point with no `label`. */\n readonly n: number;\n readonly x: number;\n readonly y: number;\n readonly size: number | null;\n readonly label: string | null;\n /** Its centre, as percentages of the drawing's width from the left and height from the top. */\n readonly left: number;\n readonly top: number;\n /** Its radius in px. */\n readonly r: number;\n /** Its marker's path about the origin. */\n readonly d: string;\n /** The same path in relative commands, for a path of many markers. */\n readonly relative: string;\n /** Its `x`, `y` and radius, and its `size` when it has one, as one attribute: what a test harness reads a point by. */\n readonly values: string;\n /** How far its hover ring reaches from its centre, in px: what the tooltip points at and the pointer reads. */\n readonly halo: WrChartMarkerExtent;\n}\n\n/** A stretch of consecutive points of one series, in drawing order: one group in the drawing. */\ninterface Run {\n readonly key: string;\n readonly series: number;\n readonly color: string;\n readonly marker: WrChartMarkerShape;\n readonly points: readonly DrawnPoint[];\n}\n\n/**\n * Points on two numeric axes: one series per marker shape, and an optional third value\n * drawn as each point's area, which makes it a bubble chart. SVG-only — no external\n * dependency.\n *\n * @example\n * ```html\n * <wr-scatter-chart\n * xLabel=\"Price\"\n * yLabel=\"Rating\"\n * [series]=\"[\n * { label: 'Laptops', data: [{ x: 899, y: 4.1 }, { x: 1299, y: 4.6 }] },\n * { label: 'Tablets', data: [{ x: 329, y: 3.9 }, { x: 599, y: 4.4 }] }\n * ]\"\n * />\n * ```\n *\n * Each series is told apart by its marker's SHAPE as well as its colour — a circle, a\n * square, a triangle, a diamond, a cross, a downward triangle — so colour is never the\n * only thing that tells two series apart. Each takes the next colour of the chart\n * palette (`--wr-chart-1` to `--wr-chart-8`). Neither axis is forced to include\n * zero: each is fitted to its data and snapped outward to a readable step, so no point\n * lands exactly on the frame, and a single value sits in the middle with a step either\n * side. A point can still sit a hair inside the frame, so the plot's padding grows to\n * the largest marker drawn, and a bubble at the edge stays inside the chart's own box.\n *\n * The drawing is one named `role=\"img\"` and takes no tab stop; the tooltip is pointer\n * only. `dataTable` renders every value as a table only assistive technology reaches.\n * The legend is a `ul[wr-chart-legend]` (`ngwr/charts/chart-legend`), placed by\n * `legendPosition` and left out for a single series; with `toggleableLegend` its rows\n * show and hide their series through `hiddenSeries`. Hovering a marker or a legend row\n * dims every other series.\n *\n * **Grid and axes.** Gridlines run across the plot at every y tick (`showGrid`), the\n * one at zero stronger, and both axes print their scale (`showAxis`). The gridlines up\n * the plot at the x ticks are in the DOM and painted `transparent`:\n * `--wr-scatter-chart-grid-x-color` draws them.\n *\n * **Empty, loading, error.** With no point to draw the chart keeps its frame and says\n * \"No data\"; `loading` and `error` put their own message there in place of the points.\n *\n * **Many points.** The pointer finds the nearest point through a grid over the drawing,\n * one lookup a move whatever the count. Up to two thousand points shown each is an\n * element of its own, drawn largest first; past that every series is one path holding\n * all its markers, drawn series by series.\n *\n * @see https://ngwr.dev/charts/scatter-chart\n */\n@Component({\n selector: 'wr-scatter-chart',\n templateUrl: './scatter-chart.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n // `wr-chart--legend`: the shared rule that keeps the legend's room from the plot.\n class: 'wr-scatter-chart wr-chart--legend',\n '[class.wr-chart--legend-side]': 'legendShown() && legendSide()',\n '[class.wr-scatter-chart--axis]': 'showAxis()',\n // A bubble chart's markers overlap as a rule, so they are drawn see-through.\n '[class.wr-scatter-chart--bubbles]': 'sized()',\n // How far the largest marker reaches, ring included: the stylesheet grows the plot's\n // padding to it, so a marker on the frame stays inside the plot.\n '[style.--wr-scatter-chart-reach-x]': 'reach().x',\n '[style.--wr-scatter-chart-reach-y]': 'reach().y',\n },\n imports: [NgTemplateOutlet, WrChartLegend, WrChartState, WrChartTable],\n})\nexport class WrScatterChart {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/scatter-chart');\n // The shared hover-dim: every run of a series' markers and its legend row carry\n // `data-wr-series`. A point is found by position, not by the element under the\n // pointer, so the section handlers have nothing to do.\n useChartHover({ enter: () => undefined, leave: () => undefined });\n\n // One native listener pair on the plot: a move runs no change detection unless it\n // lands on another point.\n const destroyRef = inject(DestroyRef);\n afterNextRender(() => {\n const plot = this.plot().nativeElement;\n const move = (event: MouseEvent): void => this.onPointerMove(event);\n const leave = (event: MouseEvent): void => this.tip.leave(event);\n plot.addEventListener('mousemove', move);\n plot.addEventListener('mouseleave', leave);\n destroyRef.onDestroy(() => {\n plot.removeEventListener('mousemove', move);\n plot.removeEventListener('mouseleave', leave);\n });\n });\n }\n\n /**\n * One entry per series. A series with no `color` takes the next entry from the chart's\n * palette, and every series takes the next marker shape, so several series are told\n * apart unconfigured.\n */\n readonly series = input<readonly WrScatterSeries[]>([]);\n\n /**\n * Accessible name of the chart. The legend carries the series NAMES only — the values\n * are nowhere in text unless `dataTable` puts them there — so say what the chart shows.\n * Falls back to `scatterChart.label` (\"Scatter chart\").\n */\n readonly ariaLabel = input<string | null>(null);\n\n protected readonly resolvedAriaLabel = useI18nText(this.ariaLabel, 'scatterChart.label', 'Scatter chart');\n\n /**\n * The x axis' name. Drawn under the axis only when given; either way it names the x\n * row of the tooltip and the x column of the data table, which fall back to\n * `scatterChart.x` (\"X\").\n */\n readonly xLabel = input<string | null>(null);\n\n /**\n * The y axis' name. Drawn above the axis only when given; either way it names the y\n * row of the tooltip and the y column of the data table, which fall back to\n * `scatterChart.y` (\"Y\").\n */\n readonly yLabel = input<string | null>(null);\n\n /**\n * What a point's `size` measures. It names the size row of the tooltip and the size\n * column of the data table, which appear only when a point has a size, and falls back\n * to `scatterChart.size` (\"Size\").\n */\n readonly sizeLabel = input<string | null>(null);\n\n protected readonly xName = useI18nText(this.xLabel, 'scatterChart.x', 'X');\n protected readonly yName = useI18nText(this.yLabel, 'scatterChart.y', 'Y');\n protected readonly sizeName = useI18nText(this.sizeLabel, 'scatterChart.size', 'Size');\n\n /**\n * Writes every number the chart shows — the axis ticks, the tooltip and the data table —\n * and is told which number it is writing: `'x'`, `'y'` or `'size'`, so the two axes can\n * carry different units. A `(value) => string` written for another chart fits too. `null`\n * uses `Intl.NumberFormat` in `LOCALE_ID`, with compact ticks (`1.2K`, `3.4M`) unless the\n * full numbers are shorter.\n */\n readonly valueFormat = input<((value: number, axis: WrScatterAxis) => string) | null>(null);\n\n /** The exact figures and the axes' compact ticks, in `LOCALE_ID` unless `valueFormat` is given. */\n private readonly numbers = useChartNumbers<[WrScatterAxis]>(this.valueFormat);\n\n /** The row headers of points with no `label`, which number them in the reader's own digits. */\n private readonly ordinals = wrChartNumberFormat(inject(LOCALE_ID));\n\n /** The plot's height in px, at least 80. @default 240 */\n readonly height = input(240, { transform: (v: unknown): number => Math.max(80, coerceNumberProperty(v, 240)) });\n\n /**\n * Draw the gridlines: one across the plot at every tick of the y axis, in\n * `--wr-scatter-chart-grid-color`, which defaults to the chart theme's\n * `--wr-chart-grid`; the one at zero is drawn in `--wr-scatter-chart-zero-color`. The\n * lines up the plot at the x ticks are drawn `transparent` unless\n * `--wr-scatter-chart-grid-x-color` gives them a colour. The scales' numbers are\n * `showAxis`. @default true\n */\n readonly showGrid = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Print both axes' scales: a number beside the plot at every y tick and under it at\n * every x tick. Off, the gutter and the strip go and the drawing takes their room.\n * The axes' names are `xLabel` and `yLabel`. @default true\n */\n readonly showAxis = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Show the legend. `'auto'` shows it when there is something to tell apart - two\n * series or more - and leaves it out for a single series, which has nothing to key;\n * `true` shows it for one series too. @default 'auto'\n */\n readonly showLegend = input<boolean | 'auto', unknown>('auto', {\n transform: (value: unknown): boolean | 'auto' => (value === 'auto' ? 'auto' : coerceBooleanProperty(value)),\n });\n\n /**\n * Where the legend sits: `bottom` or `top` of the chart as a wrapping row, `start` or\n * `end` of it as a column, or `none` for no legend at all - `hiddenSeries` still hides\n * a series from outside. @default 'bottom'\n */\n readonly legendPosition = input<WrChartLegendPosition>('bottom');\n\n /**\n * A request for the chart's data is in flight: the points give way to the loading\n * message, over the grid and the axes the chart keeps. @default false\n */\n readonly loading = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The chart's data failed to load: the points give way to the error message. `loading`\n * wins over it. @default false\n */\n readonly error = input(false, { transform: coerceBooleanProperty });\n\n /** The message shown with nothing to draw. Falls back to `chart.empty`, then `'No data'`. */\n readonly emptyLabel = input<string | null>(null);\n\n /** The message shown while `loading`. Falls back to `chart.loading`, then `'Loading…'`. */\n readonly loadingLabel = input<string | null>(null);\n\n /** The message shown on `error`. Falls back to `chart.error`, then `'Could not load'`. */\n readonly errorLabel = input<string | null>(null);\n\n /**\n * Make each legend row a toggle button that shows and hides its series, through\n * `hiddenSeries`. A row is a `<button aria-pressed>`, pressed while its series is\n * shown, so the legend becomes one tab stop per series. @default false\n */\n readonly toggleableLegend = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The positions in `series` of the series that are hidden. Positions rather than\n * labels, since two series may share a label. A toggleable legend writes it, and a host\n * may bind it with or without one: `[(hiddenSeries)]`.\n *\n * A hidden series is left out of everything that reads its values: it draws no points,\n * the tooltip cannot land on them, the data table drops its rows, and both axes and the\n * bubble scale are fitted to the series still shown, so hiding an outlier lets the rest\n * fill the plot. Its legend row stays, struck through, so it can be shown again. With\n * every series hidden the plot is the empty 0 to 1 frame. A position past the end of\n * `series` is kept and ignored.\n */\n readonly hiddenSeries = model<readonly number[]>([]);\n\n /**\n * Show a tooltip with the series, x, y and size of the point under the pointer.\n * Pointer only.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Render every point's values as a table only assistive technology reaches, beside the\n * drawing: one group of rows per series shown, headed by the series' name, a row per\n * point, and a column for x, for y and, when a point has one, for size. The drawing is\n * one named image, so without it the values are nowhere a screen reader can walk.\n * @default false\n */\n readonly dataTable = input(false, { transform: coerceBooleanProperty });\n\n /**\n * The radius, in px, the largest `size` shown is drawn at. Every other sized point is\n * scaled by AREA against it — a point of half the size has half the area, not half the\n * radius — and none is drawn under 4px. At least 4. @default 20\n */\n readonly maxRadius = input(20, {\n transform: (v: unknown): number => Math.max(MIN_RADIUS, coerceNumberProperty(v, 20)),\n });\n\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n\n private readonly plot = viewChild.required<ElementRef<HTMLElement>>('plot');\n\n /** The drawing's box, on the observer every chart shares: what a path of many markers is written for. */\n private readonly drawingSize = useChartSize(this.svg);\n\n /** Each marker's path and reach, built once per shape and radius. */\n private readonly markerOf = wrScatterMarkerCache();\n\n /**\n * Every series, resolved: its palette colour, its marker shape, and its points with\n * every one dropped whose `x` or `y` is not a finite number. Hidden ones included, since\n * the legend lists them.\n *\n * A point that cannot be placed is left out rather than kept: one NaN in the pooled\n * minimum makes every coordinate in every series NaN, and the whole chart vanishes\n * instead of one point. A point keeps its position in its series' `data` all the same,\n * so the data table numbers the rest as the consumer numbered them.\n */\n protected readonly resolvedSeries = computed(() =>\n this.series().map((s, index) => ({\n index,\n label: s.label,\n color: s.color ?? wrChartColor(index),\n marker: wrChartMarker(index),\n points: s.data.flatMap((p, i) =>\n Number.isFinite(p.x) && Number.isFinite(p.y)\n ? [\n {\n n: i + 1,\n x: p.x,\n y: p.y,\n size: typeof p.size === 'number' && Number.isFinite(p.size) && p.size >= 0 ? p.size : null,\n label: p.label ?? null,\n },\n ]\n : []\n ),\n }))\n );\n\n /** The legend's rows: every series, keyed by its own marker. */\n protected readonly legendItems = computed<readonly WrChartLegendItem[]>(() =>\n this.resolvedSeries().map(({ label, color, marker }) => ({ label, color, marker }))\n );\n\n /**\n * Whether the chart draws its legend: with a series to list, unless `legendPosition`\n * is `none` or `showLegend` is off. Under `showLegend=\"auto\"` a single series has\n * nothing to tell apart, and draws none.\n */\n protected readonly legendShown = computed(() => {\n const show = this.showLegend();\n const rows = this.legendItems().length;\n if (show === false || rows === 0 || this.legendPosition() === 'none') return false;\n return show === true || rows > 1;\n });\n\n /** Whether the legend comes before the plot, in the DOM as on screen: above it, or at inline start. */\n protected readonly legendFirst = computed(() => {\n const position = this.legendPosition();\n return position === 'top' || position === 'start';\n });\n\n /** Whether the legend sits beside the plot rather than above or below it. */\n protected readonly legendSide = computed(() => {\n const position = this.legendPosition();\n return position === 'start' || position === 'end';\n });\n\n /** Whether the chart has nothing to draw: no series, or none with a point it can place. Hidden ones count as data. */\n private readonly empty = computed(() => this.resolvedSeries().every(s => s.points.length === 0));\n\n /** What the chart shows in place of its points, or `null` while it draws them. */\n protected readonly state = useChartState({\n loading: this.loading,\n error: this.error,\n empty: this.empty,\n emptyLabel: this.emptyLabel,\n loadingLabel: this.loadingLabel,\n errorLabel: this.errorLabel,\n });\n\n /** The series drawn, read and fitted to: every one `hiddenSeries` does not name. */\n protected readonly visibleSeries = computed(() => {\n const hidden = new Set(this.hiddenSeries());\n return this.resolvedSeries().filter(s => !hidden.has(s.index));\n });\n\n /** The largest `size` among the points shown, or `null` when none has one — a plain scatter. */\n private readonly maxSize = computed(() => {\n let max: number | null = null;\n for (const s of this.visibleSeries())\n for (const p of s.points) if (p.size !== null) max = Math.max(max ?? 0, p.size);\n return max;\n });\n\n /** Whether any point shown has a size, which adds the size row and column. */\n protected readonly sized = computed(() => this.maxSize() !== null);\n\n /**\n * The x axis, from `wrChartAxis` over the points shown: fitted to the data with no zero\n * forced in, since a scatter has no baseline, snapped outward at both ends and lifted a\n * step at EITHER end a point would sit on (`symmetric`), so no point lands exactly on\n * the frame. A single value — one point, or a column of them — is centred with a step\n * either side. With nothing to fit, the 0 to 1 frame.\n */\n protected readonly xAxis = computed(() => this.fit(p => p.x));\n\n /** The y axis, fitted the way {@link xAxis} is. */\n protected readonly yAxis = computed(() => this.fit(p => p.y));\n\n /**\n * The points as drawn: placed by percentage on both axes, sized, and ordered LARGEST\n * FIRST so a small bubble is never buried under a large one. Points of equal size keep\n * the series' order, so a plain scatter draws series by series.\n */\n protected readonly points = computed<readonly DrawnPoint[]>(() => {\n const x = this.xAxis();\n const y = this.yAxis();\n const maxSize = this.maxSize();\n const maxRadius = this.maxRadius();\n const drawn = this.visibleSeries().flatMap(s =>\n s.points.map(p => {\n const r =\n p.size === null || maxSize === null\n ? POINT_RADIUS\n : Math.max(MIN_RADIUS, maxRadius * Math.sqrt(maxSize > 0 ? p.size / maxSize : 0));\n const marker = this.markerOf(s.marker, r);\n return {\n key: `${s.index}:${p.n}`,\n series: s.index,\n seriesLabel: s.label,\n color: s.color,\n marker: s.marker,\n n: p.n,\n x: p.x,\n y: p.y,\n size: p.size,\n label: p.label,\n left: percent(((p.x - x.min) / (x.max - x.min)) * 100),\n top: percent(((y.max - p.y) / (y.max - y.min)) * 100),\n r,\n d: marker.d,\n relative: marker.relative,\n values: p.size === null ? `${p.x} ${p.y} ${r}` : `${p.x} ${p.y} ${r} ${p.size}`,\n halo: this.markerOf(s.marker, r + HALO_GAP).extent,\n };\n })\n );\n return drawn.sort((a, b) => b.r - a.r);\n });\n\n /** Whether there are too many points shown for a node each: every series is then one path. */\n protected readonly dense = computed(() => this.points().length > DENSE_FROM);\n\n /**\n * The points as groups: each stretch of consecutive points of one series, in drawing\n * order. A plain scatter is a group per series; a bubble chart, whose points are drawn\n * largest first across series so no small bubble is buried, breaks a series into as\n * many groups as its sizes interleave with the others'. The group carries what its\n * points share - the colour, the shape and the legend row the hover dims by - so a\n * point carries only its own place and path. None once the chart is {@link dense}.\n */\n protected readonly runs = computed<readonly Run[]>(() => {\n if (this.dense()) return [];\n const runs: { key: string; series: number; color: string; marker: WrChartMarkerShape; points: DrawnPoint[] }[] = [];\n for (const point of this.points()) {\n const last = runs[runs.length - 1];\n if (last?.series === point.series) last.points.push(point);\n else {\n runs.push({\n key: point.key,\n series: point.series,\n color: point.color,\n marker: point.marker,\n points: [point],\n });\n }\n }\n return runs;\n });\n\n /** The box a path of many markers is written for, in px: the drawing's, once a browser has measured it. */\n private readonly denseSize = computed(() => {\n const { width, height } = this.drawingSize();\n return width > 0 && height > 0 ? { width, height } : { width: ASSUMED_WIDTH, height: this.height() };\n });\n\n /** The `viewBox` of the paths of many markers: the size they were written for, so nothing stretches once measured. */\n protected readonly denseBox = computed(() => `0 0 ${this.denseSize().width} ${this.denseSize().height}`);\n\n /**\n * Past {@link DENSE_FROM} points shown, every series as ONE path, a subpath per marker,\n * largest first within the series. A path takes no percentage, so it is written in px\n * for the drawing's measured size and again when that changes; until a browser has\n * measured it, for an assumed one the `viewBox` stretches to fit. Series are drawn in\n * order, so across series a large bubble can cover a smaller one of an earlier series -\n * the price of one element a series, and bubbles are see-through.\n */\n protected readonly densePaths = computed(() => {\n if (!this.dense()) return [];\n const { width, height } = this.denseSize();\n const bySeries = new Map<number, DrawnPoint[]>();\n for (const point of this.points()) {\n const list = bySeries.get(point.series);\n if (list) list.push(point);\n else bySeries.set(point.series, [point]);\n }\n return [...bySeries.entries()]\n .sort(([a], [b]) => a - b)\n .map(([series, points]) => ({\n series,\n color: points[0].color,\n marker: points[0].marker,\n count: points.length,\n d: wrScatterDensePath(points, width, height),\n }));\n });\n\n /** The points bucketed over the drawing, for the pointer: built once per change to the points. */\n private readonly index = computed(() =>\n wrScatterIndex(\n this.points().map(({ left, top, halo }) => ({ left, top, reach: Math.max(HIT_RADIUS, halo.radius) }))\n )\n );\n\n /**\n * How far the largest marker drawn reaches past its centre, in px, sideways and up or\n * down — its hover ring included, so hovering moves nothing. The axes keep a point\n * off the frame only when it lands exactly on it, and one a fraction of a step inside\n * sits a few px from it; the stylesheet takes the larger of this and the plot's inset\n * tokens as the plot's padding, so the marker stays inside the plot rather than over\n * the tick labels or past the chart's own box. By SHAPE, not radius: a triangle's\n * point reaches 1.56 times its radius up. The ring's stroke is the stylesheet's.\n *\n * Up or down it is held to a quarter of `height`, so a short plot with a large\n * `maxRadius` keeps half its height for the drawing and lets the marker overhang.\n */\n protected readonly reach = computed(() => {\n let x = 0;\n let y = 0;\n for (const { halo } of this.points()) {\n x = Math.max(x, halo.side);\n y = Math.max(y, halo.top, halo.bottom);\n }\n return { x: wrChartRound(x, 3), y: wrChartRound(Math.min(y, this.height() / 4), 3) };\n });\n\n /**\n * The y ticks, top to bottom: each value's label, its gridline's distance from the top\n * in percent, and whether it is the line at zero, which is drawn stronger.\n */\n protected readonly yTicks = computed(() => {\n const { min, max, step, ticks } = this.yAxis();\n const labels = this.numbers.ticks(ticks, step, 'y');\n return ticks.map((value, i) => ({\n label: labels[i],\n top: percent(((max - value) / (max - min)) * 100),\n zero: value === 0,\n }));\n });\n\n /** The x ticks, left to right: each value's label and its gridline's distance from the left, in percent. */\n protected readonly xTicks = computed(() => {\n const { min, max, step, ticks } = this.xAxis();\n const values = [...ticks].reverse();\n const labels = this.numbers.ticks(values, step, 'x');\n return values.map((value, i) => ({ label: labels[i], left: percent(((value - min) / (max - min)) * 100) }));\n });\n\n /**\n * How far apart two neighbouring x ticks are, as a percentage of the drawing's width —\n * the room each tick label has, half on either side of its gridline, which the\n * stylesheet bounds it to and ellipsises past.\n */\n protected readonly xSlot = computed(() => {\n const count = this.xTicks().length;\n return count <= 1 ? 100 : percent(100 / (count - 1));\n });\n\n /**\n * One tooltip for the point under the pointer: the series' swatch and name with the\n * point's own label as its heading, then a row each for x, y and size. It points at\n * the box of the marker's hover ring from above, so the chip clears a large bubble and\n * a triangle's point rather than sitting on its centre.\n *\n * Points are found by POSITION — the nearest within 16px of the pointer, or anywhere a\n * larger marker reaches — so a point under the open chip can still be reached by\n * moving onto it, the way a sparkline is scrubbed. The point is the one the pointer's\n * own lookup found: this reads it by its position in `points`, and measures the drawing\n * once to say where it is.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const point = this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg || this.state()) return null;\n const box = svg.getBoundingClientRect();\n const x = box.left + (point.left / 100) * box.width;\n const y = box.top + (point.top / 100) * box.height;\n const rows: WrChartTooltipRow[] = [\n { label: this.xName(), value: this.numbers.value(point.x, 'x') },\n { label: this.yName(), value: this.numbers.value(point.y, 'y') },\n ];\n if (point.size !== null) rows.push({ label: this.sizeName(), value: this.numbers.value(point.size, 'size') });\n return {\n datum: { label: point.seriesLabel, value: point.label ?? '', color: point.color, rows },\n anchor: {\n x: x - point.halo.side,\n y: y - point.halo.top,\n width: point.halo.side * 2,\n height: point.halo.top + point.halo.bottom,\n },\n };\n },\n (x, y) => this.pointAt(x, y)\n );\n\n /** The point the tooltip is reading, drawn again over the rest. None under a state, which has no point to read. */\n protected readonly activePoint = computed(() => {\n const index = this.tip.active();\n return index === null || this.state() ? null : (this.points()[index] ?? null);\n });\n\n /**\n * The hovered point's marker: its own shape a little larger, which the stylesheet rings\n * in the surface, so the reading stands clear of the points it overlaps.\n */\n protected readonly haloPath = computed(() => {\n const point = this.activePoint();\n return point ? this.markerOf(point.marker, point.r + HOVER_GROW).d : '';\n });\n\n /**\n * The figures for `dataTable`: the chart's name as the caption, one group per series\n * shown and headed by its name, and a row per point headed by the point's `label` or\n * its position in the series. Every value is written as the tooltip writes it; a point\n * with no size has an empty size cell in a chart where others have one.\n */\n protected readonly tableData = computed<WrChartTableData>(() => {\n const sized = this.sized();\n const value = (v: number, axis: WrScatterAxis): string => this.numbers.value(v, axis);\n return {\n caption: this.resolvedAriaLabel(),\n columns: sized ? [this.xName(), this.yName(), this.sizeName()] : [this.xName(), this.yName()],\n groups: this.visibleSeries().map(s => ({\n header: s.label,\n rows: s.points.map(p => {\n const cells = [value(p.x, 'x'), value(p.y, 'y')];\n if (sized) cells.push(p.size === null ? '' : value(p.size, 'size'));\n return { header: p.label ?? this.ordinals.format(p.n), cells };\n }),\n })),\n };\n });\n\n /**\n * The point under the pointer. A MOUSE event, as every chart's is: a tap fires the\n * compatibility `mousemove` and no `pointermove`. Off every point, the open tooltip\n * starts its grace period.\n *\n * Only while no chip is up: an open chip follows the pointer by itself, through\n * `pointAt`, so each move is looked up once.\n */\n private onPointerMove(event: MouseEvent): void {\n if (!this.tooltip() || this.tip.active() !== null) return;\n const index = this.pointAt(event.clientX, event.clientY);\n if (index === null) this.tip.leave(event);\n else this.tip.enter(index);\n }\n\n /**\n * The point nearest a viewport position: within 16px of its centre, or within the\n * circle its hover ring fits in where that is larger — a triangle's point or a\n * diamond's tips reach past its radius — and the nearest centre where several qualify.\n * A drawing with no box (nothing laid out yet) answers nothing. One layout read, and a\n * look in the few cells of the index the pointer can reach rather than at every point.\n */\n private pointAt(clientX: number, clientY: number): number | null {\n const svg = this.svg()?.nativeElement;\n if (!svg || this.state()) return null;\n const box = svg.getBoundingClientRect();\n if (box.width <= 0 || box.height <= 0) return null;\n return wrScatterHit(\n this.index(),\n ((clientX - box.left) / box.width) * 100,\n ((clientY - box.top) / box.height) * 100,\n box.width,\n box.height\n );\n }\n\n /** One axis over the points shown: `wrChartAxis` with both ends kept off the data, and one value centred. */\n private fit(read: (point: { readonly x: number; readonly y: number }) => number): WrChartAxis {\n let min = Number.POSITIVE_INFINITY;\n let max = Number.NEGATIVE_INFINITY;\n for (const s of this.visibleSeries()) {\n for (const p of s.points) {\n const v = read(p);\n if (v < min) min = v;\n if (v > max) max = v;\n }\n }\n // No point at all leaves both infinite, which `wrChartAxis` answers with the empty frame;\n // one value, or a column of them, it centres between a step on either side.\n return wrChartAxis(min, max, { symmetric: true });\n }\n}\n\nexport type { WrScatterAxis, WrScatterPoint, WrScatterSeries } from './types';\n","@let active = activePoint();\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 marker shape, the channel that tells the\n points apart where the colours do not. Rows are tracked by position, so two series\n that share a label are two rows. -->\n<ng-template #legend>\n <ul\n wr-chart-legend\n class=\"wr-scatter-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<!-- Three columns: the y axis' name turned along the axis, the y tick labels, and the\n drawing, with the x tick labels and the x axis' name under the drawing only, so\n their percentages are the drawing's. -->\n<div class=\"wr-scatter-chart__body\">\n @if (yLabel()) {\n <!-- Along its axis, beside the scale it names: set level above the plot it read as an\n entry of a legend placed there. -->\n <div class=\"wr-scatter-chart__y-title\">{{ yLabel() }}</div>\n }\n\n @if (showAxis()) {\n <!-- HTML beside the drawing rather than `<text>` inside it, in flow, so the column is\n exactly as wide as the longest label; each one hands the stylesheet the y of its\n own gridline. Hidden, as the drawing is one image: its name is what is announced,\n and the values are the data table's. -->\n <div class=\"wr-scatter-chart__y-axis\" aria-hidden=\"true\">\n @for (tick of yTicks(); track $index) {\n <span class=\"wr-scatter-chart__y-tick\" [style.--wr-scatter-chart-y]=\"tick.top\">{{ 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 a point is found by position. -->\n <div\n #plot\n class=\"wr-scatter-chart__plot\"\n role=\"img\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [style.height.px]=\"height()\"\n >\n <!-- No viewBox: every position is a PERCENTAGE of the drawing, so nothing stretches.\n A viewBox with `preserveAspectRatio=\"none\"` would squash each marker with the\n drawing, a circle into an oval and a square into a bar, and a scatter's marker is\n its series' only channel besides colour. -->\n <!-- Hidden as well as presentational: `img` already makes it so, but every point is\n an `<svg>` of its own, and a tree that holds a node per point for thousands of\n them is work for nothing. -->\n <svg #svg class=\"wr-scatter-chart__svg\" aria-hidden=\"true\">\n @if (showGrid()) {\n @for (tick of yTicks(); track $index) {\n <!-- The line at zero takes the stronger `--wr-scatter-chart-zero-color`. -->\n <line\n class=\"wr-scatter-chart__grid-line\"\n [class.wr-scatter-chart__grid-line--zero]=\"tick.zero\"\n x1=\"0\"\n x2=\"100%\"\n [attr.y1]=\"`${tick.top}%`\"\n [attr.y2]=\"`${tick.top}%`\"\n />\n }\n @for (tick of xTicks(); track $index) {\n <!-- Painted `transparent` by default: a chart reads its values across. The\n lines stay so that `--wr-scatter-chart-grid-x-color` can draw them. -->\n <line\n class=\"wr-scatter-chart__grid-line wr-scatter-chart__grid-line--x\"\n [attr.x1]=\"`${tick.left}%`\"\n [attr.x2]=\"`${tick.left}%`\"\n y1=\"0\"\n y2=\"100%\"\n />\n }\n }\n\n @if (!shown) {\n @for (run of runs(); track run.key) {\n <!-- A stretch of one series' points, in drawing order. The group carries what\n they share: the fill, the shape, and `data-wr-series`, the series' row in\n the legend, which the shared hover dims by. -->\n <g\n class=\"wr-scatter-chart__series\"\n [attr.fill]=\"run.color\"\n [attr.data-wr-series]=\"run.series\"\n [attr.data-marker]=\"run.marker\"\n >\n @for (p of run.points; track p.key) {\n <!-- A nested `<svg>` placed by percentage, its marker drawn about its origin\n in px: an SVG's `x` and `y` take a percentage where a `transform` does\n not, so the marker sits on its point at any size and keeps its own. Its\n viewport is the drawing's whole box, painted nowhere, and `overflow`\n lets the marker reach outside it. `data-point` is the point's x, y and\n radius, and its size when it has one: what a test harness reads. -->\n <svg\n class=\"wr-scatter-chart__point\"\n [attr.x]=\"`${p.left}%`\"\n [attr.y]=\"`${p.top}%`\"\n overflow=\"visible\"\n [attr.data-point]=\"p.values\"\n >\n <path class=\"wr-scatter-chart__marker\" [attr.d]=\"p.d\" />\n </svg>\n }\n </g>\n }\n\n @if (dense()) {\n <!-- Too many points for a node each: every series is one path, a subpath per\n marker, in px of the drawing's measured size. The `viewBox` is that size, so\n nothing is scaled once it is measured; before that, and between a resize and\n the path written for it, the markers stretch with the box. -->\n <svg\n class=\"wr-scatter-chart__dense\"\n [attr.viewBox]=\"denseBox()\"\n preserveAspectRatio=\"none\"\n width=\"100%\"\n height=\"100%\"\n overflow=\"visible\"\n >\n @for (s of densePaths(); track s.series) {\n <path\n class=\"wr-scatter-chart__points wr-scatter-chart__marker\"\n vector-effect=\"non-scaling-stroke\"\n [attr.d]=\"s.d\"\n [attr.fill]=\"s.color\"\n [attr.data-wr-series]=\"s.series\"\n [attr.data-marker]=\"s.marker\"\n [attr.data-count]=\"s.count\"\n />\n }\n </svg>\n }\n }\n\n @if (active) {\n <!-- The point being read, drawn again over the rest: its own shape a little\n larger, solid, inside a ring of the surface. -->\n <svg class=\"wr-scatter-chart__halo\" [attr.x]=\"`${active.left}%`\" [attr.y]=\"`${active.top}%`\" overflow=\"visible\">\n <path [attr.d]=\"haloPath()\" [attr.fill]=\"active.color\" />\n </svg>\n }\n </svg>\n </div>\n\n @if (shown) {\n <!-- Empty, loading or failed: the message, over the grid and the axes 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 (showAxis()) {\n <!-- The strip is as wide as the plot, and hands the stylesheet the distance between\n two ticks; each label hands it the x of its gridline, as a percentage of the\n drawing's width. -->\n <div class=\"wr-scatter-chart__x-axis\" aria-hidden=\"true\" [style.--wr-scatter-chart-x-slot]=\"xSlot()\">\n @for (tick of xTicks(); track $index) {\n <span class=\"wr-scatter-chart__x-tick\" [style.--wr-scatter-chart-x]=\"tick.left\">{{ tick.label }}</span>\n }\n </div>\n }\n\n @if (xLabel()) {\n <div class=\"wr-scatter-chart__x-title\">{{ xLabel() }}</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"],"mappings":";;;;;;;;;;;;;;;AAQA,MAAM,WAAW;AAEjB,MAAM,UAAU,SAAiB,SAC/B,KAAK,IAAI,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,MAAO,UAAU,MAAO,IAAI,CAAC,CAAC;A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A;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -3,7 +3,7 @@ import { Component, ElementRef, ViewEncapsulation, computed, inject, input, view
3
3
  import { coerceBooleanProperty, coerceNumberProperty } from "@angular/cdk/coercion";
4
4
  import { wrCheckStyles } from "ngwr/utils";
5
5
  import { useChartNumbers } from "ngwr/charts/core";
6
- import { useChartTooltip } from "ngwr/popover";
6
+ import { useChartTooltip, wrCoerceChartTooltip } from "ngwr/popover";
7
7
  /**
8
8
  * @license
9
9
  *
@@ -16,7 +16,7 @@ var WrSparkline = class WrSparkline {
16
16
  }
17
17
  data = input([], ...ngDevMode ? [{ debugName: "data" }] : /* istanbul ignore next */ []);
18
18
  ariaLabel = input(null, ...ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
19
- color = input("var(--wr-color-primary)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
19
+ color = input("var(--wr-chart-1)", ...ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []);
20
20
  strokeWidth = input(1.5, {
21
21
  ...ngDevMode ? { debugName: "strokeWidth" } : /* istanbul ignore next */ {},
22
22
  transform: (v) => Math.max(.1, coerceNumberProperty(v, 1.5))
@@ -33,7 +33,7 @@ var WrSparkline = class WrSparkline {
33
33
  height = input("2rem", ...ngDevMode ? [{ debugName: "height" }] : /* istanbul ignore next */ []);
34
34
  tooltip = input(true, {
35
35
  ...ngDevMode ? { debugName: "tooltip" } : /* istanbul ignore next */ {},
36
- transform: coerceBooleanProperty
36
+ transform: wrCoerceChartTooltip
37
37
  });
38
38
  valueFormat = input(null, ...ngDevMode ? [{ debugName: "valueFormat" }] : /* istanbul ignore next */ []);
39
39
  numbers = useChartNumbers(this.valueFormat);
@@ -86,6 +86,16 @@ var WrSparkline = class WrSparkline {
86
86
  return last ? `M ${last.x.toFixed(2)} ${last.y.toFixed(2)} h 0` : null;
87
87
  }, ...ngDevMode ? [{ debugName: "tipPath" }] : /* istanbul ignore next */ []);
88
88
  viewBox = `0 0 ${this.vbW} ${this.vbH}`;
89
+ inset = computed(() => this.showTip() ? this.strokeWidth() * 1.5 : this.strokeWidth() / 2, ...ngDevMode ? [{ debugName: "inset" }] : /* istanbul ignore next */ []);
90
+ drawing(box) {
91
+ const inset = this.inset();
92
+ return {
93
+ left: box.left + inset,
94
+ top: box.top + inset,
95
+ width: Math.max(0, box.width - 2 * inset),
96
+ height: Math.max(0, box.height - 2 * inset)
97
+ };
98
+ }
89
99
  tip = useChartTooltip(this.tooltip, (index) => {
90
100
  const value = this.values()[index];
91
101
  const marker = this.marker()?.nativeElement;
@@ -112,7 +122,7 @@ var WrSparkline = class WrSparkline {
112
122
  if (!point || !svg) return null;
113
123
  const host = this.host.nativeElement;
114
124
  const outer = host.getBoundingClientRect();
115
- const box = svg.getBoundingClientRect();
125
+ const box = this.drawing(svg.getBoundingClientRect());
116
126
  return {
117
127
  x: box.left - outer.left - host.clientLeft + point.x / this.vbW * box.width,
118
128
  y: box.top - outer.top - host.clientTop + point.y / this.vbH * box.height
@@ -124,9 +134,10 @@ var WrSparkline = class WrSparkline {
124
134
  }
125
135
  indexAt(clientX, box) {
126
136
  const count = this.points().length;
127
- if (count === 0 || box.width <= 0) return null;
137
+ const drawing = this.drawing(box);
138
+ if (count === 0 || drawing.width <= 0) return null;
128
139
  if (count === 1) return 0;
129
- const x = (clientX - box.left) / box.width * this.vbW;
140
+ const x = (clientX - drawing.left) / drawing.width * this.vbW;
130
141
  const step = (this.vbW - this.padding * 2) / (count - 1);
131
142
  return Math.min(count - 1, Math.max(0, Math.round((x - this.padding) / step)));
132
143
  }
@@ -231,7 +242,7 @@ var WrSparkline = class WrSparkline {
231
242
  isSignal: true
232
243
  }],
233
244
  ngImport: i0,
234
- template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n",
245
+ template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n",
235
246
  encapsulation: i0.ViewEncapsulation.None
236
247
  });
237
248
  };
@@ -246,7 +257,7 @@ i0.ɵɵngDeclareClassMetadata({
246
257
  selector: "wr-sparkline",
247
258
  encapsulation: ViewEncapsulation.None,
248
259
  host: { class: "wr-sparkline" },
249
- template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n"
260
+ template: "<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n"
250
261
  }]
251
262
  }],
252
263
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-charts-sparkline.mjs","names":[],"sources":["../../../projects/lib/charts/sparkline/sparkline.ts","../../../projects/lib/charts/sparkline/sparkline.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, computed, inject, input, viewChild } from '@angular/core';\n\nimport { useChartNumbers } from 'ngwr/charts/core';\nimport { useChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Tiny inline trend line. SVG path drawn from `[data]: number[]` — no\n * axes, no labels, just the shape. Optional area fill + tip dot.\n *\n * @example\n * ```html\n * <wr-sparkline [data]=\"[12, 14, 9, 17, 21, 18, 23]\" />\n * <wr-sparkline [data]=\"prices\" [showArea]=\"true\" color=\"var(--wr-color-success)\" />\n * ```\n *\n * @see https://ngwr.dev/charts/sparkline\n */\n@Component({\n selector: 'wr-sparkline',\n templateUrl: './sparkline.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sparkline' },\n})\nexport class WrSparkline {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/sparkline');\n }\n\n /**\n * The values, left to right. Evenly spaced — a sparkline carries no x axis, so\n * pass an already-ordered series rather than points with their own timestamps.\n */\n readonly data = input<readonly number[]>([]);\n\n /**\n * Accessible name. A sparkline usually sits beside the number it summarises, where\n * announcing it again is noise — so it is `aria-hidden` by default and becomes a\n * named `role=\"img\"` only when a consumer says what it shows.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /** Stroke colour. @default 'var(--wr-color-primary)' */\n readonly color = input<string>('var(--wr-color-primary)');\n\n /**\n * Line thickness in CSS pixels — `vector-effect=\"non-scaling-stroke\"` keeps it at\n * that width whatever the box is stretched to, so it is NOT in viewBox units.\n * @default 1.5\n */\n readonly strokeWidth = input(1.5, {\n transform: (v: unknown): number => Math.max(0.1, coerceNumberProperty(v, 1.5)),\n });\n\n /** Fill the area below the line, faintly (`--wr-sparkline-area-opacity`). @default false */\n readonly showArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show a dot at the last data point. @default true */\n readonly showTip = input(true, { transform: coerceBooleanProperty });\n\n /** CSS width. @default '8rem' */\n readonly width = input<string>('8rem');\n\n /** CSS height. @default '2rem' */\n readonly height = input<string>('2rem');\n\n /**\n * Show a tooltip with the value of the point nearest the pointer, marking that\n * point, and named by `ariaLabel` when one is given. Pointer only. @default true\n */\n readonly tooltip = input(true, { transform: coerceBooleanProperty });\n\n /**\n * Writes the value in the tooltip. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The value as the tooltip writes it — in full, never compact, to `Intl`'s default precision. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n private readonly marker = viewChild<ElementRef<HTMLElement>>('marker');\n\n // Drawn in a 100×40 viewBox — scales smoothly to any CSS size.\n private readonly vbW = 100;\n private readonly vbH = 40;\n private readonly padding = 2;\n\n /**\n * The data as drawn. Non-finite values are dropped rather than scaled: every\n * `min`/`max` comparison against a NaN is false, so it survived into the scale and\n * `toFixed(2)` wrote the literal text `NaN` into the path `d` — invalid geometry,\n * and the line vanishes. The tooltip reads this list too, so the value it shows is\n * the one under the point it marks.\n */\n private readonly values = computed(() => this.data().filter(v => Number.isFinite(v)));\n\n /** Mapped `{ x, y }` points for the path. */\n protected readonly points = computed(() => {\n const data = this.values();\n if (data.length === 0) return [] as readonly { x: number; y: number }[];\n if (data.length === 1) return [{ x: this.vbW / 2, y: this.vbH / 2 }];\n\n let min = data[0];\n let max = data[0];\n for (const v of data) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n const pad = this.padding;\n const w = this.vbW - pad * 2;\n const h = this.vbH - pad * 2;\n // A series with no spread has no shape, and dividing by the old `|| 1` fallback\n // pinned every point to `pad + h` — the bottom edge — so a steady series at 500\n // read as rock bottom. Centred instead, which is what a lone datum already does.\n if (max === min) {\n return data.map((_, i) => ({ x: pad + (i / (data.length - 1)) * w, y: this.vbH / 2 }));\n }\n const span = max - min;\n return data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * w,\n y: pad + h - ((v - min) / span) * h,\n }));\n });\n\n /**\n * The line through every point. A lone point repeats itself: a subpath of one `M` is\n * never stroked, so a one-value sparkline with `showTip` off drew nothing at all, and\n * the round cap paints the repeat as a dot of the line's width.\n */\n protected readonly linePath = computed(() => {\n const points = this.points();\n const path = points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n return points.length === 1 ? `${path} L ${points[0].x.toFixed(2)} ${points[0].y.toFixed(2)}` : path;\n });\n\n protected readonly areaPath = computed(() => {\n const pts = this.points();\n if (pts.length < 2) return '';\n const baseY = this.vbH - this.padding;\n const start = `M ${pts[0].x.toFixed(2)} ${baseY}`;\n const line = pts.map(p => `L ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n const close = `L ${pts[pts.length - 1].x.toFixed(2)} ${baseY} Z`;\n return `${start} ${line} ${close}`;\n });\n\n /** A zero-length line at the last point, which a round cap paints as the tip dot. */\n protected readonly tipPath = computed(() => {\n const last = this.points().at(-1);\n return last ? `M ${last.x.toFixed(2)} ${last.y.toFixed(2)} h 0` : null;\n });\n\n protected readonly viewBox = `0 0 ${this.vbW} ${this.vbH}`;\n\n /**\n * One tooltip, pointing at the hovered point: above its marker, below it when there\n * is no room. The marker is the anchor element itself, drawn for the point the\n * tooltip reads — it renders before this runs, since both follow `tip.active()`.\n *\n * The chip sits INSIDE the drawing, over the stretch of line above the marker, so the\n * helper is also told which point any spot over the drawing reads: a pointer scrubbing\n * along the top of a sparkline would otherwise land on the chip and stop there.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const value = this.values()[index];\n const marker = this.marker()?.nativeElement;\n if (value === undefined || !marker) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.numbers.value(value), color: this.color() },\n anchor: marker,\n };\n },\n (x, y) => {\n const svg = this.svg()?.nativeElement;\n if (!svg) return null;\n const box = svg.getBoundingClientRect();\n if (x < box.left || x > box.right || y < box.top || y > box.bottom) return null;\n return this.indexAt(x, box);\n }\n );\n\n /**\n * The marker's place in pixels from the host's padding edge, measured off the\n * DRAWING's box. An element rather than a `<circle>`: the drawing stretches to\n * any box with `preserveAspectRatio=\"none\"`, which would squash a circle into an\n * ellipse.\n *\n * Not percentages of the host, which is what it was: the host is only the\n * drawing's size until something stretches it — `width: 100%` on the element,\n * `display: block`, a column flex parent — while the drawing keeps its `width`.\n * Measured in Chromium, WebKit and Firefox on a 327px host round the default\n * 128px drawing, the marker for a point at 115px landed at 292px, out in empty\n * space with the chip above it. Read when a point is hovered, so the boxes are\n * laid out; `tip.active()` is never set on the server.\n */\n protected readonly markerAt = computed(() => {\n const index = this.tip.active();\n const point = index === null ? undefined : this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg) return null;\n const host = this.host.nativeElement;\n const outer = host.getBoundingClientRect();\n const box = svg.getBoundingClientRect();\n return {\n x: box.left - outer.left - host.clientLeft + (point.x / this.vbW) * box.width,\n y: box.top - outer.top - host.clientTop + (point.y / this.vbH) * box.height,\n };\n });\n\n protected onPointerMove(event: MouseEvent): void {\n const index = this.indexAt(event.clientX, (event.currentTarget as Element).getBoundingClientRect());\n if (index !== null) this.tip.enter(index);\n }\n\n /**\n * The point nearest the pointer, along x only — the points are evenly spaced, so\n * that is a rounding rather than a search. A box with no width (nothing laid out\n * yet) answers nothing rather than a NaN index.\n */\n private indexAt(clientX: number, box: DOMRect): number | null {\n const count = this.points().length;\n if (count === 0 || box.width <= 0) return null;\n if (count === 1) return 0;\n const x = ((clientX - box.left) / box.width) * this.vbW;\n const step = (this.vbW - this.padding * 2) / (count - 1);\n return Math.min(count - 1, Math.max(0, Math.round((x - this.padding) / step)));\n }\n}\n","<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,kBAAkB;CACrF;CAMS,OAAO,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAOnC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAGtC,QAAQ,MAAc,2BAA0B,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAOhD,cAAc,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,cAAA,+BAAA,CAAA;EAC9B,YAAY,MAAuB,KAAK,IAAI,IAAK,qBAAqB,GAAG,GAAG,CAAC;CAAC,CAAA;CAIvE,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAG1D,UAAU,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,UAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAGxD,QAAQ,MAAc,QAAO,GAAA,YAA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../../projects/lib/charts/sparkline/sparkline.ts","../../../projects/lib/charts/sparkline/sparkline.html"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty, coerceNumberProperty } from '@angular/cdk/coercion';\nimport { Component, ElementRef, ViewEncapsulation, computed, inject, input, viewChild } from '@angular/core';\n\nimport { useChartNumbers } from 'ngwr/charts/core';\nimport { useChartTooltip, wrCoerceChartTooltip } from 'ngwr/popover';\nimport { wrCheckStyles } from 'ngwr/utils';\n\n/**\n * Tiny inline trend line. SVG path drawn from `[data]: number[]` — no\n * axes, no labels, just the shape. Optional area fill + tip dot.\n *\n * The line is the first colour of the chart palette (`--wr-chart-1`) unless `color`\n * says otherwise. The drawing is inset from its box by the tip dot's radius, so the dot\n * on a last point at the edge, or on the highest or lowest one, stays inside `width` by\n * `height` and no ancestor that clips at the box cuts it.\n *\n * @example\n * ```html\n * <wr-sparkline [data]=\"[12, 14, 9, 17, 21, 18, 23]\" />\n * <wr-sparkline [data]=\"prices\" [showArea]=\"true\" color=\"var(--wr-color-success)\" />\n * ```\n *\n * @see https://ngwr.dev/charts/sparkline\n */\n@Component({\n selector: 'wr-sparkline',\n templateUrl: './sparkline.html',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-sparkline' },\n})\nexport class WrSparkline {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('charts/sparkline');\n }\n\n /**\n * The values, left to right. Evenly spaced — a sparkline carries no x axis, so\n * pass an already-ordered series rather than points with their own timestamps.\n */\n readonly data = input<readonly number[]>([]);\n\n /**\n * Accessible name. A sparkline usually sits beside the number it summarises, where\n * announcing it again is noise — so it is `aria-hidden` by default and becomes a\n * named `role=\"img\"` only when a consumer says what it shows.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Stroke colour. The first colour of the chart palette, which is the brand colour\n * unless the theme says otherwise. @default 'var(--wr-chart-1)'\n */\n readonly color = input<string>('var(--wr-chart-1)');\n\n /**\n * Line thickness in CSS pixels — `vector-effect=\"non-scaling-stroke\"` keeps it at\n * that width whatever the box is stretched to, so it is NOT in viewBox units.\n * @default 1.5\n */\n readonly strokeWidth = input(1.5, {\n transform: (v: unknown): number => Math.max(0.1, coerceNumberProperty(v, 1.5)),\n });\n\n /** Fill the area below the line, faintly (`--wr-sparkline-area-opacity`). @default false */\n readonly showArea = input(false, { transform: coerceBooleanProperty });\n\n /** Show a dot at the last data point. @default true */\n readonly showTip = input(true, { transform: coerceBooleanProperty });\n\n /** CSS width. @default '8rem' */\n readonly width = input<string>('8rem');\n\n /** CSS height. @default '2rem' */\n readonly height = input<string>('2rem');\n\n /**\n * Show a tooltip with the value of the point nearest the pointer, marking that point,\n * and named by `ariaLabel` when one is given. Pointer only.\n *\n * By default the pointer passes under the chip to the chart, so the next section\n * answers at once and the chip closes off the chart; `'hoverable'` lets the pointer\n * rest on the chip instead, as WCAG 1.4.13 asks of a hint. @default true\n */\n readonly tooltip = input<boolean | 'hoverable', unknown>(true, { transform: wrCoerceChartTooltip });\n\n /**\n * Writes the value in the tooltip. `null` uses `Intl.NumberFormat` in `LOCALE_ID`.\n */\n readonly valueFormat = input<((value: number) => string) | null>(null);\n\n /** The value as the tooltip writes it — in full, never compact, to `Intl`'s default precision. */\n private readonly numbers = useChartNumbers(this.valueFormat);\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n private readonly svg = viewChild<ElementRef<SVGSVGElement>>('svg');\n private readonly marker = viewChild<ElementRef<HTMLElement>>('marker');\n\n // Drawn in a 100×40 viewBox — scales smoothly to any CSS size.\n private readonly vbW = 100;\n private readonly vbH = 40;\n private readonly padding = 2;\n\n /**\n * The data as drawn. Non-finite values are dropped rather than scaled: every\n * `min`/`max` comparison against a NaN is false, so it survived into the scale and\n * `toFixed(2)` wrote the literal text `NaN` into the path `d` — invalid geometry,\n * and the line vanishes. The tooltip reads this list too, so the value it shows is\n * the one under the point it marks.\n */\n private readonly values = computed(() => this.data().filter(v => Number.isFinite(v)));\n\n /** Mapped `{ x, y }` points for the path. */\n protected readonly points = computed(() => {\n const data = this.values();\n if (data.length === 0) return [] as readonly { x: number; y: number }[];\n if (data.length === 1) return [{ x: this.vbW / 2, y: this.vbH / 2 }];\n\n let min = data[0];\n let max = data[0];\n for (const v of data) {\n if (v < min) min = v;\n if (v > max) max = v;\n }\n const pad = this.padding;\n const w = this.vbW - pad * 2;\n const h = this.vbH - pad * 2;\n // A series with no spread has no shape, and dividing by the old `|| 1` fallback\n // pinned every point to `pad + h` — the bottom edge — so a steady series at 500\n // read as rock bottom. Centred instead, which is what a lone datum already does.\n if (max === min) {\n return data.map((_, i) => ({ x: pad + (i / (data.length - 1)) * w, y: this.vbH / 2 }));\n }\n const span = max - min;\n return data.map((v, i) => ({\n x: pad + (i / (data.length - 1)) * w,\n y: pad + h - ((v - min) / span) * h,\n }));\n });\n\n /**\n * The line through every point. A lone point repeats itself: a subpath of one `M` is\n * never stroked, so a one-value sparkline with `showTip` off drew nothing at all, and\n * the round cap paints the repeat as a dot of the line's width.\n */\n protected readonly linePath = computed(() => {\n const points = this.points();\n const path = points.map((p, i) => `${i === 0 ? 'M' : 'L'} ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n return points.length === 1 ? `${path} L ${points[0].x.toFixed(2)} ${points[0].y.toFixed(2)}` : path;\n });\n\n protected readonly areaPath = computed(() => {\n const pts = this.points();\n if (pts.length < 2) return '';\n const baseY = this.vbH - this.padding;\n const start = `M ${pts[0].x.toFixed(2)} ${baseY}`;\n const line = pts.map(p => `L ${p.x.toFixed(2)} ${p.y.toFixed(2)}`).join(' ');\n const close = `L ${pts[pts.length - 1].x.toFixed(2)} ${baseY} Z`;\n return `${start} ${line} ${close}`;\n });\n\n /** A zero-length line at the last point, which a round cap paints as the tip dot. */\n protected readonly tipPath = computed(() => {\n const last = this.points().at(-1);\n return last ? `M ${last.x.toFixed(2)} ${last.y.toFixed(2)} h 0` : null;\n });\n\n protected readonly viewBox = `0 0 ${this.vbW} ${this.vbH}`;\n\n /**\n * How far the drawing sits in from the edge of its box, in px: the radius of the tip\n * dot, three times the line's width across, or half the line's width with no dot. It is\n * the SVG's padding, so the viewport the points are scaled into is that much smaller on\n * every side and nothing drawn at an edge reaches past `width` by `height`. The dot of\n * a last point used to hang over the box, where a table cell or a card cut it off.\n */\n protected readonly inset = computed(() => (this.showTip() ? this.strokeWidth() * 1.5 : this.strokeWidth() / 2));\n\n /** The box the viewBox is stretched over: the SVG's box, less its padding. */\n private drawing(box: DOMRect): { left: number; top: number; width: number; height: number } {\n const inset = this.inset();\n return {\n left: box.left + inset,\n top: box.top + inset,\n width: Math.max(0, box.width - 2 * inset),\n height: Math.max(0, box.height - 2 * inset),\n };\n }\n\n /**\n * One tooltip, pointing at the hovered point: above its marker, below it when there\n * is no room. The marker is the anchor element itself, drawn for the point the\n * tooltip reads — it renders before this runs, since both follow `tip.active()`.\n *\n * The chip sits INSIDE the drawing, over the stretch of line above the marker, so the\n * helper is also told which point any spot over the drawing reads: a pointer scrubbing\n * along the top of a sparkline would otherwise land on the chip and stop there.\n */\n protected readonly tip = useChartTooltip(\n this.tooltip,\n index => {\n const value = this.values()[index];\n const marker = this.marker()?.nativeElement;\n if (value === undefined || !marker) return null;\n return {\n datum: { label: this.ariaLabel() ?? undefined, value: this.numbers.value(value), color: this.color() },\n anchor: marker,\n };\n },\n (x, y) => {\n const svg = this.svg()?.nativeElement;\n if (!svg) return null;\n const box = svg.getBoundingClientRect();\n if (x < box.left || x > box.right || y < box.top || y > box.bottom) return null;\n return this.indexAt(x, box);\n }\n );\n\n /**\n * The marker's place in pixels from the host's padding edge, measured off the\n * DRAWING's box. An element rather than a `<circle>`: the drawing stretches to\n * any box with `preserveAspectRatio=\"none\"`, which would squash a circle into an\n * ellipse.\n *\n * Not percentages of the host, which is what it was: the host is only the\n * drawing's size until something stretches it — `width: 100%` on the element,\n * `display: block`, a column flex parent — while the drawing keeps its `width`.\n * Measured in Chromium, WebKit and Firefox on a 327px host round the default\n * 128px drawing, the marker for a point at 115px landed at 292px, out in empty\n * space with the chip above it. Read when a point is hovered, so the boxes are\n * laid out; `tip.active()` is never set on the server.\n */\n protected readonly markerAt = computed(() => {\n const index = this.tip.active();\n const point = index === null ? undefined : this.points()[index];\n const svg = this.svg()?.nativeElement;\n if (!point || !svg) return null;\n const host = this.host.nativeElement;\n const outer = host.getBoundingClientRect();\n const box = this.drawing(svg.getBoundingClientRect());\n return {\n x: box.left - outer.left - host.clientLeft + (point.x / this.vbW) * box.width,\n y: box.top - outer.top - host.clientTop + (point.y / this.vbH) * box.height,\n };\n });\n\n protected onPointerMove(event: MouseEvent): void {\n const index = this.indexAt(event.clientX, (event.currentTarget as Element).getBoundingClientRect());\n if (index !== null) this.tip.enter(index);\n }\n\n /**\n * The point nearest the pointer, along x only — the points are evenly spaced, so\n * that is a rounding rather than a search. A box with no width (nothing laid out\n * yet) answers nothing rather than a NaN index.\n */\n private indexAt(clientX: number, box: DOMRect): number | null {\n const count = this.points().length;\n const drawing = this.drawing(box);\n if (count === 0 || drawing.width <= 0) return null;\n if (count === 1) return 0;\n const x = ((clientX - drawing.left) / drawing.width) * this.vbW;\n const step = (this.vbW - this.padding * 2) / (count - 1);\n return Math.min(count - 1, Math.max(0, Math.round((x - this.padding) / step)));\n }\n}\n","<svg\n #svg\n [attr.viewBox]=\"viewBox\"\n [style.width]=\"width()\"\n [style.height]=\"height()\"\n [style.padding.px]=\"inset()\"\n [attr.role]=\"ariaLabel() ? 'img' : null\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-hidden]=\"ariaLabel() ? null : 'true'\"\n preserveAspectRatio=\"none\"\n (mousemove)=\"onPointerMove($event)\"\n (mouseleave)=\"tip.leave($event)\"\n>\n @if (showArea() && areaPath()) {\n <!-- The fill's share of its colour is the stylesheet's, from `--wr-sparkline-area-opacity`. -->\n <path class=\"wr-sparkline__area\" [attr.d]=\"areaPath()\" [attr.fill]=\"color()\" stroke=\"none\" />\n }\n @if (linePath()) {\n <path\n class=\"wr-sparkline__line\"\n [attr.d]=\"linePath()\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth()\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n <!-- A zero-length line with a round cap and a non-scaling stroke, which stays a\n circle however the drawing stretches; a `<circle>` stretched with it, into a\n 21 × 5px pill on the docs' full-width demo. Three times the line's width. -->\n @if (showTip() && tipPath(); as d) {\n <path\n class=\"wr-sparkline__tip\"\n [attr.d]=\"d\"\n fill=\"none\"\n [attr.stroke]=\"color()\"\n [attr.stroke-width]=\"strokeWidth() * 3\"\n stroke-linecap=\"round\"\n vector-effect=\"non-scaling-stroke\"\n />\n }\n</svg>\n@if (markerAt(); as at) {\n <span\n #marker\n class=\"wr-sparkline__marker\"\n aria-hidden=\"true\"\n [style.left.px]=\"at.x\"\n [style.top.px]=\"at.y\"\n [style.background]=\"color()\"\n ></span>\n}\n"],"mappings":";;;;;;;;;;;;AAqCA,IAAa,cAAb,MAAa,YAAW;CACtB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,kBAAkB;CACrF;CAMS,OAAO,MAAyB,CAAA,GAAG,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAOnC,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAMtC,QAAQ,MAAc,qBAAoB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAO1C,cAAc,MAAM,KAAG;EAAA,GAAA,YAAA,EAAA,WAAA,cAAA,+BAAA,CAAA;EAC9B,YAAY,MAAuB,KAAK,IAAI,IAAK,qBAAqB,GAAG,GAAG,CAAC;CAAC,CAAA;CAIvE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