billboard.js 4.1.4 → 4.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/dist/billboard.css +87 -1
  2. package/dist/billboard.js +11129 -7032
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +20 -20
  5. package/dist/billboard.pkgd.js +22703 -14154
  6. package/dist/billboard.pkgd.min.js +37 -37
  7. package/dist/billboard.react.js +5 -5
  8. package/dist/billboard.react.min.js +2 -2
  9. package/dist/billboard.worker.js +1 -1
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-sparkline.js +21 -4
  13. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-stanford.js +22 -13
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
  16. package/dist/plugin/billboardjs-plugin-tableview.js +20 -3
  17. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  18. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  19. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1689 -1252
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2288 -1012
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6350 -2390
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1310 -1006
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1293 -1006
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  30. package/dist/theme/dark.css +90 -1
  31. package/dist/theme/dark.min.css +2 -2
  32. package/dist/theme/datalab.css +87 -1
  33. package/dist/theme/datalab.min.css +2 -2
  34. package/dist/theme/graph.css +87 -1
  35. package/dist/theme/graph.min.css +2 -2
  36. package/dist/theme/insight.css +87 -1
  37. package/dist/theme/insight.min.css +2 -2
  38. package/dist/theme/modern.css +87 -1
  39. package/dist/theme/modern.min.css +2 -2
  40. package/dist-esm/Chart/Chart.js +5 -5
  41. package/dist-esm/Chart/api/axis.js +2 -3
  42. package/dist-esm/Chart/api/category.js +2 -3
  43. package/dist-esm/Chart/api/chart.js +3 -4
  44. package/dist-esm/Chart/api/color.js +2 -3
  45. package/dist-esm/Chart/api/data.js +3 -4
  46. package/dist-esm/Chart/api/export.js +3 -4
  47. package/dist-esm/Chart/api/flow.js +15 -9
  48. package/dist-esm/Chart/api/focus.js +5 -3
  49. package/dist-esm/Chart/api/grid.js +2 -3
  50. package/dist-esm/Chart/api/group.js +2 -3
  51. package/dist-esm/Chart/api/legend.js +1 -2
  52. package/dist-esm/Chart/api/load.js +3 -4
  53. package/dist-esm/Chart/api/regions.js +3 -4
  54. package/dist-esm/Chart/api/selection.js +3 -4
  55. package/dist-esm/Chart/api/show.js +2 -3
  56. package/dist-esm/Chart/api/stubs.js +3 -4
  57. package/dist-esm/Chart/api/subchart.js +4 -5
  58. package/dist-esm/Chart/api/tooltip.js +28 -9
  59. package/dist-esm/Chart/api/x.js +2 -3
  60. package/dist-esm/Chart/api/zoom.js +6 -7
  61. package/dist-esm/ChartInternal/Axis/Axis.js +5 -6
  62. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +26 -17
  63. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +40 -12
  64. package/dist-esm/ChartInternal/ChartInternal.js +39 -24
  65. package/dist-esm/ChartInternal/data/convert.helper.js +2 -3
  66. package/dist-esm/ChartInternal/data/convert.js +3 -4
  67. package/dist-esm/ChartInternal/data/data.js +18 -11
  68. package/dist-esm/ChartInternal/data/load.js +4 -5
  69. package/dist-esm/ChartInternal/interactions/drag.js +3 -4
  70. package/dist-esm/ChartInternal/interactions/eventrect.js +4 -5
  71. package/dist-esm/ChartInternal/interactions/flow.js +25 -19
  72. package/dist-esm/ChartInternal/interactions/interaction.js +14 -13
  73. package/dist-esm/ChartInternal/interactions/subchart.js +5 -6
  74. package/dist-esm/ChartInternal/interactions/zoom.js +4 -5
  75. package/dist-esm/ChartInternal/internals/category.js +2 -3
  76. package/dist-esm/ChartInternal/internals/class.js +5 -5
  77. package/dist-esm/ChartInternal/internals/clip.js +2 -3
  78. package/dist-esm/ChartInternal/internals/color.js +4 -5
  79. package/dist-esm/ChartInternal/internals/domain.js +7 -7
  80. package/dist-esm/ChartInternal/internals/format.js +3 -4
  81. package/dist-esm/ChartInternal/internals/grid.js +4 -5
  82. package/dist-esm/ChartInternal/internals/legend.js +7 -7
  83. package/dist-esm/ChartInternal/internals/redraw.js +13 -13
  84. package/dist-esm/ChartInternal/internals/region.js +4 -5
  85. package/dist-esm/ChartInternal/internals/scale.js +2 -3
  86. package/dist-esm/ChartInternal/internals/selection.js +3 -4
  87. package/dist-esm/ChartInternal/internals/size.axis.js +2 -3
  88. package/dist-esm/ChartInternal/internals/size.js +8 -9
  89. package/dist-esm/ChartInternal/internals/style.js +4 -5
  90. package/dist-esm/ChartInternal/internals/subchart.util.js +2 -3
  91. package/dist-esm/ChartInternal/internals/text.arc.js +3 -4
  92. package/dist-esm/ChartInternal/internals/text.js +22 -23
  93. package/dist-esm/ChartInternal/internals/text.util.js +4 -5
  94. package/dist-esm/ChartInternal/internals/title.js +4 -5
  95. package/dist-esm/ChartInternal/internals/tooltip.js +42 -23
  96. package/dist-esm/ChartInternal/internals/transform.js +5 -6
  97. package/dist-esm/ChartInternal/internals/type.js +78 -11
  98. package/dist-esm/ChartInternal/shape/arc.js +5 -6
  99. package/dist-esm/ChartInternal/shape/area.js +4 -5
  100. package/dist-esm/ChartInternal/shape/bar.js +5 -6
  101. package/dist-esm/ChartInternal/shape/boxplot.js +111 -0
  102. package/dist-esm/ChartInternal/shape/bubble.js +2 -3
  103. package/dist-esm/ChartInternal/shape/bullet.js +213 -0
  104. package/dist-esm/ChartInternal/shape/candlestick.js +5 -6
  105. package/dist-esm/ChartInternal/shape/core/barRadius.js +2 -3
  106. package/dist-esm/ChartInternal/shape/core/boxplot.js +192 -0
  107. package/dist-esm/ChartInternal/shape/core/bubble.js +4 -5
  108. package/dist-esm/ChartInternal/shape/core/bullet.js +528 -0
  109. package/dist-esm/ChartInternal/shape/core/candlestick.js +2 -3
  110. package/dist-esm/ChartInternal/shape/core/dataRegion.js +2 -3
  111. package/dist-esm/ChartInternal/shape/core/geometry.js +2 -3
  112. package/dist-esm/ChartInternal/shape/core/heatmap.js +453 -0
  113. package/dist-esm/ChartInternal/shape/core/path.js +2 -3
  114. package/dist-esm/ChartInternal/shape/core/point.js +2 -3
  115. package/dist-esm/ChartInternal/shape/core/sankey.js +576 -0
  116. package/dist-esm/ChartInternal/shape/core/treemap.js +2 -3
  117. package/dist-esm/ChartInternal/shape/funnel.js +45 -6
  118. package/dist-esm/ChartInternal/shape/gauge.js +3 -4
  119. package/dist-esm/ChartInternal/shape/heatmap.js +144 -0
  120. package/dist-esm/ChartInternal/shape/line.js +7 -8
  121. package/dist-esm/ChartInternal/shape/point.js +9 -9
  122. package/dist-esm/ChartInternal/shape/polar.js +3 -4
  123. package/dist-esm/ChartInternal/shape/radar.js +19 -7
  124. package/dist-esm/ChartInternal/shape/sankey.js +154 -0
  125. package/dist-esm/ChartInternal/shape/shape.js +15 -11
  126. package/dist-esm/ChartInternal/shape/treemap.js +8 -5
  127. package/dist-esm/canvas/CanvasAxisRenderer.js +28 -328
  128. package/dist-esm/canvas/CanvasEngine.js +2 -3
  129. package/dist-esm/canvas/CanvasPainter.js +2 -3
  130. package/dist-esm/canvas/CanvasRenderer.js +38 -408
  131. package/dist-esm/canvas/CanvasTheme.js +28 -8
  132. package/dist-esm/canvas/HitDetector.js +20 -24
  133. package/dist-esm/canvas/axisTicks.js +5 -6
  134. package/dist-esm/canvas/boxplot.js +201 -0
  135. package/dist-esm/canvas/bullet.js +212 -0
  136. package/dist-esm/canvas/classes.js +2 -3
  137. package/dist-esm/canvas/color.js +2 -3
  138. package/dist-esm/canvas/flow.js +190 -0
  139. package/dist-esm/canvas/geometry.js +2 -3
  140. package/dist-esm/canvas/grid.js +206 -0
  141. package/dist-esm/canvas/heatmap.js +141 -0
  142. package/dist-esm/canvas/labels.js +3 -4
  143. package/dist-esm/canvas/pointPattern.js +2 -3
  144. package/dist-esm/canvas/sankey.js +137 -0
  145. package/dist-esm/canvas/selection.js +473 -0
  146. package/dist-esm/canvas/subchart.js +814 -0
  147. package/dist-esm/canvas/treemap.js +100 -0
  148. package/dist-esm/canvas/util.js +2 -3
  149. package/dist-esm/config/Options/Options.js +3 -4
  150. package/dist-esm/config/Options/axis/axis.js +2 -3
  151. package/dist-esm/config/Options/axis/x.js +2 -3
  152. package/dist-esm/config/Options/axis/y.js +2 -3
  153. package/dist-esm/config/Options/axis/y2.js +14 -3
  154. package/dist-esm/config/Options/common/boost.js +2 -3
  155. package/dist-esm/config/Options/common/color.js +2 -3
  156. package/dist-esm/config/Options/common/grid.js +2 -3
  157. package/dist-esm/config/Options/common/legend.js +2 -3
  158. package/dist-esm/config/Options/common/main.js +2 -3
  159. package/dist-esm/config/Options/common/point.js +2 -3
  160. package/dist-esm/config/Options/common/title.js +2 -3
  161. package/dist-esm/config/Options/common/tooltip.js +2 -3
  162. package/dist-esm/config/Options/data/axis.js +2 -3
  163. package/dist-esm/config/Options/data/data.js +49 -4
  164. package/dist-esm/config/Options/data/selection.js +2 -3
  165. package/dist-esm/config/Options/interaction/interaction.js +2 -3
  166. package/dist-esm/config/Options/interaction/subchart.js +6 -3
  167. package/dist-esm/config/Options/interaction/zoom.js +2 -3
  168. package/dist-esm/config/Options/shape/arc.js +2 -3
  169. package/dist-esm/config/Options/shape/area.js +2 -3
  170. package/dist-esm/config/Options/shape/bar.js +2 -3
  171. package/dist-esm/config/Options/shape/boxplot.js +106 -0
  172. package/dist-esm/config/Options/shape/bubble.js +2 -3
  173. package/dist-esm/config/Options/shape/bullet.js +177 -0
  174. package/dist-esm/config/Options/shape/candlestick.js +2 -3
  175. package/dist-esm/config/Options/shape/donut.js +2 -3
  176. package/dist-esm/config/Options/shape/funnel.js +2 -3
  177. package/dist-esm/config/Options/shape/gauge.js +2 -3
  178. package/dist-esm/config/Options/shape/heatmap.js +137 -0
  179. package/dist-esm/config/Options/shape/line.js +2 -3
  180. package/dist-esm/config/Options/shape/pie.js +2 -3
  181. package/dist-esm/config/Options/shape/polar.js +2 -3
  182. package/dist-esm/config/Options/shape/radar.js +2 -3
  183. package/dist-esm/config/Options/shape/sankey.js +116 -0
  184. package/dist-esm/config/Options/shape/scatter.js +2 -3
  185. package/dist-esm/config/Options/shape/spline.js +2 -3
  186. package/dist-esm/config/Options/shape/treemap.js +2 -3
  187. package/dist-esm/config/Store/Element.js +2 -3
  188. package/dist-esm/config/Store/State.js +4 -4
  189. package/dist-esm/config/Store/Store.js +2 -3
  190. package/dist-esm/config/classes.js +2 -4
  191. package/dist-esm/config/config.js +2 -3
  192. package/dist-esm/config/const.js +31 -23
  193. package/dist-esm/config/resolver/axis.core.js +4 -5
  194. package/dist-esm/config/resolver/axis.js +2 -3
  195. package/dist-esm/config/resolver/canvas.js +113 -900
  196. package/dist-esm/config/resolver/canvasBoxplot.js +49 -0
  197. package/dist-esm/config/resolver/canvasBullet.js +29 -0
  198. package/dist-esm/config/resolver/canvasFlow.js +28 -0
  199. package/dist-esm/config/resolver/canvasGrid.js +27 -0
  200. package/dist-esm/config/resolver/canvasHeatmap.js +31 -0
  201. package/dist-esm/config/resolver/canvasSankey.js +31 -0
  202. package/dist-esm/config/resolver/canvasSelection.js +30 -0
  203. package/dist-esm/config/resolver/canvasShape.js +13 -12
  204. package/dist-esm/config/resolver/canvasSubchart.js +30 -0
  205. package/dist-esm/config/resolver/canvasType.js +48 -0
  206. package/dist-esm/config/resolver/category.js +3 -4
  207. package/dist-esm/config/resolver/customType.js +58 -0
  208. package/dist-esm/config/resolver/export.js +3 -4
  209. package/dist-esm/config/resolver/flow.js +5 -6
  210. package/dist-esm/config/resolver/grid.js +6 -7
  211. package/dist-esm/config/resolver/interaction/selection.js +6 -7
  212. package/dist-esm/config/resolver/interaction/subchart.js +6 -7
  213. package/dist-esm/config/resolver/interaction/zoom.js +6 -7
  214. package/dist-esm/config/resolver/regions.js +5 -6
  215. package/dist-esm/config/resolver/shape/arc.helpers.js +5 -6
  216. package/dist-esm/config/resolver/shape/area.js +3 -4
  217. package/dist-esm/config/resolver/shape/axis.helpers.js +2 -3
  218. package/dist-esm/config/resolver/shape/bar.js +5 -6
  219. package/dist-esm/config/resolver/shape/boxplot.js +30 -0
  220. package/dist-esm/config/resolver/shape/bubble.js +5 -6
  221. package/dist-esm/config/resolver/shape/bullet.js +23 -0
  222. package/dist-esm/config/resolver/shape/candlestick.js +5 -6
  223. package/dist-esm/config/resolver/shape/donut.js +2 -3
  224. package/dist-esm/config/resolver/shape/funnel.js +7 -6
  225. package/dist-esm/config/resolver/shape/gauge.js +4 -5
  226. package/dist-esm/config/resolver/shape/heatmap.js +23 -0
  227. package/dist-esm/config/resolver/shape/line.js +2 -3
  228. package/dist-esm/config/resolver/shape/pie.js +3 -4
  229. package/dist-esm/config/resolver/shape/polar.js +4 -5
  230. package/dist-esm/config/resolver/shape/radar.js +5 -6
  231. package/dist-esm/config/resolver/shape/sankey.js +23 -0
  232. package/dist-esm/config/resolver/shape/scatter.js +4 -5
  233. package/dist-esm/config/resolver/shape/treemap.js +4 -5
  234. package/dist-esm/core.js +5 -6
  235. package/dist-esm/index.canvas.js +13 -9
  236. package/dist-esm/index.esm.js +6 -2
  237. package/dist-esm/module/Cache.js +2 -3
  238. package/dist-esm/module/browser.js +2 -3
  239. package/dist-esm/module/dsv.js +2 -3
  240. package/dist-esm/module/error.js +23 -16
  241. package/dist-esm/module/generator.js +3 -4
  242. package/dist-esm/module/sanitize.js +2 -3
  243. package/dist-esm/module/util/brush.js +2 -3
  244. package/dist-esm/module/util/dom.js +3 -4
  245. package/dist-esm/module/util/object.js +13 -6
  246. package/dist-esm/module/util/type-checks.js +2 -3
  247. package/dist-esm/module/worker.js +2 -3
  248. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +6 -10
  249. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -18
  250. package/dist-esm/plugin/billboardjs-plugin-stanford.js +17 -45
  251. package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -18
  252. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +9 -16
  253. package/dist-esm/react/index.js +2 -3
  254. package/package.json +44 -44
  255. package/src/Chart/Chart.ts +1 -0
  256. package/src/Chart/api/chart.ts +2 -1
  257. package/src/Chart/api/flow.ts +20 -7
  258. package/src/Chart/api/focus.ts +3 -0
  259. package/src/Chart/api/subchart.ts +1 -1
  260. package/src/Chart/api/tooltip.ts +54 -15
  261. package/src/ChartInternal/Axis/AxisRenderer.ts +29 -20
  262. package/src/ChartInternal/Axis/AxisRendererHelper.ts +45 -9
  263. package/src/ChartInternal/ChartInternal.ts +46 -19
  264. package/src/ChartInternal/data/IData.ts +13 -0
  265. package/src/ChartInternal/data/data.ts +26 -5
  266. package/src/ChartInternal/data/load.ts +2 -2
  267. package/src/ChartInternal/interactions/flow.ts +50 -19
  268. package/src/ChartInternal/interactions/interaction.ts +15 -11
  269. package/src/ChartInternal/internals/class.ts +3 -2
  270. package/src/ChartInternal/internals/domain.ts +4 -2
  271. package/src/ChartInternal/internals/format.ts +3 -1
  272. package/src/ChartInternal/internals/legend.ts +2 -1
  273. package/src/ChartInternal/internals/redraw.ts +18 -12
  274. package/src/ChartInternal/internals/size.ts +5 -3
  275. package/src/ChartInternal/internals/text.ts +24 -28
  276. package/src/ChartInternal/internals/tooltip.ts +59 -20
  277. package/src/ChartInternal/internals/transform.ts +2 -2
  278. package/src/ChartInternal/internals/type.ts +101 -9
  279. package/src/ChartInternal/shape/boxplot.ts +172 -0
  280. package/src/ChartInternal/shape/bullet.ts +323 -0
  281. package/src/ChartInternal/shape/core/boxplot.ts +241 -0
  282. package/src/ChartInternal/shape/core/bullet.ts +734 -0
  283. package/src/ChartInternal/shape/core/heatmap.ts +665 -0
  284. package/src/ChartInternal/shape/core/sankey.ts +782 -0
  285. package/src/ChartInternal/shape/funnel.ts +73 -2
  286. package/src/ChartInternal/shape/heatmap.ts +236 -0
  287. package/src/ChartInternal/shape/point.ts +6 -3
  288. package/src/ChartInternal/shape/radar.ts +30 -1
  289. package/src/ChartInternal/shape/sankey.ts +242 -0
  290. package/src/ChartInternal/shape/shape.ts +16 -4
  291. package/src/ChartInternal/shape/treemap.ts +10 -0
  292. package/src/Plugin/stanford/index.ts +1 -28
  293. package/src/canvas/CanvasAxisRenderer.ts +54 -596
  294. package/src/canvas/CanvasRenderer.ts +68 -640
  295. package/src/canvas/CanvasTheme.ts +92 -6
  296. package/src/canvas/HitDetector.ts +30 -28
  297. package/src/canvas/boxplot.ts +230 -0
  298. package/src/canvas/bullet.ts +269 -0
  299. package/src/canvas/flow.ts +237 -0
  300. package/src/canvas/grid.ts +359 -0
  301. package/src/canvas/heatmap.ts +147 -0
  302. package/src/canvas/labels.ts +3 -1
  303. package/src/canvas/sankey.ts +151 -0
  304. package/src/canvas/selection.ts +626 -0
  305. package/src/canvas/subchart.ts +1292 -0
  306. package/src/canvas/treemap.ts +142 -0
  307. package/src/config/Options/axis/y2.ts +13 -0
  308. package/src/config/Options/data/data.ts +47 -1
  309. package/src/config/Options/interaction/subchart.ts +4 -0
  310. package/src/config/Options/shape/boxplot.ts +95 -0
  311. package/src/config/Options/shape/bullet.ts +170 -0
  312. package/src/config/Options/shape/heatmap.ts +125 -0
  313. package/src/config/Options/shape/sankey.ts +108 -0
  314. package/src/config/Store/State.ts +2 -1
  315. package/src/config/classes.ts +0 -1
  316. package/src/config/const.ts +30 -21
  317. package/src/config/resolver/canvas.ts +147 -1293
  318. package/src/config/resolver/canvasBoxplot.ts +42 -0
  319. package/src/config/resolver/canvasBullet.ts +20 -0
  320. package/src/config/resolver/canvasFlow.ts +18 -0
  321. package/src/config/resolver/canvasGrid.ts +17 -0
  322. package/src/config/resolver/canvasHeatmap.ts +23 -0
  323. package/src/config/resolver/canvasSankey.ts +23 -0
  324. package/src/config/resolver/canvasSelection.ts +20 -0
  325. package/src/config/resolver/canvasShape.ts +6 -1
  326. package/src/config/resolver/canvasSubchart.ts +20 -0
  327. package/src/config/resolver/canvasType.ts +51 -0
  328. package/src/config/resolver/customType.ts +69 -0
  329. package/src/config/resolver/shape/boxplot.ts +31 -0
  330. package/src/config/resolver/shape/bullet.ts +18 -0
  331. package/src/config/resolver/shape/funnel.ts +8 -2
  332. package/src/config/resolver/shape/heatmap.ts +18 -0
  333. package/src/config/resolver/shape/index.ts +4 -0
  334. package/src/config/resolver/shape/sankey.ts +18 -0
  335. package/src/index.canvas.ts +9 -3
  336. package/src/index.esm.ts +4 -0
  337. package/src/index.ts +34 -0
  338. package/src/module/error.ts +32 -18
  339. package/src/module/util/object.ts +26 -1
  340. package/src/scss/billboard.scss +106 -0
  341. package/src/scss/theme/dark.scss +110 -0
  342. package/src/scss/theme/datalab.scss +106 -0
  343. package/src/scss/theme/graph.scss +106 -0
  344. package/src/scss/theme/insight.scss +106 -0
  345. package/src/scss/theme/modern.scss +106 -0
  346. package/types/bb.d.ts +4 -0
  347. package/types/canvas.d.ts +3 -0
  348. package/types/chart.d.ts +5 -0
  349. package/types/index.d.ts +4 -0
  350. package/types/options.d.ts +13 -1
  351. package/types/options.shape.d.ts +431 -0
  352. package/types/types.d.ts +4 -0
