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
@@ -0,0 +1,142 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ import {getTreemapLabelText, getTreemapNodeRect} from "../ChartInternal/shape/core/geometry";
6
+ import type CanvasRenderer from "./CanvasRenderer";
7
+ import type HitDetector from "./HitDetector";
8
+ import {drawLabelDecorations, getLabelColor} from "./labels";
9
+ import {getFontSize, isCanvasTreemapType, isFiniteCanvasCoordinate} from "./util";
10
+
11
+ /**
12
+ * Canvas drawing and hit detection of the treemap type.
13
+ * Added to the chart by treemap(): bundles without treemap do not carry it.
14
+ */
15
+ export default {
16
+ // treemap is laid out over the whole chart: nothing of the axis types is drawn with it
17
+ exclusive: true,
18
+
19
+ /**
20
+ * Draw treemap tiles and labels on canvas.
21
+ * @param {CanvasRenderer} renderer Canvas renderer
22
+ * @private
23
+ */
24
+ draw(renderer: CanvasRenderer): void {
25
+ const $$ = this;
26
+ const {ctx, painter, theme: {style}} = renderer;
27
+ const {config} = $$;
28
+ const root = $$.getTreemapRoot?.($$.data.targets);
29
+ const nodes = root?.children || [];
30
+
31
+ painter.withState(() => {
32
+ ctx.lineWidth = style.treemap.lineWidth;
33
+ ctx.strokeStyle = style.treemap.stroke;
34
+
35
+ for (const node of nodes) {
36
+ const {data} = node;
37
+
38
+ if (!isCanvasTreemapType($$, data)) {
39
+ continue;
40
+ }
41
+
42
+ const {x, y, w, h} = getTreemapNodeRect($$, node, root, true);
43
+
44
+ if (
45
+ !isFiniteCanvasCoordinate(x, y) ||
46
+ !isFiniteCanvasCoordinate(x + w, y + h) ||
47
+ w <= 0 ||
48
+ h <= 0
49
+ ) {
50
+ continue;
51
+ }
52
+
53
+ const rect = {x, y, w, h};
54
+
55
+ ctx.fillStyle = $$.color(data.name);
56
+ painter.fillRect(rect);
57
+ painter.strokeRect(rect);
58
+
59
+ if (
60
+ !config.treemap_label_show ||
61
+ (data.ratio || 0) < (config.treemap_label_threshold || 0)
62
+ ) {
63
+ continue;
64
+ }
65
+
66
+ const label = getTreemapLabelText($$, data, w, h);
67
+
68
+ if (!label) {
69
+ continue;
70
+ }
71
+
72
+ const lines = label.split("\n");
73
+ const isCentered = !!config.data_labels.centered;
74
+
75
+ ctx.font = style.label.font;
76
+ const lineHeight = getFontSize(ctx.font);
77
+ const metrics = ctx.measureText(lines[0] ?? "");
78
+ const fontBoundingHeight = (
79
+ (metrics.fontBoundingBoxAscent || 0) +
80
+ (metrics.fontBoundingBoxDescent || 0)
81
+ ) || (
82
+ (metrics.actualBoundingBoxAscent || 0) +
83
+ (metrics.actualBoundingBoxDescent || 0)
84
+ );
85
+ const textHeight = Math.max(lineHeight, fontBoundingHeight) +
86
+ ((lines.length - 1) * lineHeight);
87
+ const blockY = isCentered ? y + h / 2 : y + textHeight + 5;
88
+ let textX = isCentered ? x + w / 2 : x + 5;
89
+ let textY = blockY - (lines.length - 1) * lineHeight / (isCentered ? 2 : 1);
90
+
91
+ ctx.textAlign = isCentered ? "center" : "left";
92
+ ctx.textBaseline = isCentered ? "middle" : "alphabetic";
93
+ ({x: textX, y: textY} = renderer.drawLabelImage($$, data, label, textX, textY));
94
+ ctx.fillStyle = getLabelColor($$, data, style.label.color);
95
+ drawLabelDecorations(
96
+ $$,
97
+ painter,
98
+ data,
99
+ label,
100
+ textX,
101
+ isCentered ? textY + ((lines.length - 1) * lineHeight / 2) : blockY
102
+ );
103
+
104
+ lines.forEach((line, i) => {
105
+ painter.text(line, textX, textY + i * lineHeight, {
106
+ maxWidth: Math.max(0, w - 8)
107
+ });
108
+ });
109
+ }
110
+ });
111
+ },
112
+
113
+ /**
114
+ * Add hit items of each treemap tile.
115
+ * @param {HitDetector} detector Hit detector
116
+ * @private
117
+ */
118
+ hits(detector: HitDetector): void {
119
+ const $$ = this;
120
+ const root = $$.getTreemapRoot?.($$.data.targets);
121
+ const nodes = root?.children || [];
122
+
123
+ for (const node of nodes) {
124
+ const {data} = node;
125
+
126
+ if (!isCanvasTreemapType($$, data)) {
127
+ continue;
128
+ }
129
+
130
+ const {x, y, w, h} = getTreemapNodeRect($$, node, root, true);
131
+
132
+ if (
133
+ !isFiniteCanvasCoordinate(x, y) ||
134
+ !isFiniteCanvasCoordinate(x + w, y + h)
135
+ ) {
136
+ continue;
137
+ }
138
+
139
+ detector.addBar({x, y, w, h, data});
140
+ }
141
+ }
142
+ };
@@ -6,6 +6,19 @@
6
6
  * y2 Axis config options
