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
@@ -10,7 +10,6 @@ import {
10
10
  capitalize,
11
11
  getBBox,
12
12
  getBoundingRect,
13
- getElementPos,
14
13
  getRandom,
15
14
  getTranslation,
16
15
  isFunction,
@@ -48,11 +47,11 @@ export default {
48
47
  * @private
49
48
  */
50
49
  initText(): void {
51
- const {$el} = this;
50
+ const {$el, state} = this;
52
51
 
53
52
  $el.main.select(`.${$COMMON.chart}`).append("g")
54
53
  .attr("class", $TEXT.chartTexts)
55
- .style("pointer-events", $el.funnel || $el.treemap ? "none" : null);
54
+ .style("pointer-events", state.customType || $el.treemap ? "none" : null);
56
55
  },
57
56
 
58
57
  /**
@@ -117,6 +116,12 @@ export default {
117
116
  isEndAnchor = !data?._isUp;
118
117
  } else if ($$.isTreemapType(d)) {
119
118
  return labelsCentered ? "middle" : "start";
119
+ } else if ($$.state.customType) {
120
+ const anchor = $$.getCustomTypeHooks(d)?.textAnchor?.($$, d);
121
+
122
+ if (anchor) {
123
+ return anchor;
124
+ }
120
125
  }
121
126
 
122
127
  return (config.axis_rotated ? (isEndAnchor ? "end" : "start") : "middle");
@@ -157,7 +162,8 @@ export default {
157
162
  const {config} = $$;
158
163
  const labelColors = config.data_labels_colors;
159
164
  const defaultColor =
160
- ($$.isArcType(d) && !$$.isRadarType(d)) || $$.isFunnelType(d) || $$.isTreemapType(d) ?
165
+ ($$.isArcType(d) && !$$.isRadarType(d)) || $$.getCustomTypeHooks(d)?.themeTextColor ||
166
+ $$.isTreemapType(d) ?
161
167
  null :
162
168
  $$.color(d);
163
169
  let color;
@@ -370,12 +376,12 @@ export default {
370
376
  generateXYForText(indices,
371
377
  forX?: boolean): (d, i, labelDimension?: TTextLabelDimension) => number {
372
378
  const $$ = this;
373
- const {state: {hasRadar, hasFunnel, hasTreemap}} = $$;
379
+ const {state: {customType, hasRadar, hasTreemap}} = $$;
374
380
  const types = Object.keys(indices);
375
381
  const points = {};
376
382
  const getter = forX ? $$.getXForText : $$.getYForText;
377
383
 
378
- hasFunnel && types.push("funnel");
384
+ customType && types.push(customType);
379
385
  hasRadar && types.push("radar");
380
386
  hasTreemap && types.push("treemap");
381
387
 
@@ -386,8 +392,8 @@ export default {
386
392
  return function(d, i, labelDimension?: TTextLabelDimension) {
387
393
  const type = ($$.isAreaType(d) && "area") ||
388
394
  ($$.isBarType(d) && "bar") ||
395
+ (customType && $$.isTypeOf(d, customType) && customType) ||
389
396
  ($$.isCandlestickType(d) && "candlestick") ||
390
- ($$.isFunnelType(d) && "funnel") ||
391
397
  ($$.isRadarType(d) && "radar") ||
392
398
  ($$.isTreemapType(d) && "treemap") || "line";
393
399
 
@@ -464,25 +470,20 @@ export default {
464
470
  const $$ = this;
465
471
  const {config} = $$;
466
472
  const isRotated = config.axis_rotated;
467
- const isFunnelType = $$.isFunnelType(d);
468
473
  const isTreemapType = $$.isTreemapType(d);
469
474
 
470
475
  let xPos = points ? points[0][0] : 0;
471
476
 
472
- if ($$.isCandlestickType(d)) {
477
+ const custom = $$.getCustomTypeHooks(d);
478
+
479
+ if (custom) {
480
+ return custom.textX($$, points, d, textElement, labelDimension);
481
+ } else if ($$.isCandlestickType(d)) {
473
482
  if (isRotated) {
474
483
  xPos = $$.getCandlestickData(d)?._isUp ? points[2][2] + 4 : points[2][1] - 4;
475
484
  } else {
476
485
  xPos += (points[1][0] - xPos) / 2;
477
486
  }
478
- } else if (isFunnelType) {
479
- // Use pre-calculated center x from points[2]
480
- // Preserve current position when points unavailable (during hide transition)
481
- if (points) {
482
- xPos = points[2]?.[0] ?? xPos;
483
- } else {
484
- return getElementPos(textElement, "x");
485
- }
486
487
  } else if (isTreemapType) {
487
488
  xPos += config.data_labels.centered ? 0 : 5;
488
489
  } else {
@@ -498,7 +499,7 @@ export default {
498
499
  }
499
500
  }
500
501
 
501
- if (isRotated || isTreemapType || isFunnelType) {
502
+ if (isRotated || isTreemapType) {
502
503
  xPos += $$.getCenteredTextPos(d, points, textElement, "x", labelDimension);
503
504
  }
504
505
 
@@ -520,7 +521,6 @@ export default {
520
521
  const isRotated = config.axis_rotated;
521
522
  const isInverted = config[`axis_${axis?.getId(d.id)}_inverted`];
522
523
  const isBarType = $$.isBarType(d);
523
- const isFunnelType = $$.isFunnelType(d);
524
524
  const isTreemapType = $$.isTreemapType(d);
525
525
  const r = config.point_r;
526
526
  const rect = labelDimension?.rect || getBoundingRect(textElement);
@@ -528,7 +528,11 @@ export default {
528
528
  let baseY = 3;
529
529
  let yPos;
530
530
 
531
- if ($$.isCandlestickType(d)) {
531
+ const custom = $$.getCustomTypeHooks(d);
532
+
533
+ if (custom) {
534
+ return custom.textY($$, points, d, textElement, rect, labelDimension);
535
+ } else if ($$.isCandlestickType(d)) {
532
536
  value = $$.getCandlestickData(d);
533
537
 
534
538
  if (isRotated) {
@@ -541,14 +545,6 @@ export default {
541
545
  yPos += 15 * (value._isUp ? 1 : -1);
542
546
  }
543
547
  }
544
- } else if (isFunnelType) {
545
- // Use pre-calculated center y from points[2]
546
- // Preserve current position when points unavailable (during hide transition)
547
- if (points) {
548
- yPos = (points[2]?.[1] ?? points[0][1]) + rect.height / 2 - 3;
549
- } else {
550
- return getElementPos(textElement, "y");
551
- }
552
548
  } else if (isTreemapType) {
553
549
  yPos = points[0][1] + (config.data_labels.centered ? 0 : rect.height + 5);
554
550
  } else {
@@ -24,9 +24,26 @@ import {
24
24
  import type {IArcData, IDataRow} from "../data/IData";
25
25
 
26
26
  // Hoisted to module level to avoid recompilation on every getTooltipContentTemplate() call
27
+ // the gap between the pointer and the tooltip of the types that have no axis, in px
28
+ const TOOLTIP_GAP = 15;
29
+
27
30
  const RE_WHITESPACE = /(\r?\n|\t)/g;
28
31
  const RE_TOOLTIP_TPL = /{{(.*)}}/;
29
32
 
33
+ /**
34
+ * Get the tooltip value of ranged data: one row per value, aligned on the colon of the names
35
+ * @param {Array} values [name, value] pairs
36
+ * @returns {string} html string
37
+ * @private
38
+ */
39
+ function getRangeValueHtml(values: (string | undefined)[][]): string {
40
+ return `<div style="display:inline-grid;grid-template-columns:auto auto;gap:0 .3em;text-align:left">${
41
+ values.map(([name, v]) => `<b style="text-align:right">${name}:</b><span>${v}</span>`).join(
42
+ ""
43
+ )
44
+ }</div>`;
45
+ }
46
+
30
47
  export default {
31
48
  /**
32
49
  * Initializes the tooltip
@@ -148,7 +165,9 @@ export default {
148
165
  row => ($$.axis && $$.isBubbleZType(row) ?
149
166
  $$.getBubbleZData(row.value, "z") :
150
167
  $$.getBaseValue(row));
151
- const getBgColor = $$.levelColor ? row => $$.levelColor(row.value) : row => color(row);
168
+ const getBaseColor = $$.levelColor ? row => $$.levelColor(row.value) : row => color(row);
169
+ // a chart type of its own can give the color of the swatch
170
+ const getBgColor = row => $$.customTypeHooks?.tooltipColor?.($$, row) ?? getBaseColor(row);
152
171
  const contents = config.tooltip_contents;
153
172
  const tplStr = contents.template;
154
173
  const targetIds = $$.mapToTargetIds();
@@ -227,7 +246,7 @@ export default {
227
246
  );
228
247
  const mid = valueFormat(getRowValue(row), ...param as [number, string, number]);
229
248
 
230
- value = `<b>Mid:</b> ${mid} <b>High:</b> ${high} <b>Low:</b> ${low}`;
249
+ value = getRangeValueHtml([["Mid", mid], ["High", high], ["Low", low]]);
231
250
  } else if ($$.isCandlestickType(row)) {
232
251
  const [open, high, low, close, volume] = ["open", "high", "low", "close", "volume"]
233
252
  .map(v => {
@@ -241,10 +260,17 @@ export default {
241
260
  undefined;
242
261
  });
243
262
 
244
- value =
245
- `<b>Open:</b> ${open} <b>High:</b> ${high} <b>Low:</b> ${low} <b>Close:</b> ${close}${
246
- volume ? ` <b>Volume:</b> ${volume}` : ""
247
- }`;
263
+ value = getRangeValueHtml([
264
+ ["Open", open],
265
+ ["High", high],
266
+ ["Low", low],
267
+ ["Close", close],
268
+ ...(volume ? [["Volume", volume]] : [])
269
+ ]);
270
+ } else if ($$.getAxisTypeHooks(row)?.tooltipRows) {
271
+ value = getRangeValueHtml(
272
+ $$.getAxisTypeHooks(row).tooltipRows($$, row, valueFormat, param)
273
+ );
248
274
  } else if ($$.isBarRangeType(row)) {
249
275
  const {value: rangeValue, id, index} = row;
250
276
 
@@ -392,7 +418,7 @@ export default {
392
418
  const {$el: {eventRect, svg}, config, state} = $$;
393
419
 
394
420
  const isRotated = config.axis_rotated;
395
- const hasArcType = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
421
+ const hasArcType = $$.hasArcType() || state.customType || state.hasTreemap;
396
422
  const target = (hasArcType ? svg : eventRect)?.node() ?? state.event.target;
397
423
 
398
424
  let {x, y} = currPos;
@@ -406,14 +432,15 @@ export default {
406
432
  const ctm = getTransformCTM(target, x, y, false);
407
433
  const rect = getBoundingRect(target);
408
434
  const size = getTransformCTM(target, 20, 0, false).x;
435
+ const gap = getTransformCTM(target, TOOLTIP_GAP, 0, false).x;
409
436
 
410
437
  let top = ctm.y;
411
438
  let left = ctm.x + (tWidth / 2) + size;
412
439
 
413
440
  if (hasArcType) {
414
- if (state.hasFunnel || state.hasTreemap || state.hasRadar) {
441
+ if (state.customType || state.hasTreemap || state.hasRadar) {
415
442
  left -= (tWidth / 2) + size;
416
- top += tHeight;
443
+ top += gap;
417
444
  } else {
418
445
  top += rect.height / 2;
419
446
  left += (rect.width / 2) - (tWidth - size);
@@ -425,7 +452,10 @@ export default {
425
452
  }
426
453
 
427
454
  if (top + tHeight > rect.height) {
428
- top -= tHeight * 2;
455
+ // above the pointer: the same gap as under it, where the type has one
456
+ top -= hasArcType && (state.customType || state.hasTreemap || state.hasRadar) ?
457
+ tHeight + gap * 2 :
458
+ tHeight * 2;
429
459
  }
430
460
 
431
461
  return {
@@ -446,8 +476,16 @@ export default {
446
476
  currPos: Record<string, number>): {top: number, left: number} {
447
477
  const $$ = this;
448
478
  const {config, scale, state} = $$;
449
- const {width, height, current, hasFunnel, hasRadar, hasTreemap, isLegendRight, inputType} =
450
- state;
479
+ const {
480
+ width,
481
+ height,
482
+ current,
483
+ customType,
484
+ hasRadar,
485
+ hasTreemap,
486
+ isLegendRight,
487
+ inputType
488
+ } = state;
451
489
  const hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle;
452
490
  const isRotated = config.axis_rotated;
453
491
  const hasArcType = $$.hasArcType();
@@ -472,10 +510,10 @@ export default {
472
510
  }
473
511
 
474
512
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
475
- y += (hasGauge ? height : (height / 2) + tHeight) + titlePadding;
513
+ y += (hasGauge ? height : height / 2) + titlePadding + TOOLTIP_GAP;
476
514
  }
477
- } else if (hasFunnel || hasTreemap) {
478
- y += tHeight;
515
+ } else if (customType || hasTreemap) {
516
+ y += TOOLTIP_GAP;
479
517
  } else {
480
518
  const padding = {
481
519
  top: $$.getCurrentPaddingByDirection("top", true),
@@ -494,13 +532,13 @@ export default {
494
532
 
495
533
  // when tooltip left + tWidth > chart's width
496
534
  if ((x + tWidth + 15) > chartRight) {
497
- x -= tWidth + (hasFunnel || hasTreemap || hasArcType ? 0 : (isRotated ? size * 2 : 38));
535
+ x -= tWidth +
536
+ (customType || hasTreemap || hasArcType ? 0 : (isRotated ? size * 2 : 38));
498
537
  }
499
538
 
500
539
  if (y + tHeight > current.height) {
501
- const gap = hasTreemap ? tHeight + 10 : 30;
502
-
503
- y -= hasGauge ? tHeight * 1.5 : tHeight + gap;
540
+ // above the pointer: the same gap as under it
541
+ y -= hasGauge ? tHeight * 1.5 + TOOLTIP_GAP : tHeight + TOOLTIP_GAP * 2;
504
542
  }
505
543
 
506
544
  const pos = {top: y, left: x};
@@ -697,7 +735,8 @@ export default {
697
735
  state: {event, hasAxis, hasRadar, hasTreemap}
698
736
  } = $$;
699
737
 
700
- if ($$.state.isCanvasMode) {
738
+ // the focus slides with a flow and its end updates the tooltip for the data moved in
739
+ if ($$.state.isCanvasMode || $$.state.flowing) {
701
740
  return;
702
741
  }
703
742
 
@@ -97,13 +97,13 @@ export default {
97
97
 
98
98
  transformAll(withTransition: boolean, transitions): void {
99
99
  const $$ = this;
100
- const {config, state: {hasAxis, hasFunnel, hasTreemap, isCanvasMode}, $el} = $$;
100
+ const {config, state: {customType, hasAxis, hasTreemap, isCanvasMode}, $el} = $$;
101
101
 
102
102
  if (isCanvasMode) {
103
103
  return;
104
104
  }
105
105
 
106
- !hasFunnel && !hasTreemap && $$.transformMain(withTransition, transitions);
106
+ !customType && !hasTreemap && $$.transformMain(withTransition, transitions);
107
107
 
108
108
  hasAxis && config.subchart_show &&
109
109
  $$.transformContext(withTransition, transitions);
@@ -34,7 +34,58 @@ export default {
34
34
  * @private
35
35
  */
36
36
  isValidChartType(type: string): boolean {
37
- return !!(type && Object.values(TYPE).indexOf(type) > -1);
37
+ // the type of a custom type module is valid too
38
+ return !!(type &&
39
+ (Object.values(TYPE).indexOf(type) > -1 || type === this.state.customType ||
40
+ this.axisTypes?.[type]));
41
+ },
42
+
43
+ /**
44
+ * Get the names of the chart types of their own modules that are drawn on the axes
45
+ * @returns {Array} Type names
46
+ * @private
47
+ */
48
+ getAxisTypes(): string[] {
49
+ return Object.keys(this.axisTypes || {});
50
+ },
51
+
52
+ /**
53
+ * Get what the modules of the axis types registered
54
+ * @returns {Array} Parts of the types
55
+ * @private
56
+ */
57
+ getAxisTypeParts(): any[] {
58
+ return Object.values(this.axisTypes || {});
59
+ },
60
+
61
+ /**
62
+ * Check if the chart has a type of its own module that is drawn like a bar: it has the room of
63
+ * the half of a shape at each end of the x axis, as the bar does
64
+ * @returns {boolean}
65
+ * @private
66
+ */
67
+ hasAxisTypePadding(): boolean {
68
+ const types = this.axisTypes;
69
+
70
+ return !!types && Object.keys(types).some(name => types[name].padded && this.hasType(name));
71
+ },
72
+
73
+ /**
74
+ * Get what the module of an axis type registered, when the data belongs to that type
75
+ * @param {object|string} d Data object or id
76
+ * @returns {object|undefined} Hooks of the type
77
+ * @private
78
+ */
79
+ getAxisTypeHooks(d) {
80
+ const types = this.axisTypes;
81
+
82
+ if (types) {
83
+ for (const name in types) {
84
+ if (this.isTypeOf(d, name)) {
85
+ return types[name];
86
+ }
87
+ }
88
+ }
38
89
  },
39
90
 
40
91
  /**
@@ -161,10 +212,12 @@ export default {
161
212
  */
162
213
  updateTypesElements(): void {
163
214
  const $$ = this;
164
- const {state: {current}} = $$;
215
+ const {state: {current, customType}} = $$;
216
+ const types = Object.values(TYPE);
217
+
218
+ customType && types.push(customType);
165
219
 
166
- Object.keys(TYPE).forEach(v => {
167
- const t = TYPE[v];
220
+ types.forEach(t => {
168
221
  const has = $$.hasType(t, null, true);
169
222
  const idx = current.types.indexOf(t);
170
223
 
@@ -292,6 +345,44 @@ export default {
292
345
  return this.isTypeOf(d, "bubble");
293
346
  },
294
347
 
348
+ /**
349
+ * Get the name of the chart type of its own module that the chart has.
350
+ * The modules register their types by name (registerCustomType()): a bundle can have more than
351
+ * one of them, and a chart has one at most.
352
+ * @returns {string|null} Type name
353
+ * @private
354
+ */
355
+ getCustomType(): string | null {
356
+ const types = this.customTypes;
357
+
358
+ return types && Object.keys(types).find(name => this.hasType(name)) || null;
359
+ },
360
+
361
+ /**
362
+ * Get what the module of the custom type of the chart has registered: hooks and canvas parts.
363
+ * @returns {object|undefined} Parts of the type
364
+ * @private
365
+ */
366
+ getCustomTypeParts() {
367
+ const {customType} = this.state;
368
+
369
+ return customType ? this.customTypes?.[customType] : undefined;
370
+ },
371
+
372
+ /**
373
+ * Get the hooks of the module of a custom type, when the data belongs to that type.
374
+ * @param {object} d Data object
375
+ * @returns {object|null} Hooks
376
+ * @private
377
+ */
378
+ getCustomTypeHooks(d) {
379
+ const {customType} = this.state;
380
+
381
+ return customType && this.isTypeOf(d, customType) ?
382
+ this.getCustomTypeParts()?.hooks ?? null :
383
+ null;
384
+ },
385
+
295
386
  isCandlestickType(d): boolean {
296
387
  return this.isTypeOf(d, "candlestick");
297
388
  },
@@ -308,10 +399,6 @@ export default {
308
399
  return this.isTypeOf(d, "pie");
309
400
  },
310
401
 
311
- isFunnelType(d): boolean {
312
- return this.isTypeOf(d, "funnel");
313
- },
314
-
315
402
  isGaugeType(d): boolean {
316
403
  return this.isTypeOf(d, "gauge");
317
404
  },
@@ -365,12 +452,17 @@ export default {
365
452
  * @private
366
453
  */
367
454
  labelishData(d) {
455
+ const custom = this.getCustomTypeHooks(d);
456
+
457
+ if (custom) {
458
+ return custom.labelData?.(this, d) ?? [];
459
+ }
460
+
368
461
  return this.isBarType(d) ||
369
462
  this.isLineType(d) ||
370
463
  this.isScatterType(d) ||
371
464
  this.isBubbleType(d) ||
372
465
  this.isCandlestickType(d) ||
373
- this.isFunnelType(d) ||
374
466
  this.isRadarType(d) ||
375
467
  this.isTreemapType(d) ?
376
468
  d.values.filter(v => isNumber(v.value) || Boolean(v.value)) :
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ import {select as d3Select} from "d3-selection";
6
+ import {$COMMON} from "../../config/classes";
7
+ import {getRandom} from "../../module/util";
8
+ import shapeBoxplotCommon, {$BOXPLOT} from "./core/boxplot";
9
+
10
+ export default {
11
+ ...shapeBoxplotCommon,
12
+
13
+ /**
14
+ * Initialize the container of the boxplot elements
15
+ * @private
16
+ */
17
+ initBoxplot(): void {
18
+ const $$ = this;
19
+ const {$el} = $$;
20
+
21
+ $el.boxplot = $el.main.select(`.${$COMMON.chart}`)
22
+ .append("g")
23
+ .attr("class", $BOXPLOT.chartBoxplots);
24
+ },
25
+
26
+ /**
27
+ * Update targets by its data
28
+ * @param {Array} targets Filtered target by type
29
+ * @private
30
+ */
31
+ updateTargetsForBoxplot(targets): void {
32
+ const $$ = this;
33
+ const {$el} = $$;
34
+
35
+ !$$.$el.boxplot && $$.initBoxplot();
36
+
37
+ const update = $el.main.select(`.${$BOXPLOT.chartBoxplots}`)
38
+ .selectAll(`.${$BOXPLOT.chartBoxplot}`)
39
+ .data($$.filterNullish(targets))
40
+ .attr("class", d => $BOXPLOT.chartBoxplot + $$.classTarget(d.id));
41
+
42
+ update.enter().append("g")
43
+ .attr("class", d => $BOXPLOT.chartBoxplot + $$.classTarget(d.id))
44
+ .style("pointer-events", "none");
45
+ },
46
+
47
+ /**
48
+ * Generate/Update elements
49
+ * @param {boolean} withTransition Transition for exit elements
50
+ * @private
51
+ */
52
+ updateBoxplot(withTransition: boolean): void {
53
+ const $$ = this;
54
+ const {$el, $T} = $$;
55
+ const boxplot = $el.main.selectAll(`.${$BOXPLOT.chartBoxplot}`)
56
+ .selectAll(`.${$BOXPLOT.boxplot}`)
57
+ .data(d => $$.getBoxplotRows(d));
58
+
59
+ $T(boxplot.exit(), withTransition)
60
+ .style("opacity", "0")
61
+ .remove();
62
+
63
+ const enter = boxplot.enter()
64
+ .append("g")
65
+ .attr("class", d => $$.generateClass($BOXPLOT.boxplot, d.index).trim());
66
+
67
+ enter.append("path").attr("class", $BOXPLOT.boxplotWhisker);
68
+ enter.append("path").attr("class", $BOXPLOT.boxplotBox);
69
+ enter.append("path").attr("class", $BOXPLOT.boxplotMedian);
70
+
71
+ $el.boxplot = boxplot.merge(enter)
72
+ .attr("class", d => $$.generateClass($BOXPLOT.boxplot, d.index).trim())
73
+ .style("opacity", $$.initialOpacity.bind($$));
74
+ },
75
+
76
+ /**
77
+ * Get the rows of a target that have a boxplot value
78
+ * @param {object} d Target
79
+ * @returns {Array} Data rows
80
+ * @private
81
+ */
82
+ getBoxplotRows(d) {
83
+ return this.isBoxplotType(d) ? d.values.filter(v => this.getBoxplotData(v)) : [];
84
+ },
85
+
86
+ /**
87
+ * Get draw function
88
+ * @param {object} indices Indice data
89
+ * @param {boolean} isSub Subchart draw
90
+ * @returns {function}
91
+ * @private
92
+ */
93
+ generateDrawBoxplot(indices, isSub) {
94
+ const $$ = this;
95
+ const getPoints = $$.generateGetBoxplotPoints(indices, isSub);
96
+ // [index position, value position] to [x, y]
97
+ const P = $$.config.axis_rotated ?
98
+ (i: number, v: number) => `${v},${i}` :
99
+ (i: number, v: number) => `${i},${v}`;
100
+
101
+ return (d, i, g) => {
102
+ const points = getPoints(d, i);
103
+
104
+ if (!points) {
105
+ return;
106
+ }
107
+
108
+ const {config} = $$;
109
+ const [[x0, q1], [x1, q3], [xc, min, max], [median], outliers, mean] = points;
110
+ const cap = (x1 - x0) * config.boxplot_whisker_width / 2;
111
+ const capPath = cap > 0 ?
112
+ `M${P(xc - cap, max)}L${P(xc + cap, max)}M${P(xc - cap, min)}L${P(xc + cap, min)}` :
113
+ "";
114
+
115
+ g.select(`.${$BOXPLOT.boxplotBox}`)
116
+ .attr("d", `M${P(x0, q1)}L${P(x1, q1)}L${P(x1, q3)}L${P(x0, q3)}z`)
117
+ .style("fill", $$.color(d));
118
+
119
+ g.select(`.${$BOXPLOT.boxplotMedian}`)
120
+ .attr("d", `M${P(x0, median)}L${P(x1, median)}`);
121
+
122
+ g.select(`.${$BOXPLOT.boxplotWhisker}`)
123
+ .attr("d", `M${P(xc, max)}L${P(xc, q3)}M${P(xc, q1)}L${P(xc, min)}${capPath}`);
124
+
125
+ // the outliers and the mean: elements are added and removed by their number
126
+ const el = d3Select(g.node());
127
+ const r = config.boxplot_outlier_r;
128
+ const m = config.boxplot_mean_r;
129
+
130
+ // a circle drawn as a path, to get the stroke of the theme as the other parts do
131
+ el.selectAll(`.${$BOXPLOT.boxplotOutlier}`)
132
+ .data<number>(outliers)
133
+ .join("path")
134
+ .attr("class", $BOXPLOT.boxplotOutlier)
135
+ .attr("d", v => {
136
+ const [cx, cy] = config.axis_rotated ? [v, xc] : [xc, v];
137
+
138
+ return `M${cx - r},${cy}a${r},${r} 0 1,0 ${2 * r},0a${r},${r} 0 1,0 ${
139
+ -2 * r
140
+ },0`;
141
+ });
142
+
143
+ el.selectAll(`.${$BOXPLOT.boxplotMean}`)
144
+ .data<number>(mean)
145
+ .join("path")
146
+ .attr("class", $BOXPLOT.boxplotMean)
147
+ .attr("d",
148
+ v => `M${P(xc - m, v)}L${P(xc, v - m)}L${P(xc + m, v)}L${P(xc, v + m)}z`);
149
+ };
150
+ },
151
+
152
+ /**
153
+ * Redraw function
154
+ * @param {function} drawFn Returned function from .generateDrawBoxplot()
155
+ * @param {boolean} withTransition With or without transition
156
+ * @returns {Array}
157
+ * @private
158
+ */
159
+ redrawBoxplot(drawFn, withTransition?: boolean) {
160
+ const $$ = this;
161
+ const {$el, $T} = $$;
162
+ const rand = getRandom(true);
163
+
164
+ return [
165
+ $el.boxplot
166
+ .each(function(d, i) {
167
+ drawFn(d, i, $T(d3Select(this), withTransition, rand));
168
+ })
169
+ .style("opacity", null)
170
+ ];
171
+ }
172
+ };