@@ -5,13 +5,12 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.4
8
+ * @version 4.2.0-next.1
9
9
  */
10
10
  import { TYPE } from "../config/const.js";
11
- import { getTreemapNodeRect } from "../ChartInternal/shape/core/geometry.js";
12
- import { createCanvasPointOccupancyGrid, getCanvasShapeIndices, getCanvasTargetVisibleRange, hasCanvasDrawableValue, isCanvasBarType, isCanvasBubbleType, isCanvasCandlestickType, isCanvasPointType, isCanvasScatterType, isCanvasTargetSupported, isCanvasTreemapType, isFiniteCanvasCoordinate, markCanvasPointOccupancy } from "./util.js";
13
11
  import { getCanvasBarGeometry, getCanvasCandlestickGeometry } from "./geometry.js";
14
- //#region src/canvas/HitDetector.ts
12
+ import { createCanvasPointOccupancyGrid, getCanvasShapeIndices, getCanvasTargetVisibleRange, hasCanvasDrawableValue, isCanvasBarType, isCanvasBubbleType, isCanvasCandlestickType, isCanvasPointType, isCanvasScatterType, isCanvasTargetSupported, isFiniteCanvasCoordinate, markCanvasPointOccupancy } from "./util.js";
13
+ // src/canvas/HitDetector.ts
15
14
  /**
16
15
  * Copyright (c) 2017 ~ present NAVER Corp.
17
16
  * billboard.js project is licensed under the MIT license
@@ -132,7 +131,7 @@ var HitDetector = class {
132
131
  this.pointGrid = /* @__PURE__ */ new Map();
133
132
  this.maxPointSensitivity = HIT_DISTANCE;
134
133
  this.indexAxis = $$.config.axis_rotated ? "y" : "x";
135
- this.plot = $$.state.hasTreemap ? {
134
+ this.plot = $$.state.customType || $$.state.hasTreemap ? {
136
135
  x: 0,
137
136
  y: 0,
138
137
  w: current.width,
@@ -143,7 +142,7 @@ var HitDetector = class {
143
142
  w: width,
144
143
  h: height
145
144
  };
146
- this.grouped = !!$$.config.tooltip_grouped && !$$.state.hasTreemap;
145
+ this.grouped = !!$$.config.tooltip_grouped && !$$.state.customType && !$$.state.hasTreemap;
147
146
  this.pointBased = !($$.config.axis_x_forceAsSingle && this.grouped) && (!!$$.isMultipleX?.() || targets.some((target) => isCanvasScatterType($$, target) || isCanvasBubbleType($$, target)));
148
147
  const indexMap = this.grouped && (!this.pointBased || $$.config.data_selection_enabled && $$.config.data_selection_grouped) ? /* @__PURE__ */ new Map() : null;
149
148
  const addIndex = (x, y, data) => {
@@ -155,22 +154,14 @@ var HitDetector = class {
155
154
  data
156
155
  });
157
156
  };
158
- if ($$.state.hasTreemap) {
159
- const root = $$.getTreemapRoot?.($$.data.targets);
160
- const nodes = root?.children || [];
161
- for (const node of nodes) {
162
- const { data } = node;
163
- if (!isCanvasTreemapType($$, data)) continue;
164
- const { x, y, w, h } = getTreemapNodeRect($$, node, root, true);
165
- if (!isFiniteCanvasCoordinate(x, y) || !isFiniteCanvasCoordinate(x + w, y + h)) continue;
166
- this.addBar({
167
- x,
168
- y,
169
- w,
170
- h,
171
- data
172
- });
173
- }
157
+ if ($$.state.customType) {
158
+ $$.getCustomTypeParts()?.canvas?.hits?.call($$, this);
159
+ this.indices = [];
160
+ return;
161
+ }
162
+ const exclusive = $$.getCanvasTypeParts?.().find((part) => part.exclusive);
163
+ if (exclusive) {
164
+ exclusive.hits?.call($$, this);
174
165
  this.indices = [];
175
166
  return;
176
167
  }
@@ -226,6 +217,12 @@ var HitDetector = class {
226
217
  }
227
218
  });
228
219
  }
220
+ $$.getAxisTypeParts?.().forEach((part) => part.canvas?.hits?.call($$, this, {
221
+ shape,
222
+ targets,
223
+ margin,
224
+ addIndex
225
+ }));
229
226
  const { cx, cy } = shape.pos;
230
227
  if (cx && cy) targets.filter(isCanvasPointType.bind(null, $$)).filter((target) => isCanvasTargetSupported($$, target, HIT_GROUPED_TYPE_FILTERS)).forEach((target) => {
231
228
  const range = getCanvasTargetVisibleRange($$, target);
@@ -260,7 +257,7 @@ var HitDetector = class {
260
257
  hitBar(mx, my) {
261
258
  for (const item of getGridItems(this.barGrid, mx, my, BAR_CELL_SIZE)) {
262
259
  const { w = 0, h = 0 } = item;
263
- if (mx >= item.x && mx <= item.x + w && my >= item.y && my <= item.y + h) return item.data;
260
+ if (mx >= item.x && mx <= item.x + w && my >= item.y && my <= item.y + h && (!item.hit || item.hit(mx, my))) return item.data;
264
261
  }
265
262
  return null;
266
263
  }
@@ -420,5 +417,4 @@ var HitDetector = class {
420
417
  return previous && Math.abs(previous[indexAxis] - value) < Math.abs(current[indexAxis] - value) ? previous : current;
421
418
  }
422
419
  };
423
- //#endregion
424
420
  export { HitDetector as default };
@@ -5,12 +5,12 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.4
8
+ * @version 4.2.0-next.1
9
9
  */
10
- import { parseDate } from "../module/util/object.js";
11
10
  import { getScale } from "../ChartInternal/internals/scale.js";
11
+ import { parseDate } from "../module/util/object.js";
12
12
  import { getCanvasComparableValue, getCanvasComparableXDomain } from "./util.js";
13
- //#region src/canvas/axisTicks.ts
13
+ // src/canvas/axisTicks.ts
14
14
  /**
15
15
  * Get tick option value for main/subchart canvas axes.
16
16
  * @param {object} config Chart config
@@ -210,7 +210,7 @@ function isInCurrentXDomain($$, value, tolerance = 0) {
210
210
  * @private
211
211
  */
212
212
  function getHalfNeighborDistance(comparableValues, index) {
213
- const distances = [index > 0 ? Math.abs(comparableValues[index] - comparableValues[index - 1]) : Infinity, index < comparableValues.length - 1 ? Math.abs(comparableValues[index + 1] - comparableValues[index]) : Infinity].filter(Number.isFinite);
213
+ const distances = [index > 0 ? Math.abs(comparableValues[index] - comparableValues[index - 1]) : 1e400, index < comparableValues.length - 1 ? Math.abs(comparableValues[index + 1] - comparableValues[index]) : 1e400].filter(Number.isFinite);
214
214
  const distance = Math.min(...distances);
215
215
  return Number.isFinite(distance) ? distance / 2 : 0;
216
216
  }
@@ -291,7 +291,7 @@ function filterXDataTicksForZoom($$, dataTicks) {
291
291
  const includeNearest = (edge) => {
292
292
  const index = lowerBoundNumbers(comparable, edge);
293
293
  let nearestIndex = -1;
294
- let nearestDistance = Infinity;
294
+ let nearestDistance = 1e400;
295
295
  for (const candidate of [index - 1, index]) {
296
296
  const distance = Math.abs(comparable[candidate] - edge);
297
297
  if (distance < nearestDistance) {
@@ -731,5 +731,4 @@ function getYGridTickValues($$) {
731
731
  if (generated?.length) return generated;
732
732
  return config.grid_y_ticks ? cullTicks(getYTickValues($$, "y", void 0, false), config.grid_y_ticks) : getYTickValues($$, "y", void 0, false);
733
733
  }
734
- //#endregion
735
734
  export { getAdditionalAxisScale, getAdditionalAxisTickFormat, getAdditionalAxisTickValues, getSubXTickLineValues, getSubXTickValues, getXScale, getXTickLinePosition, getXTickLineValues, getXTickValues, getYGridTickValues, getYTickValues, isSameTickValue, normalizeXValue, normalizeYValue };
@@ -0,0 +1,201 @@
1
+ /*!
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ *
5
+ * billboard.js, JavaScript chart library
6
+ * https://naver.github.io/billboard.js/
7
+ *
8
+ * @version 4.2.0-next.1
9
+ */
10
+ import { getRenderPoint, getRenderRect } from "../ChartInternal/shape/core/geometry.js";
11
+ import { getCanvasTargetFocusOpacity, isCanvasRenderableTarget } from "./CanvasRenderer.js";
12
+ import { getCanvasShapeIndices, getCanvasTargetVisibleRange } from "./util.js";
13
+ // src/canvas/boxplot.ts
14
+ /**
15
+ * Copyright (c) 2017 ~ present NAVER Corp.
16
+ * billboard.js project is licensed under the MIT license
17
+ */
18
+ const boxplotTheme = {
19
+ section: "boxplot",
20
+ probe({ probeIn, toColor, toNumber }) {
21
+ const box = probeIn("bb-chart-boxplot", "path", "bb-boxplot-box", [
22
+ "stroke",
23
+ "stroke-width",
24
+ "fill-opacity"
25
+ ]);
26
+ const whisker = probeIn("bb-chart-boxplot", "path", "bb-boxplot-whisker", ["stroke-width"]);
27
+ const median = probeIn("bb-chart-boxplot", "path", "bb-boxplot-median", ["stroke-width"]);
28
+ const outlier = probeIn("bb-chart-boxplot", "path", "bb-boxplot-outlier", ["stroke-width"]);
29
+ const mean = probeIn("bb-chart-boxplot", "path", "bb-boxplot-mean", ["fill"]);
30
+ return {
31
+ stroke: toColor(box.stroke, "#000"),
32
+ boxLineWidth: toNumber(box["stroke-width"], 1),
33
+ boxOpacity: toNumber(box["fill-opacity"], .7),
34
+ whiskerLineWidth: toNumber(whisker["stroke-width"], 1),
35
+ medianLineWidth: toNumber(median["stroke-width"], 2),
36
+ outlierLineWidth: toNumber(outlier["stroke-width"], 1),
37
+ meanFill: toColor(mean.fill, "#fff")
38
+ };
39
+ },
40
+ selectors: {
41
+ ".bb-boxplot-box": (style, { readColorValue, readNumberValue }) => ({
42
+ stroke: readColorValue(style, "stroke"),
43
+ boxLineWidth: readNumberValue(style, "stroke-width"),
44
+ boxOpacity: readNumberValue(style, "fill-opacity")
45
+ }),
46
+ ".bb-boxplot-whisker": (style, { readNumberValue }) => ({ whiskerLineWidth: readNumberValue(style, "stroke-width") }),
47
+ ".bb-boxplot-median": (style, { readNumberValue }) => ({ medianLineWidth: readNumberValue(style, "stroke-width") }),
48
+ ".bb-boxplot-outlier": (style, { readNumberValue }) => ({ outlierLineWidth: readNumberValue(style, "stroke-width") }),
49
+ ".bb-boxplot-mean": (style, { readColorValue }) => ({ meanFill: readColorValue(style, "fill") })
50
+ }
51
+ };
52
+ /**
53
+ * Get the box geometry of a data row, in the coordinates of the canvas.
54
+ * @param {object} $$ ChartInternal instance
55
+ * @param {function} getPoints Function from generateGetBoxplotPoints()
56
+ * @param {object} d Data row
57
+ * @param {number} i Data index
58
+ * @returns {object|null} Box, median and whisker
59
+ * @private
60
+ */
61
+ function getGeometry($$, getPoints, d, i) {
62
+ const points = getPoints(d, i);
63
+ if (!points) return null;
64
+ const [[x0, q1], [x1, q3], [xc, min, max], [median], outliers, mean] = points;
65
+ const R = (x, y) => getRenderPoint($$, [x, y]);
66
+ const cap = (x1 - x0) * $$.config.boxplot_whisker_width / 2;
67
+ const m = $$.config.boxplot_mean_r;
68
+ return {
69
+ box: getRenderRect($$, [[x0, q1], [x1, q3]]),
70
+ median: [R(x0, median), R(x1, median)],
71
+ whisker: [
72
+ [R(xc, max), R(xc, q3)],
73
+ [R(xc, q1), R(xc, min)],
74
+ ...cap > 0 ? [[R(xc - cap, max), R(xc + cap, max)], [R(xc - cap, min), R(xc + cap, min)]] : []
75
+ ],
76
+ outliers: outliers.map((v) => R(xc, v)),
77
+ mean: mean.map((v) => [
78
+ R(xc - m, v),
79
+ R(xc, v - m),
80
+ R(xc + m, v),
81
+ R(xc, v + m)
82
+ ])
83
+ };
84
+ }
85
+ /**
86
+ * Canvas drawing, hit detection and theme of the boxplot type.
87
+ * Added to the chart by boxplot(): bundles without boxplot do not carry it.
88
+ */
89
+ var boxplot_default = {
90
+ theme: boxplotTheme,
91
+ /**
92
+ * Draw the boxes on canvas.
93
+ * @param {CanvasRenderer} renderer Canvas renderer
94
+ * @param {object} shape Cached draw shape object
95
+ * @private
96
+ */
97
+ draw(renderer, shape) {
98
+ const $$ = this;
99
+ const { ctx, painter, theme: { style: { boxplot } } } = renderer;
100
+ const { margin } = $$.state;
101
+ const r = $$.config.boxplot_outlier_r;
102
+ const isBoxplot = $$.isBoxplotType.bind($$);
103
+ const getPoints = $$.generateGetBoxplotPoints(getCanvasShapeIndices($$, shape, "boxplot", isBoxplot), false);
104
+ painter.withTranslation(margin.left, margin.top, () => {
105
+ $$.filterTargetsToShow().filter(isBoxplot).filter((target) => isCanvasRenderableTarget($$, target)).forEach((target) => {
106
+ const range = getCanvasTargetVisibleRange($$, target);
107
+ const alpha = getCanvasTargetFocusOpacity($$, target);
108
+ for (let i = range.start; i < range.end; i++) {
109
+ const d = target.values[i];
110
+ const geometry = getGeometry($$, getPoints, d, i);
111
+ if (!geometry) continue;
112
+ const stroke = boxplot.stroke;
113
+ ctx.strokeStyle = stroke;
114
+ ctx.globalAlpha = alpha;
115
+ boxplot.whiskerLineWidth > 0 && painter.strokePath(() => {
116
+ geometry.whisker.forEach(([a, b]) => painter.traceLine(a[0], a[1], b[0], b[1]));
117
+ }, {
118
+ lineWidth: boxplot.whiskerLineWidth,
119
+ stroke,
120
+ alpha
121
+ });
122
+ painter.fillRect(geometry.box, {
123
+ fill: $$.color(d),
124
+ alpha: boxplot.boxOpacity * alpha
125
+ });
126
+ boxplot.boxLineWidth > 0 && painter.strokeRect(geometry.box, {
127
+ stroke,
128
+ lineWidth: boxplot.boxLineWidth,
129
+ alpha
130
+ });
131
+ const [a, b] = geometry.median;
132
+ painter.strokePath(() => painter.traceLine(a[0], a[1], b[0], b[1]), {
133
+ lineWidth: boxplot.medianLineWidth,
134
+ stroke,
135
+ alpha
136
+ });
137
+ geometry.outliers.length && painter.strokePath(() => {
138
+ geometry.outliers.forEach(([x, y]) => {
139
+ ctx.moveTo(x + r, y);
140
+ ctx.arc(x, y, r, 0, Math.PI * 2);
141
+ });
142
+ }, {
143
+ lineWidth: boxplot.outlierLineWidth,
144
+ stroke,
145
+ alpha
146
+ });
147
+ geometry.mean.forEach(([p0, p1, p2, p3]) => {
148
+ ctx.beginPath();
149
+ ctx.moveTo(p0[0], p0[1]);
150
+ [
151
+ p1,
152
+ p2,
153
+ p3
154
+ ].forEach((p) => ctx.lineTo(p[0], p[1]));
155
+ ctx.closePath();
156
+ ctx.globalAlpha = alpha;
157
+ ctx.fillStyle = boxplot.meanFill;
158
+ ctx.fill();
159
+ ctx.strokeStyle = stroke;
160
+ ctx.lineWidth = boxplot.boxLineWidth;
161
+ ctx.stroke();
162
+ });
163
+ }
164
+ ctx.globalAlpha = 1;
165
+ });
166
+ });
167
+ },
168
+ /**
169
+ * Add the hit items of the boxes.
170
+ * @param {HitDetector} detector Hit detector
171
+ * @param {object} context Shape, targets, margin and the index registration of the detector
172
+ * @param {object} context.shape Shape helpers of the chart
173
+ * @param {Array} context.targets Data targets
174
+ * @param {object} context.margin Margin of the chart
175
+ * @param {function} context.addIndex Register the index of a hit item
176
+ * @private
177
+ */
178
+ hits(detector, { shape, targets, margin, addIndex }) {
179
+ const $$ = this;
180
+ const isBoxplot = $$.isBoxplotType.bind($$);
181
+ const getPoints = $$.generateGetBoxplotPoints(getCanvasShapeIndices($$, shape, "boxplot", isBoxplot), false);
182
+ targets.filter(isBoxplot).forEach((target) => {
183
+ const range = getCanvasTargetVisibleRange($$, target);
184
+ for (let i = range.start; i < range.end; i++) {
185
+ const d = target.values[i];
186
+ const geometry = getGeometry($$, getPoints, d, i);
187
+ if (!geometry) continue;
188
+ const { x, y, w, h } = geometry.box;
189
+ detector.addBar({
190
+ x: margin.left + x,
191
+ y: margin.top + y,
192
+ w,
193
+ h,
194
+ data: d
195
+ });
196
+ addIndex(margin.left + x + w / 2, margin.top + y + h / 2, d);
197
+ }
198
+ });
199
+ }
200
+ };
201
+ export { boxplot_default as default };
@@ -0,0 +1,212 @@
1
+ /*!
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ *
5
+ * billboard.js, JavaScript chart library
6
+ * https://naver.github.io/billboard.js/
7
+ *
8
+ * @version 4.2.0-next.1
9
+ */
10
+ import { isNumber } from "../module/util/type-checks.js";
11
+ import { getCanvasTargetFocusOpacity } from "./CanvasRenderer.js";
12
+ import { getLabelPosition, getLabelText } from "./labels.js";
13
+ // src/canvas/bullet.ts
14
+ /**
15
+ * Copyright (c) 2017 ~ present NAVER Corp.
16
+ * billboard.js project is licensed under the MIT license
17
+ */
18
+ /**
19
+ * Draw the quantitative scale axis of a bullet row, mirroring the d3 axis used by SVG.
20
+ * @param {CanvasPainter} painter Canvas painter
21
+ * @param {object} axis Bullet axis geometry
22
+ * @param {object} style Bullet theme style
23
+ * @private
24
+ */
25
+ function drawAxis(painter, axis, style) {
26
+ const { scale, ticks, format, rotated, x, y } = axis;
27
+ const [start, end] = scale.range();
28
+ const tickSize = 6;
29
+ const textStyle = {
30
+ fill: style.axisColor,
31
+ font: style.axisFont,
32
+ textAlign: rotated ? "right" : "center",
33
+ textBaseline: rotated ? "middle" : "top"
34
+ };
35
+ painter.withTranslation(x, y, () => {
36
+ painter.strokePath(() => {
37
+ rotated ? painter.traceLine(0, start, 0, end) : painter.traceLine(start, 0, end, 0);
38
+ ticks.forEach((value) => {
39
+ const pos = scale(value);
40
+ rotated ? painter.traceLine(0, pos, -6, pos) : painter.traceLine(pos, 0, pos, tickSize);
41
+ });
42
+ }, {
43
+ stroke: style.axisColor,
44
+ lineWidth: 1
45
+ });
46
+ ticks.forEach((value) => {
47
+ const pos = scale(value);
48
+ rotated ? painter.text(format(value), -9, pos, textStyle) : painter.text(format(value), pos, 9, textStyle);
49
+ });
50
+ });
51
+ }
52
+ /**
53
+ * Canvas drawing, hit detection and theme of the bullet type.
54
+ * Added to the chart by bullet(): bundles without bullet do not carry it.
55
+ */
56
+ var bullet_default = {
57
+ theme: {
58
+ section: "bullet",
59
+ probe({ probeIn, probeInNested, axisFont, toColor, toNumber }) {
60
+ const target = probeIn("bb-chart-bullets", "line", "bb-bullet-target", ["stroke", "stroke-width"]);
61
+ const title = probeIn("bb-chart-bullets", "text", "bb-bullet-title", ["fill", "font"]);
62
+ const range = probeIn("bb-chart-bullets", "rect", "bb-bullet-range", ["--bb-bullet-range-min", "--bb-bullet-range-max"]);
63
+ const axis = probeInNested("bb-chart-bullets", "bb-bullet-axis", "text", "", ["fill", "font"]);
64
+ return {
65
+ targetStroke: toColor(target.stroke, "#000"),
66
+ targetLineWidth: toNumber(target["stroke-width"], 2),
67
+ rangeMin: toNumber(range["--bb-bullet-range-min"], 55),
68
+ rangeMax: toNumber(range["--bb-bullet-range-max"], 90),
69
+ axisFont: axis.font || axisFont,
70
+ axisColor: toColor(axis.fill, "#000"),
71
+ titleFont: title.font || axis.font || axisFont,
72
+ titleColor: toColor(title.fill, "#000")
73
+ };
74
+ },
75
+ selectors: {
76
+ ".bb-chart-bullets .bb-bullet-target": (style, { readColorValue, readNumberValue }) => ({
77
+ targetStroke: readColorValue(style, "stroke"),
78
+ targetLineWidth: readNumberValue(style, "stroke-width")
79
+ }),
80
+ ".bb-bullet-target": (style, { readColorValue, readNumberValue }) => ({
81
+ targetStroke: readColorValue(style, "stroke"),
82
+ targetLineWidth: readNumberValue(style, "stroke-width")
83
+ }),
84
+ ".bb-chart-bullets .bb-bullet-axis text": (style, { readColorValue, readFontValue }) => ({
85
+ axisColor: readColorValue(style, "fill"),
86
+ axisFont: readFontValue(style)
87
+ }),
88
+ ".bb-bullet-axis text": (style, { readColorValue, readFontValue }) => ({
89
+ axisColor: readColorValue(style, "fill"),
90
+ axisFont: readFontValue(style)
91
+ }),
92
+ ".bb-chart-bullets .bb-bullet-title": (style, { readColorValue, readFontValue }) => ({
93
+ titleColor: readColorValue(style, "fill"),
94
+ titleFont: readFontValue(style)
95
+ }),
96
+ ".bb-bullet-title": (style, { readColorValue, readFontValue }) => ({
97
+ titleColor: readColorValue(style, "fill"),
98
+ titleFont: readFontValue(style)
99
+ })
100
+ },
101
+ normalize(section, { toNumber }) {
102
+ section.targetLineWidth = toNumber(section.targetLineWidth, 2);
103
+ }
104
+ },
105
+ /**
106
+ * Draw bullet rows on canvas.
107
+ * Layout comes from the shared bullet row geometry, same as SVG rendering.
108
+ * @param {CanvasRenderer} renderer Canvas renderer
109
+ * @private
110
+ */
111
+ draw(renderer) {
112
+ const $$ = this;
113
+ const { ctx, painter, theme: { style } } = renderer;
114
+ const { bullet } = style;
115
+ const { config } = $$;
116
+ const layout = $$.getBulletLayout();
117
+ const lastValues = $$.hasDataLabel() && config.bullet_label_show ? new Map($$.data.targets.filter($$.isBulletType, $$).map((t) => [t.id, t.values[t.values.length - 1]])) : null;
118
+ const texts = { size: () => layout.rows.length };
119
+ for (const d of layout.rows) {
120
+ if (!$$.isTargetToShow(d.id)) continue;
121
+ const { area, offset, ranges, isDot, measure, color, targets, axis, label, title } = $$.getBulletRowGeometry(d, layout);
122
+ painter.withState(() => {
123
+ ctx.globalAlpha = getCanvasTargetFocusOpacity($$, d);
124
+ ctx.translate(area.left + offset.x, area.top + offset.y);
125
+ ranges.forEach(({ x, y, width, height, fill, t }) => {
126
+ painter.fillRect({
127
+ x,
128
+ y,
129
+ w: width,
130
+ h: height
131
+ }, { fill: fill ?? `hsl(0, 0%, ${bullet.rangeMin + t * (bullet.rangeMax - bullet.rangeMin)}%)` });
132
+ });
133
+ if (isDot) painter.fillPath(() => painter.traceCircle(measure.cx, measure.cy, measure.r), { fill: color });
134
+ else painter.fillRect({
135
+ x: measure.x,
136
+ y: measure.y,
137
+ w: measure.width,
138
+ h: measure.height
139
+ }, { fill: color });
140
+ targets.forEach((target) => {
141
+ painter.strokePath(() => painter.traceLine(target.x1, target.y1, target.x2, target.y2), {
142
+ stroke: bullet.targetStroke,
143
+ lineWidth: bullet.targetLineWidth
144
+ });
145
+ });
146
+ axis && drawAxis(painter, axis, bullet);
147
+ title && painter.text(title.text, title.x, title.y, {
148
+ fill: bullet.titleColor,
149
+ font: bullet.titleFont,
150
+ textAlign: title.anchor === "end" ? "right" : "center",
151
+ textBaseline: title.anchor === "end" ? "middle" : "alphabetic"
152
+ });
153
+ const datum = lastValues?.get(d.id);
154
+ const text = datum && (isNumber(datum.value) || datum.value) ? getLabelText($$, datum) : null;
155
+ if (text) {
156
+ const centered = config.data_labels.centered;
157
+ const anchor = centered ? label.center : label;
158
+ const isRotated = config.bullet_rotated;
159
+ ctx.font = style.label.font;
160
+ ctx.textAlign = centered || isRotated ? "center" : "left";
161
+ ctx.textBaseline = centered || !isRotated ? "middle" : "alphabetic";
162
+ renderer.drawDataLabel($$, datum, text, anchor.x + getLabelPosition($$, datum, "x", texts), anchor.y + getLabelPosition($$, datum, "y", texts));
163
+ }
164
+ });
165
+ }
166
+ },
167
+ /**
168
+ * Add hit items of each visible bullet row: the measure and the target marker.
169
+ * Range bands are intentionally not hit targets, same as SVG.
170
+ * @param {HitDetector} detector Hit detector
171
+ * @private
172
+ */
173
+ hits(detector) {
174
+ const $$ = this;
175
+ const layout = $$.getBulletLayout();
176
+ const margin = 4;
177
+ layout.rows.forEach((d) => {
178
+ if (!$$.isTargetToShow(d.id)) return;
179
+ const { area, offset, isDot, measure, targets } = $$.getBulletRowGeometry(d, layout);
180
+ const left = area.left + offset.x;
181
+ const top = area.top + offset.y;
182
+ const rect = isDot ? {
183
+ x: measure.cx - measure.r,
184
+ y: measure.cy - measure.r,
185
+ w: measure.r * 2,
186
+ h: measure.r * 2
187
+ } : {
188
+ x: measure.x,
189
+ y: measure.y,
190
+ w: measure.width,
191
+ h: measure.height
192
+ };
193
+ detector.addBar({
194
+ x: left + rect.x,
195
+ y: top + rect.y,
196
+ w: rect.w,
197
+ h: rect.h,
198
+ data: d
199
+ });
200
+ targets.forEach((target) => {
201
+ detector.addBar({
202
+ x: left + Math.min(target.x1, target.x2) - margin,
203
+ y: top + Math.min(target.y1, target.y2) - margin,
204
+ w: Math.abs(target.x2 - target.x1) + 8,
205
+ h: Math.abs(target.y2 - target.y1) + 8,
206
+ data: d
207
+ });
208
+ });
209
+ });
210
+ }
211
+ };
212
+ export { bullet_default as default };
@@ -5,9 +5,9 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.4
8
+ * @version 4.2.0-next.1
9
9
  */
10
- //#region src/canvas/classes.ts
10
+ // src/canvas/classes.ts
11
11
  /**
12
12
  * Copyright (c) 2017 ~ present NAVER Corp.
13
13
  * billboard.js project is licensed under the MIT license
@@ -27,5 +27,4 @@ const $CANVAS = {
27
27
  legendItemTitle: "bb-legend-item-title",
28
28
  legendRight: "bb-canvas-legend-right"
29
29
  };
30
- //#endregion
31
30
  export { $CANVAS, $CANVAS as default };
@@ -5,11 +5,11 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.4
8
+ * @version 4.2.0-next.1
9
9
  */
10
10
  import { window as win } from "../module/browser.js";
11
11
  import { isNumber } from "../module/util/type-checks.js";
12
- //#region src/canvas/color.ts
12
+ // src/canvas/color.ts
13
13
  /**
14
14
  * Copyright (c) 2017 ~ present NAVER Corp.
15
15
  * billboard.js project is licensed under the MIT license
@@ -53,5 +53,4 @@ function parseCanvasColor(color) {
53
53
  colorParserContext.fillStyle = color;
54
54
  return parsedOnBlack === colorParserContext.fillStyle ? parsedOnBlack : null;
55
55
  }
56
- //#endregion
57
56
  export { parseCanvasColor, withOpacity };