billboard.js 4.0.3 → 4.1.0-next.2

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 (271) hide show
  1. package/README.md +82 -7
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +1848 -494
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +19 -24
  6. package/dist/billboard.pkgd.js +1844 -679
  7. package/dist/billboard.pkgd.min.js +24 -29
  8. package/dist/billboard.react.js +205 -0
  9. package/dist/billboard.react.min.js +9 -0
  10. package/dist/billboard.worker.js +10 -0
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.js +5 -3
  12. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-sparkline.js +6 -3
  14. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-stanford.js +6 -3
  16. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  17. package/dist/plugin/billboardjs-plugin-tableview.js +59 -27
  18. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  19. package/dist/plugin/billboardjs-plugin-textoverlap.js +75 -55
  20. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +5 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +6 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +59 -27
  28. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +68 -3557
  30. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  31. package/dist/theme/dark.css +1 -1
  32. package/dist/theme/dark.min.css +1 -1
  33. package/dist/theme/datalab.css +1 -1
  34. package/dist/theme/datalab.min.css +1 -1
  35. package/dist/theme/graph.css +1 -1
  36. package/dist/theme/graph.min.css +1 -1
  37. package/dist/theme/insight.css +1 -1
  38. package/dist/theme/insight.min.css +1 -1
  39. package/dist/theme/modern.css +1 -1
  40. package/dist/theme/modern.min.css +1 -1
  41. package/dist-esm/Chart/Chart.js +134 -152
  42. package/dist-esm/Chart/api/axis.js +217 -237
  43. package/dist-esm/Chart/api/category.js +54 -54
  44. package/dist-esm/Chart/api/chart.js +172 -215
  45. package/dist-esm/Chart/api/color.js +21 -21
  46. package/dist-esm/Chart/api/data.js +172 -173
  47. package/dist-esm/Chart/api/export.js +242 -262
  48. package/dist-esm/Chart/api/flow.js +198 -254
  49. package/dist-esm/Chart/api/focus.js +136 -143
  50. package/dist-esm/Chart/api/grid.js +191 -190
  51. package/dist-esm/Chart/api/group.js +31 -34
  52. package/dist-esm/Chart/api/legend.js +54 -63
  53. package/dist-esm/Chart/api/load.js +237 -257
  54. package/dist-esm/Chart/api/regions.js +148 -168
  55. package/dist-esm/Chart/api/selection.js +181 -139
  56. package/dist-esm/Chart/api/show.js +133 -147
  57. package/dist-esm/Chart/api/stubs.js +43 -42
  58. package/dist-esm/Chart/api/subchart.js +155 -172
  59. package/dist-esm/Chart/api/tooltip.js +132 -177
  60. package/dist-esm/Chart/api/x.js +67 -71
  61. package/dist-esm/Chart/api/zoom.js +183 -220
  62. package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
  63. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
  64. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
  65. package/dist-esm/ChartInternal/ChartInternal.js +573 -749
  66. package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
  67. package/dist-esm/ChartInternal/data/convert.js +200 -229
  68. package/dist-esm/ChartInternal/data/data.js +967 -1153
  69. package/dist-esm/ChartInternal/data/load.js +145 -197
  70. package/dist-esm/ChartInternal/interactions/drag.js +86 -122
  71. package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
  72. package/dist-esm/ChartInternal/interactions/flow.js +151 -215
  73. package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
  74. package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
  75. package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
  76. package/dist-esm/ChartInternal/internals/category.js +18 -18
  77. package/dist-esm/ChartInternal/internals/class.js +89 -99
  78. package/dist-esm/ChartInternal/internals/clip.js +88 -119
  79. package/dist-esm/ChartInternal/internals/color.js +233 -288
  80. package/dist-esm/ChartInternal/internals/domain.js +452 -588
  81. package/dist-esm/ChartInternal/internals/format.js +64 -77
  82. package/dist-esm/ChartInternal/internals/grid.js +333 -457
  83. package/dist-esm/ChartInternal/internals/legend.js +675 -927
  84. package/dist-esm/ChartInternal/internals/redraw.js +200 -289
  85. package/dist-esm/ChartInternal/internals/region.js +106 -159
  86. package/dist-esm/ChartInternal/internals/scale.js +186 -215
  87. package/dist-esm/ChartInternal/internals/selection.js +132 -159
  88. package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
  89. package/dist-esm/ChartInternal/internals/size.js +286 -394
  90. package/dist-esm/ChartInternal/internals/style.js +39 -41
  91. package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
  92. package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
  93. package/dist-esm/ChartInternal/internals/text.js +368 -528
  94. package/dist-esm/ChartInternal/internals/text.util.js +179 -239
  95. package/dist-esm/ChartInternal/internals/title.js +96 -121
  96. package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
  97. package/dist-esm/ChartInternal/internals/transform.js +79 -97
  98. package/dist-esm/ChartInternal/internals/type.js +285 -236
  99. package/dist-esm/ChartInternal/shape/arc.js +825 -1112
  100. package/dist-esm/ChartInternal/shape/area.js +73 -94
  101. package/dist-esm/ChartInternal/shape/bar.js +227 -288
  102. package/dist-esm/ChartInternal/shape/bubble.js +9 -8
  103. package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
  104. package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
  105. package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
  106. package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
  107. package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
  108. package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
  109. package/dist-esm/ChartInternal/shape/core/path.js +142 -115
  110. package/dist-esm/ChartInternal/shape/core/point.js +105 -125
  111. package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
  112. package/dist-esm/ChartInternal/shape/funnel.js +310 -338
  113. package/dist-esm/ChartInternal/shape/gauge.js +71 -103
  114. package/dist-esm/ChartInternal/shape/line.js +208 -278
  115. package/dist-esm/ChartInternal/shape/point.js +310 -425
  116. package/dist-esm/ChartInternal/shape/polar.js +84 -109
  117. package/dist-esm/ChartInternal/shape/radar.js +228 -318
  118. package/dist-esm/ChartInternal/shape/shape.js +782 -843
  119. package/dist-esm/ChartInternal/shape/treemap.js +152 -190
  120. package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
  121. package/dist-esm/canvas/CanvasEngine.js +148 -166
  122. package/dist-esm/canvas/CanvasPainter.js +395 -411
  123. package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
  124. package/dist-esm/canvas/CanvasTheme.js +899 -802
  125. package/dist-esm/canvas/HitDetector.js +394 -463
  126. package/dist-esm/canvas/axisTicks.js +672 -786
  127. package/dist-esm/canvas/classes.js +19 -17
  128. package/dist-esm/canvas/color.js +40 -59
  129. package/dist-esm/canvas/geometry.js +38 -38
  130. package/dist-esm/canvas/labels.js +318 -371
  131. package/dist-esm/canvas/pointPattern.js +578 -580
  132. package/dist-esm/canvas/util.js +242 -262
  133. package/dist-esm/config/Options/Options.js +29 -32
  134. package/dist-esm/config/Options/axis/axis.js +101 -101
  135. package/dist-esm/config/Options/axis/x.js +759 -755
  136. package/dist-esm/config/Options/axis/y.js +525 -522
  137. package/dist-esm/config/Options/axis/y2.js +501 -485
  138. package/dist-esm/config/Options/common/boost.js +93 -32
  139. package/dist-esm/config/Options/common/color.js +88 -87
  140. package/dist-esm/config/Options/common/grid.js +74 -73
  141. package/dist-esm/config/Options/common/legend.js +180 -179
  142. package/dist-esm/config/Options/common/main.js +474 -473
  143. package/dist-esm/config/Options/common/point.js +160 -159
  144. package/dist-esm/config/Options/common/title.js +47 -46
  145. package/dist-esm/config/Options/common/tooltip.js +253 -252
  146. package/dist-esm/config/Options/data/axis.js +173 -172
  147. package/dist-esm/config/Options/data/data.js +958 -957
  148. package/dist-esm/config/Options/data/selection.js +131 -130
  149. package/dist-esm/config/Options/interaction/interaction.js +53 -52
  150. package/dist-esm/config/Options/interaction/subchart.js +164 -73
  151. package/dist-esm/config/Options/interaction/zoom.js +86 -85
  152. package/dist-esm/config/Options/shape/arc.js +150 -149
  153. package/dist-esm/config/Options/shape/area.js +69 -68
  154. package/dist-esm/config/Options/shape/bar.js +147 -146
  155. package/dist-esm/config/Options/shape/bubble.js +35 -34
  156. package/dist-esm/config/Options/shape/candlestick.js +61 -60
  157. package/dist-esm/config/Options/shape/donut.js +181 -180
  158. package/dist-esm/config/Options/shape/funnel.js +49 -48
  159. package/dist-esm/config/Options/shape/gauge.js +237 -236
  160. package/dist-esm/config/Options/shape/line.js +58 -57
  161. package/dist-esm/config/Options/shape/pie.js +185 -184
  162. package/dist-esm/config/Options/shape/polar.js +167 -166
  163. package/dist-esm/config/Options/shape/radar.js +76 -75
  164. package/dist-esm/config/Options/shape/scatter.js +36 -36
  165. package/dist-esm/config/Options/shape/spline.js +46 -46
  166. package/dist-esm/config/Options/shape/treemap.js +80 -79
  167. package/dist-esm/config/Store/Element.js +64 -62
  168. package/dist-esm/config/Store/State.js +189 -200
  169. package/dist-esm/config/Store/Store.js +25 -26
  170. package/dist-esm/config/classes.js +157 -155
  171. package/dist-esm/config/config.js +26 -35
  172. package/dist-esm/config/const.js +120 -128
  173. package/dist-esm/config/resolver/axis.core.js +25 -25
  174. package/dist-esm/config/resolver/axis.js +26 -27
  175. package/dist-esm/config/resolver/canvas.js +2071 -2472
  176. package/dist-esm/config/resolver/canvasShape.js +201 -177
  177. package/dist-esm/config/resolver/category.js +26 -27
  178. package/dist-esm/config/resolver/export.js +24 -26
  179. package/dist-esm/config/resolver/flow.js +29 -31
  180. package/dist-esm/config/resolver/grid.js +34 -35
  181. package/dist-esm/config/resolver/interaction/selection.js +17 -17
  182. package/dist-esm/config/resolver/interaction/subchart.js +17 -17
  183. package/dist-esm/config/resolver/interaction/zoom.js +17 -17
  184. package/dist-esm/config/resolver/regions.js +30 -31
  185. package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
  186. package/dist-esm/config/resolver/shape/area.js +17 -17
  187. package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
  188. package/dist-esm/config/resolver/shape/bar.js +13 -13
  189. package/dist-esm/config/resolver/shape/bubble.js +18 -14
  190. package/dist-esm/config/resolver/shape/candlestick.js +13 -13
  191. package/dist-esm/config/resolver/shape/donut.js +11 -11
  192. package/dist-esm/config/resolver/shape/funnel.js +11 -11
  193. package/dist-esm/config/resolver/shape/gauge.js +12 -12
  194. package/dist-esm/config/resolver/shape/line.js +10 -10
  195. package/dist-esm/config/resolver/shape/pie.js +11 -11
  196. package/dist-esm/config/resolver/shape/polar.js +12 -12
  197. package/dist-esm/config/resolver/shape/radar.js +22 -14
  198. package/dist-esm/config/resolver/shape/scatter.js +13 -13
  199. package/dist-esm/config/resolver/shape/treemap.js +11 -11
  200. package/dist-esm/core.js +208 -211
  201. package/dist-esm/index.canvas.js +14 -13
  202. package/dist-esm/index.esm.js +25 -24
  203. package/dist-esm/module/Cache.js +117 -129
  204. package/dist-esm/module/browser.js +30 -35
  205. package/dist-esm/module/dsv.js +107 -127
  206. package/dist-esm/module/error.js +45 -52
  207. package/dist-esm/module/generator.js +75 -83
  208. package/dist-esm/module/sanitize.js +302 -399
  209. package/dist-esm/module/util/brush.js +27 -38
  210. package/dist-esm/module/util/dom.js +288 -348
  211. package/dist-esm/module/util/object.js +277 -341
  212. package/dist-esm/module/util/type-checks.js +21 -25
  213. package/dist-esm/module/worker.js +312 -130
  214. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
  215. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
  216. package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
  217. package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
  218. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
  219. package/dist-esm/react/index.js +157 -0
  220. package/package.json +28 -8
  221. package/src/Chart/api/selection.ts +130 -5
  222. package/src/ChartInternal/Axis/Axis.ts +164 -65
  223. package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
  224. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  225. package/src/ChartInternal/ChartInternal.ts +1 -1
  226. package/src/ChartInternal/data/convert.ts +54 -4
  227. package/src/ChartInternal/data/data.ts +4 -1
  228. package/src/ChartInternal/interactions/eventrect.ts +8 -2
  229. package/src/ChartInternal/interactions/subchart.ts +437 -66
  230. package/src/ChartInternal/internals/color.ts +2 -2
  231. package/src/ChartInternal/internals/domain.ts +15 -3
  232. package/src/ChartInternal/internals/grid.ts +21 -1
  233. package/src/ChartInternal/internals/scale.ts +9 -2
  234. package/src/ChartInternal/internals/selection.ts +1 -1
  235. package/src/ChartInternal/internals/subchart.util.ts +55 -0
  236. package/src/ChartInternal/internals/text.arc.ts +3 -1
  237. package/src/ChartInternal/internals/text.ts +18 -5
  238. package/src/ChartInternal/internals/transform.ts +8 -2
  239. package/src/ChartInternal/internals/type.ts +105 -1
  240. package/src/ChartInternal/shape/IShape.ts +6 -3
  241. package/src/ChartInternal/shape/bar.ts +62 -31
  242. package/src/ChartInternal/shape/core/barRadius.ts +129 -0
  243. package/src/ChartInternal/shape/core/candlestick.ts +1 -1
  244. package/src/ChartInternal/shape/core/path.ts +76 -9
  245. package/src/ChartInternal/shape/funnel.ts +2 -3
  246. package/src/ChartInternal/shape/point.ts +2 -2
  247. package/src/ChartInternal/shape/shape.ts +149 -17
  248. package/src/Plugin/stanford/index.ts +0 -4
  249. package/src/Plugin/tableview/index.ts +85 -3
  250. package/src/Plugin/textoverlap/index.ts +9 -15
  251. package/src/canvas/CanvasAxisRenderer.ts +184 -36
  252. package/src/canvas/CanvasRenderer.ts +247 -160
  253. package/src/canvas/CanvasTheme.ts +212 -0
  254. package/src/canvas/axisTicks.ts +122 -40
  255. package/src/config/Options/axis/y2.ts +13 -0
  256. package/src/config/Options/common/boost.ts +64 -4
  257. package/src/config/Options/common/color.ts +2 -2
  258. package/src/config/Options/interaction/subchart.ts +98 -1
  259. package/src/config/Options/shape/gauge.ts +1 -1
  260. package/src/config/Options/shape/treemap.ts +2 -2
  261. package/src/config/Store/Element.ts +3 -1
  262. package/src/config/Store/State.ts +1 -0
  263. package/src/config/classes.ts +1 -0
  264. package/src/config/resolver/canvas.ts +92 -10
  265. package/src/module/util/type-checks.ts +3 -1
  266. package/src/module/voronoi.ts +119 -0
  267. package/src/module/worker.entry.ts +61 -0
  268. package/src/module/worker.ts +346 -63
  269. package/src/react/index.ts +193 -0
  270. package/types/options.d.ts +206 -3
  271. package/types/react/index.d.ts +27 -0
@@ -5,428 +5,375 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.3
8
+ * @version 4.1.0-next.2
9
9
  */
10
- import { isCanvasBubbleType, getFontSize, isCanvasCandlestickType, isCanvasLineType, isCanvasScatterType } from './util.js';
11
- import { isFunction, isNumber, isString, isObject } from '../module/util/type-checks.js';
12
- import { tplProcess, parseShorthand } from '../module/util/object.js';
13
-
10
+ import { isFunction, isNumber, isObject, isString } from "../module/util/type-checks.js";
11
+ import { parseShorthand, tplProcess } from "../module/util/object.js";
12
+ import { getFontSize, isCanvasBubbleType, isCanvasCandlestickType, isCanvasLineType, isCanvasScatterType } from "./util.js";
13
+ //#region src/canvas/labels.ts
14
14
  /**
15
- * Copyright (c) 2017 ~ present NAVER Corp.
16
- * billboard.js project is licensed under the MIT license
17
- */
18
- // Canvas text has no DOM line box/getBBox. Use the common 1.2 line-height ratio so
19
- // multiline data label decoration boxes stay close to SVG/CSS layout.
15
+ * Copyright (c) 2017 ~ present NAVER Corp.
16
+ * billboard.js project is licensed under the MIT license
17
+ */
20
18
  const LABEL_LINE_HEIGHT_RATIO = 1.2;
21
19
  /**
22
- * Get the data label value matching SVG label formatter input.
23
- * @param {object} $$ ChartInternal instance
24
- * @param {object} d Data row
25
- * @returns {number|object|Array|null} Data label value
26
- * @private
27
- */
20
+ * Get the data label value matching SVG label formatter input.
21
+ * @param {object} $$ ChartInternal instance
22
+ * @param {object} d Data row
23
+ * @returns {number|object|Array|null} Data label value
24
+ * @private
25
+ */
28
26
  function getLabelValue($$, d) {
29
- let { value } = d;
30
- if ($$.isBubbleZType?.(d)) {
31
- value = $$.getBubbleZData(value, "z");
32
- }
33
- else if ($$.isCandlestickType?.(d)) {
34
- const data = $$.getCandlestickData?.(d);
35
- if (data) {
36
- value = data.close;
37
- }
38
- }
39
- return value;
27
+ let { value } = d;
28
+ if ($$.isBubbleZType?.(d)) value = $$.getBubbleZData(value, "z");
29
+ else if ($$.isCandlestickType?.(d)) {
30
+ const data = $$.getCandlestickData?.(d);
31
+ if (data) value = data.close;
32
+ }
33
+ return value;
40
34
  }
41
35
  /**
42
- * Convert a data label value into drawable text.
43
- * @param {object} $$ ChartInternal instance
44
- * @param {object} d Data row
45
- * @returns {string|null} Label text
46
- * @private
47
- */
36
+ * Convert a data label value into drawable text.
37
+ * @param {object} $$ ChartInternal instance
38
+ * @param {object} d Data row
39
+ * @returns {string|null} Label text
40
+ * @private
41
+ */
48
42
  function getLabelText($$, d) {
49
- const value = $$.dataLabelFormat(d.id)(getLabelValue($$, d), d.id, d.index, []);
50
- return value === null || value === undefined ? null : String(value);
43
+ const value = $$.dataLabelFormat(d.id)(getLabelValue($$, d), d.id, d.index, []);
44
+ return value === null || value === void 0 ? null : String(value);
51
45
  }
52
46
  /**
53
- * Get a stable key for data label caches.
54
- * @param {object} d Data row
55
- * @returns {string} Label key
56
- * @private
57
- */
47
+ * Get a stable key for data label caches.
48
+ * @param {object} d Data row
49
+ * @returns {string} Label key
50
+ * @private
51
+ */
58
52
  function getLabelRowKey(d) {
59
- return `${d.id}:${d.index}`;
53
+ return `${d.id}:${d.index}`;
60
54
  }
61
55
  /**
62
- * Build a matcher for SVG-like _expanded_ bar type focus.
63
- * @param {object} $$ ChartInternal instance
64
- * @param {Array} selectedData Focused data rows
65
- * @param {function} typeFilter Canvas type filter
66
- * @returns {function} Focus matcher
67
- * @private
68
- */
56
+ * Build a matcher for SVG-like _expanded_ bar type focus.
57
+ * @param {object} $$ ChartInternal instance
58
+ * @param {Array} selectedData Focused data rows
59
+ * @param {function} typeFilter Canvas type filter
60
+ * @returns {function} Focus matcher
61
+ * @private
62
+ */
69
63
  function getExpandedFocusMatcher($$, selectedData, typeFilter) {
70
- if (!selectedData?.length) {
71
- return () => false;
72
- }
73
- if ($$.config.tooltip_grouped && selectedData.length > 1) {
74
- const index = selectedData[0]?.index;
75
- return d => index !== undefined && d.index === index && typeFilter($$, d);
76
- }
77
- const keys = new Set(selectedData
78
- .filter(d => d && typeFilter($$, d))
79
- .map(getLabelRowKey));
80
- return d => keys.has(getLabelRowKey(d));
64
+ if (!selectedData?.length) return () => false;
65
+ if ($$.config.tooltip_grouped && selectedData.length > 1) {
66
+ const index = selectedData[0]?.index;
67
+ return (d) => index !== void 0 && d.index === index && typeFilter($$, d);
68
+ }
69
+ const keys = new Set(selectedData.filter((d) => d && typeFilter($$, d)).map(getLabelRowKey));
70
+ return (d) => keys.has(getLabelRowKey(d));
81
71
  }
82
72
  /**
83
- * Get data label position offset.
84
- * @param {object} $$ ChartInternal instance
85
- * @param {object} d Data row
86
- * @param {string} type Coordinate type
87
- * @param {object} texts SVG-compatible text collection facade
88
- * @returns {number} Offset value
89
- * @private
90
- */
73
+ * Get data label position offset.
74
+ * @param {object} $$ ChartInternal instance
75
+ * @param {object} d Data row
76
+ * @param {string} type Coordinate type
77
+ * @param {object} texts SVG-compatible text collection facade
78
+ * @returns {number} Offset value
79
+ * @private
80
+ */
91
81
  function getLabelPosition($$, d, type, texts) {
92
- const position = $$.config.data_labels_position;
93
- let value;
94
- if (isFunction(position)) {
95
- value = position.bind($$.api)(type, getLabelValue($$, d), d.id, d.index, texts);
96
- }
97
- else if (position) {
98
- const targetPosition = d.id in position ? position[d.id] : position;
99
- value = targetPosition?.[type];
100
- }
101
- return isNumber(value) ? value : 0;
82
+ const position = $$.config.data_labels_position;
83
+ let value;
84
+ if (isFunction(position)) value = position.bind($$.api)(type, getLabelValue($$, d), d.id, d.index, texts);
85
+ else if (position) value = (d.id in position ? position[d.id] : position)?.[type];
86
+ return isNumber(value) ? value : 0;
102
87
  }
103
88
  /**
104
- * Get image option for data label.
105
- * @param {object} $$ ChartInternal instance
106
- * @param {object} d Data row
107
- * @returns {object|null} Image option
108
- * @private
109
- */
89
+ * Get image option for data label.
90
+ * @param {object} $$ ChartInternal instance
91
+ * @param {object} d Data row
92
+ * @returns {object|null} Image option
93
+ * @private
94
+ */
110
95
  function getLabelImageOption($$, d) {
111
- const option = $$.config.data_labels?.image;
112
- if (isFunction(option)) {
113
- return option.call($$.api, getLabelValue($$, d), d.id, d.index) ?? null;
114
- }
115
- else if (option) {
116
- const { url = "", width = 0, height = 0, pos } = option;
117
- return { url, width, height, pos };
118
- }
119
- return null;
96
+ const option = $$.config.data_labels?.image;
97
+ if (isFunction(option)) return option.call($$.api, getLabelValue($$, d), d.id, d.index) ?? null;
98
+ else if (option) {
99
+ const { url = "", width = 0, height = 0, pos } = option;
100
+ return {
101
+ url,
102
+ width,
103
+ height,
104
+ pos
105
+ };
106
+ }
107
+ return null;
120
108
  }
121
109
  /**
122
- * Get resolved image URL for a data label row.
123
- * @param {object} option Image option
124
- * @param {object} d Data row
125
- * @returns {string} Resolved image URL
126
- * @private
127
- */
110
+ * Get resolved image URL for a data label row.
111
+ * @param {object} option Image option
112
+ * @param {object} d Data row
113
+ * @returns {string} Resolved image URL
114
+ * @private
115
+ */
128
116
  function getLabelImageUrl(option, d) {
129
- return tplProcess(option.url, {
130
- ID: d.id
131
- });
117
+ return tplProcess(option.url, { ID: d.id });
132
118
  }
133
119
  /**
134
- * Get image and adjusted text position matching SVG label image placement.
135
- * @param {object} $$ ChartInternal instance
136
- * @param {object} option Image option
137
- * @param {string} text Label text
138
- * @param {number} x Text x coordinate
139
- * @param {number} y Text y coordinate
140
- * @param {object} d Data row
141
- * @returns {object} Image and text positions
142
- * @private
143
- */
120
+ * Get image and adjusted text position matching SVG label image placement.
121
+ * @param {object} $$ ChartInternal instance
122
+ * @param {object} option Image option
123
+ * @param {string} text Label text
124
+ * @param {number} x Text x coordinate
125
+ * @param {number} y Text y coordinate
126
+ * @param {object} d Data row
127
+ * @returns {object} Image and text positions
128
+ * @private
129
+ */
144
130
  function getLabelImagePosition($$, option, text, x, y, d) {
145
- const { width = 0, height = 0, pos } = option;
146
- const w = width / 2;
147
- const h = height / 2;
148
- const textHeight = getLabelDecorationBox($$.canvasEngine.ctx, text, x, y).h;
149
- const fontSize = getFontSize($$.canvasEngine.ctx.font);
150
- const imageX = x - w;
151
- const imageY = y - h - ($$.isTreemapType?.(d) ? fontSize * 0.7 : textHeight / 2);
152
- let textX = x;
153
- let textY = y;
154
- if ($$.config.axis_rotated) {
155
- textX += w;
156
- }
157
- else {
158
- textY += h;
159
- }
160
- return {
161
- x: imageX + (pos?.x ?? 0),
162
- y: imageY + (pos?.y ?? 0),
163
- textX,
164
- textY
165
- };
131
+ const { width = 0, height = 0, pos } = option;
132
+ const w = width / 2;
133
+ const h = height / 2;
134
+ const textHeight = getLabelDecorationBox($$.canvasEngine.ctx, text, x, y).h;
135
+ const fontSize = getFontSize($$.canvasEngine.ctx.font);
136
+ const imageX = x - w;
137
+ const imageY = y - h - ($$.isTreemapType?.(d) ? fontSize * .7 : textHeight / 2);
138
+ let textX = x;
139
+ let textY = y;
140
+ if ($$.config.axis_rotated) textX += w;
141
+ else textY += h;
142
+ return {
143
+ x: imageX + (pos?.x ?? 0),
144
+ y: imageY + (pos?.y ?? 0),
145
+ textX,
146
+ textY
147
+ };
166
148
  }
167
149
  /**
168
- * Get canvas fill style for data label text.
169
- * @param {object} $$ ChartInternal instance
170
- * @param {object} d Data row
171
- * @param {string} fallback Fallback color
172
- * @returns {string} Canvas fill style
173
- * @private
174
- */
150
+ * Get canvas fill style for data label text.
151
+ * @param {object} $$ ChartInternal instance
152
+ * @param {object} d Data row
153
+ * @param {string} fallback Fallback color
154
+ * @returns {string} Canvas fill style
155
+ * @private
156
+ */
175
157
  function getLabelColor($$, d, fallback) {
176
- const color = $$.updateTextColor?.(d);
177
- return typeof color === "string" ?
178
- color :
179
- ($$.isTreemapType?.(d) ? fallback : ($$.color?.(d) || fallback));
158
+ const color = $$.updateTextColor?.(d);
159
+ return typeof color === "string" ? color : $$.isTreemapType?.(d) ? fallback : $$.color?.(d) || fallback;
180
160
  }
181
161
  /**
182
- * Get canvas fill style for data label background.
183
- * @param {object} $$ ChartInternal instance
184
- * @param {object} d Data row
185
- * @returns {string|null} Canvas fill style
186
- * @private
187
- */
162
+ * Get canvas fill style for data label background.
163
+ * @param {object} $$ ChartInternal instance
164
+ * @param {object} d Data row
165
+ * @returns {string|null} Canvas fill style
166
+ * @private
167
+ */
188
168
  function getLabelBackgroundColor($$, d) {
189
- const option = $$.config.data_labels_backgroundColors;
190
- if (!option) {
191
- return null;
192
- }
193
- if (isString(option)) {
194
- return option;
195
- }
196
- if (isFunction(option)) {
197
- const defaultColor = $$.color?.(d);
198
- const color = option.bind($$.api)(defaultColor, d);
199
- return color === null || color === undefined ? null : String(color);
200
- }
201
- const color = option[d.id];
202
- return color === null || color === undefined ? null : String(color);
169
+ const option = $$.config.data_labels_backgroundColors;
170
+ if (!option) return null;
171
+ if (isString(option)) return option;
172
+ if (isFunction(option)) {
173
+ const defaultColor = $$.color?.(d);
174
+ const color = option.bind($$.api)(defaultColor, d);
175
+ return color === null || color === void 0 ? null : String(color);
176
+ }
177
+ const color = option[d.id];
178
+ return color === null || color === void 0 ? null : String(color);
203
179
  }
204
180
  /**
205
- * Get normalized canvas data label border option.
206
- * @param {object|boolean} border Border option
207
- * @returns {object|null} Border option
208
- * @private
209
- */
181
+ * Get normalized canvas data label border option.
182
+ * @param {object|boolean} border Border option
183
+ * @returns {object|null} Border option
184
+ * @private
185
+ */
210
186
  function getLabelBorderOption(border) {
211
- if (!border) {
212
- return null;
213
- }
214
- const option = isObject(border) ? border : {};
215
- return {
216
- padding: parseShorthand(option.padding ?? "3 5"),
217
- radius: isNumber(option.radius) ? option.radius : 10,
218
- stroke: option.stroke ?? "#000",
219
- strokeWidth: isNumber(option.strokeWidth) ? option.strokeWidth : 1,
220
- fill: option.fill ?? "none"
221
- };
187
+ if (!border) return null;
188
+ const option = isObject(border) ? border : {};
189
+ return {
190
+ padding: parseShorthand(option.padding ?? "3 5"),
191
+ radius: isNumber(option.radius) ? option.radius : 10,
192
+ stroke: option.stroke ?? "#000",
193
+ strokeWidth: isNumber(option.strokeWidth) ? option.strokeWidth : 1,
194
+ fill: option.fill ?? "none"
195
+ };
222
196
  }
223
197
  /**
224
- * Measure the canvas rectangle needed behind a data label.
225
- * @param {CanvasRenderingContext2D} ctx Canvas context
226
- * @param {string} text Label text
227
- * @param {number} x Label x coordinate
228
- * @param {number} y Label y coordinate
229
- * @param {object} padding Padding values
230
- * @returns {object} Canvas rectangle
231
- * @private
232
- */
233
- function getLabelDecorationBox(ctx, text, x, y, padding = { top: 0, right: 0, bottom: 0, left: 0 }) {
234
- const lines = text.split("\n");
235
- const metrics = lines.map(line => ctx.measureText(line));
236
- const width = Math.max(...metrics.map(metric => metric.width), 0);
237
- const fontSize = getFontSize(ctx.font);
238
- const lineHeight = fontSize * LABEL_LINE_HEIGHT_RATIO;
239
- const fontBoundingHeight = metrics[0] ?
240
- (metrics[0].fontBoundingBoxAscent || 0) + (metrics[0].fontBoundingBoxDescent || 0) :
241
- 0;
242
- const baselineDescent = metrics[0] ?
243
- metrics[0].fontBoundingBoxDescent || metrics[0].actualBoundingBoxDescent || 0 :
244
- 0;
245
- const height = lines.length > 1 ? lineHeight * lines.length : Math.max(fontSize, fontBoundingHeight, metrics[0]?.actualBoundingBoxAscent + metrics[0]?.actualBoundingBoxDescent || 0);
246
- let textX = x;
247
- let textY = y;
248
- if (ctx.textAlign === "center") {
249
- textX -= width / 2;
250
- }
251
- else if (ctx.textAlign === "right" || ctx.textAlign === "end") {
252
- textX -= width;
253
- }
254
- if (ctx.textBaseline === "middle") {
255
- textY -= height / 2;
256
- }
257
- else if (ctx.textBaseline === "alphabetic") {
258
- textY -= height - baselineDescent;
259
- }
260
- else if (ctx.textBaseline === "bottom" ||
261
- ctx.textBaseline === "ideographic") {
262
- textY -= height;
263
- }
264
- return {
265
- x: textX - padding.left,
266
- y: textY - padding.top,
267
- w: width + padding.left + padding.right,
268
- h: height + padding.top + padding.bottom
269
- };
198
+ * Measure the canvas rectangle needed behind a data label.
199
+ * @param {CanvasRenderingContext2D} ctx Canvas context
200
+ * @param {string} text Label text
201
+ * @param {number} x Label x coordinate
202
+ * @param {number} y Label y coordinate
203
+ * @param {object} padding Padding values
204
+ * @returns {object} Canvas rectangle
205
+ * @private
206
+ */
207
+ function getLabelDecorationBox(ctx, text, x, y, padding = {
208
+ top: 0,
209
+ right: 0,
210
+ bottom: 0,
211
+ left: 0
212
+ }) {
213
+ const lines = text.split("\n");
214
+ const metrics = lines.map((line) => ctx.measureText(line));
215
+ const width = Math.max(...metrics.map((metric) => metric.width), 0);
216
+ const fontSize = getFontSize(ctx.font);
217
+ const lineHeight = fontSize * LABEL_LINE_HEIGHT_RATIO;
218
+ const fontBoundingHeight = metrics[0] ? (metrics[0].fontBoundingBoxAscent || 0) + (metrics[0].fontBoundingBoxDescent || 0) : 0;
219
+ const baselineDescent = metrics[0] ? metrics[0].fontBoundingBoxDescent || metrics[0].actualBoundingBoxDescent || 0 : 0;
220
+ const height = lines.length > 1 ? lineHeight * lines.length : Math.max(fontSize, fontBoundingHeight, metrics[0]?.actualBoundingBoxAscent + metrics[0]?.actualBoundingBoxDescent || 0);
221
+ let textX = x;
222
+ let textY = y;
223
+ if (ctx.textAlign === "center") textX -= width / 2;
224
+ else if (ctx.textAlign === "right" || ctx.textAlign === "end") textX -= width;
225
+ if (ctx.textBaseline === "middle") textY -= height / 2;
226
+ else if (ctx.textBaseline === "alphabetic") textY -= height - baselineDescent;
227
+ else if (ctx.textBaseline === "bottom" || ctx.textBaseline === "ideographic") textY -= height;
228
+ return {
229
+ x: textX - padding.left,
230
+ y: textY - padding.top,
231
+ w: width + padding.left + padding.right,
232
+ h: height + padding.top + padding.bottom
233
+ };
270
234
  }
271
235
  /**
272
- * Draw data label background and border before drawing text.
273
- * @param {object} $$ ChartInternal instance
274
- * @param {CanvasPainter} painter Canvas painter
275
- * @param {object} d Data row
276
- * @param {string} text Label text
277
- * @param {number} x Label x coordinate
278
- * @param {number} y Label y coordinate
279
- * @private
280
- */
236
+ * Draw data label background and border before drawing text.
237
+ * @param {object} $$ ChartInternal instance
238
+ * @param {CanvasPainter} painter Canvas painter
239
+ * @param {object} d Data row
240
+ * @param {string} text Label text
241
+ * @param {number} x Label x coordinate
242
+ * @param {number} y Label y coordinate
243
+ * @private
244
+ */
281
245
  function drawLabelDecorations($$, painter, d, text, x, y) {
282
- const ctx = painter.context;
283
- const backgroundColor = getLabelBackgroundColor($$, d);
284
- const border = getLabelBorderOption($$.config.data_labels?.border);
285
- const padding = border?.padding ?? { top: 0, right: 0, bottom: 0, left: 0 };
286
- const box = getLabelDecorationBox(ctx, text, x, y, padding);
287
- const angle = $$.config.data_labels.rotate;
288
- painter.withState(canvas => {
289
- if (angle) {
290
- canvas.translate(x, y);
291
- canvas.rotate(angle * Math.PI / 180);
292
- box.x -= x;
293
- box.y -= y;
294
- }
295
- if (backgroundColor) {
296
- painter.fillRoundRect(box, border?.radius ?? 0, { fill: backgroundColor });
297
- }
298
- if (border) {
299
- if (border.fill !== "none") {
300
- painter.fillRoundRect(box, border.radius, { fill: border.fill });
301
- }
302
- painter.strokeRoundRect(box, border.radius, {
303
- stroke: border.stroke,
304
- lineWidth: border.strokeWidth
305
- });
306
- }
307
- });
246
+ const ctx = painter.context;
247
+ const backgroundColor = getLabelBackgroundColor($$, d);
248
+ const border = getLabelBorderOption($$.config.data_labels?.border);
249
+ const box = getLabelDecorationBox(ctx, text, x, y, border?.padding ?? {
250
+ top: 0,
251
+ right: 0,
252
+ bottom: 0,
253
+ left: 0
254
+ });
255
+ const angle = $$.config.data_labels.rotate;
256
+ painter.withState((canvas) => {
257
+ if (angle) {
258
+ canvas.translate(x, y);
259
+ canvas.rotate(angle * Math.PI / 180);
260
+ box.x -= x;
261
+ box.y -= y;
262
+ }
263
+ if (backgroundColor) painter.fillRoundRect(box, border?.radius ?? 0, { fill: backgroundColor });
264
+ if (border) {
265
+ if (border.fill !== "none") painter.fillRoundRect(box, border.radius, { fill: border.fill });
266
+ painter.strokeRoundRect(box, border.radius, {
267
+ stroke: border.stroke,
268
+ lineWidth: border.strokeWidth
269
+ });
270
+ }
271
+ });
308
272
  }
309
273
  /**
310
- * Get SVG-compatible text anchor for rotated data labels.
311
- * @param {number} angle Rotation angle
312
- * @returns {string} Anchor string
313
- * @private
314
- */
274
+ * Get SVG-compatible text anchor for rotated data labels.
275
+ * @param {number} angle Rotation angle
276
+ * @returns {string} Anchor string
277
+ * @private
278
+ */
315
279
  function getLabelRotateAnchor(angle) {
316
- let anchor = "middle";
317
- if (angle > 0 && angle <= 170) {
318
- anchor = "end";
319
- }
320
- else if (angle > 190 && angle <= 360) {
321
- anchor = "start";
322
- }
323
- return anchor;
280
+ let anchor = "middle";
281
+ if (angle > 0 && angle <= 170) anchor = "end";
282
+ else if (angle > 190 && angle <= 360) anchor = "start";
283
+ return anchor;
324
284
  }
325
285
  /**
326
- * Map SVG text-anchor to canvas text alignment.
327
- * @param {string} anchor SVG-compatible anchor
328
- * @returns {string} Canvas text alignment
329
- * @private
330
- */
286
+ * Map SVG text-anchor to canvas text alignment.
287
+ * @param {string} anchor SVG-compatible anchor
288
+ * @returns {string} Canvas text alignment
289
+ * @private
290
+ */
331
291
  function getCanvasTextAlign(anchor) {
332
- return anchor === "start" ? "left" : (anchor === "end" ? "right" : "center");
292
+ return anchor === "start" ? "left" : anchor === "end" ? "right" : "center";
333
293
  }
334
294
  /**
335
- * Resolve rotated data label position using the same offset rules as SVG text.
336
- * @param {object} $$ ChartInternal instance
337
- * @param {object} d Data row
338
- * @param {number} x Label x coordinate
339
- * @param {number} y Label y coordinate
340
- * @returns {object} Adjusted label position and alignment
341
- * @private
342
- */
295
+ * Resolve rotated data label position using the same offset rules as SVG text.
296
+ * @param {object} $$ ChartInternal instance
297
+ * @param {object} d Data row
298
+ * @param {number} x Label x coordinate
299
+ * @param {number} y Label y coordinate
300
+ * @returns {object} Adjusted label position and alignment
301
+ * @private
302
+ */
343
303
  function getRotatedLabelPosition($$, d, x, y) {
344
- const anchor = getLabelRotateAnchor($$.config.data_labels.rotate);
345
- const isRotated = $$.config.axis_rotated;
346
- const isInverted = $$.config[`axis_${$$.axis?.getId(d.id)}_inverted`];
347
- const isCandlestickType = isCanvasCandlestickType($$, d);
348
- const { value } = d;
349
- const isNegative = (isNumber(value) && value < 0) || (isCandlestickType && !$$.getCandlestickData?.(d)?._isUp);
350
- const gap = 4;
351
- const doubleGap = gap * 2;
352
- if (isRotated) {
353
- if (anchor === "start") {
354
- x += isNegative ? 0 : doubleGap;
355
- y += gap;
356
- }
357
- else if (anchor === "middle") {
358
- x += doubleGap;
359
- y -= doubleGap;
360
- }
361
- else if (anchor === "end") {
362
- isNegative && (x -= doubleGap);
363
- y += gap;
364
- }
365
- }
366
- else {
367
- if (anchor === "start") {
368
- x += gap;
369
- isNegative && (y += doubleGap * 2);
370
- }
371
- else if (anchor === "middle") {
372
- y -= doubleGap;
373
- }
374
- else if (anchor === "end") {
375
- x -= gap;
376
- isNegative && (y += doubleGap * 2);
377
- }
378
- if (isInverted) {
379
- y += isNegative ? -17 : (isCandlestickType ? 13 : 7);
380
- }
381
- }
382
- return {
383
- x,
384
- y,
385
- textAlign: getCanvasTextAlign(anchor)
386
- };
304
+ const anchor = getLabelRotateAnchor($$.config.data_labels.rotate);
305
+ const isRotated = $$.config.axis_rotated;
306
+ const isInverted = $$.config[`axis_${$$.axis?.getId(d.id)}_inverted`];
307
+ const isCandlestickType = isCanvasCandlestickType($$, d);
308
+ const { value } = d;
309
+ const isNegative = isNumber(value) && value < 0 || isCandlestickType && !$$.getCandlestickData?.(d)?._isUp;
310
+ const gap = 4;
311
+ const doubleGap = gap * 2;
312
+ if (isRotated) {
313
+ if (anchor === "start") {
314
+ x += isNegative ? 0 : doubleGap;
315
+ y += gap;
316
+ } else if (anchor === "middle") {
317
+ x += doubleGap;
318
+ y -= doubleGap;
319
+ } else if (anchor === "end") {
320
+ isNegative && (x -= doubleGap);
321
+ y += gap;
322
+ }
323
+ } else {
324
+ if (anchor === "start") {
325
+ x += gap;
326
+ isNegative && (y += doubleGap * 2);
327
+ } else if (anchor === "middle") y -= doubleGap;
328
+ else if (anchor === "end") {
329
+ x -= gap;
330
+ isNegative && (y += doubleGap * 2);
331
+ }
332
+ if (isInverted) y += isNegative ? -17 : isCandlestickType ? 13 : 7;
333
+ }
334
+ return {
335
+ x,
336
+ y,
337
+ textAlign: getCanvasTextAlign(anchor)
338
+ };
387
339
  }
388
340
  /**
389
- * Resolve point-like data label anchor and canvas text alignment.
390
- * @param {object} $$ ChartInternal instance
391
- * @param {CanvasRenderingContext2D} ctx Canvas context
392
- * @param {object} d Data row
393
- * @param {number} x Point x coordinate
394
- * @param {number} y Point y coordinate
395
- * @returns {object} Label anchor
396
- * @private
397
- */
341
+ * Resolve point-like data label anchor and canvas text alignment.
342
+ * @param {object} $$ ChartInternal instance
343
+ * @param {CanvasRenderingContext2D} ctx Canvas context
344
+ * @param {object} d Data row
345
+ * @param {number} x Point x coordinate
346
+ * @param {number} y Point y coordinate
347
+ * @returns {object} Label anchor
348
+ * @private
349
+ */
398
350
  function getPointLabelAnchor($$, ctx, d, x, y) {
399
- if ($$.config.axis_rotated) {
400
- x += 6;
401
- ctx.textAlign = "left";
402
- ctx.textBaseline = "middle";
403
- }
404
- else if (isCanvasBubbleType($$, d)) {
405
- ctx.textAlign = "center";
406
- ctx.textBaseline = "middle";
407
- }
408
- else {
409
- const { config, state } = $$;
410
- const isInverted = config[`axis_${$$.axis?.getId(d.id)}_inverted`];
411
- const isNegative = d.value < 0 ||
412
- (d.value === 0 && !state.hasPositiveValue && state.hasNegativeValue);
413
- let baseY = 3;
414
- if (isNumber(config.point_r) &&
415
- config.point_r > 5 &&
416
- (isCanvasLineType($$, d) || isCanvasScatterType($$, d))) {
417
- baseY += config.point_r / 2.3;
418
- }
419
- ctx.textAlign = "center";
420
- if (isInverted ? !isNegative : isNegative) {
421
- y += baseY;
422
- ctx.textBaseline = "top";
423
- }
424
- else {
425
- y -= baseY * 2;
426
- ctx.textBaseline = "bottom";
427
- }
428
- }
429
- return { x, y };
351
+ if ($$.config.axis_rotated) {
352
+ x += 6;
353
+ ctx.textAlign = "left";
354
+ ctx.textBaseline = "middle";
355
+ } else if (isCanvasBubbleType($$, d)) {
356
+ ctx.textAlign = "center";
357
+ ctx.textBaseline = "middle";
358
+ } else {
359
+ const { config, state } = $$;
360
+ const isInverted = config[`axis_${$$.axis?.getId(d.id)}_inverted`];
361
+ const isNegative = d.value < 0 || d.value === 0 && !state.hasPositiveValue && state.hasNegativeValue;
362
+ let baseY = 3;
363
+ if (isNumber(config.point_r) && config.point_r > 5 && (isCanvasLineType($$, d) || isCanvasScatterType($$, d))) baseY += config.point_r / 2.3;
364
+ ctx.textAlign = "center";
365
+ if (isInverted ? !isNegative : isNegative) {
366
+ y += baseY;
367
+ ctx.textBaseline = "top";
368
+ } else {
369
+ y -= baseY * 2;
370
+ ctx.textBaseline = "bottom";
371
+ }
372
+ }
373
+ return {
374
+ x,
375
+ y
376
+ };
430
377
  }
431
-
378
+ //#endregion
432
379
  export { drawLabelDecorations, getCanvasTextAlign, getExpandedFocusMatcher, getLabelBackgroundColor, getLabelBorderOption, getLabelColor, getLabelDecorationBox, getLabelImageOption, getLabelImagePosition, getLabelImageUrl, getLabelPosition, getLabelRotateAnchor, getLabelRowKey, getLabelText, getLabelValue, getPointLabelAnchor, getRotatedLabelPosition };