7
7
  */
8
8
  export default {
9
+ /**
10
+ * Set clip-path attribute for y2 axis element
11
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
12
+ * @name axis․y2․clipPath
13
+ * @memberof Options
14
+ * @type {boolean}
15
+ * @default true
16
+ * @example
17
+ * // don't set 'clip-path' attribute
18
+ * clipPath: false
19
+ */
20
+ axis_y2_clipPath: true,
21
+
9
22
  /**
10
23
  * Show or hide y2 axis.
11
24
  * - **NOTE**:
@@ -89,15 +89,19 @@ export default {
89
89
  * - area-step
90
90
  * - area-step-range
91
91
  * - bar
92
+ * - boxplot
92
93
  * - bubble
94
+ * - bullet
93
95
  * - candlestick
94
96
  * - donut
95
97
  * - funnel
96
98
  * - gauge
99
+ * - heatmap
97
100
  * - line
98
101
  * - pie
99
102
  * - polar
100
103
  * - radar
104
+ * - sankey
101
105
  * - scatter
102
106
  * - spline
103
107
  * - step
@@ -121,15 +125,19 @@ export default {
121
125
  * areaStep,
122
126
  * areaStepRange,
123
127
  * bar,
128
+ * boxplot,
124
129
  * bubble,
130
+ * bullet,
125
131
  * candlestick,
126
132
  * donut,
127
133
  * funnel,
128
134
  * gauge,
135
+ * heatmap,
129
136
  * line,
130
137
  * pie,
131
138
  * polar,
132
139
  * radar,
140
+ * sankey,
133
141
  * scatter,
134
142
  * spline,
135
143
  * step,
@@ -148,7 +156,7 @@ export default {
148
156
  /**
149
157
  * Set chart type for each data.<br>
150
158
  * This setting overwrites data.type setting.
151
- * - **NOTE:** `radar` and `treemap` type can't be combined with other types.
159
+ * - **NOTE:** `heatmap`, `radar`, `sankey` and `treemap` type can't be combined with other types.
152
160
  * @name data․types
153
161
  * @memberof Options
154
162
  * @type {object}
@@ -171,15 +179,19 @@ export default {
171
179
  * areaStep,
172
180
  * areaStepRange,
173
181
  * bar,
182
+ * boxplot,
174
183
  * bubble,
184
+ * bullet,
175
185
  * candlestick,
176
186
  * donut,
177
187
  * funnel,
178
188
  * gauge,
189
+ * heatmap,
179
190
  * line,
180
191
  * pie,
181
192
  * polar,
182
193
  * radar,
194
+ * sankey,
183
195
  * scatter,
184
196
  * spline,
185
197
  * step,
@@ -609,6 +621,7 @@ export default {
609
621
  * - `d` is the data clicked and element is the element clicked.
610
622
  * - `element` is the current interacting svg element.
611
623
  * - In this callback, `this` will be the Chart object.
624
+ * - For radar type, clicking an axis text calls it once for each data at the axis, with the axis text as the element.
612
625
  * @name data․onclick
613
626
  * @memberof Options
614
627
  * @type {function}
@@ -882,6 +895,18 @@ export default {
882
895
  * ],
883
896
  * type: "candlestick"
884
897
  * }
898
+ *
899
+ * // for 'boxplot' type, data should contain:
900
+ * // - an array of [min, q1, median, q3, max, [outliers](optional), mean(optional)] data following the order
901
+ * // - or the list of the samples, when the 'boxplot.samples' option is set
902
+ * data: {
903
+ * rows: [
904
+ * ["data1", "data2"],
905
+ * [[1, 3, 5, 7, 9], [2, 4, 6, 8, 10]],
906
+ * [[2, 4, 6, 8, 12, [15]], [1, 3, 4, 6, 9, [], 4.5]]
907
+ * ],
908
+ * type: "boxplot"
909
+ * }
885
910
  */
886
911
  data_rows: <(string | number)[][] | undefined>undefined,
887
912
 
@@ -952,6 +977,27 @@ export default {
952
977
  * ],
953
978
  * type: "candlestick"
954
979
  * }
980
+ *
981
+ * // for 'boxplot' type, data should contain:
982
+ * // - an array of [min, q1, median, q3, max, [outliers](optional), mean(optional)] data following the order
983
+ * // - or the list of the samples, when the 'boxplot.samples' option is set
984
+ * data: {
985
+ * columns: [
986
+ * ["data1",
987
+ * [1, 3, 5, 7, 9],
988
+ * [2, 4, 6, 8, 12, [15], 5.5] // with the outliers and the mean
989
+ * ]
990
+ * ],
991
+ * type: "boxplot"
992
+ * }
993
+ *
994
+ * // for 'boxplot' type with the 'boxplot.samples' option
995
+ * data: {
996
+ * columns: [
997
+ * ["data1", [3, 5, 6, 7, 7, 8, 9, 12, 30], [2, 4, 4, 5, 6, 8, 20]]
998
+ * ],
999
+ * type: "boxplot"
1000
+ * }
955
1001
  */
956
1002
  data_columns: <(string | number)[][] | undefined>undefined,
957
1003
 
@@ -19,6 +19,10 @@ export default {
19
19
  * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
20
20
  * - `show: subchart()`
21
21
  * @property {string} [subchart.type] Set chart type for the subchart. Defaults to data.type.
22
+ * - **NOTE:** When candlestick data is rendered as another type in the subchart, the subchart takes one value of the data:
23
+ * - `bar`: the `volume` of the data. Without `volume`, the close value for a rise and the open value for a fall, from zero.
24
+ * - other types (`line`, `area`, etc.): the close value.
25
+ * - The y axis domain of the subchart follows the taken values. The `volume` is not part of the main chart's y axis domain.
22
26
  * @property {object} [subchart.types] Set chart type for each data in the subchart. Defaults to data.types.
23
27
  * @property {boolean} [subchart.brush.enabled=true] Enable subchart brush interaction.
24
28
  * @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ /**
6
+ * boxplot config options
7
+ */
8
+ export default {
9
+ /**
10
+ * Set boxplot options
11
+ * - **NOTE:**
12
+ * - Each data value is the five-number summary: `[min, q1, median, q3, max]`. The list can have
13
+ * the outliers (array) and the mean (number) after them: `[min, q1, median, q3, max, [outliers], mean]`.
14
+ * - When `boxplot.samples` is set, each data value is the list of the samples instead, and the
15
+ * chart calculates the quartiles (linear interpolation, the default method of Plotly), the whiskers,
16
+ * the outliers and the mean from it.
17
+ * - The color of the box is the color of the data (`data.colors`, `color.pattern`). The stroke and
18
+ * the opacity of the parts are set by CSS (`.bb-boxplot-box`, `.bb-boxplot-median`, `.bb-boxplot-whisker`,
19
+ * `.bb-boxplot-outlier`, `.bb-boxplot-mean`), or by the canvas theme when the chart is rendered on canvas.
20
+ * - The data labels, the subchart and the object form of the value are not supported.
21
+ * @name boxplot
22
+ * @memberof Options
23
+ * @type {object}
24
+ * @property {object} boxplot Boxplot object
25
+ * @property {boolean} [boxplot.samples=false] Set true to give the samples as the data value, instead of the five-number summary.
26
+ * @property {number} [boxplot.width] Change the width.
27
+ * @property {number} [boxplot.width.ratio=0.6] Change the width by ratio.
28
+ * @property {number} [boxplot.width.max] The maximum width value for ratio.
29
+ * @property {number} [boxplot.width.dataname] Change the width for indicated dataset only.
30
+ * @property {number} [boxplot.width.dataname.ratio=0.6] Change the width of the dataset by ratio.
31
+ * @property {number} [boxplot.width.dataname.max] The maximum width value for ratio.
32
+ * @property {number} [boxplot.whisker.width=0.5] Set the width of the cap at the end of the whiskers, by the ratio of the width of the box. 0 hides the caps.
33
+ * @property {number} [boxplot.whisker.iqr=1.5] Set how far the whiskers reach, by the multiple of the interquartile range. A sample out of it is an outlier. Applied when `boxplot.samples` is set.
34
+ * @property {boolean} [boxplot.outlier.show=true] Show the outliers.
35
+ * @property {number} [boxplot.outlier.r=3] Set the radius of the outliers.
36
+ * @property {boolean} [boxplot.mean.show=false] Show the mean.
37
+ * @property {number} [boxplot.mean.r=4] Set the size of the mean marker.
38
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.BoxplotChart)
39
+ * @example
40
+ * data: {
41
+ * columns: [
42
+ * // min, q1, median, q3, max
43
+ * ["data1", [1, 3, 5, 7, 9], [2, 4, 6, 8, 10]],
44
+ *
45
+ * // with the outliers and the mean: min, q1, median, q3, max, [outliers], mean
46
+ * ["data2", [1, 3, 5, 7, 9, [14, 15], 5.5], [2, 4, 6, 8, 10, [], 6.1]]
47
+ * ],
48
+ * type: "boxplot"
49
+ * },
50
+ * boxplot: {
51
+ * // give the samples, and get the quartiles calculated
52
+ * samples: false,
53
+ *
54
+ * width: 10,
55
+ *
56
+ * // or
57
+ * width: {
58
+ * ratio: 0.2,
59
+ * max: 20
60
+ * },
61
+ *
62
+ * // or specify width per dataset
63
+ * width: {
64
+ * data1: 20,
65
+ * data2: {
66
+ * ratio: 0.2,
67
+ * max: 20
68
+ * }
69
+ * },
70
+ *
71
+ * whisker: {
72
+ * width: 0.5,
73
+ * iqr: 1.5
74
+ * },
75
+ * outlier: {
76
+ * show: true,
77
+ * r: 3
78
+ * },
79
+ * mean: {
80
+ * show: false,
81
+ * r: 4
82
+ * }
83
+ * }
84
+ */
85
+ boxplot_samples: false,
86
+ boxplot_width: <number | {ratio?: number, max?: number} | undefined>undefined,
87
+ boxplot_width_ratio: 0.6,
88
+ boxplot_width_max: undefined,
89
+ boxplot_whisker_width: 0.5,
90
+ boxplot_whisker_iqr: 1.5,
91
+ boxplot_outlier_show: true,
92
+ boxplot_outlier_r: 3,
93
+ boxplot_mean_show: false,
94
+ boxplot_mean_r: 4
95
+ };
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ /**
6
+ * bullet config options
7
+ */
8
+ export default {
9
+ /**
10
+ * Set bullet options.<br><br>
11
+ * The bullet chart (a.k.a. bullet graph) compares a single quantitative measure
12
+ * against qualitative ranges and an optional comparative target marker.<br>
13
+ * Each data series renders as one bullet, using the last data value of the series as the measure.<br>
14
+ * By default the scale of a bullet includes everything drawn and 0, and the measure is drawn from the 0 position to its value: a negative value extends the scale below 0, and its label is placed at the 0 position. Use `bullet.axis.min` and `bullet.axis.max` to set the scale, and to share it between the bullets.<br>
15
+ * [data.onover](#.data․onover), [data.onout](#.data․onout) and [data.onclick](#.data․onclick) are called with the row of the bullet when its measure or its target markers are hovered or clicked. The range bands are not the data of the row. Use `bullet.rotated` to switch between
16
+ * horizontal (default) and vertical layouts, and `bullet.type` to render the
17
+ * measure as a solid bar or as a dot marker.
18
+ * @name bullet
19
+ * @memberof Options
20
+ * @type {object}
21
+ * @property {object} bullet Bullet object
22
+ * @property {boolean} [bullet.rotated=false] Set bullet orientation.<br>When `false`, bullets are rendered horizontally (measure grows to the right). When `true`, bullets are rendered vertically (measure grows upward).
23
+ * @property {string} [bullet.type="bar"] Set how the measure value is rendered.<br>
24
+ * - **Available type values:**
25
+ * - `bar`: render the measure as a solid bar growing from the baseline.
26
+ * - `dot`: render the measure as a dot marker positioned at the measure value.
27
+ * @property {number} [bullet.marker.size=0] Set the dot radius (in px) used when `bullet.type="dot"`. When `0`, the radius is derived from the bullet thickness.
28
+ * @property {Array|function|object} [bullet.ranges] Set the qualitative range band thresholds.<br>
29
+ * - Can be given as:
30
+ * - `Array`: shared ascending thresholds applied to every bullet (e.g. `[50, 75, 90]`).
31
+ * - `object`: per-data-id thresholds (e.g. `{data1: [50, 75, 90]}`).
32
+ * - `Function`: callback `function(id, value) { return [...] }` returning thresholds per bullet.
33
+ * - When omitted, three bands are generated automatically from the measure/target domain.
34
+ * @property {number|Array|function|object} [bullet.target] Set the comparative target marker value.<br>
35
+ * - Can be given as a `number` or an `Array` of numbers (shared), an `object` keyed by data id (a number or an Array of numbers), or a `Function` `function(id, value) { return number | number[] }`.
36
+ * - Give an `Array` to draw more than one marker for a bullet (e.g. a warning and an error line). All the markers share the same style: `.bb-bullet-target`.
37
+ * @property {object} [bullet.width] Set the thickness of the measure and the length of the target marker.
38
+ * @property {number} [bullet.width.ratio=0.35] Set the measure thickness as a ratio (0~1) of the bullet band.
39
+ * @property {object} [bullet.width.target] Set the target marker length.
40
+ * @property {number} [bullet.width.target.ratio=0.6] Set the target marker length as a ratio (0~1) of the bullet band.
41
+ * @property {Array|function} [bullet.range.colors] Set the qualitative range band colors.<br>
42
+ * - Can be given as an `Array` of color strings (ordered from the smallest to the largest band) or a `Function` `function(index, length) { return color }`. When omitted, the grayscale of the theme is used: the lightness of the first (smallest) and the last band are the CSS variables `--bb-bullet-range-min` and `--bb-bullet-range-max` of `.bb-chart-bullets` (default `55%` and `90%`, the dark themes use darker ones), and the bands in between are interpolated.
43
+ * @property {number} [bullet.padding=4] Set the padding (in px) between each bullet band.
44
+ * @property {boolean} [bullet.axis.show=true] Show or hide the quantitative scale axis drawn under (beside, when rotated) each bullet.
45
+ * @property {number} [bullet.axis.min] Set the min value of the scale of every bullet. When not given, the scale of each bullet is calculated from its values and ranges, so bullets do not share the scale.<br>
46
+ * - Set both `min` and `max` to make the bullets share the same scale.
47
+ * - A value out of the scale is drawn up to the end of the axis, and a target out of the scale is not drawn.
48
+ * - When the scale does not include 0, the measure is drawn from the end of the axis nearest to 0.
49
+ * - When `min` is not less than `max`, both are ignored.
50
+ * @property {number} [bullet.axis.max] Set the max value of the scale of every bullet. See `bullet.axis.min`.
51
+ * @property {number} [bullet.axis.tick.count] Set the approximate number of the ticks of the axis. D3 picks round values, so the actual number can differ. When not given, it follows the length of the axis.
52
+ * @property {Array} [bullet.axis.tick.values] Set the values of the ticks. The values out of the scale are not drawn. It takes precedence over `bullet.axis.tick.count`.
53
+ * @property {function} [bullet.axis.tick.format] Set the format of the tick labels.<br>
54
+ * - **Arguments:**
55
+ * - `value {number}`: Tick value
56
+ * @property {boolean} [bullet.title.show=false] Show or hide the title of each bullet.<br>
57
+ * The title is drawn on the left of the bullet (under the column, when rotated), so the bullets can be told apart without the legend. A long title takes the room of the bullet.
58
+ * @property {object|function} [bullet.title.text] Set the text of the title. By default it is the data name (`data.names`), or the data id.<br>
59
+ * - Can be given as an `object` keyed by data id, or a `Function` `function(id, value) { return string }`.
60
+ * @property {boolean} [bullet.label.show=true] Show or hide the measure value label.<br>
61
+ * The label is the data label of the measure: it is drawn when [data.labels](#.data․labels) is set, and customized by its options (`format`, `colors`, `position`, `centered`, `rotate`, `border`, `image`).
62
+ * @property {function} [bullet.label.format] Set a formatter for the measure value label.<br>
63
+ * Takes precedence over `data.labels.format`.<br>
64
+ * - **Arguments:**
65
+ * - `value {number}`: Measure value
66
+ * - `id {string}`: Data id
67
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.BulletChart)
68
+ * @see [Demo: Bullet axis and negative value](https://naver.github.io/billboard.js/demo/#BulletChartOptions.BulletAxis)
69
+ * @see [Demo: Bullet target and color by value](https://naver.github.io/billboard.js/demo/#BulletChartOptions.BulletTarget)
70
+ * @see [Demo: Bullet title](https://naver.github.io/billboard.js/demo/#BulletChartOptions.BulletTitle)
71
+ * @example
72
+ * bullet: {
73
+ * // render vertically
74
+ * rotated: true,
75
+ *
76
+ * // render the measure as a dot marker
77
+ * type: "dot",
78
+ * marker: {
79
+ * size: 6
80
+ * },
81
+ *
82
+ * // qualitative range bands (ascending)
83
+ * ranges: [50, 75, 90],
84
+ *
85
+ * // or per data id
86
+ * // ranges: {data1: [50, 75, 90]},
87
+ *
88
+ * // or as a callback
89
+ * // ranges: function(id, value) { return [50, 75, 90]; },
90
+ *
91
+ * // comparative target marker
92
+ * target: 85,
93
+ *
94
+ * // or more than one: [70, 85]
95
+ * // target: [70, 85],
96
+ *
97
+ * // measure thickness & target marker length, as a ratio of the bullet band
98
+ * width: {
99
+ * ratio: 0.35,
100
+ * target: {
101
+ * ratio: 0.6
102
+ * }
103
+ * },
104
+ *
105
+ * // range band colors
106
+ * range: {
107
+ * colors: ["#b3b3b3", "#cccccc", "#e6e6e6"]
108
+ * },
109
+ *
110
+ * padding: 4,
111
+ *
112
+ * // quantitative scale axis
113
+ * axis: {
114
+ * show: true,
115
+ *
116
+ * // the scale of every bullet: the bullets share it
117
+ * min: 0,
118
+ * max: 100,
119
+ *
120
+ * tick: {
121
+ * count: 5,
122
+ * // values: [0, 50, 100],
123
+ * format: function(value) {
124
+ * return value + "%";
125
+ * }
126
+ * }
127
+ * },
128
+ *
129
+ * // title of each bullet
130
+ * title: {
131
+ * show: true,
132
+ * text: function(id, value) {
133
+ * return id.toUpperCase();
134
+ * }
135
+ * },
136
+ *
137
+ * // the value label is a data label: set data.labels to show it
138
+ * // data: {labels: true},
139
+ * label: {
140
+ * show: true,
141
+ * format: function(value, id) {
142
+ * return value;
143
+ * }
144
+ * }
145
+ * }
146
+ */
147
+ bullet_rotated: false,
148
+ bullet_type: "bar",
149
+ bullet_marker_size: 0,
150
+ bullet_ranges: <number[] | ((id: string, value: number) => number[]) | {[key: string]: number[]}
151
+ | null>null,
152
+ bullet_target: <number | number[] | ((id: string, value: number) => number | number[]) | {
153
+ [key: string]: number | number[]
154
+ } | null>null,
155
+ bullet_width_ratio: 0.35,
156
+ bullet_width_target_ratio: 0.6,
157
+ bullet_range_colors: <string[] | ((index: number, length: number) => string) | null>null,
158
+ bullet_padding: 4,
159
+ bullet_axis_show: true,
160
+ bullet_axis_min: <number | undefined>undefined,
161
+ bullet_axis_max: <number | undefined>undefined,
162
+ bullet_axis_tick_count: <number | undefined>undefined,
163
+ bullet_axis_tick_values: <number[] | undefined>undefined,
164
+ bullet_axis_tick_format: <((value: number) => string | number) | undefined>undefined,
165
+ bullet_title_show: false,
166
+ bullet_title_text: <((id: string, value: number) => string) | {[key: string]: string}
167
+ | undefined>undefined,
168
+ bullet_label_show: true,
169
+ bullet_label_format: <((value: number, id: string) => string | number) | undefined>undefined
170
+ };
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ /**
6
+ * heatmap config options
7
+ */
8
+ export default {
9
+ /**
10
+ * Set heatmap options.<br>
11
+ * The data is a matrix: `data.x` names the columns, a data series is a row, and its values are the cells.
12
+ * The cells are colored by their value: the colors of `heatmap.color.range` are spread from the min to the max value.
13
+ * - **NOTE:** `data.colors` doesn't color the cells (the legend shows the color of the rows).
14
+ * - **NOTE:** The first series is the top row. A `null` value is a cell of `heatmap.color.none`.
15
+ * - **NOTE:** With `heatmap.cell.ratio`, the chart height is set automatically from its width, so the cells keep the ratio and no space is left under them.
16
+ * It follows the width on resize. Set `size.height` to fix the height: the cells are then the biggest of the ratio that fit in it.
17
+ * - **NOTE:** `.hide(id)` removes the row: the other cells keep their colors. The names that don't fit are skipped.
18
+ *
19
+ * The interactions:
20
+ * - [data.onover](#.data․onover), [data.onout](#.data․onout) and [data.onclick](#.data․onclick) are called with the data of a cell `{id, x, index, value, name}`,
21
+ * where `id` is the row, `x` the name of the column, `index` the index of the column and `name` is "row / column".
22
+ * - `.focus(id)` and the legend hover dim the other rows.
23
+ * @name heatmap
24
+ * @memberof Options
25
+ * @type {object}
26
+ * @property {object} heatmap Heatmap object
27
+ * @property {Array} [heatmap.color.range=["#f6efa6","#d88273","#bf444c"]] The colors from the min to the max value (two or more).
28
+ * @property {Array} [heatmap.color.ranges] The colors by the ranges of the values, instead of a color range spread on the values: `[{from, to, color, name}]`.
29
+ * The first range that has the value (`from` <= value <= `to`) is used. Without `from` or `to`, the range has no lower or upper limit.
30
+ * A value in no range is of `heatmap.color.none`. The color bar has a band for each range, with its `name` (or `from - to`).
31
+ * @property {number} [heatmap.color.min] The value of the first color. When it isn't set, the min value of the data is used.
32
+ * @property {number} [heatmap.color.max] The value of the last color. When it isn't set, the max value of the data is used.
33
+ * @property {string} [heatmap.color.none="#ebedf0"] The color of a cell without a value. Set `null` to draw nothing there.
34
+ * @property {number} [heatmap.cell.ratio] The ratio of the width to the height of the cells: `1` makes them squares, `2` twice as wide as high.
35
+ * The chart is as high as the cells need, from its width, so no space is left (and follows the width on resize).
36
+ * When `size.height` is set, the cells are the biggest of the ratio that fit in it, and the space left is empty. When the ratio isn't set, the cells fill the chart.
37
+ * @property {number} [heatmap.cell.padding=0] The gap between the cells in pixels.
38
+ * @property {number} [heatmap.cell.radius=0] The radius of the corners of the cells in pixels.
39
+ * @property {number} [heatmap.cell.border.width=0] The width of the border of the cells in pixels.
40
+ * @property {string} [heatmap.cell.border.color="#fff"] The color of the border of the cells.
41
+ * @property {boolean} [heatmap.label.show=false] Show the values in the cells.
42
+ * @property {function} [heatmap.label.format] Set the formatter of the values in the cells.
43
+ * - **NOTE:** The arguments are the value, the name of the column and the id of the row.
44
+ * @property {string} [heatmap.label.color] The color of the values. When it isn't set, black or white is used to read on the cell.
45
+ * @property {boolean} [heatmap.axis.x.show=true] Show the names of the columns.
46
+ * @property {string} [heatmap.axis.x.position="bottom"] The position of the names of the columns: "bottom" or "top".
47
+ * @property {boolean} [heatmap.axis.y.show=true] Show the names of the rows.
48
+ * @property {boolean} [heatmap.colorbar.show=true] Show the color bar, with the min and the max value, at the right of the cells.
49
+ * @property {string} [heatmap.colorbar.position="right"] The position of the color bar: "right" (vertical), "bottom" or "top" (horizontal, the min value at the left).
50
+ * @property {function} [heatmap.colorbar.format] Set the formatter of the values of the color bar.
51
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.HeatmapChart)
52
+ * @example
53
+ * data: {
54
+ * x: "x",
55
+ * columns: [
56
+ * // the columns
57
+ * ["x", "Mon", "Tue", "Wed"],
58
+ * // the rows
59
+ * ["Morning", 3, 8, 5],
60
+ * ["Evening", 9, null, 1]
61
+ * ],
62
+ * type: "heatmap" // for ESM, import {heatmap} from "billboard.js" and do type: heatmap()
63
+ * },
64
+ * heatmap: {
65
+ * color: {
66
+ * range: ["#ffffcc", "#41b6c4", "#0c2c84"],
67
+ * min: 0,
68
+ * max: 10,
69
+ * none: "#eee",
70
+ * // or by the ranges of the values
71
+ * ranges: [
72
+ * {to: 0, color: "#ebedf0", name: "none"},
73
+ * {from: 1, to: 9, color: "#9be9a8"},
74
+ * {from: 10, color: "#216e39", name: "10+"}
75
+ * ]
76
+ * },
77
+ * cell: {
78
+ * ratio: 1,
79
+ * padding: 2,
80
+ * radius: 3,
81
+ * border: {
82
+ * width: 1,
83
+ * color: "#fff"
84
+ * }
85
+ * },
86
+ * label: {
87
+ * show: true,
88
+ * format: function(value, x, id) {
89
+ * return value + "%";
90
+ * }
91
+ * },
92
+ * axis: {
93
+ * x: {
94
+ * position: "top"
95
+ * }
96
+ * },
97
+ * colorbar: {
98
+ * show: true,
99
+ * position: "bottom"
100
+ * }
101
+ * }
102
+ */
103
+ heatmap_color_range: ["#f6efa6", "#d88273", "#bf444c"],
104
+ heatmap_color_ranges: <
105
+ | {from?: number, to?: number, color: string, name?: string}[]
106
+ | undefined
107
+ >undefined,
108
+ heatmap_color_min: <number | undefined>undefined,
109
+ heatmap_color_max: <number | undefined>undefined,
110
+ heatmap_color_none: <string | null>"#ebedf0",
111
+ heatmap_cell_ratio: <number | undefined>undefined,
112
+ heatmap_cell_padding: 0,
113
+ heatmap_cell_radius: 0,
114
+ heatmap_cell_border_width: 0,
115
+ heatmap_cell_border_color: "#fff",
116
+ heatmap_label_show: false,
117
+ heatmap_label_format: <((value: number, x: string, id: string) => string) | undefined>undefined,
118
+ heatmap_label_color: <string | undefined>undefined,
119
+ heatmap_axis_x_show: true,
120
+ heatmap_axis_x_position: <"bottom" | "top">"bottom",
121
+ heatmap_axis_y_show: true,
122
+ heatmap_colorbar_show: true,
123
+ heatmap_colorbar_position: <"right" | "bottom" | "top">"right",
124
+ heatmap_colorbar_format: <((value: number) => string) | undefined>undefined
125
+ };