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
@@ -17,7 +17,7 @@ import Options from "../config/Options/Options";
17
17
  import Store from "../config/Store/Store";
18
18
  import {document, window} from "../module/browser";
19
19
  import Cache from "../module/Cache";
20
- import {checkModuleImport} from "../module/error";
20
+ import {checkModuleImport, getTypeMethod} from "../module/error";
21
21
  import {generateResize} from "../module/generator";
22
22
  import {
23
23
  callFn,
@@ -81,11 +81,23 @@ function getUnsupportedCanvasRenderType($$): string | null {
81
81
  return "arc charts";
82
82
  }
83
83
 
84
- if ($$.hasType("funnel")) {
85
- return "funnel chart";
84
+ if ($$.state.customType) {
85
+ // the type tells it by itself when it is drawn by svg only
86
+ const unsupported = $$.customTypeHooks?.canvasUnsupported;
87
+
88
+ if (unsupported) {
89
+ return unsupported;
90
+ }
91
+
92
+ // otherwise it is drawn on canvas by the canvas part of its module:
93
+ // there is nothing to draw it when only the svg part was imported
94
+ if (!$$.getCustomTypeParts()?.canvas) {
95
+ return `${$$.state.customType} chart without its canvas module`;
96
+ }
86
97
  }
87
98
 
88
- return null;
99
+ // the types drawn by canvas parts, which only the canvas module knows
100
+ return $$.getUnsupportedCanvasPart?.() ?? null;
89
101
  }
90
102
 
91
103
  /**
@@ -238,19 +250,33 @@ export default class ChartInternal {
238
250
  callFn($$.config.onafterinit, $$.api);
239
251
  }
240
252
 
253
+ /**
254
+ * The hooks of the module of the custom type of the chart (see registerCustomType()).
255
+ * @private
256
+ */
257
+ get customTypeHooks() {
258
+ const $$ = <any>this;
259
+
260
+ // (reading it from the prototype, which has no state, is not an error)
261
+ return $$.state && $$.getCustomTypeParts()?.hooks;
262
+ }
263
+
241
264
  init(): void {
242
265
  const $$ = <any>this;
243
266
  const {config, state, $el} = $$;
244
267
  const {boost_useCssRule, bindto} = config;
245
268
 
269
+ // set by the module of a type that is neither axis based nor built in:
270
+ // the import check needs it to tell a type whose module is there
271
+ state.customType = $$.getCustomType();
272
+
246
273
  checkModuleImport($$);
247
274
  fallbackUnsupportedCanvasRenderMode($$);
248
275
 
249
276
  const hasArcType = $$.hasArcType();
250
277
  state.hasRadar = !state.hasAxis && $$.hasType("radar");
251
- state.hasFunnel = !state.hasAxis && $$.hasType("funnel");
252
278
  state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
253
- state.hasAxis = !hasArcType && !state.hasFunnel && !state.hasTreemap;
279
+ state.hasAxis = !hasArcType && !state.customType && !state.hasTreemap;
254
280
 
255
281
  // datetime to be used for uniqueness
256
282
  state.datetimeId = `bb-${+new Date() * (getRandom() as number)}`;
@@ -354,7 +380,7 @@ export default class ChartInternal {
354
380
  }
355
381
 
356
382
  if (config.render_mode !== "canvas" && ($$.hasPointType() || $$.hasLegendDefsPoint?.())) {
357
- $$.point = $$.generatePoint();
383
+ $$.point = getTypeMethod($$, "generatePoint").call($$);
358
384
  }
359
385
 
360
386
  if (state.hasAxis) {
@@ -405,7 +431,7 @@ export default class ChartInternal {
405
431
  initWithData(data): void {
406
432
  const $$ = <any>this;
407
433
  const {config, scale, state, $el, org} = $$;
408
- const {hasAxis, hasFunnel, hasTreemap} = state;
434
+ const {customType, hasAxis, hasTreemap} = state;
409
435
  const hasInteraction = config.interaction_enabled;
410
436
  const hasPolar = $$.hasType("polar");
411
437
  const labelsBGColor = config.data_labels_backgroundColors;
@@ -542,7 +568,7 @@ export default class ChartInternal {
542
568
  $el.defs = $el.svg.append("defs");
543
569
 
544
570
  if (hasAxis) {
545
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
571
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
546
572
  $$.appendClip($el.defs, state.clip[v]);
547
573
  });
548
574
  }
@@ -564,7 +590,7 @@ export default class ChartInternal {
564
590
  // Define regions
565
591
  const main = $el.svg.append("g")
566
592
  .classed($COMMON.main, true)
567
- .attr("transform", hasFunnel || hasTreemap ? null : $$.getTranslate("main"));
593
+ .attr("transform", customType || hasTreemap ? null : $$.getTranslate("main"));
568
594
 
569
595
  $el.main = main;
570
596
 
@@ -657,7 +683,7 @@ export default class ChartInternal {
657
683
  const types: string[] = [];
658
684
 
659
685
  if (hasAxis) {
660
- const shapes = ["bar", "bubble", "candlestick", "line"];
686
+ const shapes = ["bar", "bubble", "candlestick", "line", ...$$.getAxisTypes()];
661
687
 
662
688
  if ($$.config.bar_front) {
663
689
  shapes.push(shapes.shift() as string);
@@ -671,8 +697,8 @@ export default class ChartInternal {
671
697
  }
672
698
  } else if (hasTreemap) {
673
699
  types.push("Treemap");
674
- } else if ($$.hasType("funnel")) {
675
- types.push("Funnel");
700
+ } else if ($$.state.customType) {
701
+ types.push(capitalize($$.state.customType));
676
702
  } else {
677
703
  const hasPolar = $$.hasType("polar");
678
704
  const hasGauge = $$.hasType("gauge");
@@ -691,7 +717,7 @@ export default class ChartInternal {
691
717
  }
692
718
 
693
719
  for (const type of types) {
694
- $$[`init${type}`]();
720
+ getTypeMethod($$, `init${type}`).call($$);
695
721
  }
696
722
 
697
723
  if (notEmpty($$.config.data_labels) && !$$.hasArcType(null, ["radar"])) {
@@ -784,9 +810,10 @@ export default class ChartInternal {
784
810
  */
785
811
  updateTargets(targets): void {
786
812
  const $$ = <any>this;
787
- const {hasAxis, hasFunnel, hasRadar, hasTreemap} = $$.state;
813
+ const {customType, hasAxis, hasRadar, hasTreemap} = $$.state;
788
814
  const helper = type =>
789
- $$[`updateTargetsFor${type}`](
815
+ getTypeMethod($$, `updateTargetsFor${type}`).call(
816
+ $$,
790
817
  targets.filter($$[`is${type}Type`].bind($$))
791
818
  );
792
819
 
@@ -794,7 +821,7 @@ export default class ChartInternal {
794
821
  $$.updateTargetsForText(targets);
795
822
 
796
823
  if (hasAxis) {
797
- const shapes = ["bar", "candlestick", "line"];
824
+ const shapes = ["bar", "candlestick", "line", ...$$.getAxisTypes()];
798
825
  for (const shape of shapes) {
799
826
  const name = capitalize(shape);
800
827
  if ((shape === "line" && $$.hasTypeOf(name)) || $$.hasType(shape)) {
@@ -816,8 +843,8 @@ export default class ChartInternal {
816
843
  }
817
844
 
818
845
  helper(type);
819
- } else if (hasFunnel) {
820
- helper("Funnel");
846
+ } else if (customType) {
847
+ helper(capitalize(customType));
821
848
  } else if (hasTreemap) {
822
849
  helper("Treemap");
823
850
  }
@@ -15,6 +15,19 @@ export interface IFunnelData {
15
15
  coords?: number[][];
16
16
  }
17
17
 
18
+ export interface IBulletData {
19
+ id: string;
20
+ index: number;
21
+ x: number; // for compatibility
22
+ name: string;
23
+ value: number;
24
+ title: string; // empty when bullet.title.show is not set
25
+ ranges: number[];
26
+ targets: number[];
27
+ domainMin: number; // 0 or less, unless bullet.axis.min is given
28
+ domainMax: number;
29
+ }
30
+
18
31
  export interface ITreemapData {
19
32
  name: string;
20
33
  id?: string; // for compatibility
@@ -763,12 +763,18 @@ export default {
763
763
 
764
764
  targets.forEach(t => {
765
765
  const data: any[] = [];
766
+ // a type of its own module that has the values of a row to cover by itself
767
+ const axisDomain = $$.getAxisTypeHooks?.(t)?.domainValues;
766
768
 
767
769
  t.values
768
770
  .filter(({value}) => isValue(value) || value === null)
769
771
  .forEach(v => {
770
772
  let {value} = v;
771
773
 
774
+ if (axisDomain) {
775
+ value = axisDomain($$, v);
776
+ }
777
+
772
778
  // exclude 'volume' value to correct mis domain calculation
773
779
  if (value !== null && $$.isCandlestickType(v)) {
774
780
  value = isArray(value) ?
@@ -840,9 +846,20 @@ export default {
840
846
 
841
847
  if (orderAsc || orderDesc) {
842
848
  const reducer = (p, c) => p + Math.abs(c.value);
843
- const sum = v => (isNumber(v) ? v : (
844
- "values" in v ? v.values.reduce(reducer, 0) : v.value
845
- ));
849
+ // sort calls the compare function O(n log n) times, so sum once per target
850
+ // (the cache lives as long as this compare function)
851
+ const sums = new WeakMap();
852
+ const sum = v => {
853
+ if (isNumber(v)) {
854
+ return v;
855
+ }
856
+
857
+ if (!sums.has(v)) {
858
+ sums.set(v, "values" in v ? v.values.reduce(reducer, 0) : v.value);
859
+ }
860
+
861
+ return sums.get(v);
862
+ };
846
863
 
847
864
  fn = (t1: IData | IDataRow, t2: IData | IDataRow) => {
848
865
  const t1Sum = sum(t1);
@@ -1217,9 +1234,13 @@ export default {
1217
1234
 
1218
1235
  const isBar = $$.isBarType(v.id);
1219
1236
  const isCandle = $$.isCandlestickType(v.id);
1237
+ // the selector of the shape of a type of its own module drawn on the axes
1238
+ const axisHit = $$.getAxisTypeHooks(v.id)?.hit;
1220
1239
 
1221
- if (isBar || isCandle) {
1222
- const selector = isBar ?
1240
+ if (isBar || isCandle || axisHit) {
1241
+ const selector = axisHit ?
1242
+ axisHit($$, v) :
1243
+ isBar ?
1223
1244
  `.${$BAR.chartBar}.${$COMMON.target}${
1224
1245
  $$.getTargetSelectorSuffix(v.id)
1225
1246
  } .${$BAR.bar}-${v.index}` :
@@ -227,8 +227,8 @@ export default {
227
227
  // Remove targets
228
228
  $$.data.targets = $$.data.targets.filter(t => !unloadIds.has(t.id));
229
229
 
230
- // since treemap uses different data types, it needs to be transformed
231
- state.hasFunnel && $$.updateFunnel($$.data.targets);
230
+ // a type of its own module can need its data to be transformed
231
+ $$.customTypeHooks?.afterUnload?.($$);
232
232
 
233
233
  // since treemap uses different data types, it needs to be transformed
234
234
  state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
@@ -15,9 +15,14 @@ export default {
15
15
  */
16
16
  generateFlow(args): Function {
17
17
  const $$ = this;
18
- const {data, state, $el} = $$;
18
+ const {config, data, state, $el} = $$;
19
19
 
20
20
  return function() {
21
+ // destroy() empties the instance while the redraw transition is waited on
22
+ if (!$$.$el) {
23
+ return;
24
+ }
25
+
21
26
  const flowLength = args.flow.length;
22
27
 
23
28
  // set flag
@@ -63,7 +68,18 @@ export default {
63
68
  }
64
69
  });
65
70
 
66
- $$.hideGridFocus?.();
71
+ // the focus slides with its data and the flow end moves it to the data under the pointer
72
+ if (config.axis_rotated) {
73
+ $$.hideGridFocus?.();
74
+ } else {
75
+ const xFocus = $el.main.selectAll(
76
+ `line.${CLASS.xgridFocus}:not(.${CLASS.xgridFocusContinuous})`
77
+ );
78
+
79
+ xFocus.size() && (elements["gridFocus.x"] = xFocus);
80
+ $el.main.selectAll(`line.${CLASS.ygridFocus}`).style("visibility", "hidden");
81
+ }
82
+
67
83
  $$.setFlowList(elements, args);
68
84
  };
69
85
  },
@@ -79,12 +95,10 @@ export default {
79
95
  const {flow, targets} = args;
80
96
  const {
81
97
  duration = args.duration,
82
- index: flowIndex,
83
- length: flowLength,
84
98
  orgDataCount
85
99
  } = flow;
86
100
 
87
- const transform = $$.getFlowTransform(targets, orgDataCount, flowIndex, flowLength);
101
+ const transform = $$.getFlowTransform(targets, orgDataCount);
88
102
  const wait = generateWait();
89
103
  let n;
90
104
 
@@ -121,6 +135,13 @@ export default {
121
135
  */
122
136
  cleanUpFlow(elements, args): void {
123
137
  const $$ = this;
138
+
139
+ // destroy() interrupts the flow transition, which the wait counts as ended,
140
+ // and empties the instance before this runs
141
+ if (!$$.$el) {
142
+ return;
143
+ }
144
+
124
145
  const {config, state, $el: {svg}} = $$;
125
146
  const isRotated = config.axis_rotated;
126
147
 
@@ -133,6 +154,11 @@ export default {
133
154
 
134
155
  // Remove flowed elements
135
156
  if (flowLength) {
157
+ // point.focus.only draws one circle per data series, which the focus moves to any index
158
+ const isFocusCircle = $$.isPointFocusOnly() ?
159
+ (node: Element) => node.parentElement?.classList.contains(CLASS.circles) :
160
+ () => false;
161
+
136
162
  ["circle", "text", "shape", "eventRect"].forEach(v => {
137
163
  const target: string[] = [];
138
164
 
@@ -142,6 +168,9 @@ export default {
142
168
 
143
169
  svg.selectAll(`.${CLASS[`${v}s`]}`) // circles, shapes, texts, eventRects
144
170
  .selectAll(target)
171
+ .filter(function() {
172
+ return !isFocusCircle(this);
173
+ })
145
174
  .remove();
146
175
  });
147
176
 
@@ -190,28 +219,31 @@ export default {
190
219
 
191
220
  config.interaction_enabled && $$.redrawEventRect();
192
221
 
222
+ state.flowing = false;
223
+
224
+ // other data is under the pointer now: show its focus and tooltip
225
+ if ($$.$el.tooltip?.style("display") === "block") {
226
+ $$.updateTooltipOnRedraw();
227
+ } else {
228
+ $$.hideGridFocus?.();
229
+ }
230
+
193
231
  // callback for end of flow
194
232
  done.call($$.api);
195
-
196
- state.flowing = false;
197
233
  },
198
234
 
199
235
  /**
200
236
  * Get flow transform value
201
237
  * @param {object} targets target
202
238
  * @param {number} orgDataCount original data count
203
- * @param {number} flowIndex flow index
204
- * @param {number} flowLength flow length
205
239
  * @returns {string}
206
240
  * @private
207
241
  */
208
- getFlowTransform(targets, orgDataCount, flowIndex, flowLength): string {
242
+ getFlowTransform(targets, orgDataCount): string {
209
243
  const $$ = this;
210
244
  const {data, scale: {x}} = $$;
211
245
  const dataValues = data.targets[0].values;
212
246
 
213
- let flowStart = $$.getValueOnIndex(dataValues, flowIndex);
214
- let flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength);
215
247
  let translateX;
216
248
 
217
249
  // update x domain to generate axis elements for flow
@@ -224,19 +256,18 @@ export default {
224
256
  translateX = x(orgDomain[0]) - x(domain[0]);
225
257
  } else {
226
258
  if ($$.axis.isTimeSeries()) {
227
- flowStart = $$.getValueOnIndex(dataValues, 0);
228
- flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1);
259
+ const flowStart = $$.getValueOnIndex(dataValues, 0);
260
+ const flowEnd = $$.getValueOnIndex(dataValues, dataValues.length - 1);
261
+
229
262
  translateX = x(flowStart.x) - x(flowEnd.x);
230
263
  } else {
231
264
  translateX = diffDomain(domain) / 2;
232
265
  }
233
266
  }
234
- } else if (orgDataCount === 1 || flowStart?.x === flowEnd?.x) {
235
- translateX = x(orgDomain[0]) - x(domain[0]);
236
267
  } else {
237
- translateX = $$.axis.isTimeSeries() ?
238
- x(orgDomain[0]) - x(domain[0]) :
239
- x(flowStart?.x || 0) - x(flowEnd.x);
268
+ // The flowed-out head is already spliced from the data, so the slide is
269
+ // measured by how far the domain start moved.
270
+ translateX = x(orgDomain[0]) - x(domain[0]);
240
271
  }
241
272
 
242
273
  const scaleX = diffDomain(orgDomain) / diffDomain(domain);
@@ -59,11 +59,12 @@ export default {
59
59
  * Handle data.onover/out callback options
60
60
  * @param {boolean} isOver Over or not
61
61
  * @param {number|object} d data object
62
+ * @param {Element} [element] The element hovered, when it isn't the first shape of the data
62
63
  * @private
63
64
  */
64
- setOverOut(isOver: boolean, d: number | IArcDataRow): void {
65
+ setOverOut(isOver: boolean, d: number | IArcDataRow, element?: Element): void {
65
66
  const $$ = this;
66
- const {config, state: {hasFunnel, hasRadar, hasTreemap}, $el: {main}} = $$;
67
+ const {config, state: {customType, hasRadar, hasTreemap}, $el: {main}} = $$;
67
68
  const isArcishData = isObject(d);
68
69
 
69
70
  // Call event handler
@@ -74,11 +75,12 @@ export default {
74
75
 
75
76
  if (isArcishData) {
76
77
  const suffix = $$.getTargetSelectorSuffix((d as IArcDataRow).id);
77
- const selector = hasFunnel || hasTreemap ?
78
+ const selector = customType || hasTreemap ?
78
79
  `${$COMMON.target + suffix} .${$SHAPE.shape}` :
79
80
  $ARC.arc + suffix;
80
81
 
81
- callback(d, main.select(`.${selector}`).node());
82
+ // the element the type gives (the hovered cell, link...), or the first shape of the data
83
+ callback(d, element ?? main.select(`.${selector}`).node());
82
84
  } else if (!config.tooltip_grouped) {
83
85
  const last = $$.cache.get(KEY.setOverOut) || [];
84
86
 
@@ -187,14 +189,14 @@ export default {
187
189
  state: {
188
190
  eventReceiver,
189
191
  hasAxis,
190
- hasFunnel,
192
+ customType,
191
193
  hasRadar,
192
194
  hasTreemap
193
195
  },
194
- $el: {eventRect, funnel, radar, svg, treemap}
196
+ $el: {eventRect, radar, svg, treemap}
195
197
  } = $$;
196
198
  let element = (
197
- ((hasFunnel || hasTreemap) && eventReceiver.rect) ||
199
+ ((customType || hasTreemap) && eventReceiver.rect) ||
198
200
  (hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`)) || (
199
201
  eventRect || $$.getArcElementByIdOrIndex?.(index)
200
202
  )
@@ -242,9 +244,9 @@ export default {
242
244
  bubbles: hasRadar // radar type needs to bubble up event
243
245
  };
244
246
 
245
- // for funnel and treemap event bound to <g> node
246
- if (hasFunnel || hasTreemap) {
247
- element = (funnel ?? treemap).node();
247
+ // for custom type and treemap event bound to <g> node
248
+ if (customType || hasTreemap) {
249
+ element = ($$.$el[customType as string] ?? treemap).node();
248
250
  }
249
251
 
250
252
  emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](
@@ -283,7 +285,8 @@ export default {
283
285
  */
284
286
  unbindAllEvents(): void {
285
287
  const $$ = this;
286
- const {$el: {arcs, eventRect, legend, region, svg, treemap}, brush} = $$;
288
+ const {$el: {arcs, eventRect, legend, region, svg, treemap}, brush, state: {customType}} =
289
+ $$;
287
290
  const list = [
288
291
  "wheel",
289
292
  "click",
@@ -311,6 +314,7 @@ export default {
311
314
  brush?.getSelection(),
312
315
  arcs?.selectAll("path"),
313
316
  legend?.selectAll("g"),
317
+ $$.$el[customType as string],
314
318
  treemap
315
319
  ]
316
320
  .forEach(v => v?.on(list, null));
@@ -25,12 +25,13 @@ export default {
25
25
  * Get class string
26
26
  * @param {string} type Shape type
27
27
  * @param {boolean} withShape Get with shape prefix
28
+ * @param {boolean} useId Use the id of the data as the key of the class, as the types of the group
28
29
  * @returns {string} Class string
29
30
  * @private
30
31
  */
31
- getClass(type: string, withShape: boolean): Function {
32
+ getClass(type: string, withShape: boolean, useId?: boolean): Function {
32
33
  const isPlural = /s$/.test(type);
33
- const useIdKey = /^(area|arc|line|funnel|treemap)s?$/.test(type);
34
+ const useIdKey = useId ?? /^(area|arc|line|treemap)s?$/.test(type);
34
35
  const key = isPlural ? "id" : "index";
35
36
 
36
37
  return (d): string => {
@@ -120,11 +120,13 @@ function getTargetValueMinMax($$, targets: IData[]): DomainMinMax {
120
120
  // asking per row made every main-chart domain pass walk the subchart type chain
121
121
  const isSubchartCandlestick = !isCandlestick &&
122
122
  !!$$.isSubchartSourceTypeOf?.(target, TYPE.CANDLESTICK);
123
+ // a type of its own module that has the values of a row to cover by itself
124
+ const axisDomain = $$.getAxisTypeHooks?.(target)?.domainValues;
123
125
  const {values} = target;
124
126
 
125
127
  for (let j = 0; j < values.length; j++) {
126
128
  const row = values[j];
127
- let value: any = row.value;
129
+ let value: any = axisDomain ? axisDomain($$, row) : row.value;
128
130
 
129
131
  if (!(isValue(value) || value === null)) {
130
132
  continue;
@@ -521,7 +523,7 @@ export default {
521
523
  // determine default padding value
522
524
  if (axis.isCategorized() || isTimeSeriesTickCount) {
523
525
  defaultValue = 0;
524
- } else if ($$.hasType("bar")) {
526
+ } else if ($$.hasType("bar") || $$.hasAxisTypePadding?.()) {
525
527
  const maxDataCount = $$.getMaxDataCount();
526
528
 
527
529
  defaultValue = maxDataCount > 1 ? (diff / (maxDataCount - 1)) / 2 : 0.5;
@@ -91,6 +91,8 @@ export default {
91
91
  }
92
92
  }
93
93
 
94
- return format.bind($$.api);
94
+ // the format given by the module of a custom type takes precedence, as treemap.label.format does
95
+ return $$.state.customType && $$.customTypeHooks?.labelFormat?.($$, targetId) ||
96
+ format.bind($$.api);
95
97
  }
96
98
  };
@@ -33,7 +33,8 @@ function _getLegendColor(id: string): string {
33
33
  const data = $$.getDataById(id);
34
34
  const color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
35
35
 
36
- return color;
36
+ // a chart type of its own can give the color of the swatch
37
+ return $$.customTypeHooks?.legendColor?.($$, data) ?? color;
37
38
  }
38
39
 
39
40
  /**
@@ -65,7 +65,8 @@ export default {
65
65
 
66
66
  if (state.isCanvasMode) {
67
67
  const zoomScale = $$.scale.zoom;
68
- const zoomDomain = zoomScale?.domain();
68
+ // the domain set to the scale: a category scale reads its end one category further
69
+ const zoomDomain = zoomScale?.orgDomain?.() ?? zoomScale?.domain();
69
70
 
70
71
  zoomScale && ($$.scale.zoom = null);
71
72
  $$.updateScales(initializing, wth.UpdateXDomain);
@@ -73,7 +74,8 @@ export default {
73
74
  if (zoomScale) {
74
75
  zoomScale.range($$.scale.x.range());
75
76
  zoomDomain && zoomScale.domain(zoomDomain);
76
- $$.scale.zoom = $$.getCustomizedXScale(zoomScale);
77
+ // wrap the plain scale: wrapping the customized one again shifts a category domain
78
+ $$.scale.zoom = $$.getCustomizedXScale(zoomScale.orgScale?.() ?? zoomScale);
77
79
  $$.axis.x.scale($$.scale.zoom);
78
80
  $$.scale.x.domain(config.zoom_rescale ? zoomDomain : $$.org.xDomain);
79
81
  $$.scale.subX.domain($$.org.xDomain);
@@ -149,7 +151,7 @@ export default {
149
151
  // rect for regions (optional module — updateRegion installed by regions resolver)
150
152
  config.regions.length && $$.updateRegion?.();
151
153
 
152
- ["bar", "candlestick", "line", "area"].forEach(v => {
154
+ ["bar", "candlestick", "line", "area", ...$$.getAxisTypes()].forEach(v => {
153
155
  const name = capitalize(v);
154
156
 
155
157
  if ((/^(line|area)$/.test(v) && $$.hasTypeOf(name)) || $$.hasType(v)) {
@@ -180,8 +182,8 @@ export default {
180
182
  // polar
181
183
  $el.polar && $$.redrawPolar();
182
184
 
183
- // funnel
184
- $el.funnel && $$.redrawFunnel();
185
+ // custom type
186
+ state.customType && $$[`redraw${capitalize(state.customType)}`](wth.Transition);
185
187
 
186
188
  // treemap
187
189
  treemap && $$.updateTreemap(durationForExit);
@@ -189,7 +191,7 @@ export default {
189
191
 
190
192
  if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
191
193
  if (needShapeUpdate) {
192
- $$.updateCircle();
194
+ $$.updateCircle(false, !!flow);
193
195
  }
194
196
  } else if ($$.hasLegendDefsPoint?.()) {
195
197
  $$.data.targets.forEach($$.point("create", this));
@@ -223,6 +225,12 @@ export default {
223
225
  needShapeRegen: boolean = true): void {
224
226
  const $$ = this;
225
227
  const {config, state} = $$;
228
+
229
+ // subchart first: its initial range narrows the x domain, which sizes the main shapes
230
+ if (state.hasAxis) {
231
+ config.subchart_show && $$.redrawSubchart(withSubchart, duration);
232
+ }
233
+
226
234
  const shape = needShapeRegen ?
227
235
  $$.getDrawShape() :
228
236
  (state._cachedDrawShape || $$.getDrawShape());
@@ -231,11 +239,6 @@ export default {
231
239
  state._cachedDrawShape = shape;
232
240
  }
233
241
 
234
- if (state.hasAxis) {
235
- // subchart
236
- config.subchart_show && $$.redrawSubchart(withSubchart, duration, shape);
237
- }
238
-
239
242
  // generate flow
240
243
  const flowFn = flow && $$.generateFlow({
241
244
  targets,
@@ -244,7 +247,10 @@ export default {
244
247
  shape,
245
248
  xv: $$.xv.bind($$)
246
249
  });
247
- const withTransition = (duration || flowFn) && isTabVisible();
250
+ // A flow slides the shapes itself, so they take their new data at once: a chart
251
+ // transition interpolated the paths between different point counts first, which
252
+ // bent them and held back the slide until it ended.
253
+ const withTransition = !flowFn && duration && isTabVisible();
248
254
 
249
255
  // redraw list
250
256
  const redrawList = $$.getRedrawList(shape, flow, flowFn, withTransition);
@@ -37,7 +37,8 @@ export default {
37
37
  getCurrentHeight(): number {
38
38
  const $$ = this;
39
39
  const {config, state, $el} = $$;
40
- let h = config.size_height;
40
+ // a chart type of its own can make the chart as high as it needs, from the width
41
+ let h = config.size_height || $$.customTypeHooks?.currentHeight?.($$);
41
42
 
42
43
  if (!h) {
43
44
  // The min-height reserved for the canvas surface is this element's own
@@ -441,7 +442,7 @@ export default {
441
442
  const $$ = this;
442
443
  const {config, state, $el: {legend}} = $$;
443
444
  const isRotated = config.axis_rotated;
444
- const isNonAxis = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
445
+ const isNonAxis = $$.hasArcType() || state.customType || state.hasTreemap;
445
446
  const isFitPadding = config.padding?.mode === "fit";
446
447
 
447
448
  !isInit && $$.setContainerSize();
@@ -579,7 +580,8 @@ export default {
579
580
  $$.updateRadius?.();
580
581
  }
581
582
 
582
- if (state.isLegendRight && isNonAxis) {
583
+ // arc types center their legend by the arc size: a custom type can place it beside its own plot
584
+ if (state.isLegendRight && isNonAxis && !$$.customTypeHooks?.ownLegendLayout) {
583
585
  state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
584
586
  }
585
587
  }