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,7 +5,7 @@
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
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.11
@@ -26388,7 +26388,9 @@ const diffDomain = (d) => d[1] - d[0];
26388
26388
  const isObjectType = (v) => typeof v === "object";
26389
26389
  const isEmptyObject = (obj) => {
26390
26390
  for (const x in obj) {
26391
- return false;
26391
+ if (Object.prototype.hasOwnProperty.call(obj, x)) {
26392
+ return false;
26393
+ }
26392
26394
  }
26393
26395
  return true;
26394
26396
  };
@@ -27088,7 +27090,7 @@ function getScale(type = "linear", min, max) {
27088
27090
  * @private
27089
27091
  */
27090
27092
  updateScales(isInit, updateXDomain = true) {
27091
- var _a, _b, _c, _d, _e, _f;
27093
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
27092
27094
  const $$ = this;
27093
27095
  const {
27094
27096
  axis,
@@ -27124,7 +27126,12 @@ function getScale(type = "linear", min, max) {
27124
27126
  format.subXAxisTick = axis.getXAxisTickFormat(true);
27125
27127
  axis.setAxis("x", scale.x, config.axis_x_tick_outer, isInit);
27126
27128
  if (config.subchart_show) {
27127
- axis.setAxis("subX", scale.subX, config.axis_x_tick_outer, isInit);
27129
+ axis.setAxis(
27130
+ "subX",
27131
+ scale.subX,
27132
+ (_f = config.subchart_axis_x_tick_outer) != null ? _f : config.axis_x_tick_outer,
27133
+ isInit
27134
+ );
27128
27135
  }
27129
27136
  scale.y = $$.getYScale(
27130
27137
  "y",
@@ -27141,7 +27148,13 @@ function getScale(type = "linear", min, max) {
27141
27148
  scale.subY
27142
27149
  );
27143
27150
  axis.setAxis("y", scale.y, config.axis_y_tick_outer, isInit);
27144
- if (config.axis_y2_show) {
27151
+ config.subchart_show && config.subchart_axis_y_show && axis.setAxis(
27152
+ "subY",
27153
+ scale.subY,
27154
+ (_g = config.subchart_axis_y_tick_outer) != null ? _g : config.axis_y_tick_outer,
27155
+ isInit
27156
+ );
27157
+ if (config.axis_y2_show || config.subchart_axis_y2_show) {
27145
27158
  scale.y2 = $$.getYScale(
27146
27159
  "y2",
27147
27160
  min.y,
@@ -27157,13 +27170,19 @@ function getScale(type = "linear", min, max) {
27157
27170
  scale.subY2
27158
27171
  );
27159
27172
  axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
27173
+ config.subchart_show && config.subchart_axis_y2_show && axis.setAxis(
27174
+ "subY2",
27175
+ scale.subY2,
27176
+ (_h = config.subchart_axis_y2_tick_outer) != null ? _h : config.axis_y2_tick_outer,
27177
+ isInit
27178
+ );
27160
27179
  }
27161
27180
  } else if (hasTreemap) {
27162
27181
  const padding = $$.getCurrentPadding();
27163
27182
  scale.x = linear_linear().rangeRound([padding.left, current.width - padding.right]);
27164
27183
  scale.y = linear_linear().rangeRound([padding.top, current.height - padding.bottom]);
27165
27184
  } else {
27166
- (_f = $$.updateArc) == null ? void 0 : _f.call($$);
27185
+ (_i = $$.updateArc) == null ? void 0 : _i.call($$);
27167
27186
  }
27168
27187
  },
27169
27188
  /**
@@ -27372,6 +27391,10 @@ function markCanvasPointOccupancy(grid, x, y) {
27372
27391
 
27373
27392
 
27374
27393
 
27394
+ function getAxisTickOption(config, id, key, prefix = `axis_${id}`) {
27395
+ const value = config[`${prefix}_tick_${key}`];
27396
+ return value !== void 0 ? value : config[`axis_${id}_tick_${key}`];
27397
+ }
27375
27398
  function getOptionTickValues(values, api) {
27376
27399
  const resolved = typeof values === "function" ? values.call(api) : values;
27377
27400
  return (resolved == null ? void 0 : resolved.length) ? resolved : void 0;
@@ -27664,52 +27687,59 @@ function getXTickValues($$, cull = true) {
27664
27687
  function getSubXTickCullMax($$) {
27665
27688
  const { config, state: { height2, width2 } } = $$;
27666
27689
  const size = config.axis_rotated ? height2 : width2;
27667
- if (config.axis_x_tick_count) {
27668
- return config.axis_x_tick_count;
27690
+ const count = getAxisTickOption(config, "x", "count", "subchart_axis_x");
27691
+ const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
27692
+ const cullingMax = getAxisTickOption(config, "x", "culling_max", "subchart_axis_x");
27693
+ if (count) {
27694
+ return count;
27669
27695
  }
27670
- if (config.axis_x_tick_culling !== false) {
27696
+ if (culling !== false) {
27671
27697
  return Math.min(
27672
- config.axis_x_tick_culling_max || AXIS_DEFAULT_TICK_COUNT,
27698
+ cullingMax || AXIS_DEFAULT_TICK_COUNT,
27673
27699
  Math.max(2, Math.floor(size / 70))
27674
27700
  );
27675
27701
  }
27676
27702
  return void 0;
27677
27703
  }
27678
- function getSubXTickValues($$) {
27704
+ function getSubXTickValues($$, culling = true) {
27679
27705
  var _a, _b, _c, _d;
27680
27706
  const { axis, config, scale } = $$;
27681
27707
  const targetScale = scale.subX;
27682
27708
  const targetsToShow = ((_a = $$.getTargetsToShow) == null ? void 0 : _a.call($$)) || $$.filterTargetsToShow();
27709
+ const tickCount = getAxisTickOption(config, "x", "count", "subchart_axis_x");
27683
27710
  const cullMax = getSubXTickCullMax($$);
27684
- const cull = (ticks) => cullTicks(ticks, cullMax);
27711
+ const cullData = (ticks, sorted = false) => culling ? cullDataTicks($$, ticks, sorted, "subchart_axis_x", cullMax) : ticks;
27685
27712
  if (!targetScale || !(targetsToShow == null ? void 0 : targetsToShow.length)) {
27686
27713
  return [];
27687
27714
  }
27688
- const explicit = getOptionTickValues(config.axis_x_tick_values, $$.api);
27715
+ const explicit = getOptionTickValues(
27716
+ getAxisTickOption(config, "x", "values", "subchart_axis_x"),
27717
+ $$.api
27718
+ );
27689
27719
  if (explicit) {
27690
- return cull(normalizeXTickValues($$, explicit));
27720
+ return cullData(normalizeXTickValues($$, explicit));
27691
27721
  }
27692
27722
  if (config.axis_x_tick_fit && $$.mapTargetsToUniqueXs) {
27693
27723
  const generated2 = generateTickValues(
27694
27724
  $$,
27695
27725
  $$.mapTargetsToUniqueXs(targetsToShow),
27696
- config.axis_x_tick_count,
27726
+ tickCount,
27697
27727
  (_b = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _b.call(axis)
27698
27728
  );
27699
- return cull(generated2);
27729
+ return cullData(generated2, true);
27700
27730
  }
27701
27731
  if (((_c = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _c.call(axis)) && ((_d = config.axis_x_categories) == null ? void 0 : _d.length)) {
27702
- return cull(config.axis_x_categories.map((_, i) => i));
27732
+ return cullData(config.axis_x_categories.map((_, i) => i), true);
27703
27733
  }
27704
27734
  const generated = getScaleTicks(
27705
27735
  targetScale,
27706
- config.axis_x_tick_count || AXIS_DEFAULT_TICK_COUNT
27736
+ tickCount || AXIS_DEFAULT_TICK_COUNT
27707
27737
  );
27708
- return cull(generated);
27738
+ return cullData(generated, true);
27709
27739
  }
27710
- function getCategoryXTickLineValues($$) {
27740
+ function getCategoryXTickLineValues($$, targetScale = getXScale($$), outerTick = $$.config.axis_x_tick_outer) {
27711
27741
  var _a, _b;
27712
- const scale = getXScale($$);
27742
+ const scale = targetScale;
27713
27743
  const domain = ((_a = scale.orgDomain) == null ? void 0 : _a.call(scale)) || ((_b = scale.domain) == null ? void 0 : _b.call(scale));
27714
27744
  if (!(domain == null ? void 0 : domain.length)) {
27715
27745
  return [];
@@ -27722,7 +27752,7 @@ function getCategoryXTickLineValues($$) {
27722
27752
  const min = Math.ceil(Math.min(start, end));
27723
27753
  const max = Math.floor(Math.max(start, end));
27724
27754
  const values = Array.from({ length: Math.max(0, max - min + 1) }, (_, i) => min + i);
27725
- return $$.config.axis_x_tick_outer ? values.slice(1, -1) : values;
27755
+ return outerTick ? values.slice(1, -1) : values;
27726
27756
  }
27727
27757
  function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
27728
27758
  var _a, _b, _c, _d, _e;
@@ -27738,12 +27768,12 @@ function getXTickLinePosition($$, value, targetScale = getXScale($$)) {
27738
27768
  }
27739
27769
  return scale(normalized);
27740
27770
  }
27741
- function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
27771
+ function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth, targetScale = getXScale($$)) {
27742
27772
  if (ticks.length < 2) {
27743
27773
  return false;
27744
27774
  }
27745
27775
  const halfWidth = Math.max(1, tickLineWidth) / 2;
27746
- const positions = ticks.map((tick) => getXTickLinePosition($$, tick)).filter(Number.isFinite).sort((a, b) => a - b);
27776
+ const positions = ticks.map((tick) => getXTickLinePosition($$, tick, targetScale)).filter(Number.isFinite).sort((a, b) => a - b);
27747
27777
  if (positions.length < 2) {
27748
27778
  return false;
27749
27779
  }
@@ -27758,10 +27788,10 @@ function hasOverlappedXTickLineIntervals($$, ticks, tickLineWidth) {
27758
27788
  }
27759
27789
  return false;
27760
27790
  }
27761
- function dedupeXTickLineValues($$, ticks) {
27791
+ function dedupeXTickLineValues($$, ticks, targetScale = getXScale($$)) {
27762
27792
  const seen = /* @__PURE__ */ new Set();
27763
27793
  return ticks.filter((tick) => {
27764
- const pos = getXTickLinePosition($$, tick);
27794
+ const pos = getXTickLinePosition($$, tick, targetScale);
27765
27795
  const key = Math.round(pos);
27766
27796
  if (!Number.isFinite(pos) || seen.has(key)) {
27767
27797
  return false;
@@ -27783,13 +27813,35 @@ function getXTickLineValues($$, textTicks, tickLineWidth = 1) {
27783
27813
  const lineTicks = getXTickValues($$, false);
27784
27814
  return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth) ? textTicks : dedupeXTickLineValues($$, lineTicks);
27785
27815
  }
27786
- function getYTickValues($$, id = "y", count, culling = true) {
27787
- var _a, _b, _c;
27816
+ function getSubXTickLineValues($$, textTicks, tickLineWidth = 1) {
27817
+ var _a;
27788
27818
  const { axis, config, scale } = $$;
27819
+ const targetScale = scale.subX;
27820
+ const culling = getAxisTickOption(config, "x", "culling", "subchart_axis_x");
27821
+ const cullingLines = getAxisTickOption(config, "x", "culling_lines", "subchart_axis_x");
27822
+ const outerTick = getAxisTickOption(config, "x", "outer", "subchart_axis_x");
27823
+ if (!targetScale) {
27824
+ return [];
27825
+ }
27826
+ if ((_a = axis == null ? void 0 : axis.isCategorized) == null ? void 0 : _a.call(axis)) {
27827
+ const categoryLineTicks = getCategoryXTickLineValues($$, targetScale, outerTick);
27828
+ return dedupeXTickLineValues($$, categoryLineTicks, targetScale);
27829
+ }
27830
+ if (culling === false || cullingLines === false) {
27831
+ return textTicks;
27832
+ }
27833
+ const lineTicks = getSubXTickValues($$, false);
27834
+ return hasOverlappedXTickLineIntervals($$, lineTicks, tickLineWidth, targetScale) ? textTicks : dedupeXTickLineValues($$, lineTicks, targetScale);
27835
+ }
27836
+ function getYTickValues($$, id = "y", count, culling = true, targetScale = $$.scale[id], optionPrefix = `axis_${id}`) {
27837
+ var _a, _b, _c;
27838
+ const { axis, config } = $$;
27789
27839
  const prefix = `axis_${id}`;
27790
- const targetScale = scale[id];
27791
- const explicit = getOptionTickValues(config[`${prefix}_tick_values`], $$.api);
27792
- const maybeCull = (ticks) => culling ? cullAxisTicks($$, id, ticks) : ticks;
27840
+ const explicit = getOptionTickValues(
27841
+ getAxisTickOption(config, id, "values", optionPrefix),
27842
+ $$.api
27843
+ );
27844
+ const maybeCull = (ticks) => culling ? cullAxisTicks($$, id, ticks, optionPrefix) : ticks;
27793
27845
  if (explicit) {
27794
27846
  return maybeCull(normalizeYTickValues($$, explicit, id));
27795
27847
  }
@@ -27797,7 +27849,7 @@ function getYTickValues($$, id = "y", count, culling = true) {
27797
27849
  if (stepTicks.length) {
27798
27850
  return maybeCull(stepTicks);
27799
27851
  }
27800
- const tickCount = count != null ? count : config[`${prefix}_tick_count`];
27852
+ const tickCount = count != null ? count : getAxisTickOption(config, id, "count", optionPrefix);
27801
27853
  if (((_a = axis == null ? void 0 : axis.isTimeSeries) == null ? void 0 : _a.call(axis, id)) && config[`${prefix}_tick_time_value`]) {
27802
27854
  return maybeCull(getScaleTicks(targetScale, config[`${prefix}_tick_time_value`]));
27803
27855
  }
@@ -27851,20 +27903,21 @@ function cullTicks(ticks, count) {
27851
27903
  }
27852
27904
  return ticks;
27853
27905
  }
27854
- function cullAxisTicks($$, id, ticks) {
27906
+ function cullAxisTicks($$, id, ticks, optionPrefix = `axis_${id}`) {
27855
27907
  const { config } = $$;
27856
- const prefix = `axis_${id}_tick_culling`;
27857
- if (!config[prefix]) {
27908
+ const culling = getAxisTickOption(config, id, "culling", optionPrefix);
27909
+ if (!culling) {
27858
27910
  return ticks;
27859
27911
  }
27912
+ const cullingMax = getAxisTickOption(config, id, "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
27913
+ const reverse = getAxisTickOption(config, id, "culling_reverse", optionPrefix);
27860
27914
  const sortedTicks = ticks.slice().sort((a, b) => {
27861
27915
  const av = +a;
27862
27916
  const bv = +b;
27863
27917
  const order = Number.isFinite(av) && Number.isFinite(bv) ? av - bv : String(a).localeCompare(String(b));
27864
- return config[`${prefix}_reverse`] ? -order : order;
27918
+ return reverse ? -order : order;
27865
27919
  });
27866
27920
  const tickSize = sortedTicks.length;
27867
- const cullingMax = config[`${prefix}_max`] || AXIS_DEFAULT_TICK_COUNT;
27868
27921
  let intervalForCulling = 0;
27869
27922
  for (let i = 1; i < tickSize; i++) {
27870
27923
  if (tickSize / i < cullingMax) {
@@ -27880,19 +27933,21 @@ function cullAxisTicks($$, id, ticks) {
27880
27933
  );
27881
27934
  return ticks.filter((tick) => visible.has(tick));
27882
27935
  }
27883
- function cullDataTicks($$, ticks, sorted = false) {
27936
+ function cullDataTicks($$, ticks, sorted = false, optionPrefix = "axis_x", max) {
27884
27937
  const { config } = $$;
27885
- if (config.axis_x_tick_culling === false) {
27938
+ const culling = getAxisTickOption(config, "x", "culling", optionPrefix);
27939
+ if (culling === false) {
27886
27940
  return ticks;
27887
27941
  }
27888
- const cullingMax = config.axis_x_tick_culling_max || AXIS_DEFAULT_TICK_COUNT;
27942
+ const cullingMax = max || getAxisTickOption(config, "x", "culling_max", optionPrefix) || AXIS_DEFAULT_TICK_COUNT;
27943
+ const reverse = getAxisTickOption(config, "x", "culling_reverse", optionPrefix);
27889
27944
  const sortedTicks = sorted ? ticks : ticks.slice().sort((a, b) => {
27890
27945
  const av = +a;
27891
27946
  const bv = +b;
27892
27947
  if (Number.isFinite(av) && Number.isFinite(bv)) {
27893
- return config.axis_x_tick_culling_reverse ? bv - av : av - bv;
27948
+ return reverse ? bv - av : av - bv;
27894
27949
  }
27895
- return config.axis_x_tick_culling_reverse ? String(b).localeCompare(String(a)) : String(a).localeCompare(String(b));
27950
+ return reverse ? String(b).localeCompare(String(a)) : String(a).localeCompare(String(b));
27896
27951
  });
27897
27952
  const tickSize = sortedTicks.length;
27898
27953
  let intervalForCulling = 0;
@@ -27907,7 +27962,7 @@ function cullDataTicks($$, ticks, sorted = false) {
27907
27962
  }
27908
27963
  if (sorted) {
27909
27964
  return ticks.filter(
27910
- (_, i) => config.axis_x_tick_culling_reverse ? (tickSize - 1 - i) % intervalForCulling === 0 : i % intervalForCulling === 0
27965
+ (_, i) => reverse ? (tickSize - 1 - i) % intervalForCulling === 0 : i % intervalForCulling === 0
27911
27966
  );
27912
27967
  }
27913
27968
  const visible = new Set(
@@ -28369,6 +28424,29 @@ function getXTickTextDirection(isRotated) {
28369
28424
  function getYTickTextDirection(isRotated, isY2) {
28370
28425
  return isRotated ? isY2 ? -1 : 1 : isY2 ? 1 : -1;
28371
28426
  }
28427
+ function getSubYTickFormat($$, id) {
28428
+ var _a, _b, _c;
28429
+ const subAxisId = id === "y2" ? "subY2" : "subY";
28430
+ const axisFormat = (_c = (_b = (_a = $$.axis) == null ? void 0 : _a[subAxisId]) == null ? void 0 : _b.tickFormat) == null ? void 0 : _c.call(_b);
28431
+ const configFormat = $$.config[`subchart_axis_${id}_tick_format`] || $$.config[`axis_${id}_tick_format`];
28432
+ if (axisFormat) {
28433
+ return axisFormat;
28434
+ }
28435
+ return typeof configFormat === "function" ? configFormat.bind($$.api) : ((v) => v);
28436
+ }
28437
+ function getGridLineCanvasStyle(style) {
28438
+ return style ? {
28439
+ stroke: style.lineColor,
28440
+ lineWidth: style.lineWidth,
28441
+ lineDash: style.dashArray
28442
+ } : void 0;
28443
+ }
28444
+ function getGridTextCanvasStyle(style) {
28445
+ return style ? {
28446
+ fill: style.labelColor,
28447
+ font: style.labelFont
28448
+ } : void 0;
28449
+ }
28372
28450
  function getHorizontalXAxisClipRect(margin, width, height) {
28373
28451
  return {
28374
28452
  x: margin.left - X_AXIS_TICK_TEXT_HORIZONTAL_CLIP_PADDING,
@@ -28693,7 +28771,7 @@ class CanvasAxisRenderer {
28693
28771
  * @private
28694
28772
  */
28695
28773
  drawSubXAxis($$) {
28696
- var _a, _b, _c;
28774
+ var _a, _b, _c, _d;
28697
28775
  const { ctx, painter, theme: { style: { axis } } } = this;
28698
28776
  const {
28699
28777
  config,
@@ -28714,12 +28792,14 @@ class CanvasAxisRenderer {
28714
28792
  const rangeStart = isRotated ? y1 : x1;
28715
28793
  const rangeEnd = isRotated ? y2 : x2;
28716
28794
  const ticks = getSubXTickValues($$);
28795
+ const lineTicks = getSubXTickLineValues($$, ticks, axis.tickWidth);
28796
+ const outerTick = (_a = config.subchart_axis_x_tick_outer) != null ? _a : config.axis_x_tick_outer;
28717
28797
  const tickDirection = isRotated ? config.axis_x_tick_inner ? 1 : -1 : config.axis_x_tick_inner ? -1 : 1;
28718
28798
  const outerTickDirection = getXOuterTickDirection(isRotated);
28719
28799
  const tickTextDirection = getXTickTextDirection(isRotated);
28720
28800
  const tickTextPosition = config.axis_x_tick_text_position;
28721
- const tickRotate = !isRotated ? ((_a = $$.getAxisTickRotate) == null ? void 0 : _a.call($$, "x")) || 0 : 0;
28722
- const tickFormat = format.subXAxisTick || ((_c = (_b = $$.axis) == null ? void 0 : _b.getXAxisTickFormat) == null ? void 0 : _c.call(_b, true));
28801
+ const tickRotate = !isRotated ? ((_b = $$.getAxisTickRotate) == null ? void 0 : _b.call($$, "x")) || 0 : 0;
28802
+ const tickFormat = format.subXAxisTick || ((_d = (_c = $$.axis) == null ? void 0 : _c.getXAxisTickFormat) == null ? void 0 : _d.call(_c, true));
28723
28803
  painter.clipRect(
28724
28804
  isRotated ? getRotatedXAxisClipRect(margin2, current.width, height2) : __spreadProps(CanvasAxisRenderer_spreadValues({}, getHorizontalXAxisClipRect(
28725
28805
  margin2,
@@ -28729,15 +28809,17 @@ class CanvasAxisRenderer {
28729
28809
  y: margin2.top
28730
28810
  }),
28731
28811
  () => {
28812
+ ctx.globalAlpha = 1;
28732
28813
  ctx.strokeStyle = axis.lineColor;
28733
28814
  ctx.lineWidth = axis.lineWidth;
28815
+ ctx.setLineDash([]);
28734
28816
  painter.strokePath(() => {
28735
28817
  if (isRotated) {
28736
28818
  painter.traceLine(x, y1, x, y2);
28737
28819
  } else {
28738
28820
  painter.traceLine(x1, y, x2, y);
28739
28821
  }
28740
- if (config.axis_x_tick_outer) {
28822
+ if (outerTick) {
28741
28823
  if (isRotated) {
28742
28824
  painter.traceLine(x, y1, x + AXIS_TICK_SIZE * outerTickDirection, y1);
28743
28825
  painter.traceLine(x, y2, x + AXIS_TICK_SIZE * outerTickDirection, y2);
@@ -28756,15 +28838,15 @@ class CanvasAxisRenderer {
28756
28838
  ctx.lineWidth = axis.tickWidth;
28757
28839
  const lineHeight = getXTickTextLineHeight(painter, getFontSize(tickFont));
28758
28840
  const tickTextWidth = getXTickTextWidth($$, ticks, isRotated, scale.subX);
28759
- for (const tick of ticks) {
28760
- const tickPos = scale.subX(normalizeXValue($$, tick));
28761
- const tx = margin2.left + tickPos;
28762
- const ty = margin2.top + tickPos;
28763
- const pos = isRotated ? ty : tx;
28764
- if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
28765
- continue;
28766
- }
28767
- if (config.subchart_axis_x_tick_show) {
28841
+ if (config.subchart_axis_x_tick_show) {
28842
+ for (const tick of lineTicks) {
28843
+ const tickPos = scale.subX(normalizeXValue($$, tick));
28844
+ const tx = margin2.left + tickPos;
28845
+ const ty = margin2.top + tickPos;
28846
+ const pos = isRotated ? ty : tx;
28847
+ if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
28848
+ continue;
28849
+ }
28768
28850
  painter.strokePath(() => {
28769
28851
  if (isRotated) {
28770
28852
  painter.traceLine(x, ty, x + AXIS_TICK_SIZE * tickDirection, ty);
@@ -28773,6 +28855,15 @@ class CanvasAxisRenderer {
28773
28855
  }
28774
28856
  });
28775
28857
  }
28858
+ }
28859
+ for (const tick of ticks) {
28860
+ const tickPos = scale.subX(normalizeXValue($$, tick));
28861
+ const tx = margin2.left + tickPos;
28862
+ const ty = margin2.top + tickPos;
28863
+ const pos = isRotated ? ty : tx;
28864
+ if (!isInAxisRange(pos, rangeStart, rangeEnd)) {
28865
+ continue;
28866
+ }
28776
28867
  if (!config.subchart_axis_x_tick_text_show) {
28777
28868
  continue;
28778
28869
  }
@@ -28810,6 +28901,42 @@ class CanvasAxisRenderer {
28810
28901
  }
28811
28902
  );
28812
28903
  }
28904
+ /**
28905
+ * Draw the canvas subchart y/y2 axes.
28906
+ * @param {object} $$ ChartInternal instance
28907
+ * @private
28908
+ */
28909
+ drawSubYAxes($$) {
28910
+ const {
28911
+ config,
28912
+ scale,
28913
+ state: { margin2, width2, height2 }
28914
+ } = $$;
28915
+ if (!config.subchart_show || width2 <= 0 || height2 <= 0) {
28916
+ return;
28917
+ }
28918
+ ["y", "y2"].forEach((id) => {
28919
+ var _a;
28920
+ const subScale = id === "y2" ? scale.subY2 : scale.subY;
28921
+ if (!config[`subchart_axis_${id}_show`] || !subScale) {
28922
+ return;
28923
+ }
28924
+ this.drawYAxis($$, id, {
28925
+ scale: subScale,
28926
+ ticks: getYTickValues($$, id, void 0, true, subScale, `subchart_axis_${id}`),
28927
+ format: getSubYTickFormat($$, id),
28928
+ index: 0,
28929
+ outerTick: (_a = config[`subchart_axis_${id}_tick_outer`]) != null ? _a : config[`axis_${id}_tick_outer`],
28930
+ margin: margin2,
28931
+ width: width2,
28932
+ height: height2,
28933
+ prefix: `subchart_axis_${id}`,
28934
+ tickShow: config[`subchart_axis_${id}_tick_show`],
28935
+ tickTextShow: config[`subchart_axis_${id}_tick_text_show`],
28936
+ tickTextPosition: config[`axis_${id}_tick_text_position`]
28937
+ });
28938
+ });
28939
+ }
28813
28940
  /**
28814
28941
  * Draw chart title.
28815
28942
  * @param {object} $$ ChartInternal instance
@@ -29040,14 +29167,21 @@ class CanvasAxisRenderer {
29040
29167
  ctx.fillStyle = grid.labelColor;
29041
29168
  ctx.textBaseline = "middle";
29042
29169
  ctx.setLineDash([]);
29043
- const drawLabel = (text, x, y, rotated = false) => {
29170
+ const drawLabel = (text, x, y, rotated = false, style) => {
29044
29171
  if (!text) {
29045
29172
  return;
29046
29173
  }
29047
- painter.text(text, x, y, {
29174
+ painter.text(text, x, y, __spreadProps(CanvasAxisRenderer_spreadValues({}, style), {
29048
29175
  angle: rotated ? -90 : 0
29049
- });
29176
+ }));
29050
29177
  };
29178
+ const drawLine = (line, axisId, draw) => {
29179
+ const style = getGridLineCanvasStyle(
29180
+ this.theme.getGridLineStyle(axisId, line, "line")
29181
+ );
29182
+ painter.strokePath(draw, style);
29183
+ };
29184
+ const getTextStyle = (axisId, line) => getGridTextCanvasStyle(this.theme.getGridLineStyle(axisId, line, "text"));
29051
29185
  const drawXLine = (line) => {
29052
29186
  if (line.value === void 0 || !scale.x) {
29053
29187
  return;
@@ -29058,18 +29192,20 @@ class CanvasAxisRenderer {
29058
29192
  }
29059
29193
  if (isRotated) {
29060
29194
  const y = margin.top + pos;
29061
- painter.strokePath(() => {
29195
+ drawLine(line, "x", () => {
29062
29196
  painter.traceLine(x1, y, x2, y);
29063
29197
  });
29064
29198
  ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
29065
29199
  drawLabel(
29066
29200
  line.text,
29067
29201
  getLineTextPosition(line.position, x1, x2),
29068
- y - 5
29202
+ y - 5,
29203
+ false,
29204
+ getTextStyle("x", line)
29069
29205
  );
29070
29206
  } else {
29071
29207
  const x = margin.left + pos;
29072
- painter.strokePath(() => {
29208
+ drawLine(line, "x", () => {
29073
29209
  painter.traceLine(x, y1, x, y2);
29074
29210
  });
29075
29211
  ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
@@ -29077,7 +29213,8 @@ class CanvasAxisRenderer {
29077
29213
  line.text,
29078
29214
  x - 5,
29079
29215
  getRotatedLineTextPosition(line.position, y1, y2),
29080
- true
29216
+ true,
29217
+ getTextStyle("x", line)
29081
29218
  );
29082
29219
  }
29083
29220
  };
@@ -29094,7 +29231,7 @@ class CanvasAxisRenderer {
29094
29231
  }
29095
29232
  if (isRotated) {
29096
29233
  const x = margin.left + pos;
29097
- painter.strokePath(() => {
29234
+ drawLine(line, "y", () => {
29098
29235
  painter.traceLine(x, y1, x, y2);
29099
29236
  });
29100
29237
  ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
@@ -29102,18 +29239,21 @@ class CanvasAxisRenderer {
29102
29239
  line.text,
29103
29240
  x - 5,
29104
29241
  getRotatedLineTextPosition(line.position, y1, y2),
29105
- true
29242
+ true,
29243
+ getTextStyle("y", line)
29106
29244
  );
29107
29245
  } else {
29108
29246
  const y = margin.top + pos;
29109
- painter.strokePath(() => {
29247
+ drawLine(line, "y", () => {
29110
29248
  painter.traceLine(x1, y, x2, y);
29111
29249
  });
29112
29250
  ctx.textAlign = line.position === "start" ? "left" : line.position === "middle" ? "center" : "right";
29113
29251
  drawLabel(
29114
29252
  line.text,
29115
29253
  getLineTextPosition(line.position, x1, x2),
29116
- y - 5
29254
+ y - 5,
29255
+ false,
29256
+ getTextStyle("y", line)
29117
29257
  );
29118
29258
  }
29119
29259
  };
@@ -29504,31 +29644,37 @@ class CanvasAxisRenderer {
29504
29644
  * @private
29505
29645
  */
29506
29646
  drawYAxis($$, id = "y", axisOptions) {
29507
- var _a, _b, _c, _d;
29647
+ var _a, _b, _c, _d, _e, _f, _g, _h;
29508
29648
  const { ctx, painter, theme: { style: { axis } } } = this;
29509
- const { config, scale, state: { margin, width, height } } = $$;
29510
- const prefix = `axis_${id}`;
29649
+ const { config, scale, state } = $$;
29650
+ const { margin, width, height } = state;
29651
+ const plotMargin = (axisOptions == null ? void 0 : axisOptions.margin) || margin;
29652
+ const plotWidth = (_a = axisOptions == null ? void 0 : axisOptions.width) != null ? _a : width;
29653
+ const plotHeight = (_b = axisOptions == null ? void 0 : axisOptions.height) != null ? _b : height;
29654
+ const prefix = (axisOptions == null ? void 0 : axisOptions.prefix) || `axis_${id}`;
29511
29655
  const targetScale = (axisOptions == null ? void 0 : axisOptions.scale) || scale[id];
29512
29656
  const isY2 = id === "y2";
29513
29657
  const isRotated = config.axis_rotated;
29514
29658
  const axisOffset = (axisOptions == null ? void 0 : axisOptions.index) ? $$.getAxisSize(id) * axisOptions.index : 0;
29515
29659
  const x = painter.crisp(
29516
- margin.left + (isY2 ? width + (isRotated ? 0 : axisOffset) : -axisOffset),
29660
+ plotMargin.left + (isY2 ? plotWidth + (isRotated ? 0 : axisOffset) : -axisOffset),
29517
29661
  axis.lineWidth
29518
29662
  );
29519
- const y = painter.crisp(margin.top + (isRotated ? isY2 ? -axisOffset - 1 : height + axisOffset : 0), axis.lineWidth);
29520
- const x1 = margin.left;
29521
- const x2 = margin.left + width;
29522
- const y1 = margin.top;
29523
- const y2 = margin.top + height;
29663
+ const y = painter.crisp(plotMargin.top + (isRotated ? isY2 ? -axisOffset - 1 : plotHeight + axisOffset : 0), axis.lineWidth);
29664
+ const x1 = plotMargin.left;
29665
+ const x2 = plotMargin.left + plotWidth;
29666
+ const y1 = plotMargin.top;
29667
+ const y2 = plotMargin.top + plotHeight;
29524
29668
  const ticks = (axisOptions == null ? void 0 : axisOptions.ticks) || getYTickValues($$, id);
29525
29669
  const lineTicks = (axisOptions == null ? void 0 : axisOptions.ticks) || (config[`${prefix}_tick_culling`] && config[`${prefix}_tick_culling_lines`] !== false ? getYTickValues($$, id, void 0, false) : ticks);
29526
- const format = (axisOptions == null ? void 0 : axisOptions.format) || ((_c = (_b = (_a = $$.axis) == null ? void 0 : _a[id]) == null ? void 0 : _b.tickFormat) == null ? void 0 : _c.call(_b)) || ((_d = config[`${prefix}_tick_format`]) == null ? void 0 : _d.bind($$.api)) || ((v) => v);
29670
+ const format = (axisOptions == null ? void 0 : axisOptions.format) || ((_e = (_d = (_c = $$.axis) == null ? void 0 : _c[id]) == null ? void 0 : _d.tickFormat) == null ? void 0 : _e.call(_d)) || ((_f = config[`${prefix}_tick_format`]) == null ? void 0 : _f.bind($$.api)) || ((v) => v);
29527
29671
  const outerTick = axisOptions ? axisOptions.outerTick : config[`${prefix}_tick_outer`];
29528
29672
  const tickDirection = isRotated ? isY2 ? config.axis_y2_tick_inner ? 1 : -1 : config.axis_y_tick_inner ? -1 : 1 : isY2 ? config.axis_y2_tick_inner ? -1 : 1 : config.axis_y_tick_inner ? 1 : -1;
29529
29673
  const outerTickDirection = getYOuterTickDirection(config, isRotated, isY2);
29530
29674
  const tickTextDirection = getYTickTextDirection(isRotated, isY2);
29531
- const tickTextPosition = config[`${prefix}_tick_text_position`];
29675
+ const tickTextPosition = (axisOptions == null ? void 0 : axisOptions.tickTextPosition) || config[`${prefix}_tick_text_position`] || config[`axis_${id}_tick_text_position`];
29676
+ const tickShow = (_g = axisOptions == null ? void 0 : axisOptions.tickShow) != null ? _g : axisOptions ? true : config[`${prefix}_tick_show`];
29677
+ const tickTextShow = (_h = axisOptions == null ? void 0 : axisOptions.tickTextShow) != null ? _h : axisOptions ? true : config[`${prefix}_tick_text_show`];
29532
29678
  painter.withState(() => {
29533
29679
  ctx.strokeStyle = axis.lineColor;
29534
29680
  ctx.lineWidth = axis.lineWidth;
@@ -29559,8 +29705,8 @@ class CanvasAxisRenderer {
29559
29705
  const drawableLineTicks = [];
29560
29706
  const addDrawableTick = (tick, target) => {
29561
29707
  const value = normalizeYValue($$, tick, id);
29562
- const tx = margin.left + targetScale(value);
29563
- const ty = margin.top + targetScale(value);
29708
+ const tx = plotMargin.left + targetScale(value);
29709
+ const ty = plotMargin.top + targetScale(value);
29564
29710
  const pos = isRotated ? tx : ty;
29565
29711
  if (!isDrawable(pos)) {
29566
29712
  return;
@@ -29573,7 +29719,7 @@ class CanvasAxisRenderer {
29573
29719
  for (const tick of lineTicks) {
29574
29720
  addDrawableTick(tick, drawableLineTicks);
29575
29721
  }
29576
- if (axisOptions || config[`${prefix}_tick_show`]) {
29722
+ if (tickShow) {
29577
29723
  painter.strokePath(() => {
29578
29724
  for (const { tx, ty } of drawableLineTicks) {
29579
29725
  if (isRotated) {
@@ -29584,7 +29730,7 @@ class CanvasAxisRenderer {
29584
29730
  }
29585
29731
  });
29586
29732
  }
29587
- if (axisOptions || config[`${prefix}_tick_text_show`]) {
29733
+ if (tickTextShow) {
29588
29734
  for (const { tick, tx, ty } of drawableTicks) {
29589
29735
  if (isRotated) {
29590
29736
  painter.text(
@@ -29776,8 +29922,112 @@ class CanvasEngine {
29776
29922
  }
29777
29923
  }
29778
29924
 
29925
+ ;// ./src/ChartInternal/internals/subchart.util.ts
29926
+ function isContinuousGridFocusEnabled($$) {
29927
+ const { config, state } = $$;
29928
+ return !!(config.subchart_grid_focus_continuous && config.subchart_grid_focus !== false && config.subchart_show && config.subchart_brush_enabled === false && state.width2 > 0 && state.height2 > 0);
29929
+ }
29930
+ function getMainCoordFromSubchartCoord($$, subCoord) {
29931
+ var _a;
29932
+ const { config, scale, state } = $$;
29933
+ const mainX = scale.zoom || scale.x;
29934
+ const subX = scale.subX;
29935
+ if (!mainX || !subX) {
29936
+ return null;
29937
+ }
29938
+ const subLength = config.axis_rotated ? state.height2 : state.width2;
29939
+ const mainLength = config.axis_rotated ? state.height : state.width;
29940
+ const domainValue = (_a = subX.invert) == null ? void 0 : _a.call(subX, subCoord);
29941
+ let mainCoord = domainValue == null ? NaN : mainX(domainValue);
29942
+ if (!Number.isFinite(mainCoord) && subLength > 0) {
29943
+ mainCoord = Math.max(0, Math.min(1, subCoord / subLength)) * mainLength;
29944
+ }
29945
+ return Number.isFinite(mainCoord) ? Math.max(0, Math.min(mainLength, mainCoord)) : null;
29946
+ }
29947
+
29779
29948
  ;// ./src/ChartInternal/shape/core/barRadius.ts
29780
29949
 
29950
+ const RE_PATH_NUMBER = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;
29951
+ const RE_PATH_TOKEN = /([aAcChHlLmMqQsStTvVzZ])|([-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?)/g;
29952
+ function getArcFlagTokenIndexes(path) {
29953
+ const flags = /* @__PURE__ */ new Set();
29954
+ let numIndex = -1;
29955
+ let argIndex = 0;
29956
+ let inArc = false;
29957
+ let token;
29958
+ RE_PATH_TOKEN.lastIndex = 0;
29959
+ while (token = RE_PATH_TOKEN.exec(path)) {
29960
+ if (token[1]) {
29961
+ inArc = token[1] === "a" || token[1] === "A";
29962
+ argIndex = 0;
29963
+ } else {
29964
+ numIndex++;
29965
+ if (inArc) {
29966
+ const pos = argIndex % 7;
29967
+ if (pos === 2 || pos === 3 || pos === 4) {
29968
+ flags.add(numIndex);
29969
+ }
29970
+ argIndex++;
29971
+ }
29972
+ }
29973
+ }
29974
+ return flags;
29975
+ }
29976
+ function getBarPathInterpolator(a, b) {
29977
+ const flagSet = getArcFlagTokenIndexes(b);
29978
+ const segments = [];
29979
+ const interpolators = [];
29980
+ let bIndex = 0;
29981
+ let segIndex = -1;
29982
+ let numIndex = -1;
29983
+ let am;
29984
+ let bm;
29985
+ const append = (text) => {
29986
+ if (segments[segIndex]) {
29987
+ segments[segIndex] += text;
29988
+ } else {
29989
+ segments[++segIndex] = text;
29990
+ }
29991
+ };
29992
+ RE_PATH_NUMBER.lastIndex = 0;
29993
+ const reA = RE_PATH_NUMBER;
29994
+ const reB = new RegExp(RE_PATH_NUMBER.source, "g");
29995
+ a += "";
29996
+ b += "";
29997
+ while ((am = reA.exec(a)) && (bm = reB.exec(b))) {
29998
+ numIndex++;
29999
+ if (bm.index > bIndex) {
30000
+ append(b.slice(bIndex, bm.index));
30001
+ }
30002
+ if (am[0] === bm[0]) {
30003
+ append(bm[0]);
30004
+ } else {
30005
+ const from = +am[0];
30006
+ const to = +bm[0];
30007
+ const isFlag = flagSet.has(numIndex);
30008
+ segments[++segIndex] = null;
30009
+ interpolators.push({
30010
+ index: segIndex,
30011
+ fn: isFlag ? (t) => Math.round(from + (to - from) * t) : (t) => from + (to - from) * t
30012
+ });
30013
+ }
30014
+ bIndex = reB.lastIndex;
30015
+ }
30016
+ if (bIndex < b.length) {
30017
+ append(b.slice(bIndex));
30018
+ }
30019
+ if (!interpolators.length) {
30020
+ const result = segments.join("");
30021
+ return () => result;
30022
+ }
30023
+ return (t) => {
30024
+ for (let i = 0, len = interpolators.length; i < len; i++) {
30025
+ const { index, fn } = interpolators[i];
30026
+ segments[index] = String(fn(t));
30027
+ }
30028
+ return segments.join("");
30029
+ };
30030
+ }
29781
30031
  function getBarRadiusResolver($$) {
29782
30032
  const { bar_radius: radius, bar_radius_ratio: ratio } = $$.config;
29783
30033
  return isNumber(radius) && radius > 0 ? () => radius : isNumber(ratio) ? (width) => width * ratio : null;
@@ -30305,6 +30555,26 @@ var path_spreadValues = (a, b) => {
30305
30555
  };
30306
30556
  var path_spreadProps = (a, b) => path_defProps(a, path_getOwnPropDescs(b));
30307
30557
 
30558
+ function getPathValueFn($$, isSub) {
30559
+ if (!isSub) {
30560
+ return (d) => $$.getBaseValue(d);
30561
+ }
30562
+ return (d) => {
30563
+ var _a;
30564
+ const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, true);
30565
+ return value === void 0 ? $$.getBaseValue(d) : value;
30566
+ };
30567
+ }
30568
+ function getProjectedValues($$, values, isSub) {
30569
+ if (!isSub) {
30570
+ return values;
30571
+ }
30572
+ return values.map((d) => {
30573
+ var _a;
30574
+ const value = (_a = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _a.call($$, d, isSub);
30575
+ return value === void 0 ? d : path_spreadProps(path_spreadValues({}, d), { value });
30576
+ });
30577
+ }
30308
30578
  function getLineValues($$, d, values) {
30309
30579
  return $$.isStepType(d) ? $$.convertValuesToStep(values) : values;
30310
30580
  }
@@ -30314,13 +30584,16 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
30314
30584
  const isRotated = config.axis_rotated;
30315
30585
  const getPoints = $$.generateGetLinePoints(lineIndices, isSub);
30316
30586
  const yScale = $$.getYScaleById.bind($$);
30587
+ const pathValue = getPathValueFn($$, isSub);
30317
30588
  const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
30318
- const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.getBaseValue(d));
30589
+ const yValue = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
30590
+ pathValue(d)
30591
+ );
30319
30592
  let line = src_line();
30320
30593
  line = isRotated ? line.x(yValue).y(xValue) : line.x(xValue).y(yValue);
30321
30594
  context && (line = line.context(context));
30322
30595
  if (!lineConnectNull) {
30323
- line = line.defined((d) => $$.getBaseValue(d) !== null);
30596
+ line = line.defined((d) => pathValue(d) !== null);
30324
30597
  }
30325
30598
  const x = isSub ? scale.subX : scale.x;
30326
30599
  return (d) => {
@@ -30332,6 +30605,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
30332
30605
  if ($$.isLineType(d)) {
30333
30606
  const regions = config.data_regions[d.id];
30334
30607
  if (regions && !context && $$.lineWithRegions) {
30608
+ values = getProjectedValues($$, values, isSub);
30335
30609
  if ($$.isAreaRangeType(d)) {
30336
30610
  values = values.map((dv) => path_spreadProps(path_spreadValues({}, dv), { value: $$.getRangedData(dv, "mid") }));
30337
30611
  }
@@ -30345,7 +30619,7 @@ function generateDrawLinePath($$, lineIndices, isSub, context) {
30345
30619
  } else {
30346
30620
  if (values[0]) {
30347
30621
  x0 = x(values[0].x);
30348
- y0 = y(values[0].value);
30622
+ y0 = y(pathValue(values[0]));
30349
30623
  }
30350
30624
  path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
30351
30625
  }
@@ -30358,12 +30632,22 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
30358
30632
  const isRotated = config.axis_rotated;
30359
30633
  const getPoints = $$.generateGetAreaPoints(areaIndices, isSub);
30360
30634
  const yScale = $$.getYScaleById.bind($$);
30635
+ const pathValue = getPathValueFn($$, isSub);
30636
+ const shapeYMin = /* @__PURE__ */ new Map();
30637
+ const getShapeYMin = (id) => {
30638
+ let min = shapeYMin.get(id);
30639
+ if (min === void 0) {
30640
+ min = $$.getShapeYMin(id, isSub);
30641
+ shapeYMin.set(id, min);
30642
+ }
30643
+ return min;
30644
+ };
30361
30645
  const xValue = (d) => (isSub ? $$.subxx : $$.xx).call($$, d);
30362
30646
  const value0 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)(
30363
- $$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : $$.getShapeYMin(d.id)
30647
+ $$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : getShapeYMin(d.id)
30364
30648
  );
30365
30649
  const value1 = (d, i) => $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)(
30366
- $$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d.value
30650
+ $$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : pathValue(d)
30367
30651
  );
30368
30652
  return (d) => {
30369
30653
  let values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values;
@@ -30372,19 +30656,20 @@ function generateDrawAreaPath($$, areaIndices, isSub, context) {
30372
30656
  let path;
30373
30657
  if ($$.isAreaType(d)) {
30374
30658
  let area = src_area();
30375
- area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? $$.state.height : value0).y1(value1);
30659
+ area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? isSub ? $$.state.height2 : $$.state.height : value0).y1(value1);
30376
30660
  context && (area = area.context(context));
30377
30661
  if (!lineConnectNull) {
30378
- area = area.defined((d2) => $$.getBaseValue(d2) !== null);
30662
+ area = area.defined((d2) => pathValue(d2) !== null);
30379
30663
  }
30664
+ values = getProjectedValues($$, values, isSub);
30380
30665
  if ($$.isStepType(d)) {
30381
30666
  values = $$.convertValuesToStep(values);
30382
30667
  }
30383
30668
  path = area.curve($$.getCurve(d))(values);
30384
30669
  } else {
30385
30670
  if (values[0]) {
30386
- x0 = $$.scale.x(values[0].x);
30387
- y0 = $$.getYScaleById(d.id)(values[0].value);
30671
+ x0 = (isSub ? $$.scale.subX : $$.scale.x)(values[0].x);
30672
+ y0 = $$.getYScaleById(d.id, isSub)(pathValue(values[0]));
30388
30673
  }
30389
30674
  path = isRotated ? `M ${y0} ${x0}` : `M ${x0} ${y0}`;
30390
30675
  }
@@ -31244,6 +31529,7 @@ var CanvasRenderer_publicField = (obj, key, value) => CanvasRenderer_defNormalPr
31244
31529
 
31245
31530
 
31246
31531
 
31532
+
31247
31533
  const RENDERER_GROUPED_TYPE_FILTERS = [
31248
31534
  isCanvasAreaType,
31249
31535
  isCanvasBarType,
@@ -31925,165 +32211,175 @@ class CanvasRenderer {
31925
32211
  /**
31926
32212
  * Draw the canvas subchart overview and brush selection.
31927
32213
  * @param {object} $$ ChartInternal instance
31928
- * @param {object} shape Cached draw shape object
32214
+ * @param {object} _shape Cached main shape object
31929
32215
  * @private
31930
32216
  */
31931
- drawSubchart($$, shape) {
32217
+ drawSubchart($$, _shape) {
31932
32218
  const { config, state } = $$;
32219
+ void _shape;
31933
32220
  if (!config.subchart_show || !state.hasAxis || state.width2 <= 0 || state.height2 <= 0) {
31934
32221
  return;
31935
32222
  }
31936
32223
  const { ctx, painter, theme: { style } } = this;
31937
32224
  const { margin2, width2, height2 } = state;
31938
32225
  const rect = { x: margin2.left, y: margin2.top, w: width2, h: height2 };
31939
- const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
31940
- painter.withState(() => {
31941
- ctx.strokeStyle = style.axis.lineColor;
31942
- ctx.lineWidth = style.axis.lineWidth;
31943
- painter.strokePath(() => {
31944
- if (config.axis_rotated) {
31945
- painter.traceLine(rect.x, rect.y, rect.x, rect.y + rect.h);
31946
- } else {
31947
- painter.traceLine(rect.x, rect.y + rect.h, rect.x + rect.w, rect.y + rect.h);
31948
- }
31949
- });
31950
- painter.clipRect(rect, () => {
31951
- painter.withTranslation(rect.x, rect.y, () => {
31952
- var _a, _b, _c, _d, _e, _f;
31953
- const areaTargets = targets.filter(isCanvasAreaType.bind(null, $$));
31954
- const areaIndices = getCanvasShapeIndices(
31955
- $$,
31956
- shape,
31957
- TYPE.AREA,
31958
- isCanvasAreaType.bind(null, $$)
31959
- );
31960
- ctx.globalAlpha = style.shape.areaOpacity;
31961
- for (const target of areaTargets) {
31962
- if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
31963
- continue;
31964
- }
31965
- ctx.fillStyle = $$.color(target.id);
31966
- drawCanvasArea($$, target, areaIndices, painter, true);
31967
- }
31968
- ctx.globalAlpha = 1;
31969
- const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
31970
- const barIndices = getCanvasShapeIndices(
31971
- $$,
31972
- shape,
31973
- TYPE.BAR,
31974
- isCanvasBarType.bind(null, $$)
31975
- );
31976
- const getBarPoints = (_a = $$.generateGetBarPoints) == null ? void 0 : _a.call($$, barIndices, true);
31977
- if (getBarPoints) {
31978
- ctx.globalAlpha = style.shape.barOpacity;
31979
- for (const target of barTargets) {
32226
+ $$.withSubchartTypeContext(() => {
32227
+ var _a;
32228
+ const targets = $$.filterTargetsToShow().filter(isCanvasRenderableTarget.bind(null, $$));
32229
+ const shape = $$.getDrawShape();
32230
+ (_a = $$.updateSubchartYDomain) == null ? void 0 : _a.call($$, targets);
32231
+ painter.withState(() => {
32232
+ painter.clipRect(rect, () => {
32233
+ painter.withTranslation(rect.x, rect.y, () => {
32234
+ var _a2, _b, _c, _d, _e, _f;
32235
+ const areaTargets = targets.filter(isCanvasAreaType.bind(null, $$));
32236
+ const areaIndices = getCanvasShapeIndices(
32237
+ $$,
32238
+ shape,
32239
+ TYPE.AREA,
32240
+ isCanvasAreaType.bind(null, $$)
32241
+ );
32242
+ for (const target of areaTargets) {
32243
+ if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
32244
+ continue;
32245
+ }
32246
+ ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
31980
32247
  ctx.fillStyle = $$.color(target.id);
31981
- target.values.forEach((d, i) => {
31982
- if (!hasCanvasDrawableValue($$, d)) {
31983
- return;
31984
- }
31985
- const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
31986
- geometry && painter.fillRect(geometry.rect, { fill: ctx.fillStyle });
31987
- });
32248
+ drawCanvasArea($$, target, areaIndices, painter, true);
31988
32249
  }
31989
32250
  ctx.globalAlpha = 1;
31990
- }
31991
- const candlestickTargets = targets.filter(
31992
- isCanvasCandlestickType.bind(null, $$)
31993
- );
31994
- const candlestickIndices = getCanvasShapeIndices(
31995
- $$,
31996
- shape,
31997
- TYPE.CANDLESTICK,
31998
- isCanvasCandlestickType.bind(null, $$)
31999
- );
32000
- const getCandlestickPoints = (_b = $$.generateGetCandlestickPoints) == null ? void 0 : _b.call(
32001
- $$,
32002
- candlestickIndices,
32003
- true
32004
- );
32005
- if (getCandlestickPoints) {
32006
- ctx.lineWidth = style.shape.candlestickLineWidth;
32007
- for (const target of candlestickTargets) {
32008
- target.values.forEach((d, i) => {
32009
- var _a2;
32010
- const value = (_a2 = $$.getCandlestickData) == null ? void 0 : _a2.call($$, d);
32011
- const geometry = value && getCanvasCandlestickGeometry(
32012
- $$,
32013
- getCandlestickPoints,
32014
- d,
32015
- i
32016
- );
32017
- if (!geometry) {
32018
- return;
32019
- }
32020
- const color = getCandlestickColor($$, { id: target.id }, value);
32021
- ctx.strokeStyle = color;
32022
- ctx.fillStyle = color;
32023
- painter.strokePath(() => {
32024
- painter.traceLine(
32025
- geometry.wickStart[0],
32026
- geometry.wickStart[1],
32027
- geometry.wickEnd[0],
32028
- geometry.wickEnd[1]
32029
- );
32030
- });
32031
- painter.fillRect(geometry.body, { fill: ctx.fillStyle });
32032
- });
32033
- }
32034
- }
32035
- const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
32036
- const lineIndices = getCanvasShapeIndices(
32037
- $$,
32038
- shape,
32039
- TYPE.LINE,
32040
- isCanvasLineType.bind(null, $$)
32041
- );
32042
- ctx.globalAlpha = 1;
32043
- ctx.lineWidth = style.shape.lineWidth;
32044
- for (const target of lineTargets) {
32045
- if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
32046
- continue;
32047
- }
32048
- ctx.strokeStyle = $$.color(target.id);
32049
- drawCanvasLine($$, target, lineIndices, painter, true);
32050
- }
32051
- if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
32052
- const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
32053
- const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
32054
- if (cx && cy) {
32055
- for (const target of targets) {
32056
- if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
32057
- continue;
32058
- }
32059
- const color = $$.color(target.id);
32060
- const pointFill = style.shape.pointFillColor || color;
32061
- const pointStroke = style.shape.pointStrokeColor || color;
32062
- const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
32063
- const pointStyle = pointStroke && pointLineWidth > 0 ? {
32064
- fill: pointFill,
32065
- stroke: pointStroke,
32066
- lineWidth: pointLineWidth
32067
- } : { fill: pointFill };
32068
- ctx.globalAlpha = getPointOpacity($$, target);
32251
+ const barTargets = targets.filter(isCanvasBarType.bind(null, $$));
32252
+ const barIndices = getCanvasShapeIndices(
32253
+ $$,
32254
+ shape,
32255
+ TYPE.BAR,
32256
+ isCanvasBarType.bind(null, $$)
32257
+ );
32258
+ const getBarPoints = (_a2 = $$.generateGetBarPoints) == null ? void 0 : _a2.call($$, barIndices, true);
32259
+ if (getBarPoints) {
32260
+ for (const target of barTargets) {
32261
+ ctx.globalAlpha = style.shape.barOpacity * getCanvasTargetFocusOpacity($$, target);
32262
+ ctx.fillStyle = $$.color(target.id);
32069
32263
  target.values.forEach((d, i) => {
32264
+ var _a3;
32070
32265
  if (!hasCanvasDrawableValue($$, d)) {
32071
32266
  return;
32072
32267
  }
32073
- const x = config.axis_rotated ? cy(d, i) : cx(d);
32074
- const y = config.axis_rotated ? cx(d) : cy(d, i);
32075
- const r = Math.min(getTargetPointRadius($$, target, d), 3);
32076
- if (isFiniteCanvasCoordinate(x, y)) {
32077
- drawPointPattern(painter, "circle", x, y, r, pointStyle);
32078
- }
32268
+ const geometry = getCanvasBarGeometry($$, getBarPoints, d, i);
32269
+ const fill = ((_a3 = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a3.call($$, d, true)) || ctx.fillStyle;
32270
+ geometry && painter.fillRect(geometry.rect, { fill });
32079
32271
  });
32080
32272
  }
32081
32273
  ctx.globalAlpha = 1;
32082
32274
  }
32083
- }
32275
+ const candlestickTargets = targets.filter(
32276
+ isCanvasCandlestickType.bind(null, $$)
32277
+ );
32278
+ const candlestickIndices = getCanvasShapeIndices(
32279
+ $$,
32280
+ shape,
32281
+ TYPE.CANDLESTICK,
32282
+ isCanvasCandlestickType.bind(null, $$)
32283
+ );
32284
+ const getCandlestickPoints = (_b = $$.generateGetCandlestickPoints) == null ? void 0 : _b.call(
32285
+ $$,
32286
+ candlestickIndices,
32287
+ true
32288
+ );
32289
+ if (getCandlestickPoints) {
32290
+ ctx.lineWidth = style.shape.candlestickLineWidth;
32291
+ for (const target of candlestickTargets) {
32292
+ const targetOpacity = getCanvasTargetFocusOpacity($$, target);
32293
+ ctx.globalAlpha = targetOpacity;
32294
+ target.values.forEach((d, i) => {
32295
+ var _a3;
32296
+ const value = (_a3 = $$.getCandlestickData) == null ? void 0 : _a3.call($$, d);
32297
+ const geometry = value && getCanvasCandlestickGeometry(
32298
+ $$,
32299
+ getCandlestickPoints,
32300
+ d,
32301
+ i
32302
+ );
32303
+ if (!geometry) {
32304
+ return;
32305
+ }
32306
+ const color = getCandlestickColor($$, { id: target.id }, value);
32307
+ ctx.strokeStyle = color;
32308
+ ctx.fillStyle = color;
32309
+ painter.strokePath(() => {
32310
+ painter.traceLine(
32311
+ geometry.wickStart[0],
32312
+ geometry.wickStart[1],
32313
+ geometry.wickEnd[0],
32314
+ geometry.wickEnd[1]
32315
+ );
32316
+ });
32317
+ painter.fillRect(geometry.body, { fill: ctx.fillStyle });
32318
+ });
32319
+ }
32320
+ }
32321
+ const lineTargets = targets.filter(isCanvasLineType.bind(null, $$));
32322
+ const lineIndices = getCanvasShapeIndices(
32323
+ $$,
32324
+ shape,
32325
+ TYPE.LINE,
32326
+ isCanvasLineType.bind(null, $$)
32327
+ );
32328
+ ctx.globalAlpha = 1;
32329
+ for (const target of lineTargets) {
32330
+ if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
32331
+ continue;
32332
+ }
32333
+ ctx.globalAlpha = getCanvasTargetFocusOpacity($$, target);
32334
+ ctx.lineWidth = isCanvasTargetFocused($$, target) ? style.shape.lineFocusedWidth : style.shape.lineWidth;
32335
+ ctx.strokeStyle = $$.color(target.id);
32336
+ drawCanvasLine($$, target, lineIndices, painter, true);
32337
+ }
32338
+ ctx.globalAlpha = 1;
32339
+ if (config.point_show && !((_c = $$.isPointFocusOnly) == null ? void 0 : _c.call($$))) {
32340
+ const cy = (_d = $$.updateCircleY) == null ? void 0 : _d.call($$, true);
32341
+ const cx = (_e = $$.subxx) == null ? void 0 : _e.bind($$);
32342
+ if (cx && cy) {
32343
+ for (const target of targets) {
32344
+ if (!isCanvasScatterType($$, target) && !isCanvasBubbleType($$, target)) {
32345
+ continue;
32346
+ }
32347
+ const color = $$.color(target.id);
32348
+ const pointFill = style.shape.pointFillColor || color;
32349
+ const pointStroke = style.shape.pointStrokeColor || color;
32350
+ const pointLineWidth = pointStroke ? (_f = style.shape.pointLineWidth) != null ? _f : 1 : 0;
32351
+ const pointStyle = pointStroke && pointLineWidth > 0 ? {
32352
+ fill: pointFill,
32353
+ stroke: pointStroke,
32354
+ lineWidth: pointLineWidth
32355
+ } : { fill: pointFill };
32356
+ ctx.globalAlpha = getPointOpacity($$, target) * getCanvasTargetFocusOpacity($$, target);
32357
+ target.values.forEach((d, i) => {
32358
+ if (!hasCanvasDrawableValue($$, d)) {
32359
+ return;
32360
+ }
32361
+ const x = config.axis_rotated ? cy(d, i) : cx(d);
32362
+ const y = config.axis_rotated ? cx(d) : cy(d, i);
32363
+ const r = Math.min(getTargetPointRadius($$, target, d), 3);
32364
+ if (isFiniteCanvasCoordinate(x, y)) {
32365
+ drawPointPattern(
32366
+ painter,
32367
+ "circle",
32368
+ x,
32369
+ y,
32370
+ r,
32371
+ pointStyle
32372
+ );
32373
+ }
32374
+ });
32375
+ }
32376
+ ctx.globalAlpha = 1;
32377
+ }
32378
+ }
32379
+ });
32084
32380
  });
32381
+ this.drawSubchartBrush($$);
32085
32382
  });
32086
- this.drawSubchartBrush($$);
32087
32383
  });
32088
32384
  }
32089
32385
  /**
@@ -32095,7 +32391,7 @@ class CanvasRenderer {
32095
32391
  var _a, _b;
32096
32392
  const { config, scale, state } = $$;
32097
32393
  const domain = state.domain;
32098
- if (!config.subchart_show || !(domain == null ? void 0 : domain.length) || !scale.subX) {
32394
+ if (!config.subchart_show || config.subchart_brush_enabled === false || !(domain == null ? void 0 : domain.length) || !scale.subX) {
32099
32395
  return;
32100
32396
  }
32101
32397
  const { margin2, width2, height2 } = state;
@@ -32556,7 +32852,7 @@ class CanvasRenderer {
32556
32852
  const stackingRadiusSet = getRadius ? getStackingBarRadiusSet($$) : /* @__PURE__ */ new Set();
32557
32853
  painter.withTranslation(margin.left, margin.top, () => {
32558
32854
  selectedData.forEach((d) => {
32559
- var _a2, _b2, _c, _d, _e, _f;
32855
+ var _a2, _b2, _c, _d, _e, _f, _g;
32560
32856
  const color = $$.color(d.id);
32561
32857
  if (isBar(d) && barPoints) {
32562
32858
  const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
@@ -32600,11 +32896,13 @@ class CanvasRenderer {
32600
32896
  lineWidth: style.selectedPoint.lineWidth,
32601
32897
  stroke: style.selectedPoint.stroke || color
32602
32898
  });
32603
- drawPointPattern(painter, pointType, x, y, r, {
32604
- fill: style.shape.pointFillColor || color,
32605
- stroke: style.shape.pointStrokeColor || color,
32606
- lineWidth: (_f = style.shape.pointLineWidth) != null ? _f : 1
32607
- });
32899
+ if (!((_f = $$.isPointFocusOnly) == null ? void 0 : _f.call($$))) {
32900
+ drawPointPattern(painter, pointType, x, y, r, {
32901
+ fill: style.shape.pointFillColor || color,
32902
+ stroke: style.shape.pointStrokeColor || color,
32903
+ lineWidth: (_g = style.shape.pointLineWidth) != null ? _g : 1
32904
+ });
32905
+ }
32608
32906
  }
32609
32907
  });
32610
32908
  ctx.globalAlpha = 1;
@@ -32848,6 +33146,37 @@ class CanvasRenderer {
32848
33146
  }
32849
33147
  });
32850
33148
  }
33149
+ /**
33150
+ * Draw synchronized focus grid on the canvas subchart.
33151
+ * @param {object} $$ ChartInternal instance
33152
+ * @param {Array} selectedData Focused data rows
33153
+ * @private
33154
+ */
33155
+ drawSubchartFocus($$, selectedData) {
33156
+ const { config, scale, state } = $$;
33157
+ const focus = selectedData == null ? void 0 : selectedData.find(
33158
+ (d) => d && hasCanvasDrawableValue($$, d)
33159
+ );
33160
+ if (!focus || !config.subchart_show || config.subchart_grid_focus_continuous || config.subchart_brush_enabled !== false || config.grid_focus_show === false || config.subchart_grid_focus === false || !config.tooltip_show || config.axis_tooltip || !scale.subX || state.width2 <= 0 || state.height2 <= 0) {
33161
+ return;
33162
+ }
33163
+ const { margin2, width2, height2 } = state;
33164
+ const pos = scale.subX(focus.x);
33165
+ if (!Number.isFinite(pos)) {
33166
+ return;
33167
+ }
33168
+ const { painter, theme: { style } } = this;
33169
+ const lineWidth = style.axis.lineWidth;
33170
+ const x = painter.crisp(margin2.left + pos, lineWidth);
33171
+ const y = painter.crisp(margin2.top + pos, lineWidth);
33172
+ painter.strokePath(() => {
33173
+ config.axis_rotated ? painter.traceLine(margin2.left, y, margin2.left + width2, y) : painter.traceLine(x, margin2.top, x, margin2.top + height2);
33174
+ }, {
33175
+ lineDash: style.focusGrid.dashArray,
33176
+ lineWidth: style.focusGrid.lineWidth,
33177
+ stroke: style.focusGrid.lineColor
33178
+ });
33179
+ }
32851
33180
  /**
32852
33181
  * Draw focus grid and focused points on canvas.
32853
33182
  * @param {object} $$ ChartInternal instance
@@ -32864,6 +33193,7 @@ class CanvasRenderer {
32864
33193
  const focus = selectedData.find(
32865
33194
  (d) => d && hasCanvasDrawableValue($$, d)
32866
33195
  );
33196
+ $$.config.subchart_grid_focus !== false && !isContinuousGridFocusEnabled($$) && this.drawSubchartFocus($$, selectedData);
32867
33197
  painter.withTranslation(margin.left, margin.top, () => {
32868
33198
  if ($$.config.tooltip_show && $$.config.grid_focus_show !== false && !$$.config.axis_tooltip && focus) {
32869
33199
  const { x, y } = getRenderDataPoint($$, focus);
@@ -32874,6 +33204,9 @@ class CanvasRenderer {
32874
33204
  const crispEdgeX = (value) => painter.crisp(margin.left + value, axisLineWidth) - margin.left;
32875
33205
  const crispEdgeY = (value) => painter.crisp(margin.top + value, axisLineWidth) - margin.top;
32876
33206
  const isEdge = $$.config.grid_focus_edge && !$$.config.tooltip_grouped;
33207
+ const continuousFocus = isContinuousGridFocusEnabled($$);
33208
+ const focusEndX = continuousFocus ? $$.state.margin2.left - margin.left + $$.state.width2 : $$.state.width;
33209
+ const focusEndY = continuousFocus ? $$.state.margin2.top - margin.top + $$.state.height2 : $$.state.height;
32877
33210
  if (hasIndexCoordinate) {
32878
33211
  painter.strokePath(() => {
32879
33212
  var _a, _b;
@@ -32881,7 +33214,7 @@ class CanvasRenderer {
32881
33214
  painter.traceLine(
32882
33215
  crispEdgeX(0),
32883
33216
  y,
32884
- isEdge && hasValueCoordinate ? x : crispEdgeX($$.state.width),
33217
+ isEdge && hasValueCoordinate ? x : crispEdgeX(focusEndX),
32885
33218
  y
32886
33219
  );
32887
33220
  if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
@@ -32898,7 +33231,7 @@ class CanvasRenderer {
32898
33231
  x,
32899
33232
  isEdge && hasValueCoordinate ? y : crispEdgeY(0),
32900
33233
  x,
32901
- crispEdgeY($$.state.height)
33234
+ crispEdgeY(focusEndY)
32902
33235
  );
32903
33236
  if (hasValueCoordinate && $$.config.grid_focus_y && !$$.config.tooltip_grouped) {
32904
33237
  const isY2 = ((_b = $$.axis) == null ? void 0 : _b.getId(focus.id)) === "y2";
@@ -33096,6 +33429,77 @@ function normalizeThemeSelectors(selector) {
33096
33429
  (value) => value.trim().replace(/\s*>\s*/g, " ").replace(/\s+/g, " ").replace(/^(?:svg)?\.bb\s+/, "").replace(/(^|\s)(?:g|path|rect|line|text|circle)\./g, "$1.")
33097
33430
  ).filter(Boolean);
33098
33431
  }
33432
+ function getDefinedKeys(values) {
33433
+ return Object.keys(values).filter((key) => values[key] !== void 0);
33434
+ }
33435
+ function assignDefined(target, source, skip) {
33436
+ getDefinedKeys(source).forEach((key) => {
33437
+ if (!(skip == null ? void 0 : skip.has(key))) {
33438
+ target[key] = source[key];
33439
+ }
33440
+ });
33441
+ return target;
33442
+ }
33443
+ function isSimpleGridLineSelector(selector) {
33444
+ const tokens = selector.split(" ");
33445
+ return tokens.every(
33446
+ (token, index) => token === "line" || token === "text" ? index === tokens.length - 1 : /^(\.[A-Za-z_-][\w-]*)+$/.test(token)
33447
+ );
33448
+ }
33449
+ function getGridLineSelectorTarget(selector) {
33450
+ const tokens = selector.split(" ");
33451
+ const target = tokens[tokens.length - 1];
33452
+ return target === "line" || target === "text" ? target : null;
33453
+ }
33454
+ function getClassNames(className) {
33455
+ return (className || "").split(/\s+/).filter(Boolean);
33456
+ }
33457
+ function getGridLineSelectorStyle(style, target) {
33458
+ const values = target === "text" ? {
33459
+ labelColor: readColorValue(style, "fill"),
33460
+ labelFont: readFontValue(style)
33461
+ } : {
33462
+ lineColor: readColorValue(style, "stroke"),
33463
+ lineWidth: readNumberValue(style, "stroke-width"),
33464
+ dashArray: readDashArrayValue(style)
33465
+ };
33466
+ return assignDefined({}, values);
33467
+ }
33468
+ function getGridLineSelectorOverrides(selectors) {
33469
+ const overrides = [];
33470
+ Object.keys(selectors != null ? selectors : {}).forEach((selector) => {
33471
+ normalizeThemeSelectors(selector).forEach((normalizedSelector) => {
33472
+ const target = getGridLineSelectorTarget(normalizedSelector) || "line";
33473
+ const style = getGridLineSelectorStyle(selectors[selector], target);
33474
+ if (isSimpleGridLineSelector(normalizedSelector) && getDefinedKeys(style).length) {
33475
+ overrides.push({ selector: normalizedSelector, target, style });
33476
+ }
33477
+ });
33478
+ });
33479
+ return overrides;
33480
+ }
33481
+ function matchesGridLineSelector(selector, axis, className, target) {
33482
+ if (!isSimpleGridLineSelector(selector)) {
33483
+ return false;
33484
+ }
33485
+ const selectorTarget = getGridLineSelectorTarget(selector);
33486
+ if (selectorTarget && selectorTarget !== target) {
33487
+ return false;
33488
+ } else if (!selectorTarget && target === "text") {
33489
+ return false;
33490
+ }
33491
+ const customClasses = getClassNames(className);
33492
+ const axisLineClass = `bb-${axis}grid-line`;
33493
+ const availableClasses = /* @__PURE__ */ new Set([
33494
+ "bb-grid",
33495
+ "bb-grid-lines",
33496
+ `bb-${axis}grid-lines`,
33497
+ axisLineClass,
33498
+ ...customClasses
33499
+ ]);
33500
+ const selectorClasses = (selector.match(/\.[A-Za-z_-][\w-]*/g) || []).map((match) => match.slice(1));
33501
+ return !!selectorClasses.length && selectorClasses.every((cls) => availableClasses.has(cls)) && (selectorClasses.includes(axisLineClass) || customClasses.some((cls) => selectorClasses.includes(cls)));
33502
+ }
33099
33503
  function applySelectorStyle(target, selector, style) {
33100
33504
  switch (selector) {
33101
33505
  case ".bb-axis path.domain":
@@ -33372,6 +33776,8 @@ class CanvasTheme {
33372
33776
  CanvasTheme_publicField(this, "style");
33373
33777
  CanvasTheme_publicField(this, "cacheContainer", null);
33374
33778
  CanvasTheme_publicField(this, "cacheKey", null);
33779
+ CanvasTheme_publicField(this, "gridLineSelectorOverrides", []);
33780
+ CanvasTheme_publicField(this, "directGridOverrideKeys", /* @__PURE__ */ new Set());
33375
33781
  }
33376
33782
  /**
33377
33783
  * Read theme values from temporary SVG probes.
@@ -33380,8 +33786,12 @@ class CanvasTheme {
33380
33786
  * @private
33381
33787
  */
33382
33788
  load(container, userOverride) {
33383
- var _a, _b, _c, _d;
33789
+ var _a, _b, _c, _d, _e;
33384
33790
  const svg = browser_doc.createElementNS(SVG_NS, "svg");
33791
+ this.gridLineSelectorOverrides = getGridLineSelectorOverrides(userOverride == null ? void 0 : userOverride.selectors);
33792
+ this.directGridOverrideKeys = new Set(
33793
+ Object.keys((_a = userOverride == null ? void 0 : userOverride.grid) != null ? _a : {})
33794
+ );
33385
33795
  svg.setAttribute("class", "bb");
33386
33796
  svg.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;width:0;height:0;overflow:hidden";
33387
33797
  container.appendChild(svg);
@@ -33546,7 +33956,7 @@ class CanvasTheme {
33546
33956
  subchartBrushSelection.fill,
33547
33957
  toColor(subchartBrushExtent.fill, zoomBrushFill)
33548
33958
  );
33549
- const subchartBrushOpacity = (_d = (_c = (_b = (_a = toOptionalNumber(subchartBrushSelection["fill-opacity"], 1)) != null ? _a : toOptionalNumber(subchartBrushSelection.opacity, 1)) != null ? _b : toOptionalNumber(subchartBrushExtent["fill-opacity"], 1)) != null ? _c : toOptionalNumber(subchartBrushExtent.opacity, 1)) != null ? _d : zoomBrushOpacity;
33959
+ const subchartBrushOpacity = (_e = (_d = (_c = (_b = toOptionalNumber(subchartBrushSelection["fill-opacity"], 1)) != null ? _b : toOptionalNumber(subchartBrushSelection.opacity, 1)) != null ? _c : toOptionalNumber(subchartBrushExtent["fill-opacity"], 1)) != null ? _d : toOptionalNumber(subchartBrushExtent.opacity, 1)) != null ? _e : zoomBrushOpacity;
33550
33960
  const subchartBrushHandleStroke = toColor(subchartBrushHandle.stroke, "transparent");
33551
33961
  const defaultStyle = {
33552
33962
  axis: {
@@ -33772,6 +34182,25 @@ class CanvasTheme {
33772
34182
  }
33773
34183
  this.load(container, userOverride);
33774
34184
  }
34185
+ /**
34186
+ * Resolve selector based style for one configured optional grid line.
34187
+ * @param {string} axis Grid axis
34188
+ * @param {object} line Grid line options
34189
+ * @param {string} line.class Grid line custom class
34190
+ * @param {string} target Draw target
34191
+ * @returns {object|undefined} Grid line style override
34192
+ * @private
34193
+ */
34194
+ getGridLineStyle(axis, line = {}, target = "line") {
34195
+ const style = {};
34196
+ for (const override of this.gridLineSelectorOverrides) {
34197
+ if (!matchesGridLineSelector(override.selector, axis, line.class, target)) {
34198
+ continue;
34199
+ }
34200
+ assignDefined(style, override.style, this.directGridOverrideKeys);
34201
+ }
34202
+ return getDefinedKeys(style).length ? style : void 0;
34203
+ }
33775
34204
  }
33776
34205
 
33777
34206
  ;// ./src/canvas/HitDetector.ts
@@ -34307,6 +34736,7 @@ const $FOCUS = {
34307
34736
  defocused: "bb-defocused",
34308
34737
  legendItemFocused: "bb-legend-item-focused",
34309
34738
  xgridFocus: "bb-xgrid-focus",
34739
+ xgridFocusContinuous: "bb-xgrid-focus-continuous",
34310
34740
  ygridFocus: "bb-ygrid-focus"
34311
34741
  };
34312
34742
  const $GRID = {
@@ -34384,19 +34814,79 @@ const $ZOOM = {
34384
34814
  * - **NOTE:**
34385
34815
  * - Will append &lt;style> to the head tag and will add shpes' CSS rules dynamically.
34386
34816
  * - For now, covers colors related properties (fill, stroke, etc.) only.
34387
- * @property {boolean} [boost.useWorker=false] Use Web Worker as possible for processing.
34817
+ * @property {boolean|string} [boost.useWorker=false] Use Web Worker as possible for processing.
34818
+ * - **Available values:**
34819
+ * - `false`: never offload.
34820
+ * - `true`: always offload when a Worker can be created.
34821
+ * - `"auto"`: offload only when the given data exceeds ~5,000 cells, since smaller
34822
+ * payloads lose more to structured cloning than they gain.
34388
34823
  * - **NOTE:**
34389
34824
  * - For now, only applies for data conversion at the initial time.
34390
- * - As of Web Worker's async nature, handling chart instance synchrously is not recommended.
34825
+ * - As of Web Worker's async nature, handling chart instance synchronously is not recommended.
34826
+ * - When Worker isn't available, fails or times out, data conversion falls back to main thread.
34391
34827
  * - When given data is empty, useWorker will be ignored.
34828
+ * @property {string} [boost.workerUrl=undefined] Use a custom static worker script URL instead of an inline Blob worker.
34829
+ * - **NOTE:**
34830
+ * - **Requires `boost.useWorker` to be enabled** — this option only selects where the
34831
+ * worker source comes from, it does not turn offloading on by itself.
34832
+ * - Useful for strict CSP environments that disallow `blob:` workers. Without it under
34833
+ * such a policy, worker creation throws and each conversion waits out the 5s timeout
34834
+ * before falling back, so the chart still renders but the initial draw is delayed.
34835
+ * - Point it at `dist/billboard.worker.js`, shipped in the package, or any script
34836
+ * implementing the same protocol: receive `{id, op, args}` and post back
34837
+ * `{id, result}` or `{id, error}`. No `eval()` is involved.
34838
+ * - With a bundler, make sure the file is emitted as a **real asset**, not inlined:
34839
+ * it is ~1.5KB, and inlining turns it into a `data:` URI, which a strict CSP
34840
+ * blocks exactly like `blob:`. Copying it into the static/public directory is the
34841
+ * option that works everywhere.
34842
+ * - Any failure (load error, unknown op, timeout, result mismatch) falls back to the main thread.
34392
34843
  * @example
34844
+ * // offload data conversion on a Worker, using the inline Blob worker
34393
34845
  * boost: {
34394
34846
  * useCssRule: true,
34395
- * useWorker: false
34847
+ * useWorker: true
34848
+ * }
34849
+ * @example
34850
+ * // offload only past ~5,000 cells
34851
+ * boost: {
34852
+ * useWorker: "auto"
34396
34853
  * }
34854
+ * @example
34855
+ * // strict CSP: serve the shipped script and point at it.
34856
+ * // 'useWorker' still has to be on - 'workerUrl' alone offloads nothing.
34857
+ * boost: {
34858
+ * useWorker: true,
34859
+ * workerUrl: "$YOUR_PATH/dist/billboard.worker.js"
34860
+ * }
34861
+ * @example
34862
+ * // ESM: the file is reachable as a package subpath.
34863
+ * // Vite - '?url' resolves it, but assets under 4KB are inlined as a 'data:' URI,
34864
+ * // which a strict CSP rejects. Opt that one file out of inlining:
34865
+ * //
34866
+ * // // vite.config.js
34867
+ * // export default {
34868
+ * // build: {
34869
+ * // assetsInlineLimit: path => /billboard\.worker\.js$/.test(path) ? false : undefined
34870
+ * // }
34871
+ * // };
34872
+ * import bb, {bar} from "billboard.js";
34873
+ * import workerUrl from "billboard.js/dist/billboard.worker.js?url";
34874
+ *
34875
+ * bb.generate({
34876
+ * boost: {useWorker: true, workerUrl},
34877
+ * data: {columns: [["data1", 30, 200, 100]], type: bar()}
34878
+ * });
34879
+ * @example
34880
+ * // ESM, bundler-agnostic: copy the file into the served static directory
34881
+ * // cp node_modules/billboard.js/dist/billboard.worker.js public/
34882
+ * bb.generate({
34883
+ * boost: {useWorker: true, workerUrl: "/billboard.worker.js"},
34884
+ * data: {columns: [["data1", 30, 200, 100]]}
34885
+ * });
34397
34886
  */
34398
34887
  boost_useCssRule: false,
34399
- boost_useWorker: false
34888
+ boost_useWorker: false,
34889
+ boost_workerUrl: void 0
34400
34890
  });
34401
34891
 
34402
34892
  ;// ./src/config/Options/common/color.ts
@@ -34407,9 +34897,9 @@ const $ZOOM = {
34407
34897
  * @memberof Options
34408
34898
  * @type {object}
34409
34899
  * @property {object} color color object
34410
- * @property {string|object|((this: Chart, d: DataItem) => string)} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
34900
+ * @property {string|object|function(DataItem): string} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
34411
34901
  * @property {Array|null} [color.pattern=[]] Set custom color pattern. Passing `null` will not set a color for these elements, which requires the usage of custom CSS-based theming to work.
34412
- * @property {(this: Chart) => SVGPathElement[]} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
34902
+ * @property {function(): Array.<SVGPatternElement>} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
34413
34903
  * - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
34414
34904
  * ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
34415
34905
  * - `bb-colorize-pattern-red`
@@ -36472,7 +36962,9 @@ class Element {
36472
36962
  x: null,
36473
36963
  y: null,
36474
36964
  y2: null,
36475
- subX: null
36965
+ subX: null,
36966
+ subY: null,
36967
+ subY2: null
36476
36968
  },
36477
36969
  axisTooltip: {
36478
36970
  x: null,
@@ -36587,6 +37079,7 @@ class State {
36587
37079
  loading: void 0,
36588
37080
  // Zoom/subchart domain (different from current.domain which is for rendering)
36589
37081
  domain: void 0,
37082
+ subchartSourceTypes: void 0,
36590
37083
  current: {
36591
37084
  // current domain value. Assigned when is zoom is called
36592
37085
  domain: void 0,
@@ -37290,28 +37783,148 @@ function generateWait() {
37290
37783
  ;// ./src/module/worker.ts
37291
37784
 
37292
37785
  const cache = {};
37786
+ const disabledKeys = /* @__PURE__ */ new Set();
37787
+ const verifiedOps = /* @__PURE__ */ new Map();
37788
+ const DEFAULT_WORKER_TIMEOUT = 5e3;
37789
+ const VERIFY_SAMPLE_SIZE = 3;
37293
37790
  let messageId = 0;
37294
- function getOrCreateWorkerResources(fn, depsFn) {
37295
- var _a;
37296
- const fnString = fn.toString();
37297
- const depsString = (_a = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _a : "";
37298
- const key = (fnString + depsString).replace(/(function|[\s\W\n])/g, "").substring(0, 30);
37791
+ function getWorkerSrc() {
37792
+ try {
37793
+ return "var bbWorker=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(e){let t=[];return e.forEach(function(e,n){let r=e[0];e.forEach(function(e,i){if(i>0){if(t[i-1]===void 0&&(t[i-1]={}),e===void 0)throw Error(`Source data is missing a component at (${n}, ${i})!`);t[i-1][r]=e}})}),t}function n(e){let t=e[0],n=[];return e.forEach(function(e,r){if(r>0){let i={};e.forEach(function(e,n){if(e===void 0)throw Error(`Source data is missing a component at (${r}, ${n})!`);i[t[n]]=e}),n.push(i)}}),n}function r(e,r){let i=[],a,o;if(Array.isArray(e)){let t=function(e,t){if(e[t]!==void 0)return e[t];let n=t.replace(/\\[(\\w+)\\]/g,`.$1`).replace(/^\\./,``).split(`.`),r=e;return n.some(function(e){return!(r=r&&typeof r==`object`&&e in r?r[e]:void 0)}),r};a=r.x?r.value.concat(r.x):r.value,i.push(a),e.forEach(function(e){let n=a.map(function(n){let r=t(e,n);return r===void 0&&(r=null),r});i.push(n)}),o=n(i)}else Object.keys(e).forEach(function(t){let n=[].concat(e[t]);n.unshift?.(t),i.push(n)}),o=t(i);return o}let i={columns:t,json:r,rows:n},a=self;function o({data:e}){let{args:t,id:n,op:r}=e;try{let e=i[r];if(!e)throw Error(`Unknown worker op: ${r}`);a.postMessage({id:n,result:e(...t)})}catch(e){a.postMessage({id:n,error:e&&(e.message||e.name)||String(e)})}}return typeof window>`u`&&(a.onmessage=o),e.handleMessage=o,e.ops=i,e})({});";
37794
+ } catch (e) {
37795
+ return "";
37796
+ }
37797
+ }
37798
+ function getWorkerAPI() {
37799
+ const { Blob, Worker, URL } = win;
37800
+ return Worker && Blob && (URL == null ? void 0 : URL.createObjectURL) && (URL == null ? void 0 : URL.revokeObjectURL) ? { Blob, Worker, URL } : null;
37801
+ }
37802
+ function getWorkerConstructor() {
37803
+ return win.Worker || null;
37804
+ }
37805
+ function normalizeWorkerOptions(options) {
37806
+ var _a, _b;
37807
+ return typeof options === "number" ? { timeout: options, workerUrl: "" } : {
37808
+ timeout: (_a = options == null ? void 0 : options.timeout) != null ? _a : DEFAULT_WORKER_TIMEOUT,
37809
+ workerUrl: (_b = options == null ? void 0 : options.workerUrl) != null ? _b : ""
37810
+ };
37811
+ }
37812
+ function releaseWorker(key, disable = false) {
37813
+ var _a, _b;
37814
+ const cached = cache[key];
37815
+ if (disable) {
37816
+ disabledKeys.add(key);
37817
+ }
37818
+ if (cached) {
37819
+ (_a = cached.worker) == null ? void 0 : _a.terminate();
37820
+ cached.revoke && ((_b = getWorkerAPI()) == null ? void 0 : _b.URL.revokeObjectURL(cached.src));
37821
+ delete cache[key];
37822
+ }
37823
+ for (const verified of verifiedOps.keys()) {
37824
+ if (verified.startsWith(`${key}:`)) {
37825
+ verifiedOps.delete(verified);
37826
+ }
37827
+ }
37828
+ }
37829
+ function isSameResult(actual, expected) {
37830
+ if (actual === expected) {
37831
+ return true;
37832
+ }
37833
+ try {
37834
+ return JSON.stringify(actual) === JSON.stringify(expected);
37835
+ } catch (e) {
37836
+ return true;
37837
+ }
37838
+ }
37839
+ function getVerifySample(args) {
37840
+ const [data, ...rest] = args;
37841
+ if (!Array.isArray(data)) {
37842
+ return args;
37843
+ }
37844
+ return [
37845
+ data.slice(0, VERIFY_SAMPLE_SIZE).map(
37846
+ (entry) => (
37847
+ // +1: a column/row entry leads with its name, which the values follow
37848
+ Array.isArray(entry) ? entry.slice(0, VERIFY_SAMPLE_SIZE + 1) : entry
37849
+ )
37850
+ ),
37851
+ ...rest
37852
+ ];
37853
+ }
37854
+ function request(worker, op, args, timeout) {
37855
+ const id = ++messageId;
37856
+ let settled = false;
37857
+ let cleanup;
37858
+ const promise = new Promise((resolve, reject) => {
37859
+ const settle = (fn, value) => {
37860
+ if (!settled) {
37861
+ settled = true;
37862
+ cleanup();
37863
+ fn(value);
37864
+ }
37865
+ };
37866
+ const handler = function(e) {
37867
+ var _a;
37868
+ if (((_a = e.data) == null ? void 0 : _a.id) === id) {
37869
+ e.data.error ? settle(reject, new Error(e.data.error)) : settle(resolve, e.data.result);
37870
+ }
37871
+ };
37872
+ const errorHandler = function() {
37873
+ settle(reject, new Error("worker error"));
37874
+ };
37875
+ const timer = setTimeout(() => settle(reject, new Error("worker timeout")), timeout);
37876
+ cleanup = () => {
37877
+ clearTimeout(timer);
37878
+ worker.removeEventListener("message", handler);
37879
+ worker.removeEventListener("error", errorHandler);
37880
+ };
37881
+ worker.addEventListener("message", handler);
37882
+ worker.addEventListener("error", errorHandler);
37883
+ });
37884
+ try {
37885
+ worker.postMessage({ args, id, op });
37886
+ } catch (error) {
37887
+ settled = true;
37888
+ cleanup();
37889
+ throw error;
37890
+ }
37891
+ return promise;
37892
+ }
37893
+ function startVerify(worker, verifyKey, op, fn, args, timeout) {
37894
+ const sample = getVerifySample(args);
37895
+ const check = request(worker, op, sample, timeout).then((result) => isSameResult(result, fn(...sample)), () => false).then((matched) => {
37896
+ matched ? verifiedOps.set(verifyKey, true) : verifiedOps.delete(verifyKey);
37897
+ return matched;
37898
+ });
37899
+ verifiedOps.set(verifyKey, check);
37900
+ return check;
37901
+ }
37902
+ function getOrCreateWorkerResources(op, workerUrl = "") {
37903
+ const hasWorker = !!getWorkerConstructor();
37904
+ const api = workerUrl ? null : getWorkerAPI();
37905
+ const src = workerUrl ? "" : getWorkerSrc();
37906
+ const key = workerUrl || "blob";
37907
+ if (!hasWorker || !workerUrl && (!api || !src) || disabledKeys.has(key)) {
37908
+ return null;
37909
+ }
37299
37910
  if (!(key in cache)) {
37300
37911
  try {
37301
- const blob = new win.Blob([
37302
- `${depsString}
37303
-
37304
- self.onmessage=function({data}) {
37305
- const result = (${fnString}).apply(null, data.args);
37306
- self.postMessage({id: data.id, result});
37307
- };`
37308
- ], {
37309
- type: "text/javascript"
37310
- });
37311
- cache[key] = {
37312
- src: win.URL.createObjectURL(blob),
37313
- worker: null
37314
- };
37912
+ if (workerUrl) {
37913
+ cache[key] = {
37914
+ revoke: false,
37915
+ src: workerUrl,
37916
+ worker: null
37917
+ };
37918
+ } else if (api) {
37919
+ const blob = new api.Blob([src], {
37920
+ type: "text/javascript"
37921
+ });
37922
+ cache[key] = {
37923
+ revoke: true,
37924
+ src: api.URL.createObjectURL(blob),
37925
+ worker: null
37926
+ };
37927
+ }
37315
37928
  } catch (e) {
37316
37929
  return null;
37317
37930
  }
@@ -37320,59 +37933,71 @@ function getOrCreateWorkerResources(fn, depsFn) {
37320
37933
  }
37321
37934
  function getWorker(key, src) {
37322
37935
  const cached = cache[key];
37323
- if (!cached) {
37936
+ const Worker = getWorkerConstructor();
37937
+ if (!cached || !Worker || disabledKeys.has(key)) {
37324
37938
  return null;
37325
37939
  }
37326
37940
  if (!cached.worker) {
37327
37941
  try {
37328
- cached.worker = new win.Worker(src);
37942
+ cached.worker = new Worker(src);
37329
37943
  } catch (e) {
37944
+ releaseWorker(key, true);
37330
37945
  return null;
37331
37946
  }
37332
- if (cached.worker) {
37333
- cached.worker.onerror = function(e) {
37334
- console.error ? console.error(e) : console.log(e);
37335
- };
37336
- }
37337
37947
  }
37338
37948
  return cached.worker;
37339
37949
  }
37340
- function runWorker(useWorker = true, fn, callback, depsFn) {
37341
- let runFn = function(...args) {
37950
+ function runWorker(useWorker = true, op, fn, callback, options) {
37951
+ const { timeout, workerUrl } = normalizeWorkerOptions(options);
37952
+ const runSync = function(...args) {
37342
37953
  const res = fn(...args);
37343
37954
  callback(res);
37344
37955
  };
37345
- if (win.Worker && useWorker) {
37346
- const workerResources = getOrCreateWorkerResources(fn, depsFn);
37347
- const worker = workerResources && getWorker(workerResources.key, workerResources.src);
37348
- if (worker) {
37956
+ let runFn = runSync;
37957
+ if (useWorker) {
37958
+ const workerResources = getOrCreateWorkerResources(op, workerUrl);
37959
+ const worker = workerResources ? getWorker(workerResources.key, workerResources.src) : null;
37960
+ if (worker && workerResources) {
37961
+ const { key } = workerResources;
37349
37962
  runFn = function(...args) {
37350
- const id = ++messageId;
37351
- const handler = function(e) {
37352
- var _a;
37353
- if (((_a = e.data) == null ? void 0 : _a.id) === id) {
37354
- worker.removeEventListener("message", handler);
37355
- callback(e.data.result);
37356
- }
37963
+ var _a;
37964
+ const fallback = () => {
37965
+ releaseWorker(key, true);
37966
+ runFn = runSync;
37967
+ runSync(...args);
37357
37968
  };
37358
- worker.addEventListener("message", handler);
37359
- worker.postMessage({ id, args });
37969
+ try {
37970
+ const verifyKey = `${key}:${op}`;
37971
+ const verified = (_a = verifiedOps.get(verifyKey)) != null ? _a : startVerify(worker, verifyKey, op, fn, args, timeout);
37972
+ request(worker, op, args, timeout).then((result) => {
37973
+ if (verified === true) {
37974
+ callback(result);
37975
+ } else {
37976
+ verified.then((matched) => matched ? callback(result) : fallback());
37977
+ }
37978
+ }, fallback);
37979
+ } catch (e) {
37980
+ fallback();
37981
+ }
37360
37982
  };
37361
37983
  }
37362
37984
  }
37363
37985
  return runFn;
37364
37986
  }
37365
37987
  function cleanupWorkers() {
37988
+ const api = getWorkerAPI();
37366
37989
  for (const key in cache) {
37367
37990
  const cached = cache[key];
37368
37991
  if (cached.worker) {
37369
37992
  cached.worker.terminate();
37370
37993
  }
37371
37994
  if (cached.src) {
37372
- win.URL.revokeObjectURL(cached.src);
37995
+ cached.revoke && (api == null ? void 0 : api.URL.revokeObjectURL(cached.src));
37373
37996
  }
37374
37997
  delete cache[key];
37375
37998
  }
37999
+ disabledKeys.clear();
38000
+ verifiedOps.clear();
37376
38001
  }
37377
38002
 
37378
38003
  ;// ./src/module/dsv.ts
@@ -37611,6 +38236,19 @@ function convert_helper_tsv(tsv2) {
37611
38236
 
37612
38237
 
37613
38238
 
38239
+ const WORKER_CELL_THRESHOLD = 5e3;
38240
+ function _getCellCount(data) {
38241
+ var _a, _b;
38242
+ const first = data[0];
38243
+ if (isArray(first)) {
38244
+ let count = 0;
38245
+ for (let i = 0, len = data.length; i < len; i++) {
38246
+ count += (_b = (_a = data[i]) == null ? void 0 : _a.length) != null ? _b : 0;
38247
+ }
38248
+ return count;
38249
+ }
38250
+ return data.length * Object.keys(first != null ? first : {}).length;
38251
+ }
37614
38252
  function _getDataKeyForJson(keysParam, config) {
37615
38253
  const keys = keysParam || (config == null ? void 0 : config.data_keys);
37616
38254
  if (keys == null ? void 0 : keys.x) {
@@ -37656,7 +38294,15 @@ function _setXS(ids, data, params) {
37656
38294
  */
37657
38295
  convertData(args, callback) {
37658
38296
  const { config } = this;
37659
- const useWorker = (d) => (d == null ? void 0 : d.length) && !isEmpty(d[0]) ? config.boost_useWorker : false;
38297
+ const useWorker = (d) => {
38298
+ if (!(d == null ? void 0 : d.length) || isEmpty(d[0])) {
38299
+ return false;
38300
+ }
38301
+ return config.boost_useWorker === "auto" ? _getCellCount(d) >= WORKER_CELL_THRESHOLD : !!config.boost_useWorker;
38302
+ };
38303
+ const workerOptions = config.boost_workerUrl ? {
38304
+ workerUrl: config.boost_workerUrl
38305
+ } : void 0;
37660
38306
  let data = args;
37661
38307
  if (args.bindto) {
37662
38308
  data = {};
@@ -37676,14 +38322,16 @@ function _setXS(ids, data, params) {
37676
38322
  callback
37677
38323
  );
37678
38324
  } else if (data.json) {
37679
- runWorker(useWorker(data.json), json, callback, [columns, rows])(
38325
+ runWorker(useWorker(data.json), "json", json, callback, workerOptions)(
37680
38326
  data.json,
37681
38327
  _getDataKeyForJson(data.keys, config)
37682
38328
  );
37683
38329
  } else if (data.rows) {
37684
- runWorker(useWorker(data.rows), rows, callback)(data.rows);
38330
+ runWorker(useWorker(data.rows), "rows", rows, callback, workerOptions)(data.rows);
37685
38331
  } else if (data.columns) {
37686
- runWorker(useWorker(data.columns), columns, callback)(data.columns);
38332
+ runWorker(useWorker(data.columns), "columns", columns, callback, workerOptions)(
38333
+ data.columns
38334
+ );
37687
38335
  } else if (args.bindto) {
37688
38336
  throw Error("url or json or rows or columns is required.");
37689
38337
  }
@@ -37800,6 +38448,7 @@ function _setXS(ids, data, params) {
37800
38448
 
37801
38449
 
37802
38450
 
38451
+
37803
38452
  const rangedDataKeyIndex = {
37804
38453
  areaRange: { high: 0, mid: 1, low: 2 },
37805
38454
  candlestick: { open: 0, high: 1, low: 2, close: 3, volume: 4 }
@@ -38850,9 +39499,10 @@ function normalizeTargetIds(targetIds) {
38850
39499
  * @private
38851
39500
  */
38852
39501
  isBarRangeType(d) {
39502
+ var _a;
38853
39503
  const $$ = this;
38854
39504
  const { value } = d;
38855
- return $$.isBarType(d) && isArray(value) && value.length >= 2 && value.every(isNumber);
39505
+ return $$.isBarType(d) && !((_a = $$.isSubchartSourceTypeOf) == null ? void 0 : _a.call($$, d, TYPE.CANDLESTICK)) && isArray(value) && value.length >= 2 && value.every(isNumber);
38856
39506
  },
38857
39507
  /**
38858
39508
  * Get data object by id
@@ -39664,107 +40314,12 @@ const RE_SELECTOR_SUFFIX = /[\x00-\x20\x7F-\xA0\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`
39664
40314
  }
39665
40315
  });
39666
40316
 
39667
- ;// ./node_modules/.pnpm/internmap@2.0.3/node_modules/internmap/src/index.js
39668
- class InternMap extends Map {
39669
- constructor(entries, key = keyof) {
39670
- super();
39671
- Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
39672
- if (entries != null) for (const [key2, value] of entries) this.set(key2, value);
39673
- }
39674
- get(key) {
39675
- return super.get(intern_get(this, key));
39676
- }
39677
- has(key) {
39678
- return super.has(intern_get(this, key));
39679
- }
39680
- set(key, value) {
39681
- return super.set(intern_set(this, key), value);
39682
- }
39683
- delete(key) {
39684
- return super.delete(intern_delete(this, key));
39685
- }
39686
- }
39687
- class InternSet extends Set {
39688
- constructor(values, key = keyof) {
39689
- super();
39690
- Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } });
39691
- if (values != null) for (const value of values) this.add(value);
39692
- }
39693
- has(value) {
39694
- return super.has(intern_get(this, value));
39695
- }
39696
- add(value) {
39697
- return super.add(intern_set(this, value));
39698
- }
39699
- delete(value) {
39700
- return super.delete(intern_delete(this, value));
39701
- }
39702
- }
39703
- function intern_get({ _intern, _key }, value) {
39704
- const key = _key(value);
39705
- return _intern.has(key) ? _intern.get(key) : value;
39706
- }
39707
- function intern_set({ _intern, _key }, value) {
39708
- const key = _key(value);
39709
- if (_intern.has(key)) return _intern.get(key);
39710
- _intern.set(key, value);
39711
- return value;
39712
- }
39713
- function intern_delete({ _intern, _key }, value) {
39714
- const key = _key(value);
39715
- if (_intern.has(key)) {
39716
- value = _intern.get(key);
39717
- _intern.delete(key);
39718
- }
39719
- return value;
39720
- }
39721
- function keyof(value) {
39722
- return value !== null && typeof value === "object" ? value.valueOf() : value;
39723
- }
39724
-
39725
- ;// ./node_modules/.pnpm/d3-scale@4.0.2/node_modules/d3-scale/src/ordinal.js
39726
-
39727
-
39728
- const implicit = /* @__PURE__ */ Symbol("implicit");
39729
- function ordinal() {
39730
- var index = new InternMap(), domain = [], range = [], unknown = implicit;
39731
- function scale(d) {
39732
- let i = index.get(d);
39733
- if (i === void 0) {
39734
- if (unknown !== implicit) return unknown;
39735
- index.set(d, i = domain.push(d) - 1);
39736
- }
39737
- return range[i % range.length];
39738
- }
39739
- scale.domain = function(_) {
39740
- if (!arguments.length) return domain.slice();
39741
- domain = [], index = new InternMap();
39742
- for (const value of _) {
39743
- if (index.has(value)) continue;
39744
- index.set(value, domain.push(value) - 1);
39745
- }
39746
- return scale;
39747
- };
39748
- scale.range = function(_) {
39749
- return arguments.length ? (range = Array.from(_), scale) : range.slice();
39750
- };
39751
- scale.unknown = function(_) {
39752
- return arguments.length ? (unknown = _, scale) : unknown;
39753
- };
39754
- scale.copy = function() {
39755
- return ordinal(domain, range).unknown(unknown);
39756
- };
39757
- initRange.apply(scale, arguments);
39758
- return scale;
39759
- }
39760
-
39761
40317
  ;// ./src/ChartInternal/internals/color.ts
39762
40318
 
39763
40319
 
39764
40320
 
39765
40321
 
39766
40322
 
39767
-
39768
40323
  const _colorizePattern = (pattern, color, id) => {
39769
40324
  const node = src_select(pattern.cloneNode(true));
39770
40325
  node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color);
@@ -39806,7 +40361,7 @@ const schemeCategory10 = [
39806
40361
  const { $el, config } = $$;
39807
40362
  const ids = [];
39808
40363
  const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
39809
- let pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal(_getColorFromCss($el.chart) || schemeCategory10).range();
40364
+ let pattern = notEmpty(config.color_pattern) ? config.color_pattern : [..._getColorFromCss($el.chart) || schemeCategory10];
39810
40365
  const originalColorPattern = pattern;
39811
40366
  if (isFunction(config.color_tiles)) {
39812
40367
  const tiles = config.color_tiles.bind($$.api)();
@@ -41508,13 +42063,15 @@ function brushEmpty(ctx) {
41508
42063
 
41509
42064
  function getTargetDomainCacheKey($$, targets) {
41510
42065
  return targets.map((target) => {
41511
- var _a, _b, _c, _d;
42066
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
41512
42067
  const { values } = target;
41513
42068
  const first = values[0];
41514
42069
  const last = values[values.length - 1];
41515
42070
  const firstX = first ? (_b = (_a = $$.getXCacheKey) == null ? void 0 : _a.call($$, first.x)) != null ? _b : first.x : "";
41516
42071
  const lastX = last ? (_d = (_c = $$.getXCacheKey) == null ? void 0 : _c.call($$, last.x)) != null ? _d : last.x : "";
41517
- return `${target.id}:${values.length}:${firstX}:${lastX}`;
42072
+ const targetType = (_f = (_e = $$.getTargetType) == null ? void 0 : _e.call($$, target)) != null ? _f : "";
42073
+ const sourceType = (_i = (_h = (_g = $$.state) == null ? void 0 : _g.subchartSourceTypes) == null ? void 0 : _h[target.id]) != null ? _i : "";
42074
+ return `${target.id}:${targetType}:${sourceType}:${values.length}:${firstX}:${lastX}`;
41518
42075
  }).join("|");
41519
42076
  }
41520
42077
  function canCacheTargetDomain($$, targets) {
@@ -41549,12 +42106,13 @@ function updateMinMaxFromValues(minMax, values) {
41549
42106
  }
41550
42107
  }
41551
42108
  function getTargetValueMinMax($$, targets) {
41552
- var _a, _b;
42109
+ var _a, _b, _c, _d;
41553
42110
  const minMax = { min: void 0, max: void 0 };
41554
42111
  const hasAxis = $$.state.hasAxis;
41555
42112
  for (let i = 0; i < targets.length; i++) {
41556
42113
  const target = targets[i];
41557
42114
  const isCandlestick = (_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, target);
42115
+ const isSubchartCandlestick = !isCandlestick && !!((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, target, TYPE.CANDLESTICK));
41558
42116
  const { values } = target;
41559
42117
  for (let j = 0; j < values.length; j++) {
41560
42118
  const row = values[j];
@@ -41562,14 +42120,17 @@ function getTargetValueMinMax($$, targets) {
41562
42120
  if (!(isValue(value) || value === null)) {
41563
42121
  continue;
41564
42122
  }
41565
- if (value !== null && isCandlestick) {
42123
+ const subchartCandlestickValue = isSubchartCandlestick ? (_c = $$.getSubchartCandlestickShapeValue) == null ? void 0 : _c.call($$, row, true) : void 0;
42124
+ if (isNumber(subchartCandlestickValue)) {
42125
+ value = subchartCandlestickValue;
42126
+ } else if (value !== null && (isCandlestick || isSubchartCandlestick)) {
41566
42127
  value = Array.isArray(value) ? value.slice(0, 4) : [value.open, value.high, value.low, value.close];
41567
42128
  }
41568
42129
  if (Array.isArray(value)) {
41569
42130
  updateMinMaxFromValues(minMax, value);
41570
42131
  } else if (isObject(value) && "high" in value) {
41571
42132
  updateMinMaxFromValues(minMax, Object.values(value));
41572
- } else if ((_b = $$.isBubbleZType) == null ? void 0 : _b.call($$, row)) {
42133
+ } else if ((_d = $$.isBubbleZType) == null ? void 0 : _d.call($$, row)) {
41573
42134
  updateMinMax(minMax, hasAxis && $$.getBubbleZData(value, "y"));
41574
42135
  } else {
41575
42136
  updateMinMax(minMax, value);
@@ -41596,7 +42157,7 @@ function getTargetXMinMax(targets, type) {
41596
42157
  * Get both min and max Y domain values in a single pass.
41597
42158
  * Avoids calling getValuesAsIdKeyed twice.
41598
42159
  * @param {Array} targets Target data
41599
- * @returns {[number|Date|undefined, number|Date|undefined]} [min, max]
42160
+ * @returns {Array.<number|Date|undefined>} [min, max]
41600
42161
  * @private
41601
42162
  */
41602
42163
  getYDomainMinMaxBoth(targets) {
@@ -44047,13 +44608,23 @@ function batchGetBBox(elements) {
44047
44608
  const textNode = textNodes.filter((node) => node.data.id === id);
44048
44609
  const translate = getTranslation(textNode.node());
44049
44610
  const calcHypo = (x, y) => Math.sqrt(x * x + y * y);
44050
- textNode.node() && filteredTextNodes.each(function() {
44611
+ if (!textNode.node()) {
44612
+ return;
44613
+ }
44614
+ const fontSize = parseInt(textNode.style("font-size"), 10);
44615
+ const overlapStates = [];
44616
+ filteredTextNodes.each(function() {
44051
44617
  const coordinate = getTranslation(this);
44052
- const filteredTextNode = src_select(this);
44053
- const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : filteredTextNode;
44618
+ const nodeForWidth = calcHypo(translate.e, translate.f) > calcHypo(coordinate.e, coordinate.f) ? textNode : src_select(this);
44054
44619
  const overlapsX = Math.ceil(Math.abs(translate.e - coordinate.e)) < Math.ceil(nodeForWidth.node().getComputedTextLength());
44055
- const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < parseInt(textNode.style("font-size"), 10);
44056
- filteredTextNode.classed($TEXT.TextOverlapping, overlapsX && overlapsY);
44620
+ const overlapsY = Math.ceil(Math.abs(translate.f - coordinate.f)) < fontSize;
44621
+ overlapStates.push({
44622
+ node: this,
44623
+ overlaps: overlapsX && overlapsY
44624
+ });
44625
+ });
44626
+ overlapStates.forEach(({ node, overlaps }) => {
44627
+ src_select(node).classed($TEXT.TextOverlapping, overlaps);
44057
44628
  });
44058
44629
  },
44059
44630
  /**
@@ -44737,6 +45308,12 @@ const RE_TOOLTIP_TPL = /{{(.*)}}/;
44737
45308
  } else if (target === "subX") {
44738
45309
  x = 0;
44739
45310
  y = isRotated ? 0 : state.height2;
45311
+ } else if (target === "subY") {
45312
+ x = 0;
45313
+ y = isRotated ? state.height2 : 0;
45314
+ } else if (target === "subY2") {
45315
+ x = isRotated ? 0 : state.width2;
45316
+ y = isRotated ? -1 : 0;
44740
45317
  } else if (target === "arc") {
44741
45318
  x = state.arcWidth / 2;
44742
45319
  y = state.arcHeight / 2;
@@ -44807,6 +45384,96 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
44807
45384
  isValidChartType(type) {
44808
45385
  return !!(type && Object.values(TYPE).indexOf(type) > -1);
44809
45386
  },
45387
+ /**
45388
+ * Get the chart type to use for the subchart target.
45389
+ * subchart.types > subchart.type > data.types > data.type > line
45390
+ * @param {object|string} d Target data or id
45391
+ * @returns {string}
45392
+ * @private
45393
+ */
45394
+ getSubchartTargetType(d) {
45395
+ const $$ = this;
45396
+ const { config } = $$;
45397
+ const id = isString(d) ? d : d == null ? void 0 : d.id;
45398
+ const subchartTypes = config.subchart_types || {};
45399
+ const subchartType = config.subchart_type;
45400
+ const dataTypes = config.data_types || {};
45401
+ const targetSubchartType = id && subchartTypes[id];
45402
+ if (targetSubchartType && $$.isValidChartType(targetSubchartType)) {
45403
+ return targetSubchartType;
45404
+ } else if (subchartType && $$.isValidChartType(subchartType)) {
45405
+ return subchartType;
45406
+ }
45407
+ return id && dataTypes[id] || config.data_type || TYPE.LINE;
45408
+ },
45409
+ /**
45410
+ * Get the regular chart type configured for the target.
45411
+ * @param {object|string} d Target data or id
45412
+ * @returns {string}
45413
+ * @private
45414
+ */
45415
+ getTargetType(d) {
45416
+ var _a;
45417
+ const { config } = this;
45418
+ const id = isString(d) ? d : d == null ? void 0 : d.id;
45419
+ return id && ((_a = config.data_types) == null ? void 0 : _a[id]) || config.data_type || TYPE.LINE;
45420
+ },
45421
+ /**
45422
+ * Get the target's original chart type while subchart.type context is active.
45423
+ * @param {object|string} d Target data or id
45424
+ * @returns {string}
45425
+ * @private
45426
+ */
45427
+ getSubchartSourceTargetType(d) {
45428
+ const { state } = this;
45429
+ const id = isString(d) ? d : d == null ? void 0 : d.id;
45430
+ const sourceTypes = state.subchartSourceTypes;
45431
+ return id && (sourceTypes == null ? void 0 : sourceTypes[id]) || this.getTargetType(d);
45432
+ },
45433
+ /**
45434
+ * Check whether a target had the given source type before subchart.type remapping.
45435
+ * @param {object|string} d Target data or id
45436
+ * @param {string|Array} type chart type
45437
+ * @returns {boolean}
45438
+ * @private
45439
+ */
45440
+ isSubchartSourceTypeOf(d, type) {
45441
+ const sourceType = this.getSubchartSourceTargetType(d);
45442
+ return isArray(type) ? type.indexOf(sourceType) >= 0 : sourceType === type;
45443
+ },
45444
+ /**
45445
+ * Run a callback while regular type helpers resolve using subchart.type/types.
45446
+ * @param {function(): unknown} callback Callback to run
45447
+ * @returns {unknown} Callback return value
45448
+ * @private
45449
+ */
45450
+ withSubchartTypeContext(callback) {
45451
+ const $$ = this;
45452
+ const { config, data, state } = $$;
45453
+ const dataType = config.data_type;
45454
+ const dataTypes = config.data_types;
45455
+ const currentTypes = state.current.types;
45456
+ const sourceTypes = state.subchartSourceTypes;
45457
+ const subchartTypes = {};
45458
+ const subchartSourceTypes = {};
45459
+ const subchartType = config.subchart_type;
45460
+ $$.mapToIds(data.targets).forEach((id) => {
45461
+ subchartSourceTypes[id] = $$.getTargetType(id);
45462
+ subchartTypes[id] = $$.getSubchartTargetType(id);
45463
+ });
45464
+ config.data_type = subchartType && $$.isValidChartType(subchartType) ? subchartType : dataType;
45465
+ config.data_types = subchartTypes;
45466
+ state.current.types = [];
45467
+ state.subchartSourceTypes = subchartSourceTypes;
45468
+ try {
45469
+ return callback();
45470
+ } finally {
45471
+ config.data_type = dataType;
45472
+ config.data_types = dataTypes;
45473
+ state.current.types = currentTypes;
45474
+ state.subchartSourceTypes = sourceTypes;
45475
+ }
45476
+ },
44810
45477
  setTargetType(targetIds, type) {
44811
45478
  const $$ = this;
44812
45479
  const { config, state: { withoutFadeIn } } = $$;
@@ -44885,9 +45552,8 @@ const INTERPOLATION_TYPES = /* @__PURE__ */ new Set([
44885
45552
  * @private
44886
45553
  */
44887
45554
  isTypeOf(d, type) {
44888
- var _a;
44889
45555
  const id = isString(d) ? d : d.id;
44890
- const dataType = this.config && (((_a = this.config.data_types) == null ? void 0 : _a[id]) || this.config.data_type);
45556
+ const dataType = this.config && this.getTargetType(id);
44891
45557
  return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
44892
45558
  },
44893
45559
  hasPointType() {
@@ -45873,6 +46539,7 @@ function stepAfter(context) {
45873
46539
 
45874
46540
 
45875
46541
 
46542
+
45876
46543
  const CURVE_MAP = {
45877
46544
  basis: curve_basis,
45878
46545
  "basis-closed": curve_basisClosed,
@@ -45900,13 +46567,48 @@ function isLinePointGroupType($$, d) {
45900
46567
  function getLinePointGroupTypeFilter($$) {
45901
46568
  return (d) => isLinePointGroupType($$, d);
45902
46569
  }
45903
- function getShapeOffsetValue($$, d) {
46570
+ function getShapeOffsetValue($$, d, isSub) {
45904
46571
  var _a, _b, _c;
46572
+ const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
46573
+ if (isNumber(subchartCandlestickValue)) {
46574
+ return subchartCandlestickValue;
46575
+ }
45905
46576
  if ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) {
45906
46577
  return (_c = (_b = $$.getCandlestickData) == null ? void 0 : _b.call($$, d)) == null ? void 0 : _c.close;
45907
46578
  }
45908
46579
  return $$.getBaseValue(d);
45909
46580
  }
46581
+ function getSubchartCandlestickShapeValue($$, d, isSub) {
46582
+ var _a, _b, _c;
46583
+ if (!isSub || ((_a = $$.isCandlestickType) == null ? void 0 : _a.call($$, d)) || !((_b = $$.isSubchartSourceTypeOf) == null ? void 0 : _b.call($$, d, TYPE.CANDLESTICK))) {
46584
+ return void 0;
46585
+ }
46586
+ const value = (_c = $$.getCandlestickData) == null ? void 0 : _c.call($$, d);
46587
+ if (!value) {
46588
+ return void 0;
46589
+ }
46590
+ if ($$.isBarType(d)) {
46591
+ return isNumber(value.open) && isNumber(value.close) ? value._isUp ? value.close : value.open : void 0;
46592
+ }
46593
+ return isNumber(value.close) ? value.close : void 0;
46594
+ }
46595
+ function isSubchartCandlestickBarValue($$, d, isSub) {
46596
+ const value = getSubchartCandlestickShapeValue($$, d, isSub);
46597
+ return isNumber(value) && $$.isBarType(d);
46598
+ }
46599
+ function getSubchartCandlestickBarColor($$, d, isSub) {
46600
+ var _a;
46601
+ if (!isSubchartCandlestickBarValue($$, d, isSub)) {
46602
+ return null;
46603
+ }
46604
+ const value = (_a = $$.getCandlestickData) == null ? void 0 : _a.call($$, d);
46605
+ if (value == null ? void 0 : value._isUp) {
46606
+ return $$.color(d);
46607
+ }
46608
+ const downColor = $$.config.candlestick_color_down;
46609
+ const color = downColor && typeof downColor === "object" ? downColor[d.id] : downColor;
46610
+ return color || $$.color(d);
46611
+ }
45910
46612
  function _getGroupedDataPointsFn(d) {
45911
46613
  var _a, _b;
45912
46614
  const $$ = this;
@@ -46135,8 +46837,11 @@ function updateTargetsForShape(targets, config) {
46135
46837
  const isStackNormalized = $$.isStackNormalized();
46136
46838
  return (d) => {
46137
46839
  let { value } = d;
46840
+ const subchartCandlestickValue = isSub ? getSubchartCandlestickShapeValue($$, d, isSub) : void 0;
46138
46841
  if (isNumber(d)) {
46139
46842
  value = d;
46843
+ } else if (isNumber(subchartCandlestickValue)) {
46844
+ value = subchartCandlestickValue;
46140
46845
  } else if ($$.isAreaRangeType(d)) {
46141
46846
  value = $$.getBaseValue(d, "mid");
46142
46847
  } else if (isStackNormalized) {
@@ -46152,13 +46857,14 @@ function updateTargetsForShape(targets, config) {
46152
46857
  /**
46153
46858
  * Get shape based y Axis min value
46154
46859
  * @param {string} id Data id
46860
+ * @param {boolean} isSub Whether to use subchart scale
46155
46861
  * @returns {number}
46156
46862
  * @private
46157
46863
  */
46158
- getShapeYMin(id) {
46864
+ getShapeYMin(id, isSub = false) {
46159
46865
  const $$ = this;
46160
46866
  const axisId = $$.axis.getId(id);
46161
- const scale = $$.scale[axisId];
46867
+ const scale = $$.getYScaleById(id, isSub);
46162
46868
  const [yMin] = scale.domain();
46163
46869
  const inverted = $$.config[`axis_${axisId}_inverted`];
46164
46870
  return !$$.isGrouped(id) && !inverted && yMin > 0 ? yMin : 0;
@@ -46166,17 +46872,18 @@ function updateTargetsForShape(targets, config) {
46166
46872
  /**
46167
46873
  * Get Shape's offset data
46168
46874
  * @param {function} typeFilter Type filter function
46875
+ * @param {boolean} isSub Whether coordinates are for the subchart
46169
46876
  * @returns {object}
46170
46877
  * @private
46171
46878
  */
46172
- getShapeOffsetData(typeFilter) {
46879
+ getShapeOffsetData(typeFilter, isSub) {
46173
46880
  const $$ = this;
46174
46881
  const targets = $$.orderTargets(
46175
46882
  $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
46176
46883
  );
46177
46884
  const dataGeneration = $$.state.dataGeneration;
46178
46885
  const targetIds = targets.map((t) => t.id).join("_");
46179
- const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
46886
+ const cacheKey = `${KEY.shapeOffset}_${isSub ? "sub" : "main"}_${targetIds}`;
46180
46887
  const cachedData = $$.cache.get(cacheKey);
46181
46888
  if ((cachedData == null ? void 0 : cachedData.generation) === dataGeneration) {
46182
46889
  return cachedData;
@@ -46190,7 +46897,7 @@ function updateTargetsForShape(targets, config) {
46190
46897
  }
46191
46898
  const rowValueMapByXValue = rowValues.reduce((out, d) => {
46192
46899
  const key = Number(d.x);
46193
- const value = getShapeOffsetValue($$, d);
46900
+ const value = getShapeOffsetValue($$, d, isSub);
46194
46901
  out[key] = d;
46195
46902
  values[key] = isStackNormalized ? $$.getRatio("index", d, true) : value;
46196
46903
  return out;
@@ -46213,7 +46920,8 @@ function updateTargetsForShape(targets, config) {
46213
46920
  getShapeOffset(typeFilter, indices, isSub) {
46214
46921
  const $$ = this;
46215
46922
  const { shapeOffsetTargets, indexMapByTargetId } = $$.getShapeOffsetData(
46216
- typeFilter
46923
+ typeFilter,
46924
+ isSub
46217
46925
  );
46218
46926
  const groupsZeroAs = $$.config.data_groupsZeroAs;
46219
46927
  let sameGroupByTargetId = null;
@@ -46232,14 +46940,14 @@ function updateTargetsForShape(targets, config) {
46232
46940
  return (d, idx) => {
46233
46941
  var _a;
46234
46942
  const { id, value, x } = d;
46235
- const baseValue = getShapeOffsetValue($$, d);
46943
+ const baseValue = getShapeOffsetValue($$, d, isSub);
46236
46944
  const ind = $$.getIndices(indices, d);
46237
46945
  const scale = $$.getYScaleById(id, isSub);
46238
46946
  if ($$.isBarRangeType(d)) {
46239
46947
  return scale(value[0]);
46240
46948
  }
46241
46949
  const dataXAsNumber = Number(x);
46242
- const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
46950
+ const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id, isSub));
46243
46951
  let offset = y0;
46244
46952
  const sameGroupTargets = (_a = sameGroupByTargetId == null ? void 0 : sameGroupByTargetId.get(id)) != null ? _a : shapeOffsetTargets.filter((t) => t.id !== id && ind[t.id] === ind[id]);
46245
46953
  for (const t of sameGroupTargets) {
@@ -46255,7 +46963,7 @@ function updateTargetsForShape(targets, config) {
46255
46963
  if (!row || Number(row.x) !== dataXAsNumber) {
46256
46964
  row = rowValueMapByXValue[dataXAsNumber];
46257
46965
  }
46258
- const rowValue = row && getShapeOffsetValue($$, row);
46966
+ const rowValue = row && getShapeOffsetValue($$, row, isSub);
46259
46967
  if (isNumber(rowValue) && isNumber(baseValue) && rowValue * baseValue >= 0 && isNumber(rValue)) {
46260
46968
  const addOffset = baseValue === 0 ? groupsZeroAs === "positive" && rValue > 0 || groupsZeroAs === "negative" && rValue < 0 : true;
46261
46969
  if (addOffset) {
@@ -46282,8 +46990,13 @@ function updateTargetsForShape(targets, config) {
46282
46990
  const y = $$.getShapeY(isSub);
46283
46991
  const lineOffset = $$.getShapeOffset(typeFilter || $$.isLineType, lineIndices, isSub);
46284
46992
  const yScale = $$.getYScaleById.bind($$);
46993
+ const y0Cache = /* @__PURE__ */ new Map();
46285
46994
  return (d, i) => {
46286
- const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
46995
+ let y0 = y0Cache.get(d.id);
46996
+ if (y0 === void 0) {
46997
+ y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
46998
+ y0Cache.set(d.id, y0);
46999
+ }
46287
47000
  const offset = lineOffset(d, i) || y0;
46288
47001
  const posX = x(d);
46289
47002
  let posY = y(d);
@@ -46317,7 +47030,7 @@ function updateTargetsForShape(targets, config) {
46317
47030
  return function(d, i) {
46318
47031
  let y0 = y0Cache.get(d.id);
46319
47032
  if (y0 === void 0) {
46320
- y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
47033
+ y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
46321
47034
  y0Cache.set(d.id, y0);
46322
47035
  }
46323
47036
  const offset = areaOffset(d, i) || y0;
@@ -46358,7 +47071,7 @@ function updateTargetsForShape(targets, config) {
46358
47071
  let idInfo = idCache.get(id);
46359
47072
  if (!idInfo) {
46360
47073
  idInfo = {
46361
- y0: yScale.call($$, id, isSub)($$.getShapeYMin(id)),
47074
+ y0: yScale.call($$, id, isSub)($$.getShapeYMin(id, isSub)),
46362
47075
  isInverted: config[`axis_${$$.axis.getId(id)}_inverted`]
46363
47076
  };
46364
47077
  idCache.set(id, idInfo);
@@ -46423,11 +47136,42 @@ function updateTargetsForShape(targets, config) {
46423
47136
  isSub,
46424
47137
  typeFilter
46425
47138
  );
47139
+ const y = $$.getShapeY(isSub);
46426
47140
  return (d, i) => {
46427
47141
  const id = d.id;
46428
- return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] : $$.getYScaleById(id, isSub)($$.getBaseValue(d));
47142
+ return $$.isGrouped(id) && isLinePointGroupType($$, d) ? getPoints(d, i)[0][1] : y(d);
46429
47143
  };
46430
47144
  },
47145
+ /**
47146
+ * Get candlestick data projected for alternate subchart shapes.
47147
+ * @param {object} d Data row
47148
+ * @param {boolean} isSub Whether coordinates are for the subchart
47149
+ * @returns {number|undefined} Projected value
47150
+ * @private
47151
+ */
47152
+ getSubchartCandlestickShapeValue(d, isSub) {
47153
+ return getSubchartCandlestickShapeValue(this, d, isSub);
47154
+ },
47155
+ /**
47156
+ * Check whether the row should be drawn as a candlestick-derived subchart bar.
47157
+ * @param {object} d Data row
47158
+ * @param {boolean} isSub Whether coordinates are for the subchart
47159
+ * @returns {boolean}
47160
+ * @private
47161
+ */
47162
+ isSubchartCandlestickBarValue(d, isSub) {
47163
+ return isSubchartCandlestickBarValue(this, d, isSub);
47164
+ },
47165
+ /**
47166
+ * Get subchart bar color projected from candlestick up/down state.
47167
+ * @param {object} d Data row
47168
+ * @param {boolean} isSub Whether coordinates are for the subchart
47169
+ * @returns {string|null} Bar color
47170
+ * @private
47171
+ */
47172
+ getSubchartCandlestickBarColor(d, isSub) {
47173
+ return getSubchartCandlestickBarColor(this, d, isSub);
47174
+ },
46431
47175
  /**
46432
47176
  * Get point radius.
46433
47177
  * @param {object} d Data row
@@ -46985,7 +47729,7 @@ class ChartInternal {
46985
47729
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
46986
47730
  $el.defs = $el.svg.append("defs");
46987
47731
  if (hasAxis) {
46988
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
47732
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
46989
47733
  $$.appendClip($el.defs, state.clip[v]);
46990
47734
  });
46991
47735
  }
@@ -47328,6 +48072,7 @@ object_extend(ChartInternal.prototype, [
47328
48072
 
47329
48073
 
47330
48074
 
48075
+
47331
48076
  const CANVAS_SELECTABLE_TYPE_FILTERS = [
47332
48077
  isCanvasPointType,
47333
48078
  isCanvasBarType,
@@ -47636,6 +48381,21 @@ function isCanvasSubchartPoint($$, point) {
47636
48381
  const rect = getCanvasSubchartRect($$);
47637
48382
  return !!rect && point[0] >= rect.x && point[0] <= rect.x + rect.w && point[1] >= rect.y && point[1] <= rect.y + rect.h;
47638
48383
  }
48384
+ function getCanvasMainPointFromSubchart($$, point) {
48385
+ const { config, state } = $$;
48386
+ const rect = getCanvasSubchartRect($$);
48387
+ if (config.subchart_brush_enabled !== false || !rect || !isCanvasSubchartPoint($$, point)) {
48388
+ return null;
48389
+ }
48390
+ const mainCoord = getMainCoordFromSubchartCoord(
48391
+ $$,
48392
+ config.axis_rotated ? point[1] - rect.y : point[0] - rect.x
48393
+ );
48394
+ if (mainCoord === null) {
48395
+ return null;
48396
+ }
48397
+ return config.axis_rotated ? [state.margin.left + state.width / 2, state.margin.top + mainCoord] : [state.margin.left + mainCoord, state.margin.top + state.height / 2];
48398
+ }
47639
48399
  function getCanvasSubchartBrushExtent($$) {
47640
48400
  var _a, _b;
47641
48401
  const rect = getCanvasSubchartRect($$);
@@ -47827,15 +48587,17 @@ function getCanvasFlowValueCount($$) {
47827
48587
  return $$.data.targets.reduce((sum, target) => sum + target.values.length, 0);
47828
48588
  }
47829
48589
  function syncCanvasFlowYDomains($$) {
47830
- var _a, _b;
47831
48590
  const { scale } = $$;
47832
48591
  const targetsToShow = $$.filterTargetsToShow($$.data.targets);
47833
48592
  ["y", "y2"].forEach((key) => {
47834
- var _a2;
47835
- (_a2 = scale[key]) == null ? void 0 : _a2.domain($$.getYDomain(targetsToShow, key));
48593
+ var _a;
48594
+ (_a = scale[key]) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, key));
48595
+ });
48596
+ $$.withSubchartTypeContext(() => {
48597
+ var _a, _b;
48598
+ (_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
48599
+ (_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
47836
48600
  });
47837
- (_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
47838
- (_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
47839
48601
  }
47840
48602
  const canvasInternal = {
47841
48603
  /**
@@ -48512,22 +49274,42 @@ const canvasInternal = {
48512
49274
  const { config, state } = $$;
48513
49275
  const selected = state.canvasSelection;
48514
49276
  const selectionGrouped = config.data_selection_grouped;
48515
- const targetIds = getCanvasSelectionIds(ids);
49277
+ let targetIds = getCanvasSelectionIds(ids);
48516
49278
  let changed = false;
49279
+ const singleSelection = isSelection && !config.data_selection_multiple;
49280
+ let resetDone = !singleSelection;
48517
49281
  if (!config.data_selection_enabled) {
48518
49282
  return;
48519
49283
  }
49284
+ if (singleSelection) {
49285
+ indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
49286
+ if (!selectionGrouped) {
49287
+ if (targetIds) {
49288
+ targetIds = targetIds.slice(0, 1);
49289
+ } else {
49290
+ const [firstTarget] = $$.filterTargetsToShow($$.data.targets);
49291
+ targetIds = firstTarget ? [firstTarget.id] : [];
49292
+ }
49293
+ }
49294
+ }
48520
49295
  eachCanvasSelectableData($$, (d) => {
48521
49296
  const key = getCanvasDataKey(d);
48522
49297
  const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(d.id) >= 0;
48523
49298
  const isTargetIndex = !indices || indices.indexOf(d.index) >= 0;
48524
49299
  const isSelected = selected.has(key);
48525
49300
  if (isSelection) {
48526
- if (isTargetId && isTargetIndex && !isSelected) {
49301
+ if (isTargetId && isTargetIndex && (!isSelected || singleSelection)) {
49302
+ if (!resetDone) {
49303
+ $$.setCanvasSelection(false);
49304
+ resetDone = true;
49305
+ }
49306
+ if (selected.has(key)) {
49307
+ return;
49308
+ }
48527
49309
  selected.add(key);
48528
49310
  callFn(config.data_onselected, $$.api, d, $$.canvasEngine.canvas);
48529
49311
  changed = true;
48530
- } else if (resetOther && isSelected) {
49312
+ } else if ((!singleSelection || resetDone) && resetOther && isSelected) {
48531
49313
  selected.delete(key);
48532
49314
  callFn(config.data_onunselected, $$.api, d, $$.canvasEngine.canvas);
48533
49315
  changed = true;
@@ -48774,12 +49556,12 @@ const canvasInternal = {
48774
49556
  updateCanvasSubchartBrush(event) {
48775
49557
  var _a, _b;
48776
49558
  const $$ = this;
48777
- const { state } = $$;
49559
+ const { config, state } = $$;
48778
49560
  const start = state.canvasSubchartBrushStart;
48779
49561
  const origin = state.canvasSubchartBrushOrigin;
48780
49562
  const mode = state.canvasSubchartBrushMode;
48781
49563
  const coord = getCanvasSubchartBrushCoord($$, event, true);
48782
- if (!state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
49564
+ if (config.subchart_brush_enabled === false || !state.canvasSubchartBrushDragging || start === null || coord === null || !mode) {
48783
49565
  return false;
48784
49566
  }
48785
49567
  const delta = coord - start;
@@ -48830,6 +49612,10 @@ const canvasInternal = {
48830
49612
  updateCanvasSubchartCursor(event) {
48831
49613
  const $$ = this;
48832
49614
  const canvas2 = $$.$el.canvas.node();
49615
+ if ($$.config.subchart_brush_enabled === false) {
49616
+ canvas2.style.cursor = "";
49617
+ return false;
49618
+ }
48833
49619
  const coord = getCanvasSubchartBrushCoord($$, event);
48834
49620
  if (coord === null) {
48835
49621
  canvas2.style.cursor = "";
@@ -48849,6 +49635,9 @@ const canvasInternal = {
48849
49635
  var _a;
48850
49636
  const $$ = this;
48851
49637
  const { state } = $$;
49638
+ if ($$.config.subchart_brush_enabled === false) {
49639
+ return false;
49640
+ }
48852
49641
  const coord = getCanvasSubchartBrushCoord($$, event);
48853
49642
  if (coord === null) {
48854
49643
  return false;
@@ -49208,7 +49997,8 @@ const canvasInternal = {
49208
49997
  (_b = $$.hideTooltip) == null ? void 0 : _b.call($$);
49209
49998
  return;
49210
49999
  }
49211
- const point = getCanvasEventPoint($$, event);
50000
+ const rawPoint = getCanvasEventPoint($$, event);
50001
+ const point = rawPoint && (getCanvasMainPointFromSubchart($$, rawPoint) || rawPoint);
49212
50002
  const d = point ? getCanvasHoverDatumFromPoint($$, point) : null;
49213
50003
  if (!d) {
49214
50004
  $$.dispatchCanvasDataOut(canvas2);
@@ -49216,8 +50006,8 @@ const canvasInternal = {
49216
50006
  state.canvasFocusKey = null;
49217
50007
  $$.clearCanvasFocus();
49218
50008
  }
49219
- if (point && config.axis_tooltip && isCanvasAxisTooltipArea($$, point)) {
49220
- $$.renderCanvasAxisTooltip(point);
50009
+ if (rawPoint && config.axis_tooltip && isCanvasAxisTooltipArea($$, rawPoint)) {
50010
+ $$.renderCanvasAxisTooltip(rawPoint);
49221
50011
  (_c = $$.hideTooltip) == null ? void 0 : _c.call($$);
49222
50012
  return;
49223
50013
  }
@@ -49348,6 +50138,7 @@ const canvasInternal = {
49348
50138
  state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
49349
50139
  $$.canvasRenderer.drawSubchart($$, drawShape);
49350
50140
  state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
50141
+ state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
49351
50142
  $$.canvasRenderer.drawEmptyLabel($$);
49352
50143
  rebuildHit && $$.hitDetector.rebuild($$, drawShape);
49353
50144
  } finally {
@@ -49379,6 +50170,7 @@ const canvasInternal = {
49379
50170
  state.hasAxis && $$.config.grid_lines_front && $$.canvasAxisRenderer.drawGridLines($$);
49380
50171
  $$.canvasRenderer.drawSubchart($$, drawShape);
49381
50172
  state.hasAxis && $$.canvasAxisRenderer.drawSubXAxis($$);
50173
+ state.hasAxis && $$.canvasAxisRenderer.drawSubYAxes($$);
49382
50174
  $$.canvasRenderer.drawEmptyLabel($$);
49383
50175
  } finally {
49384
50176
  $$.canvasEngine.endFrame();
@@ -51465,7 +52257,7 @@ object_extend(ygrids, {
51465
52257
 
51466
52258
 
51467
52259
 
51468
- const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}, line.${$FOCUS.ygridFocus}`;
52260
+ const GRID_FOCUS_SELECTOR = `line.${$FOCUS.xgridFocus}:not(.${$FOCUS.xgridFocusContinuous}), line.${$FOCUS.ygridFocus}`;
51469
52261
  const _getGridTextAnchor = (d) => isValue(d.position) || "end";
51470
52262
  const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
51471
52263
  function _getGridFocusEl($$) {
@@ -51476,6 +52268,9 @@ function _getGridFocusEl($$) {
51476
52268
  const cachedNodes = ((_a = cached == null ? void 0 : cached.nodes) == null ? void 0 : _a.call(cached)) || [];
51477
52269
  return cachedNodes.length && cachedNodes.every((node) => mainNode == null ? void 0 : mainNode.contains(node)) ? cached : state._gridFocusEl = main.selectAll(GRID_FOCUS_SELECTOR);
51478
52270
  }
52271
+ function _hideContinuousGridFocus($$) {
52272
+ $$.$el.main.select(`line.${$FOCUS.xgridFocusContinuous}`).style("visibility", "hidden");
52273
+ }
51479
52274
  function _getGridTextX(isX, width, height) {
51480
52275
  return (d) => {
51481
52276
  let x = isX ? 0 : width;
@@ -51646,6 +52441,7 @@ function _smoothLines(el, type) {
51646
52441
  if (config.grid_focus_y && !config.tooltip_grouped) {
51647
52442
  grid.append("g").attr("class", $FOCUS.ygridFocus).append("line").attr("class", $FOCUS.ygridFocus);
51648
52443
  }
52444
+ config.subchart_grid_focus_continuous && config.subchart_grid_focus !== false && $el.main.insert("g", className).attr("class", $FOCUS.xgridFocusContinuous).append("line").attr("class", `${$FOCUS.xgridFocus} ${$FOCUS.xgridFocusContinuous}`).style("visibility", "hidden");
51649
52445
  }
51650
52446
  },
51651
52447
  showAxisGridFocus() {
@@ -51754,6 +52550,7 @@ function _smoothLines(el, type) {
51754
52550
  if (force || inputType === "mouse" || !resizing) {
51755
52551
  const focusEl = _getGridFocusEl($$);
51756
52552
  focusEl.style("visibility", "hidden");
52553
+ _hideContinuousGridFocus($$);
51757
52554
  (_a = $$.hideCircleFocus) == null ? void 0 : _a.call($$);
51758
52555
  }
51759
52556
  },
@@ -51771,6 +52568,7 @@ function _smoothLines(el, type) {
51771
52568
  } else {
51772
52569
  const isRotated = $$.config.axis_rotated;
51773
52570
  xgridFocus.attr("x1", isRotated ? 0 : -10).attr("x2", isRotated ? width : -10).attr("y1", isRotated ? -10 : 0).attr("y2", isRotated ? -10 : height);
52571
+ _hideContinuousGridFocus($$);
51774
52572
  }
51775
52573
  return true;
51776
52574
  },
@@ -51909,28 +52707,85 @@ let grid_grid = () => {
51909
52707
 
51910
52708
 
51911
52709
 
52710
+ function setSelectionForFocusOnly(isSelection, ids, indices, resetOther) {
52711
+ const $$ = this;
52712
+ const { config, $el: { main } } = $$;
52713
+ const selectionGrouped = config.data_selection_grouped;
52714
+ const isSelectable = config.data_selection_isselectable.bind($$.api);
52715
+ const targetIds = isDefined(ids) ? [].concat(ids) : null;
52716
+ const singleSelection = isSelection && !config.data_selection_multiple;
52717
+ let resetDone = !singleSelection;
52718
+ const unselect = (circle, d, index) => {
52719
+ $$.unselectPoint(circle, d, index);
52720
+ circle.interrupt().remove();
52721
+ };
52722
+ $$.getTargetsToShow().forEach((target) => {
52723
+ const { id } = target;
52724
+ const isTargetId = selectionGrouped || !targetIds || targetIds.indexOf(id) >= 0;
52725
+ const selectedCircles = main.select(
52726
+ `.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(id)}`
52727
+ );
52728
+ target.values.forEach((d) => {
52729
+ const { index } = d;
52730
+ const isTargetIndex = !indices || indices.indexOf(index) >= 0;
52731
+ const circle = selectedCircles.selectAll(`.${$SELECT.selectedCircle}-${index}`);
52732
+ const isSelected = !circle.empty();
52733
+ if (isSelection) {
52734
+ if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
52735
+ if (!resetDone) {
52736
+ setSelectionForFocusOnly.call($$, false);
52737
+ resetDone = true;
52738
+ }
52739
+ $$.selectPoint(null, d, index);
52740
+ } else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
52741
+ unselect(circle, d, index);
52742
+ }
52743
+ } else if (isTargetId && isTargetIndex && isSelected) {
52744
+ unselect(circle, d, index);
52745
+ }
52746
+ });
52747
+ });
52748
+ }
51912
52749
  function setSelection(isSelection = false, ids, indices, resetOther) {
52750
+ var _a;
51913
52751
  const $$ = this;
51914
52752
  const { config, $el: { main } } = $$;
51915
52753
  const selectionGrouped = config.data_selection_grouped;
51916
52754
  const isSelectable = config.data_selection_isselectable.bind($$.api);
52755
+ const singleSelection = isSelection && !config.data_selection_multiple;
52756
+ let resetDone = !singleSelection;
51917
52757
  if (!config.data_selection_enabled) {
51918
52758
  return;
51919
52759
  }
52760
+ if (singleSelection) {
52761
+ indices = (indices == null ? void 0 : indices.length) ? [indices[0]] : [0];
52762
+ if (!selectionGrouped) {
52763
+ const targetIds = isDefined(ids) ? [].concat(ids) : $$.getTargetsToShow().map((t) => t.id);
52764
+ ids = targetIds.slice(0, 1);
52765
+ }
52766
+ }
52767
+ if ((_a = $$.isPointFocusOnly) == null ? void 0 : _a.call($$)) {
52768
+ setSelectionForFocusOnly.call($$, isSelection, ids, indices, resetOther);
52769
+ return;
52770
+ }
51920
52771
  main.selectAll(`.${$SHAPE.shapes}`).selectAll(`.${$SHAPE.shape}`).each(function(d) {
51921
52772
  const shape = src_select(this);
51922
52773
  const { id, index } = d.data ? d.data : d;
51923
- const toggle = $$.getToggle(this, d).bind($$);
51924
52774
  const isTargetId = selectionGrouped || !ids || ids.indexOf(id) >= 0;
51925
52775
  const isTargetIndex = !indices || indices.indexOf(index) >= 0;
51926
- const isSelected = shape.classed($SELECT.SELECTED);
51927
52776
  if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
51928
52777
  return;
51929
52778
  }
52779
+ const toggle = $$.getToggle(this, d).bind($$);
52780
+ const isSelected = shape.classed($SELECT.SELECTED);
51930
52781
  if (isSelection) {
51931
- if (isTargetId && isTargetIndex && isSelectable(d) && !isSelected) {
51932
- toggle(true, shape.classed($SELECT.SELECTED, true), d, index);
51933
- } else if (isDefined(resetOther) && resetOther && isSelected) {
52782
+ if (isTargetId && isTargetIndex && isSelectable(d) && (!isSelected || singleSelection)) {
52783
+ if (!resetDone) {
52784
+ setSelection.call($$, false);
52785
+ resetDone = true;
52786
+ }
52787
+ !shape.classed($SELECT.SELECTED) && toggle(true, shape.classed($SELECT.SELECTED, true), d, index);
52788
+ } else if ((!singleSelection || resetDone) && isDefined(resetOther) && resetOther && isSelected) {
51934
52789
  toggle(false, shape.classed($SELECT.SELECTED, false), d, index);
51935
52790
  }
51936
52791
  } else {
@@ -51958,12 +52813,16 @@ function setSelection(isSelection = false, ids, indices, resetOther) {
51958
52813
  * chart.selected("data1");
51959
52814
  */
51960
52815
  selected(targetId) {
51961
- var _a;
52816
+ var _a, _b;
51962
52817
  const $$ = this.internal;
51963
52818
  const dataPoint = [];
51964
52819
  if ($$.state.isCanvasMode) {
51965
52820
  return ((_a = $$.getCanvasSelectedData) == null ? void 0 : _a.call($$, targetId)) || dataPoint;
51966
52821
  }
52822
+ if ((_b = $$.isPointFocusOnly) == null ? void 0 : _b.call($$)) {
52823
+ $$.$el.main.selectAll(`.${$SELECT.selectedCircles + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SELECT.selectedCircle}`).each((d) => dataPoint.push(d));
52824
+ return dataPoint;
52825
+ }
51967
52826
  $$.$el.main.selectAll(`.${$SHAPE.shapes + $$.getTargetSelectorSuffix(targetId)}`).selectAll(`.${$SHAPE.shape}`).filter(function() {
51968
52827
  return src_select(this).classed($SELECT.SELECTED);
51969
52828
  }).each((d) => dataPoint.push(d));
@@ -52161,7 +53020,7 @@ var selection_spreadProps = (a, b) => selection_defProps(a, selection_getOwnProp
52161
53020
  const cx = (isRotated ? $$.circleY : $$.circleX).bind($$);
52162
53021
  const cy = (isRotated ? $$.circleX : $$.circleY).bind($$);
52163
53022
  const r = $$.pointSelectR.bind($$);
52164
- callFn(config.data_onselected, $$.api, d, target.node());
53023
+ callFn(config.data_onselected, $$.api, d, target == null ? void 0 : target.node());
52165
53024
  $T(main.select(`.${$SELECT.selectedCircles}${$$.getTargetSelectorSuffix(d.id)}`).selectAll(`.${$SELECT.selectedCircle}-${i}`).data([d]).enter().append("circle").attr("class", () => $$.generateClass($SELECT.selectedCircle, i)).attr("cx", cx).attr("cy", cy).attr("stroke", $$.color).attr("r", (d2) => $$.pointSelectR(d2) * 1.4)).attr("r", r);
52166
53025
  },
52167
53026
  /**
@@ -52590,7 +53449,134 @@ object_extend(subchart, {
52590
53449
 
52591
53450
 
52592
53451
 
53452
+
53453
+
53454
+ const SUBCHART_TYPES = ["bar", "line", "bubble", "candlestick", "scatter"];
53455
+ const FOCUS_GRID_STYLE_PROPS = [
53456
+ "opacity",
53457
+ "stroke",
53458
+ "stroke-dasharray",
53459
+ "stroke-dashoffset",
53460
+ "stroke-linecap",
53461
+ "stroke-linejoin",
53462
+ "stroke-miterlimit",
53463
+ "stroke-opacity",
53464
+ "stroke-width"
53465
+ ];
53466
+ function syncSubchartGridFocusStyle($$, line) {
53467
+ var _a, _b;
53468
+ const source = (_b = (_a = $$.$el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(`line.${config_classes.xgridFocus}`).node();
53469
+ if (!source || !win.getComputedStyle) {
53470
+ return;
53471
+ }
53472
+ const style = win.getComputedStyle(source);
53473
+ FOCUS_GRID_STYLE_PROPS.forEach((prop) => {
53474
+ const value = style.getPropertyValue(prop);
53475
+ value && line.style(prop, value);
53476
+ });
53477
+ }
53478
+ function getFiniteAttr(value, fallback) {
53479
+ const parsed = Number(value);
53480
+ return Number.isFinite(parsed) ? parsed : fallback;
53481
+ }
53482
+ function showContinuousSubchartGridFocus($$) {
53483
+ var _a, _b;
53484
+ if (!isContinuousGridFocusEnabled($$)) {
53485
+ return false;
53486
+ }
53487
+ const { config, state, $el } = $$;
53488
+ const mainLine = (_b = (_a = $el.grid) == null ? void 0 : _a.main) == null ? void 0 : _b.select(
53489
+ `line.${config_classes.xgridFocus}:not(.${config_classes.xgridFocusContinuous})`
53490
+ );
53491
+ const line = $el.main.select(`line.${config_classes.xgridFocusContinuous}`);
53492
+ if (!(mainLine == null ? void 0 : mainLine.node()) || !line.node()) {
53493
+ return false;
53494
+ }
53495
+ const x2 = state.margin2.left - state.margin.left + state.width2;
53496
+ const y2 = state.margin2.top - state.margin.top + state.height2;
53497
+ syncSubchartGridFocusStyle($$, line);
53498
+ config.axis_rotated ? line.attr("x1", getFiniteAttr(mainLine.attr("x1"), 0)).attr("x2", x2).attr("y1", getFiniteAttr(mainLine.attr("y1"), -10)).attr("y2", getFiniteAttr(mainLine.attr("y2"), -10)) : line.attr("x1", getFiniteAttr(mainLine.attr("x1"), -10)).attr("x2", getFiniteAttr(mainLine.attr("x2"), -10)).attr("y1", getFiniteAttr(mainLine.attr("y1"), 0)).attr("y2", y2);
53499
+ line.style("visibility", null);
53500
+ mainLine.style("visibility", "hidden");
53501
+ return true;
53502
+ }
53503
+ function hideContinuousSubchartGridFocus($$) {
53504
+ var _a;
53505
+ (_a = $$.$el.main) == null ? void 0 : _a.select(`line.${config_classes.xgridFocusContinuous}`).style("visibility", "hidden");
53506
+ }
53507
+ function getMainPointFromSubchartEvent($$, event, context) {
53508
+ const { config, state } = $$;
53509
+ const [x, y] = getPointer(event, context);
53510
+ const mainCoord = getMainCoordFromSubchartCoord($$, config.axis_rotated ? y : x);
53511
+ if (mainCoord === null) {
53512
+ return null;
53513
+ }
53514
+ return config.axis_rotated ? [state.width / 2, mainCoord] : [mainCoord, state.height / 2];
53515
+ }
53516
+ function dispatchSubchartEvent($$, type, event, context) {
53517
+ var _a, _b;
53518
+ const mainEventRect = (_b = (_a = $$.$el.eventRect) == null ? void 0 : _a.node) == null ? void 0 : _b.call(_a);
53519
+ if (!mainEventRect) {
53520
+ return;
53521
+ }
53522
+ const point = getMainPointFromSubchartEvent($$, event, context) || [0, 0];
53523
+ const rect = getBoundingRect(mainEventRect, true);
53524
+ const clientX = rect.left + point[0];
53525
+ const clientY = rect.top + point[1];
53526
+ const params = {
53527
+ bubbles: true,
53528
+ cancelable: true,
53529
+ screenX: clientX,
53530
+ screenY: clientY,
53531
+ clientX,
53532
+ clientY
53533
+ };
53534
+ /^touch/.test(type) ? emulateEvent.touch(mainEventRect, type, params) : emulateEvent.mouse(mainEventRect, type, params);
53535
+ }
52593
53536
  /* harmony default export */ var interactions_subchart = ({
53537
+ /**
53538
+ * Whether subchart brush interaction is enabled.
53539
+ * @returns {boolean}
53540
+ * @private
53541
+ */
53542
+ isSubchartBrushEnabled() {
53543
+ const { config } = this;
53544
+ return config.subchart_show && config.subchart_brush_enabled !== false;
53545
+ },
53546
+ /**
53547
+ * Bind event rect handlers for subchart hover interactions.
53548
+ * @param {d3Selection} eventRect Subchart event rect selection
53549
+ * @private
53550
+ */
53551
+ bindSubchartEventRect(eventRect) {
53552
+ const $$ = this;
53553
+ const { config, state } = $$;
53554
+ eventRect.on("mouseover mousemove mouseout touchstart touchmove touchend", null);
53555
+ if (!config.interaction_enabled) {
53556
+ return;
53557
+ }
53558
+ if (state.inputType === "mouse") {
53559
+ eventRect.on("mouseover mousemove", function(event) {
53560
+ if ($$.isSubchartBrushEnabled()) {
53561
+ return;
53562
+ }
53563
+ dispatchSubchartEvent($$, event.type, event, this);
53564
+ }).on("mouseout", function(event) {
53565
+ if ($$.isSubchartBrushEnabled()) {
53566
+ return;
53567
+ }
53568
+ dispatchSubchartEvent($$, "mouseout", event, this);
53569
+ });
53570
+ } else if (state.inputType === "touch") {
53571
+ eventRect.on("touchstart touchmove touchend", function(event) {
53572
+ var _a;
53573
+ if ($$.isSubchartBrushEnabled() || ((_a = event.touches) == null ? void 0 : _a.length) > 1) {
53574
+ return;
53575
+ }
53576
+ dispatchSubchartEvent($$, event.type, event, this);
53577
+ });
53578
+ }
53579
+ },
52594
53580
  /**
52595
53581
  * Initialize the brush.
52596
53582
  * @private
@@ -52684,19 +53670,26 @@ object_extend(subchart, {
52684
53670
  const { main } = subchart;
52685
53671
  main.style("visibility", visibility);
52686
53672
  main.append("g").attr("clip-path", clipPath).attr("class", config_classes.chart);
52687
- ["bar", "line", "bubble", "candlestick", "scatter"].forEach((v) => {
52688
- const type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
52689
- if ($$.hasType(v) || $$.hasTypeOf(type)) {
52690
- const chart = main.select(`.${config_classes.chart}`);
52691
- const chartClassName = config_classes[`chart${type}s`];
52692
- if (chart.select(`.${chartClassName}`).empty()) {
52693
- chart.append("g").attr("class", chartClassName);
53673
+ $$.withSubchartTypeContext(() => {
53674
+ SUBCHART_TYPES.forEach((v) => {
53675
+ const type = capitalize(/^(bubble|scatter)$/.test(v) ? "circle" : v);
53676
+ if ($$.hasType(v) || $$.hasTypeOf(type)) {
53677
+ const chart = main.select(`.${config_classes.chart}`);
53678
+ const chartClassName = config_classes[`chart${type}s`];
53679
+ if (chart.select(`.${chartClassName}`).empty()) {
53680
+ chart.append("g").attr("class", chartClassName);
53681
+ }
52694
53682
  }
52695
- }
53683
+ });
52696
53684
  });
52697
- const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).call($$.brush);
53685
+ const brush = main.append("g").attr("clip-path", clipPath).attr("class", config_classes.brush).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none").call($$.brush);
52698
53686
  config.subchart_showHandle && $$.addBrushHandle(brush);
53687
+ subchart.eventRect = main.append("g").attr("clip-path", clipPath).attr("class", `${config_classes.eventRects} ${config_classes.eventRects}-subchart`).style("fill-opacity", "0").style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all").append("rect").attr("class", `${config_classes.eventRect} ${config_classes.eventRect}-subchart`).attr("width", $$.state.width2).attr("height", $$.state.height2);
53688
+ $$.bindSubchartEventRect(subchart.eventRect);
53689
+ main.append("g").attr("clip-path", clipPath).attr("class", config_classes.xgridFocus).append("line").attr("class", config_classes.xgridFocus).style("visibility", "hidden");
52699
53690
  axis.subX = main.append("g").attr("class", config_classes.axisX).attr("transform", $$.getTranslate("subX")).attr("clip-path", config.axis_rotated ? "" : clip.pathXAxis).style("visibility", config.subchart_axis_x_show ? visibility : "hidden");
53691
+ axis.subY = main.append("g").attr("class", config_classes.axisY).attr("transform", $$.getTranslate("subY")).style("visibility", config.subchart_axis_y_show ? visibility : "hidden");
53692
+ axis.subY2 = main.append("g").attr("class", config_classes.axisY2).attr("transform", $$.getTranslate("subY2")).style("visibility", config.subchart_axis_y2_show ? visibility : "hidden");
52700
53693
  },
52701
53694
  /**
52702
53695
  * Add brush handle
@@ -52719,64 +53712,89 @@ object_extend(subchart, {
52719
53712
  * @private
52720
53713
  */
52721
53714
  updateTargetsForSubchart(targets) {
53715
+ var _a;
52722
53716
  const $$ = this;
52723
53717
  const { config, state, $el: { subchart: { main } } } = $$;
52724
53718
  if (config.subchart_show) {
52725
- ["bar", "line", "bubble", "candlestick", "scatter"].filter((v) => $$.hasType(v) || $$.hasTypeOf(capitalize(v))).forEach((v) => {
52726
- const isPointType = /^(bubble|scatter)$/.test(v);
52727
- const name = capitalize(isPointType ? "circle" : v);
52728
- const chartClass = $$.getChartClass(name, true);
52729
- const shapeClass = $$.getClass(isPointType ? "circles" : `${v}s`, true);
52730
- const shapeChart = main.select(`.${config_classes[`chart${`${name}s`}`]}`);
52731
- if (isPointType) {
52732
- const circle = shapeChart.selectAll(`.${config_classes.circles}`).data(targets.filter($$[`is${capitalize(v)}Type`].bind($$))).attr("class", shapeClass);
52733
- circle.exit().remove();
52734
- circle.enter().append("g").attr("class", shapeClass);
52735
- } else {
52736
- const shapeUpdate = shapeChart.selectAll(`.${config_classes[`chart${name}`]}`).attr("class", chartClass).data(targets.filter($$[`is${name}Type`].bind($$)));
52737
- const shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
52738
- shapeUpdate.exit().remove();
52739
- v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", true));
52740
- }
53719
+ $$.withSubchartTypeContext(() => {
53720
+ SUBCHART_TYPES.filter((v) => $$.hasType(v) || $$.hasTypeOf(capitalize(v))).forEach((v) => {
53721
+ const isPointType = /^(bubble|scatter)$/.test(v);
53722
+ const name = capitalize(isPointType ? "circle" : v);
53723
+ const chartClass = $$.getChartClass(name, true);
53724
+ const shapeClass = $$.getClass(isPointType ? "circles" : `${v}s`, true);
53725
+ const shapeChart = main.select(`.${config_classes[`chart${`${name}s`}`]}`);
53726
+ if (isPointType) {
53727
+ const circle = shapeChart.selectAll(`.${config_classes.circles}`).data(targets.filter($$[`is${capitalize(v)}Type`].bind($$))).attr("class", shapeClass);
53728
+ circle.exit().remove();
53729
+ circle.enter().append("g").attr("class", shapeClass);
53730
+ } else {
53731
+ const shapeUpdate = shapeChart.selectAll(`.${config_classes[`chart${name}`]}`).attr("class", chartClass).data(targets.filter($$[`is${name}Type`].bind($$)));
53732
+ const shapeEnter = shapeUpdate.enter().append("g").style("opacity", "0").attr("class", chartClass).append("g").attr("class", shapeClass);
53733
+ shapeUpdate.exit().remove();
53734
+ v === "line" && $$.hasTypeOf("Area") && shapeEnter.append("g").attr("class", $$.getClass("areas", true));
53735
+ }
53736
+ });
52741
53737
  });
52742
53738
  main.selectAll(`.${config_classes.brush} rect`).attr(
52743
53739
  config.axis_rotated ? "width" : "height",
52744
53740
  config.axis_rotated ? state.width2 : state.height2
52745
53741
  );
53742
+ (_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.attr("width", state.width2).attr("height", state.height2).style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
52746
53743
  }
52747
53744
  },
53745
+ /**
53746
+ * Update subchart y domains using subchart type options.
53747
+ * @param {object} targets Targets to show
53748
+ * @private
53749
+ */
53750
+ updateSubchartYDomain(targets) {
53751
+ var _a, _b;
53752
+ const $$ = this;
53753
+ const { scale } = $$;
53754
+ const targetsToShow = targets || $$.filterTargetsToShow($$.data.targets);
53755
+ (_a = scale.subY) == null ? void 0 : _a.domain($$.getYDomain(targetsToShow, "y"));
53756
+ (_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
53757
+ },
52748
53758
  /**
52749
53759
  * Redraw subchart.
52750
53760
  * @private
52751
53761
  * @param {boolean} withSubchart whether or not to show subchart
52752
53762
  * @param {number} duration duration
52753
- * @param {object} shape Shape's info
52754
53763
  */
52755
- redrawSubchart(withSubchart, duration, shape) {
52756
- var _a;
53764
+ redrawSubchart(withSubchart, duration) {
53765
+ var _a, _b, _c, _d;
52757
53766
  const $$ = this;
52758
53767
  const { config, $el: { subchart: { main } }, state } = $$;
52759
53768
  const withTransition = !!duration;
52760
53769
  main.style("visibility", config.subchart_show ? null : "hidden");
53770
+ main.select(`.${config_classes.brush}`).style("pointer-events", $$.isSubchartBrushEnabled() ? null : "none");
53771
+ (_a = $$.$el.subchart.eventRect) == null ? void 0 : _a.style("pointer-events", $$.isSubchartBrushEnabled() ? "none" : "all");
53772
+ (_b = $$.$el.axis.subY) == null ? void 0 : _b.style("visibility", config.subchart_axis_y_show ? null : "hidden");
53773
+ (_c = $$.$el.axis.subY2) == null ? void 0 : _c.style("visibility", config.subchart_axis_y2_show ? null : "hidden");
52761
53774
  if (config.subchart_show) {
52762
- if (((_a = state.event) == null ? void 0 : _a.type) === "zoom") {
53775
+ if (((_d = state.event) == null ? void 0 : _d.type) === "zoom") {
52763
53776
  $$.brush.update();
52764
53777
  }
52765
53778
  if (withSubchart) {
52766
53779
  const initRange = config.subchart_init_range;
52767
53780
  !brushEmpty($$) && $$.brush.update();
52768
- Object.keys(shape.type).forEach((v) => {
52769
- const name = capitalize(v);
52770
- const drawFn = $$[`generateDraw${name}`](shape.indices[v], true);
52771
- $$[`update${name}`](withTransition, true);
52772
- $$[`redraw${name}`](drawFn, withTransition, true);
53781
+ $$.withSubchartTypeContext(() => {
53782
+ const targetsToShow = state._targetsToShow || $$.filterTargetsToShow($$.data.targets);
53783
+ $$.updateSubchartYDomain(targetsToShow);
53784
+ const subchartShape = $$.getDrawShape();
53785
+ Object.keys(subchartShape.type).forEach((v) => {
53786
+ const name = capitalize(v);
53787
+ const drawFn = $$[`generateDraw${name}`](subchartShape.indices[v], true);
53788
+ $$[`update${name}`](withTransition, true);
53789
+ $$[`redraw${name}`](drawFn, withTransition, true);
53790
+ });
53791
+ if ($$.hasType("bubble") || $$.hasType("scatter")) {
53792
+ const { cx } = subchartShape.pos;
53793
+ const cy = $$.updateCircleY(true);
53794
+ $$.updateCircle(true);
53795
+ $$.redrawCircle(cx, cy, withTransition, void 0, true);
53796
+ }
52773
53797
  });
52774
- if ($$.hasType("bubble") || $$.hasType("scatter")) {
52775
- const { cx } = shape.pos;
52776
- const cy = $$.updateCircleY(true);
52777
- $$.updateCircle(true);
52778
- $$.redrawCircle(cx, cy, withTransition, void 0, true);
52779
- }
52780
53798
  if (!state.rendered && initRange) {
52781
53799
  state.domain = initRange;
52782
53800
  $$.brush.move(
@@ -52787,6 +53805,46 @@ object_extend(subchart, {
52787
53805
  }
52788
53806
  }
52789
53807
  },
53808
+ /**
53809
+ * Show a focus grid line on subchart following main chart focus.
53810
+ * @param {Array} data Selected data
53811
+ * @private
53812
+ */
53813
+ showSubchartGridFocus(data) {
53814
+ const $$ = this;
53815
+ const { config, state, $el: { subchart: { main } } } = $$;
53816
+ if (!main || !config.subchart_show || $$.isSubchartBrushEnabled() || config.grid_focus_show === false || config.subchart_grid_focus === false || !config.tooltip_show || config.axis_tooltip) {
53817
+ return;
53818
+ }
53819
+ const focusData = Array.isArray(data) ? data : [data];
53820
+ const focus = focusData.find((d) => d && $$.getBaseValue(d) != null);
53821
+ if (!focus) {
53822
+ $$.hideSubchartGridFocus();
53823
+ return;
53824
+ }
53825
+ const pos = $$.scale.subX(focus.x);
53826
+ if (!Number.isFinite(pos)) {
53827
+ $$.hideSubchartGridFocus();
53828
+ return;
53829
+ }
53830
+ const line = main.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`);
53831
+ if (showContinuousSubchartGridFocus($$)) {
53832
+ line.style("visibility", "hidden");
53833
+ return;
53834
+ }
53835
+ syncSubchartGridFocusStyle($$, line);
53836
+ config.axis_rotated ? line.attr("x1", 0).attr("x2", state.width2).attr("y1", pos).attr("y2", pos) : line.attr("x1", pos).attr("x2", pos).attr("y1", 0).attr("y2", state.height2);
53837
+ line.style("visibility", null);
53838
+ },
53839
+ /**
53840
+ * Hide subchart focus grid line.
53841
+ * @private
53842
+ */
53843
+ hideSubchartGridFocus() {
53844
+ var _a;
53845
+ hideContinuousSubchartGridFocus(this);
53846
+ (_a = this.$el.subchart.main) == null ? void 0 : _a.select(`g.${config_classes.xgridFocus} line.${config_classes.xgridFocus}`).style("visibility", "hidden");
53847
+ },
52790
53848
  /**
52791
53849
  * Redraw the brush.
52792
53850
  * @param {boolean} [callCallbck=true] Call 'onbrush' callback or not.
@@ -52822,8 +53880,12 @@ object_extend(subchart, {
52822
53880
  const $$ = this;
52823
53881
  const { $el: { subchart }, $T } = $$;
52824
53882
  const subXAxis = (transitions == null ? void 0 : transitions.axisSubX) ? transitions.axisSubX : $T(subchart.main.select(`.${config_classes.axisX}`), withTransition);
53883
+ const subYAxis = (transitions == null ? void 0 : transitions.axisSubY) ? transitions.axisSubY : $T(subchart.main.select(`.${config_classes.axisY}`), withTransition);
53884
+ const subY2Axis = (transitions == null ? void 0 : transitions.axisSubY2) ? transitions.axisSubY2 : $T(subchart.main.select(`.${config_classes.axisY2}`), withTransition);
52825
53885
  subchart.main.attr("transform", $$.getTranslate("context"));
52826
53886
  subXAxis.attr("transform", $$.getTranslate("subX"));
53887
+ subYAxis.attr("transform", $$.getTranslate("subY"));
53888
+ subY2Axis.attr("transform", $$.getTranslate("subY2"));
52827
53889
  }
52828
53890
  });
52829
53891
 
@@ -52831,7 +53893,7 @@ object_extend(subchart, {
52831
53893
  /* harmony default export */ var interaction_subchart = ({
52832
53894
  /**
52833
53895
  * Set subchart options.
52834
- * - **NOTE:** Not supported for `bubble`, `scatter` and non-Axis based(pie, donut, gauge, radar) types.
53896
+ * - **NOTE:** Not supported for non-Axis based(pie, donut, gauge, radar) types.
52835
53897
  * @name subchart
52836
53898
  * @memberof Options
52837
53899
  * @type {object}
@@ -52839,11 +53901,45 @@ object_extend(subchart, {
52839
53901
  * @property {boolean} [subchart.show=false] Show sub chart on the bottom of the chart.
52840
53902
  * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
52841
53903
  * - `show: subchart()`
53904
+ * @property {string} [subchart.type] Set chart type for the subchart. Defaults to data.type.
53905
+ * @property {object} [subchart.types] Set chart type for each data in the subchart. Defaults to data.types.
53906
+ * @property {boolean} [subchart.brush.enabled=true] Enable subchart brush interaction.
52842
53907
  * @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
53908
+ * @property {boolean|object} [subchart.grid.focus=true] Show x focus grid line in subchart when subchart brush is disabled.
53909
+ * @property {boolean} [subchart.grid.focus.continuous=false] Render x focus grid line as one continuous line across main chart and subchart when subchart brush is disabled.
52843
53910
  * @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
52844
53911
  * @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
53912
+ * @property {number} [subchart.axis.x.tick.count] Set the number of x axis ticks.
53913
+ * @property {Array|function} [subchart.axis.x.tick.values] Set x axis tick values manually.
53914
+ * @property {boolean|object} [subchart.axis.x.tick.culling] Setting for culling x axis ticks.
53915
+ * @property {number} [subchart.axis.x.tick.culling.max] The number of x axis tick texts will be adjusted to less than this value.
53916
+ * @property {boolean} [subchart.axis.x.tick.culling.lines=true] Control x axis tick line visibility within culling option.
53917
+ * @property {boolean} [subchart.axis.x.tick.culling.reverse=false] Control x axis culling start point to be reversed.
53918
+ * @property {boolean} [subchart.axis.x.tick.outer] Show or hide x axis outer tick.
52845
53919
  * @property {function|string} [subchart.axis.x.tick.format] Use custom format for x axis ticks - see [axis.x.tick.format](#.axis․x․tick․format) for details.
52846
53920
  * @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
53921
+ * @property {boolean} [subchart.axis.y.show=false] Show or hide y axis.
53922
+ * @property {boolean} [subchart.axis.y.tick.show=true] Show or hide y axis tick line.
53923
+ * @property {number} [subchart.axis.y.tick.count] Set the number of y axis ticks.
53924
+ * @property {Array|function} [subchart.axis.y.tick.values] Set y axis tick values manually.
53925
+ * @property {boolean|object} [subchart.axis.y.tick.culling] Setting for culling y axis ticks.
53926
+ * @property {number} [subchart.axis.y.tick.culling.max] The number of y axis tick texts will be adjusted to less than this value.
53927
+ * @property {boolean} [subchart.axis.y.tick.culling.lines=true] Control y axis tick line visibility within culling option.
53928
+ * @property {boolean} [subchart.axis.y.tick.culling.reverse=false] Control y axis culling start point to be reversed.
53929
+ * @property {boolean} [subchart.axis.y.tick.outer] Show or hide y axis outer tick.
53930
+ * @property {function|string} [subchart.axis.y.tick.format] Use custom format for y axis ticks - see [axis.y.tick.format](#.axis․y․tick․format) for details.
53931
+ * @property {boolean} [subchart.axis.y.tick.text.show=true] Show or hide y axis tick text.
53932
+ * @property {boolean} [subchart.axis.y2.show=false] Show or hide y2 axis.
53933
+ * @property {boolean} [subchart.axis.y2.tick.show=true] Show or hide y2 axis tick line.
53934
+ * @property {number} [subchart.axis.y2.tick.count] Set the number of y2 axis ticks.
53935
+ * @property {Array|function} [subchart.axis.y2.tick.values] Set y2 axis tick values manually.
53936
+ * @property {boolean|object} [subchart.axis.y2.tick.culling] Setting for culling y2 axis ticks.
53937
+ * @property {number} [subchart.axis.y2.tick.culling.max] The number of y2 axis tick texts will be adjusted to less than this value.
53938
+ * @property {boolean} [subchart.axis.y2.tick.culling.lines=true] Control y2 axis tick line visibility within culling option.
53939
+ * @property {boolean} [subchart.axis.y2.tick.culling.reverse=false] Control y2 axis culling start point to be reversed.
53940
+ * @property {boolean} [subchart.axis.y2.tick.outer] Show or hide y2 axis outer tick.
53941
+ * @property {function|string} [subchart.axis.y2.tick.format] Use custom format for y2 axis ticks - see [axis.y2.tick.format](#.axis․y2․tick․format) for details.
53942
+ * @property {boolean} [subchart.axis.y2.tick.text.show=true] Show or hide y2 axis tick text.
52847
53943
  * @property {Array} [subchart.init.range] Set initial selection domain range.
52848
53944
  * @property {number} [subchart.size.height] Change the height of the subchart.
52849
53945
  * @property {function} [subchart.onbrush] Set callback for brush event.<br>
@@ -52853,9 +53949,29 @@ object_extend(subchart, {
52853
53949
  * subchart: {
52854
53950
  * show: true,
52855
53951
  * showHandle: true,
53952
+ *
53953
+ * // render the overview with a different chart type than the main chart
53954
+ * type: "bar",
53955
+ *
53956
+ * // override the type per data series
53957
+ * types: {
53958
+ * data2: "area"
53959
+ * },
52856
53960
  * size: {
52857
53961
  * height: 20
52858
53962
  * },
53963
+ * brush: {
53964
+ * // disable brush(zoom) interaction, rendering the subchart as a static overview
53965
+ * enabled: false
53966
+ * },
53967
+ * grid: {
53968
+ * // set false to hide focus grid line in subchart
53969
+ * // focus: false,
53970
+ * focus: {
53971
+ * // NOTE: works only when 'brush.enabled=false'
53972
+ * continuous: true
53973
+ * }
53974
+ * },
52859
53975
  * init: {
52860
53976
  * // specify initial range domain selection
52861
53977
  * range: [1, 2]
@@ -52870,6 +53986,12 @@ object_extend(subchart, {
52870
53986
  * show: false
52871
53987
  * }
52872
53988
  * }
53989
+ * },
53990
+ * y: {
53991
+ * show: true,
53992
+ * tick: {
53993
+ * count: 3
53994
+ * }
52873
53995
  * }
52874
53996
  * },
52875
53997
  * onbrush: function(domain) { ... }
@@ -52884,12 +54006,46 @@ object_extend(subchart, {
52884
54006
  * }
52885
54007
  */
52886
54008
  subchart_show: false,
54009
+ subchart_type: void 0,
54010
+ subchart_types: {},
54011
+ subchart_brush_enabled: true,
52887
54012
  subchart_showHandle: false,
52888
54013
  subchart_size_height: 60,
54014
+ subchart_grid_focus: true,
54015
+ subchart_grid_focus_continuous: false,
52889
54016
  subchart_axis_x_show: true,
52890
54017
  subchart_axis_x_tick_show: true,
54018
+ subchart_axis_x_tick_count: void 0,
54019
+ subchart_axis_x_tick_values: void 0,
54020
+ subchart_axis_x_tick_culling: void 0,
54021
+ subchart_axis_x_tick_culling_max: void 0,
54022
+ subchart_axis_x_tick_culling_lines: void 0,
54023
+ subchart_axis_x_tick_culling_reverse: void 0,
54024
+ subchart_axis_x_tick_outer: void 0,
52891
54025
  subchart_axis_x_tick_format: void 0,
52892
54026
  subchart_axis_x_tick_text_show: true,
54027
+ subchart_axis_y_show: false,
54028
+ subchart_axis_y_tick_show: true,
54029
+ subchart_axis_y_tick_count: void 0,
54030
+ subchart_axis_y_tick_values: void 0,
54031
+ subchart_axis_y_tick_culling: void 0,
54032
+ subchart_axis_y_tick_culling_max: void 0,
54033
+ subchart_axis_y_tick_culling_lines: void 0,
54034
+ subchart_axis_y_tick_culling_reverse: void 0,
54035
+ subchart_axis_y_tick_outer: void 0,
54036
+ subchart_axis_y_tick_format: void 0,
54037
+ subchart_axis_y_tick_text_show: true,
54038
+ subchart_axis_y2_show: false,
54039
+ subchart_axis_y2_tick_show: true,
54040
+ subchart_axis_y2_tick_count: void 0,
54041
+ subchart_axis_y2_tick_values: void 0,
54042
+ subchart_axis_y2_tick_culling: void 0,
54043
+ subchart_axis_y2_tick_culling_max: void 0,
54044
+ subchart_axis_y2_tick_culling_lines: void 0,
54045
+ subchart_axis_y2_tick_culling_reverse: void 0,
54046
+ subchart_axis_y2_tick_outer: void 0,
54047
+ subchart_axis_y2_tick_format: void 0,
54048
+ subchart_axis_y2_tick_text_show: true,
52893
54049
  subchart_init_range: void 0,
52894
54050
  subchart_onbrush: () => {
52895
54051
  }
@@ -55671,109 +56827,6 @@ const axis = {
55671
56827
  }
55672
56828
  });
55673
56829
 
55674
- ;// ./node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/identity.js
55675
- /* harmony default export */ function d3_axis_src_identity(x) {
55676
- return x;
55677
- }
55678
-
55679
- ;// ./node_modules/.pnpm/d3-axis@3.0.0/node_modules/d3-axis/src/axis.js
55680
-
55681
- var axis_top = 1, right = 2, bottom = 3, left = 4, axis_epsilon = 1e-6;
55682
- function translateX(x) {
55683
- return "translate(" + x + ",0)";
55684
- }
55685
- function translateY(y) {
55686
- return "translate(0," + y + ")";
55687
- }
55688
- function axis_number(scale) {
55689
- return (d) => +scale(d);
55690
- }
55691
- function center(scale, offset) {
55692
- offset = Math.max(0, scale.bandwidth() - offset * 2) / 2;
55693
- if (scale.round()) offset = Math.round(offset);
55694
- return (d) => +scale(d) + offset;
55695
- }
55696
- function entering() {
55697
- return !this.__axis;
55698
- }
55699
- function axis_axis(orient, scale) {
55700
- var tickArguments = [], tickValues = null, tickFormat = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k = orient === axis_top || orient === left ? -1 : 1, x = orient === left || orient === right ? "x" : "y", transform = orient === axis_top || orient === bottom ? translateX : translateY;
55701
- function axis2(context) {
55702
- var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format = tickFormat == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : d3_axis_src_identity : tickFormat, spacing = Math.max(tickSizeInner, 0) + tickPadding, range = scale.range(), range0 = +range[0] + offset, range1 = +range[range.length - 1] + offset, position = (scale.bandwidth ? center : axis_number)(scale.copy(), offset), selection = context.selection ? context.selection() : context, path = selection.selectAll(".domain").data([null]), tick = selection.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line = tick.select("line"), text = tick.select("text");
55703
- path = path.merge(path.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor"));
55704
- tick = tick.merge(tickEnter);
55705
- line = line.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x + "2", k * tickSizeInner));
55706
- text = text.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x, k * spacing).attr("dy", orient === axis_top ? "0em" : orient === bottom ? "0.71em" : "0.32em"));
55707
- if (context !== selection) {
55708
- path = path.transition(context);
55709
- tick = tick.transition(context);
55710
- line = line.transition(context);
55711
- text = text.transition(context);
55712
- tickExit = tickExit.transition(context).attr("opacity", axis_epsilon).attr("transform", function(d) {
55713
- return isFinite(d = position(d)) ? transform(d + offset) : this.getAttribute("transform");
55714
- });
55715
- tickEnter.attr("opacity", axis_epsilon).attr("transform", function(d) {
55716
- var p = this.parentNode.__axis;
55717
- return transform((p && isFinite(p = p(d)) ? p : position(d)) + offset);
55718
- });
55719
- }
55720
- tickExit.remove();
55721
- path.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1);
55722
- tick.attr("opacity", 1).attr("transform", function(d) {
55723
- return transform(position(d) + offset);
55724
- });
55725
- line.attr(x + "2", k * tickSizeInner);
55726
- text.attr(x, k * spacing).text(format);
55727
- selection.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");
55728
- selection.each(function() {
55729
- this.__axis = position;
55730
- });
55731
- }
55732
- axis2.scale = function(_) {
55733
- return arguments.length ? (scale = _, axis2) : scale;
55734
- };
55735
- axis2.ticks = function() {
55736
- return tickArguments = Array.from(arguments), axis2;
55737
- };
55738
- axis2.tickArguments = function(_) {
55739
- return arguments.length ? (tickArguments = _ == null ? [] : Array.from(_), axis2) : tickArguments.slice();
55740
- };
55741
- axis2.tickValues = function(_) {
55742
- return arguments.length ? (tickValues = _ == null ? null : Array.from(_), axis2) : tickValues && tickValues.slice();
55743
- };
55744
- axis2.tickFormat = function(_) {
55745
- return arguments.length ? (tickFormat = _, axis2) : tickFormat;
55746
- };
55747
- axis2.tickSize = function(_) {
55748
- return arguments.length ? (tickSizeInner = tickSizeOuter = +_, axis2) : tickSizeInner;
55749
- };
55750
- axis2.tickSizeInner = function(_) {
55751
- return arguments.length ? (tickSizeInner = +_, axis2) : tickSizeInner;
55752
- };
55753
- axis2.tickSizeOuter = function(_) {
55754
- return arguments.length ? (tickSizeOuter = +_, axis2) : tickSizeOuter;
55755
- };
55756
- axis2.tickPadding = function(_) {
55757
- return arguments.length ? (tickPadding = +_, axis2) : tickPadding;
55758
- };
55759
- axis2.offset = function(_) {
55760
- return arguments.length ? (offset = +_, axis2) : offset;
55761
- };
55762
- return axis2;
55763
- }
55764
- function axisTop(scale) {
55765
- return axis_axis(axis_top, scale);
55766
- }
55767
- function axisRight(scale) {
55768
- return axis_axis(right, scale);
55769
- }
55770
- function axisBottom(scale) {
55771
- return axis_axis(bottom, scale);
55772
- }
55773
- function axisLeft(scale) {
55774
- return axis_axis(left, scale);
55775
- }
55776
-
55777
56830
  ;// ./src/ChartInternal/Axis/AxisRendererHelper.ts
55778
56831
  var AxisRendererHelper_defProp = Object.defineProperty;
55779
56832
  var AxisRendererHelper_defNormalProp = (obj, key, value) => key in obj ? AxisRendererHelper_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -55829,7 +56882,7 @@ class AxisRendererHelper {
55829
56882
  /**
55830
56883
  * Get tick transform setter function
55831
56884
  * @param {string} id Axis id
55832
- * @returns {(selection: d3Selection, scale) => void} transfrom setter function
56885
+ * @returns {function(d3Selection, d3Scale): void} transform setter function
55833
56886
  * @private
55834
56887
  */
55835
56888
  getTickTransformSetter(id) {
@@ -55911,6 +56964,13 @@ var AxisRenderer_publicField = (obj, key, value) => AxisRenderer_defNormalProp(o
55911
56964
 
55912
56965
 
55913
56966
 
56967
+ function getBaseAxisId(id) {
56968
+ return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
56969
+ }
56970
+ function getAxisOptionPrefix(id) {
56971
+ const type = getBaseAxisId(id);
56972
+ return /^sub/.test(id) ? `subchart_axis_${type}` : `axis_${type}`;
56973
+ }
55914
56974
  class AxisRenderer {
55915
56975
  constructor(params = {}) {
55916
56976
  AxisRenderer_publicField(this, "helper");
@@ -55943,8 +57003,8 @@ class AxisRenderer {
55943
57003
  const { config, params } = this;
55944
57004
  const { config: chartConfig, id, owner } = params;
55945
57005
  const isX = /^(x|subX)$/.test(id);
55946
- const type = id === "subX" ? "x" : id;
55947
- const customTickFormat = id === "subX" ? chartConfig.subchart_axis_x_tick_format || chartConfig.axis_x_tick_format : chartConfig[`axis_${type}_tick_format`];
57006
+ const type = getBaseAxisId(id);
57007
+ const customTickFormat = /^sub/.test(id) ? chartConfig[`subchart_axis_${type}_tick_format`] || chartConfig[`axis_${type}_tick_format`] : chartConfig[`axis_${type}_tick_format`];
55948
57008
  const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight && !(params.tickWidth > 0);
55949
57009
  return !!(owner.state.resizing && !owner.state.flowing && !isFunction(chartConfig.axis_evalTextSize) && !customTickFormat && !params.tickTitle && !(isX && chartConfig.axis_x_tick_autorotate) && !categoryAutoWrap && config.withoutTransition);
55950
57010
  }
@@ -55986,10 +57046,12 @@ class AxisRenderer {
55986
57046
  this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
55987
57047
  const { innerTickSize, tickLength, range } = config;
55988
57048
  const id = params.id;
55989
- const tickTextPos = id && /^(x|y|y2)$/.test(id) ? params.config[`axis_${id}_tick_text_position`] : { x: 0, y: 0 };
55990
- const prefix = id === "subX" ? `subchart_axis_x` : `axis_${id}`;
57049
+ const type = getBaseAxisId(id);
57050
+ const { isSubAxes } = params;
57051
+ const tickTextPos = !isSubAxes && type && /^(x|y|y2)$/.test(type) ? params.config[`axis_${type}_tick_text_position`] : { x: 0, y: 0 };
57052
+ const prefix = getAxisOptionPrefix(id);
55991
57053
  const axisShow = params.config[`${prefix}_show`];
55992
- const tickShow = {
57054
+ const tickShow = isSubAxes ? { tick: true, text: true } : {
55993
57055
  tick: axisShow ? params.config[`${prefix}_tick_show`] : false,
55994
57056
  text: axisShow ? params.config[`${prefix}_tick_text_show`] : false
55995
57057
  };
@@ -56188,7 +57250,7 @@ class AxisRenderer {
56188
57250
  axis_x_tick_text_inner: inner
56189
57251
  }
56190
57252
  } = this.params.owner;
56191
- const tickLineInner = this.params.config[`axis_${axisId}_tick_inner`];
57253
+ const tickLineInner = this.params.config[`axis_${getBaseAxisId(axisId)}_tick_inner`];
56192
57254
  switch (orient) {
56193
57255
  case "bottom":
56194
57256
  lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", (d) => this.getTickSize.bind(this)(d) * (tickLineInner ? -1 : 1));
@@ -56383,7 +57445,17 @@ var Axis_publicField = (obj, key, value) => Axis_defNormalProp(obj, typeof key !
56383
57445
 
56384
57446
 
56385
57447
 
56386
-
57448
+ function Axis_getBaseAxisId(id) {
57449
+ return id === "subX" ? "x" : id === "subY" ? "y" : id === "subY2" ? "y2" : id;
57450
+ }
57451
+ function isSubAxis(id) {
57452
+ return /^sub/.test(id);
57453
+ }
57454
+ function Axis_getAxisTickOption(config, id, key) {
57455
+ const type = Axis_getBaseAxisId(id);
57456
+ const subValue = config[`subchart_axis_${type}_tick_${key}`];
57457
+ return isSubAxis(id) && subValue !== void 0 ? subValue : config[`axis_${type}_tick_${key}`];
57458
+ }
56387
57459
  function _sampleTickNodes(nodes) {
56388
57460
  var _a, _b;
56389
57461
  const sampled = [nodes[0], nodes[nodes.length - 1]];
@@ -56587,6 +57659,8 @@ class Axis_Axis {
56587
57659
  Axis_publicField(this, "owner");
56588
57660
  Axis_publicField(this, "x");
56589
57661
  Axis_publicField(this, "subX");
57662
+ Axis_publicField(this, "subY");
57663
+ Axis_publicField(this, "subY2");
56590
57664
  Axis_publicField(this, "y");
56591
57665
  Axis_publicField(this, "y2");
56592
57666
  Axis_publicField(this, "axesList", {});
@@ -56600,7 +57674,9 @@ class Axis_Axis {
56600
57674
  x: "bottom",
56601
57675
  y: "left",
56602
57676
  y2: "right",
56603
- subX: "bottom"
57677
+ subX: "bottom",
57678
+ subY: "left",
57679
+ subY2: "right"
56604
57680
  });
56605
57681
  this.owner = owner;
56606
57682
  this.setOrient();
@@ -56691,7 +57767,9 @@ class Axis_Axis {
56691
57767
  x: isRotated ? "left" : "bottom",
56692
57768
  y: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
56693
57769
  y2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right",
56694
- subX: isRotated ? "left" : "bottom"
57770
+ subX: isRotated ? "left" : "bottom",
57771
+ subY: isRotated ? yInner ? "top" : "bottom" : yInner ? "right" : "left",
57772
+ subY2: isRotated ? y2Inner ? "bottom" : "top" : y2Inner ? "left" : "right"
56695
57773
  };
56696
57774
  }
56697
57775
  /**
@@ -56706,24 +57784,32 @@ class Axis_Axis {
56706
57784
  const axes = [];
56707
57785
  const axesConfig = config[`axis_${id}_axes`];
56708
57786
  const isRotated = config.axis_rotated;
56709
- let d3Axis;
57787
+ let orient;
56710
57788
  if (id === "x") {
56711
- d3Axis = isRotated ? axisLeft : axisBottom;
57789
+ orient = isRotated ? "left" : "bottom";
56712
57790
  } else if (id === "y") {
56713
- d3Axis = isRotated ? axisBottom : axisLeft;
57791
+ orient = isRotated ? "bottom" : "left";
56714
57792
  } else if (id === "y2") {
56715
- d3Axis = isRotated ? axisTop : axisRight;
57793
+ orient = isRotated ? "top" : "right";
56716
57794
  }
56717
57795
  if (axesConfig.length) {
56718
57796
  axesConfig.forEach((v) => {
56719
57797
  const tick = v.tick || {};
56720
57798
  const scale = $$.scale[id].copy();
56721
57799
  v.domain && scale.domain(v.domain);
56722
- axes.push(
56723
- d3Axis(scale).ticks(tick.count).tickFormat(
56724
- isFunction(tick.format) ? tick.format.bind($$.api) : ((x) => x)
56725
- ).tickValues(tick.values).tickSizeOuter(tick.outer === false ? 0 : AXIS_TICK_SIZE)
57800
+ const axis = new AxisRenderer({
57801
+ outerTick: tick.outer !== false,
57802
+ noTransition: false,
57803
+ config,
57804
+ id,
57805
+ isSubAxes: true,
57806
+ owner: $$
57807
+ }).scale(scale).orient(orient).tickFormat(
57808
+ isFunction(tick.format) ? tick.format.bind($$.api) : ((x) => x)
56726
57809
  );
57810
+ isValue(tick.count) && axis.ticks(tick.count);
57811
+ tick.values && axis.tickValues(tick.values);
57812
+ axes.push(axis);
56727
57813
  });
56728
57814
  }
56729
57815
  this.axesList[id] = axes;
@@ -56747,10 +57833,11 @@ class Axis_Axis {
56747
57833
  const className = `${this.getAxisClassName(id)}-${i + 1}`;
56748
57834
  let g = main.select(`.${className.replace(/\s/, ".")}`);
56749
57835
  if (g.empty()) {
56750
- g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden").call(v);
57836
+ g = main.append("g").attr("class", className).style("visibility", config[`axis_${id}_show`] ? null : "hidden");
57837
+ v.create(g);
56751
57838
  } else {
56752
57839
  axesConfig[i].domain && scale.domain(axesConfig[i].domain);
56753
- $T(g).call(v.scale(scale));
57840
+ v.scale(scale).create($T(g));
56754
57841
  }
56755
57842
  g.attr("transform", $$.getTranslate(id, i + 1));
56756
57843
  });
@@ -56767,8 +57854,9 @@ class Axis_Axis {
56767
57854
  */
56768
57855
  setAxis(id, scale, outerTick, noTransition) {
56769
57856
  const $$ = this.owner;
56770
- if (id !== "subX") {
56771
- this.tick[id] = this.getTickValues(id);
57857
+ const type = Axis_getBaseAxisId(id);
57858
+ if (!isSubAxis(id)) {
57859
+ this.tick[type] = this.getTickValues(type);
56772
57860
  }
56773
57861
  this[id] = this.getAxis(
56774
57862
  id,
@@ -56784,7 +57872,7 @@ class Axis_Axis {
56784
57872
  const $$ = this.owner;
56785
57873
  const { config } = $$;
56786
57874
  const isX = /^(x|subX)$/.test(id);
56787
- const type = isX ? "x" : id;
57875
+ const type = Axis_getBaseAxisId(id);
56788
57876
  const isCategory = isX && this.isCategorized();
56789
57877
  const orient = this.orient[id];
56790
57878
  const tickTextRotate = noTickTextRotate ? 0 : $$.getAxisTickRotate(type);
@@ -56792,12 +57880,12 @@ class Axis_Axis {
56792
57880
  if (isX) {
56793
57881
  tickFormat = id === "subX" ? $$.format.subXAxisTick : $$.format.xAxisTick;
56794
57882
  } else {
56795
- const fn = config[`axis_${id}_tick_format`];
57883
+ const fn = isSubAxis(id) ? config[`subchart_axis_${type}_tick_format`] || config[`axis_${type}_tick_format`] : config[`axis_${type}_tick_format`];
56796
57884
  if (isFunction(fn)) {
56797
57885
  tickFormat = fn.bind($$.api);
56798
57886
  }
56799
57887
  }
56800
- let tickValues = this.tick[type];
57888
+ let tickValues = isSubAxis(id) ? this.getTickValues(type, true) : this.tick[type];
56801
57889
  const axisParams = mergeObj({
56802
57890
  outerTick,
56803
57891
  noTransition,
@@ -56826,7 +57914,7 @@ class Axis_Axis {
56826
57914
  }
56827
57915
  tickValues && axis.tickValues(tickValues);
56828
57916
  axis.tickFormat(
56829
- tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
57917
+ tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(type) && ((x) => `${x}%`))
56830
57918
  );
56831
57919
  if (isCategory) {
56832
57920
  axis.tickCentered(config.axis_x_tick_centered);
@@ -56834,7 +57922,7 @@ class Axis_Axis {
56834
57922
  config.axis_x_tick_culling = false;
56835
57923
  }
56836
57924
  }
56837
- const tickCount = config[`axis_${type}_tick_count`];
57925
+ const tickCount = Axis_getAxisTickOption(config, id, "count");
56838
57926
  tickCount && axis.ticks(tickCount);
56839
57927
  return axis;
56840
57928
  }
@@ -56843,24 +57931,31 @@ class Axis_Axis {
56843
57931
  const $$ = this.owner;
56844
57932
  const { config } = $$;
56845
57933
  const fit = config.axis_x_tick_fit;
56846
- let count = config.axis_x_tick_count;
56847
- let values;
56848
- if (fit) {
56849
- values = $$.mapTargetsToUniqueXs(targets);
56850
- if (this.isCategorized() && count > values.length) {
56851
- count = values.length;
56852
- }
56853
- values = this.generateTickValues(
56854
- values,
56855
- count,
56856
- this.isTimeSeries()
56857
- );
56858
- }
57934
+ const generateValues = (countOption = config.axis_x_tick_count) => {
57935
+ let count = countOption;
57936
+ let values2;
57937
+ if (fit) {
57938
+ values2 = $$.mapTargetsToUniqueXs(targets);
57939
+ if (this.isCategorized() && count > values2.length) {
57940
+ count = values2.length;
57941
+ }
57942
+ values2 = this.generateTickValues(
57943
+ values2,
57944
+ count,
57945
+ this.isTimeSeries()
57946
+ );
57947
+ }
57948
+ return values2;
57949
+ };
57950
+ const values = generateValues();
56859
57951
  if (axis) {
56860
57952
  axis.tickValues(values);
56861
57953
  } else if (this.x) {
57954
+ const subTickValues = this.getTickValues("x", true);
57955
+ const subTickCount = Axis_getAxisTickOption(config, "subX", "count");
57956
+ const subValues = subTickValues != null ? subTickValues : subTickCount !== config.axis_x_tick_count ? generateValues(subTickCount) : values;
56862
57957
  this.x.tickValues(values);
56863
- (_a = this.subX) == null ? void 0 : _a.tickValues(values);
57958
+ (_a = this.subX) == null ? void 0 : _a.tickValues(subValues);
56864
57959
  }
56865
57960
  return values;
56866
57961
  }
@@ -56890,11 +57985,12 @@ class Axis_Axis {
56890
57985
  }
56891
57986
  return isFunction(currFormat) ? (v) => currFormat.apply($$, isCategorized ? [v, $$.categoryName(v)] : [v]) : currFormat;
56892
57987
  }
56893
- getTickValues(id) {
57988
+ getTickValues(id, isSub = false) {
56894
57989
  const $$ = this.owner;
56895
- const tickValues = $$.config[`axis_${id}_tick_values`];
57990
+ const tickValues = isSub ? Axis_getAxisTickOption($$.config, `sub${capitalize(id)}`, "values") : $$.config[`axis_${id}_tick_values`];
57991
+ const values = isFunction(tickValues) ? tickValues.call($$.api) : tickValues;
56896
57992
  const axis = $$[`${id}Axis`];
56897
- return (isFunction(tickValues) ? tickValues.call($$.api) : tickValues) || (axis ? axis.tickValues() : void 0);
57993
+ return isSub ? values != null ? values : void 0 : values || (axis ? axis.tickValues() : void 0);
56898
57994
  }
56899
57995
  getLabelOptionByAxisId(id) {
56900
57996
  return this.owner.config[`axis_${id}_label`];
@@ -57329,14 +58425,21 @@ class Axis_Axis {
57329
58425
  generateTransitions(withTransition) {
57330
58426
  const $$ = this.owner;
57331
58427
  const { $el: { axis }, $T } = $$;
57332
- const [axisX, axisY, axisY2, axisSubX] = ["x", "y", "y2", "subX"].map((v) => $T(axis[v], withTransition));
57333
- return { axisX, axisY, axisY2, axisSubX };
58428
+ const [axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2] = [
58429
+ "x",
58430
+ "y",
58431
+ "y2",
58432
+ "subX",
58433
+ "subY",
58434
+ "subY2"
58435
+ ].map((v) => $T(axis[v], withTransition));
58436
+ return { axisX, axisY, axisY2, axisSubX, axisSubY, axisSubY2 };
57334
58437
  }
57335
58438
  redraw(transitions, isHidden, isInit) {
57336
58439
  const $$ = this.owner;
57337
58440
  const { config, state, $el } = $$;
57338
58441
  const opacity = isHidden ? "0" : null;
57339
- ["x", "y", "y2", "subX"].forEach((id) => {
58442
+ ["x", "y", "y2", "subX", "subY", "subY2"].forEach((id) => {
57340
58443
  const axis = this[id];
57341
58444
  const $axis = $el.axis[id];
57342
58445
  if (axis && $axis) {
@@ -57358,7 +58461,7 @@ class Axis_Axis {
57358
58461
  * @private
57359
58462
  */
57360
58463
  syncAxisDomains(targetsToShow, wth, flow) {
57361
- var _a, _b, _c;
58464
+ var _a;
57362
58465
  const $$ = this.owner;
57363
58466
  const { config, scale, $el } = $$;
57364
58467
  const hasZoom = !!scale.zoom;
@@ -57404,8 +58507,30 @@ class Axis_Axis {
57404
58507
  }
57405
58508
  });
57406
58509
  if (wth.Y) {
57407
- (_b = scale.subY) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y"));
57408
- (_c = scale.subY2) == null ? void 0 : _c.domain($$.getYDomain(targetsToShow, "y2"));
58510
+ const updateSubDomain = () => {
58511
+ var _a2, _b;
58512
+ (_a2 = scale.subY) == null ? void 0 : _a2.domain($$.getYDomain(targetsToShow, "y"));
58513
+ (_b = scale.subY2) == null ? void 0 : _b.domain($$.getYDomain(targetsToShow, "y2"));
58514
+ ["y", "y2"].forEach((key) => {
58515
+ const subAxisId = key === "y2" ? "subY2" : "subY";
58516
+ const axisScale = scale[subAxisId];
58517
+ const axis = $$.axis[subAxisId];
58518
+ const tickValues = this.getTickValues(key, true);
58519
+ const tickCount = Axis_getAxisTickOption(config, subAxisId, "count");
58520
+ if (!axisScale || !axis || tickValues || !tickCount) {
58521
+ return;
58522
+ }
58523
+ const domain = axisScale.domain();
58524
+ axis.tickValues(
58525
+ this.generateTickValues(
58526
+ domain,
58527
+ domain.every((v) => v === 0) ? 1 : tickCount,
58528
+ this.isTimeSeriesY()
58529
+ )
58530
+ );
58531
+ });
58532
+ };
58533
+ config.subchart_show ? $$.withSubchartTypeContext(updateSubDomain) : updateSubDomain();
57409
58534
  }
57410
58535
  }
57411
58536
  /**
@@ -57433,20 +58558,18 @@ class Axis_Axis {
57433
58558
  setCulling() {
57434
58559
  const $$ = this.owner;
57435
58560
  const { config, state: { clip, current }, $el } = $$;
57436
- ["subX", "x", "y", "y2"].forEach((type) => {
58561
+ ["subX", "x", "y", "y2", "subY", "subY2"].forEach((type) => {
57437
58562
  const axis = $el.axis[type];
57438
- const id = type === "subX" ? "x" : type;
57439
- const cullingOptionPrefix = `axis_${id}_tick_culling`;
57440
- const toCull = config[cullingOptionPrefix];
58563
+ const toCull = Axis_getAxisTickOption(config, type, "culling");
57441
58564
  if (axis && toCull) {
57442
58565
  const tickNodes = axis.selectAll(".tick");
57443
58566
  const tickValues = sortValue(
57444
58567
  tickNodes.data(),
57445
- !config[`${cullingOptionPrefix}_reverse`]
58568
+ !Axis_getAxisTickOption(config, type, "culling_reverse")
57446
58569
  );
57447
58570
  const tickSize = tickValues.length;
57448
- const cullingMax = config[`${cullingOptionPrefix}_max`];
57449
- const lines = config[`${cullingOptionPrefix}_lines`];
58571
+ const cullingMax = Axis_getAxisTickOption(config, type, "culling_max");
58572
+ const lines = Axis_getAxisTickOption(config, type, "culling_lines");
57450
58573
  const cullTickLine = !lines || _hasOverlappedTickLineIntervals(
57451
58574
  this[type],
57452
58575
  tickValues,
@@ -57766,7 +58889,7 @@ var eventrect_pow = Math.pow;
57766
58889
  * @private
57767
58890
  */
57768
58891
  selectRectForSingle(context, index) {
57769
- var _a, _b, _c, _d;
58892
+ var _a, _b, _c, _d, _e, _f, _g;
57770
58893
  const $$ = this;
57771
58894
  const { config, state, $el: { main, circle } } = $$;
57772
58895
  const isSelectionEnabled = config.data_selection_enabled;
@@ -57777,6 +58900,7 @@ var eventrect_pow = Math.pow;
57777
58900
  if (isTooltipGrouped) {
57778
58901
  $$.showTooltip(selectedData, context);
57779
58902
  (_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
58903
+ (_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
57780
58904
  if (!isSelectionEnabled || isSelectionGrouped) {
57781
58905
  return;
57782
58906
  }
@@ -57789,7 +58913,7 @@ var eventrect_pow = Math.pow;
57789
58913
  return $$.isWithinShape(this, d);
57790
58914
  });
57791
58915
  shapeAtIndex.call((selected) => {
57792
- var _a2, _b2;
58916
+ var _a2, _b2, _c2;
57793
58917
  const d = selected.data();
57794
58918
  if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(d)))) {
57795
58919
  context.style.cursor = "pointer";
@@ -57797,7 +58921,8 @@ var eventrect_pow = Math.pow;
57797
58921
  if (!isTooltipGrouped) {
57798
58922
  $$.showTooltip(d, context);
57799
58923
  (_a2 = $$.showGridFocus) == null ? void 0 : _a2.call($$, d);
57800
- (_b2 = $$.unexpandCircles) == null ? void 0 : _b2.call($$);
58924
+ (_b2 = $$.showSubchartGridFocus) == null ? void 0 : _b2.call($$, d);
58925
+ (_c2 = $$.unexpandCircles) == null ? void 0 : _c2.call($$);
57801
58926
  selected.each((d2) => $$.setExpand(index, d2.id));
57802
58927
  }
57803
58928
  });
@@ -57822,14 +58947,16 @@ var eventrect_pow = Math.pow;
57822
58947
  }
57823
58948
  }
57824
58949
  $$.showTooltip([closest], context);
57825
- (_b = $$.showGridFocus) == null ? void 0 : _b.call($$, [closest]);
57826
- (_c = $$.unexpandCircles) == null ? void 0 : _c.call($$);
58950
+ (_c = $$.showGridFocus) == null ? void 0 : _c.call($$, [closest]);
58951
+ (_d = $$.showSubchartGridFocus) == null ? void 0 : _d.call($$, [closest]);
58952
+ (_e = $$.unexpandCircles) == null ? void 0 : _e.call($$);
57827
58953
  $$.setExpand(index, closest.id, true);
57828
58954
  if (isSelectionEnabled && (isSelectionGrouped || (isSelectable == null ? void 0 : isSelectable.bind($$.api)(closest)))) {
57829
58955
  context.style.cursor = "pointer";
57830
58956
  }
57831
58957
  } else if (config.interaction_onout) {
57832
- (_d = $$.hideGridFocus) == null ? void 0 : _d.call($$);
58958
+ (_f = $$.hideGridFocus) == null ? void 0 : _f.call($$);
58959
+ (_g = $$.hideSubchartGridFocus) == null ? void 0 : _g.call($$);
57833
58960
  $$.hideTooltip();
57834
58961
  !isSelectionGrouped && $$.setExpand(index);
57835
58962
  }
@@ -57842,7 +58969,7 @@ var eventrect_pow = Math.pow;
57842
58969
  * @private
57843
58970
  */
57844
58971
  selectRectForMultipleXs(context, triggerEvent = true) {
57845
- var _a;
58972
+ var _a, _b;
57846
58973
  const $$ = this;
57847
58974
  const { config, state } = $$;
57848
58975
  const targetsToShow = $$.getTargetsToShow();
@@ -57864,6 +58991,7 @@ var eventrect_pow = Math.pow;
57864
58991
  $$.showTooltip(selectedData, context);
57865
58992
  $$.setExpand(closest.index, closest.id, true);
57866
58993
  (_a = $$.showGridFocus) == null ? void 0 : _a.call($$, selectedData);
58994
+ (_b = $$.showSubchartGridFocus) == null ? void 0 : _b.call($$, selectedData);
57867
58995
  const dist = $$.dist(closest, mouse);
57868
58996
  if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
57869
58997
  $$.$el.eventRect.style("cursor", "pointer");
@@ -57878,7 +59006,7 @@ var eventrect_pow = Math.pow;
57878
59006
  * @private
57879
59007
  */
57880
59008
  unselectRect() {
57881
- var _a, _b, _c;
59009
+ var _a, _b, _c, _d;
57882
59010
  const $$ = this;
57883
59011
  const { state, $el: { circle, tooltip } } = $$;
57884
59012
  state._lastTooltipMouse = null;
@@ -57889,6 +59017,7 @@ var eventrect_pow = Math.pow;
57889
59017
  }
57890
59018
  (_b = $$.$el.eventRect) == null ? void 0 : _b.style("cursor", null);
57891
59019
  (_c = $$.hideGridFocus) == null ? void 0 : _c.call($$);
59020
+ (_d = $$.hideSubchartGridFocus) == null ? void 0 : _d.call($$);
57892
59021
  if (tooltip) {
57893
59022
  $$.hideTooltip();
57894
59023
  $$._handleLinkedCharts(false);
@@ -57926,6 +59055,7 @@ var eventrect_pow = Math.pow;
57926
59055
  $$.updateEventRect();
57927
59056
  Object.values($$.$el.axisTooltip).forEach((v) => v == null ? void 0 : v.style("display", null));
57928
59057
  }).on("mousemove", function(event) {
59058
+ var _a;
57929
59059
  const d = getData(event);
57930
59060
  state.event = event;
57931
59061
  if (!d) {
@@ -57943,7 +59073,7 @@ var eventrect_pow = Math.pow;
57943
59073
  index += 1;
57944
59074
  }
57945
59075
  }
57946
- $$.showAxisGridFocus();
59076
+ (_a = $$.showAxisGridFocus) == null ? void 0 : _a.call($$);
57947
59077
  const eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
57948
59078
  if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
57949
59079
  if (config.tooltip_show && eventOnSameIdx) {
@@ -57963,11 +59093,12 @@ var eventrect_pow = Math.pow;
57963
59093
  index === -1 ? $$.unselectRect() : $$.selectRectForSingle(this, index);
57964
59094
  $$.setOverOut(index !== -1, index);
57965
59095
  }).on("mouseout", (event) => {
59096
+ var _a;
57966
59097
  state.event = event;
57967
59098
  if (!$$.config || $$.hasArcType() || eventReceiver.currentIdx === -1 || !config.interaction_onout) {
57968
59099
  return;
57969
59100
  }
57970
- $$.hideAxisGridFocus();
59101
+ (_a = $$.hideAxisGridFocus) == null ? void 0 : _a.call($$);
57971
59102
  $$.unselectRect();
57972
59103
  $$.setOverOut(false, eventReceiver.currentIdx);
57973
59104
  eventReceiver.currentIdx = -1;
@@ -59521,6 +60652,18 @@ var eventrect_pow = Math.pow;
59521
60652
 
59522
60653
  ;// ./src/config/Options/axis/y2.ts
59523
60654
  /* harmony default export */ var y2 = ({
60655
+ /**
60656
+ * Set clip-path attribute for y2 axis element
60657
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
60658
+ * @name axis․y2․clipPath
60659
+ * @memberof Options
60660
+ * @type {boolean}
60661
+ * @default true
60662
+ * @example
60663
+ * // don't set 'clip-path' attribute
60664
+ * clipPath: false
60665
+ */
60666
+ axis_y2_clipPath: true,
59524
60667
  /**
59525
60668
  * Show or hide y2 axis.
59526
60669
  * - **NOTE**:
@@ -60019,7 +61162,7 @@ var axis_spreadValues = (a, b) => {
60019
61162
 
60020
61163
 
60021
61164
 
60022
- /* harmony default export */ var Options_axis_axis = (axis_spreadValues(axis_spreadValues(axis_spreadValues({
61165
+ /* harmony default export */ var axis_axis = (axis_spreadValues(axis_spreadValues(axis_spreadValues({
60023
61166
  /**
60024
61167
  * Setup the way to evaluate tick text size.
60025
61168
  * - **NOTE:**
@@ -60300,7 +61443,7 @@ const internal = {
60300
61443
  };
60301
61444
  const options = {
60302
61445
  optDataAxis: data_axis,
60303
- optAxis: Options_axis_axis
61446
+ optAxis: axis_axis
60304
61447
  };
60305
61448
 
60306
61449
  ;// ./src/config/resolver/axis.core.ts
@@ -60451,28 +61594,51 @@ function _getConnectLineType(id) {
60451
61594
  const { bar } = isSub ? $$.$el.subchart : $$.$el;
60452
61595
  const barPath = [];
60453
61596
  const connectLineCache = /* @__PURE__ */ new Map();
60454
- return [
60455
- $$.$T(bar, withTransition, getRandom()).attr("d", function(d, i, arr) {
60456
- const path = (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d, i);
60457
- let connectLineType = connectLineCache.get(d.id);
60458
- if (connectLineType === void 0) {
60459
- connectLineType = _getConnectLineType.call($$, d.id);
60460
- connectLineCache.set(d.id, connectLineType);
60461
- }
60462
- if (path.length > 1) {
60463
- barPath.push(path[1]);
60464
- }
60465
- if (i === arr.length - 1 && barPath.length) {
60466
- const barConnectLineNode = $$.$T(
60467
- src_select(this.parentNode.querySelector(`.${$BAR.barConnectLine}`)),
60468
- withTransition,
60469
- getRandom()
60470
- );
60471
- $$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
60472
- barPath.splice(0);
61597
+ const getRadius = getBarRadiusResolver($$);
61598
+ const barColor = $$.generateUpdateBarColor();
61599
+ const getBarPath = function(d, i, arr) {
61600
+ var _a;
61601
+ const isDrawable = isNumber(d.value) || $$.isBarRangeType(d) || ((_a = $$.isSubchartCandlestickBarValue) == null ? void 0 : _a.call($$, d, isSub));
61602
+ const path = isDrawable ? drawFn(d, i) : [""];
61603
+ let connectLineType = connectLineCache.get(d.id);
61604
+ if (connectLineType === void 0) {
61605
+ connectLineType = _getConnectLineType.call($$, d.id);
61606
+ connectLineCache.set(d.id, connectLineType);
61607
+ }
61608
+ if (path.length > 1) {
61609
+ barPath.push(path[1]);
61610
+ }
61611
+ if (i === arr.length - 1 && barPath.length) {
61612
+ const barConnectLineNode = $$.$T(
61613
+ src_select(
61614
+ this.parentNode.querySelector(`.${$BAR.barConnectLine}`)
61615
+ ),
61616
+ withTransition,
61617
+ getRandom()
61618
+ );
61619
+ $$.updateConnectLine(barConnectLineNode, connectLineType, barPath);
61620
+ barPath.splice(0);
61621
+ }
61622
+ return path[0];
61623
+ };
61624
+ const barTransition = $$.$T(bar, withTransition, getRandom());
61625
+ if (getRadius && typeof barTransition.attrTween === "function") {
61626
+ barTransition.attrTween(
61627
+ "d",
61628
+ function(d, i, arr) {
61629
+ var _a;
61630
+ const target = getBarPath.call(this, d, i, arr);
61631
+ return getBarPathInterpolator((_a = this.getAttribute("d")) != null ? _a : "", target);
60473
61632
  }
60474
- return path[0];
60475
- }).style("fill", $$.generateUpdateBarColor()).style("clip-path", (d) => d.clipPath).style("opacity", null)
61633
+ );
61634
+ } else {
61635
+ barTransition.attr("d", getBarPath);
61636
+ }
61637
+ return [
61638
+ barTransition.style("fill", (d) => {
61639
+ var _a;
61640
+ return ((_a = $$.getSubchartCandlestickBarColor) == null ? void 0 : _a.call($$, d, isSub)) || barColor(d);
61641
+ }).style("clip-path", (d) => d.clipPath).style("opacity", null)
60476
61642
  ];
60477
61643
  },
60478
61644
  /**
@@ -60906,7 +62072,7 @@ var candlestick_spreadValues = (a, b) => {
60906
62072
  const shapeOffset = $$.getShapeOffset($$.isCandlestickType, indices, !!isSub);
60907
62073
  const yScale = $$.getYScaleById.bind($$);
60908
62074
  return (d, i) => {
60909
- const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
62075
+ const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id, isSub));
60910
62076
  const offset = shapeOffset(d, i) || y0;
60911
62077
  const width = isNumber(barW) ? barW : barW[d.id] || barW._$width;
60912
62078
  const value = $$.getCandlestickData(d);
@@ -62789,7 +63955,6 @@ var funnel_spreadValues = (a, b) => {
62789
63955
 
62790
63956
 
62791
63957
 
62792
-
62793
63958
  function _getSize(checkNeck = false) {
62794
63959
  const $$ = this;
62795
63960
  const { config, state: { current: { width, height } } } = $$;
@@ -63022,7 +64187,7 @@ function _getSplineClipPath() {
63022
64187
  },
63023
64188
  /**
63024
64189
  * Generate funnel coordinate points data for text labels
63025
- * @returns {(d: IDataRow) => [number, number][]} Point getter function
64190
+ * @returns {function(IDataRow): Array.<Array.<number>>} Point getter function
63026
64191
  * @private
63027
64192
  */
63028
64193
  generateGetFunnelPoints() {
@@ -63238,7 +64403,7 @@ let funnel_funnel = () => (extendArc([funnel], [shape_funnel]), (funnel_funnel =
63238
64403
  * @property {number} [gauge.expand.rate=0.98] Set expand rate.
63239
64404
  * @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
63240
64405
  * @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
63241
- * - **Note:** Only works for single data series.
64406
+ * - **Note:** Applies only to unstacked/multi-arc gauges; stacked gauge data is not supported.
63242
64407
  * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
63243
64408
  * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
63244
64409
  * @property {number} [gauge.min=0] Set min value of the gauge.
@@ -64998,7 +66163,7 @@ ${percentValue}%`;
64998
66163
  * - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
64999
66164
  * - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
65000
66165
  * - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
65001
- * - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
66166
+ * - squarify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
65002
66167
  * - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
65003
66168
  * @property {function} [treemap.label.format] Set formatter for the label text.<br>
65004
66169
  * - **Arguments:**
@@ -65011,7 +66176,7 @@ ${percentValue}%`;
65011
66176
  * @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
65012
66177
  * @example
65013
66178
  * treemap: {
65014
- * // "binary", "dice", "slice", "sliceDice", "squrify", "resquarify"
66179
+ * // "binary", "dice", "slice", "sliceDice", "squarify", "resquarify"
65015
66180
  * tile: "dice",
65016
66181
  *
65017
66182
  * label: {
@@ -65092,7 +66257,7 @@ const bb = {
65092
66257
  * bb.version; // "1.0.0"
65093
66258
  * @memberof bb
65094
66259
  */
65095
- version: "4.0.3",
66260
+ version: "4.1.0-next.2",
65096
66261
  /**
65097
66262
  * Generate chart
65098
66263
  * - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when: