billboard.js 4.0.0-next.3 → 4.0.0

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 (228) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +240 -149
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +20 -20
  5. package/dist/billboard.pkgd.js +240 -149
  6. package/dist/billboard.pkgd.min.js +27 -27
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +11 -13
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  11. package/dist/plugin/billboardjs-plugin-stanford.js +11 -13
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
  13. package/dist/plugin/billboardjs-plugin-tableview.js +28 -15
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +11 -13
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +9 -9
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +11 -13
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +28 -15
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +6 -6
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/Chart/Chart.js +1 -1
  38. package/dist-esm/Chart/api/axis.js +1 -1
  39. package/dist-esm/Chart/api/category.js +1 -1
  40. package/dist-esm/Chart/api/chart.js +1 -1
  41. package/dist-esm/Chart/api/color.js +1 -1
  42. package/dist-esm/Chart/api/data.js +1 -1
  43. package/dist-esm/Chart/api/export.js +1 -1
  44. package/dist-esm/Chart/api/flow.js +1 -1
  45. package/dist-esm/Chart/api/focus.js +1 -1
  46. package/dist-esm/Chart/api/grid.js +1 -1
  47. package/dist-esm/Chart/api/group.js +1 -1
  48. package/dist-esm/Chart/api/legend.js +1 -1
  49. package/dist-esm/Chart/api/load.js +1 -1
  50. package/dist-esm/Chart/api/regions.js +1 -1
  51. package/dist-esm/Chart/api/selection.js +1 -1
  52. package/dist-esm/Chart/api/show.js +1 -1
  53. package/dist-esm/Chart/api/stubs.js +53 -0
  54. package/dist-esm/Chart/api/subchart.js +2 -2
  55. package/dist-esm/Chart/api/tooltip.js +1 -1
  56. package/dist-esm/Chart/api/x.js +1 -1
  57. package/dist-esm/Chart/api/zoom.js +2 -2
  58. package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
  59. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +149 -96
  60. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  61. package/dist-esm/ChartInternal/ChartInternal.js +8 -4
  62. package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
  63. package/dist-esm/ChartInternal/data/convert.js +1 -1
  64. package/dist-esm/ChartInternal/data/data.js +1 -1
  65. package/dist-esm/ChartInternal/data/load.js +1 -1
  66. package/dist-esm/ChartInternal/interactions/drag.js +1 -1
  67. package/dist-esm/ChartInternal/interactions/eventrect.js +2 -2
  68. package/dist-esm/ChartInternal/interactions/flow.js +1 -1
  69. package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
  70. package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
  71. package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
  72. package/dist-esm/ChartInternal/internals/category.js +1 -1
  73. package/dist-esm/ChartInternal/internals/class.js +1 -1
  74. package/dist-esm/ChartInternal/internals/clip.js +1 -1
  75. package/dist-esm/ChartInternal/internals/color.js +1 -1
  76. package/dist-esm/ChartInternal/internals/domain.js +1 -1
  77. package/dist-esm/ChartInternal/internals/format.js +1 -1
  78. package/dist-esm/ChartInternal/internals/grid.js +1 -1
  79. package/dist-esm/ChartInternal/internals/legend.js +1 -1
  80. package/dist-esm/ChartInternal/internals/redraw.js +1 -1
  81. package/dist-esm/ChartInternal/internals/region.js +1 -1
  82. package/dist-esm/ChartInternal/internals/scale.js +1 -1
  83. package/dist-esm/ChartInternal/internals/selection.js +1 -1
  84. package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
  85. package/dist-esm/ChartInternal/internals/size.js +1 -1
  86. package/dist-esm/ChartInternal/internals/style.js +1 -1
  87. package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
  88. package/dist-esm/ChartInternal/internals/text.js +1 -1
  89. package/dist-esm/ChartInternal/internals/text.util.js +1 -1
  90. package/dist-esm/ChartInternal/internals/title.js +1 -1
  91. package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
  92. package/dist-esm/ChartInternal/internals/transform.js +1 -1
  93. package/dist-esm/ChartInternal/internals/type.js +1 -1
  94. package/dist-esm/ChartInternal/shape/arc.js +1 -1
  95. package/dist-esm/ChartInternal/shape/area.js +1 -1
  96. package/dist-esm/ChartInternal/shape/bar.js +1 -1
  97. package/dist-esm/ChartInternal/shape/bubble.js +1 -1
  98. package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
  99. package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
  100. package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
  101. package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
  102. package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
  103. package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
  104. package/dist-esm/ChartInternal/shape/core/path.js +1 -1
  105. package/dist-esm/ChartInternal/shape/core/point.js +1 -1
  106. package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
  107. package/dist-esm/ChartInternal/shape/funnel.js +1 -1
  108. package/dist-esm/ChartInternal/shape/gauge.js +1 -1
  109. package/dist-esm/ChartInternal/shape/line.js +1 -1
  110. package/dist-esm/ChartInternal/shape/point.js +1 -1
  111. package/dist-esm/ChartInternal/shape/polar.js +1 -1
  112. package/dist-esm/ChartInternal/shape/radar.js +1 -1
  113. package/dist-esm/ChartInternal/shape/shape.js +6 -4
  114. package/dist-esm/ChartInternal/shape/treemap.js +1 -1
  115. package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
  116. package/dist-esm/canvas/CanvasEngine.js +18 -5
  117. package/dist-esm/canvas/CanvasPainter.js +1 -1
  118. package/dist-esm/canvas/CanvasRenderer.js +58 -35
  119. package/dist-esm/canvas/CanvasTheme.js +1 -1
  120. package/dist-esm/canvas/HitDetector.js +1 -1
  121. package/dist-esm/canvas/axisTicks.js +1 -1
  122. package/dist-esm/canvas/classes.js +1 -1
  123. package/dist-esm/canvas/color.js +1 -1
  124. package/dist-esm/canvas/geometry.js +1 -1
  125. package/dist-esm/canvas/labels.js +1 -1
  126. package/dist-esm/canvas/pointPattern.js +1 -1
  127. package/dist-esm/canvas/util.js +1 -1
  128. package/dist-esm/config/Options/Options.js +1 -1
  129. package/dist-esm/config/Options/axis/axis.js +1 -1
  130. package/dist-esm/config/Options/axis/x.js +1 -1
  131. package/dist-esm/config/Options/axis/y.js +1 -1
  132. package/dist-esm/config/Options/axis/y2.js +1 -13
  133. package/dist-esm/config/Options/common/boost.js +1 -1
  134. package/dist-esm/config/Options/common/color.js +1 -1
  135. package/dist-esm/config/Options/common/grid.js +1 -1
  136. package/dist-esm/config/Options/common/legend.js +1 -1
  137. package/dist-esm/config/Options/common/main.js +1 -1
  138. package/dist-esm/config/Options/common/point.js +1 -1
  139. package/dist-esm/config/Options/common/title.js +1 -1
  140. package/dist-esm/config/Options/common/tooltip.js +1 -1
  141. package/dist-esm/config/Options/data/axis.js +1 -1
  142. package/dist-esm/config/Options/data/data.js +1 -1
  143. package/dist-esm/config/Options/data/selection.js +1 -1
  144. package/dist-esm/config/Options/interaction/interaction.js +1 -1
  145. package/dist-esm/config/Options/interaction/subchart.js +1 -1
  146. package/dist-esm/config/Options/interaction/zoom.js +1 -1
  147. package/dist-esm/config/Options/shape/arc.js +1 -1
  148. package/dist-esm/config/Options/shape/area.js +1 -1
  149. package/dist-esm/config/Options/shape/bar.js +1 -1
  150. package/dist-esm/config/Options/shape/bubble.js +1 -1
  151. package/dist-esm/config/Options/shape/candlestick.js +1 -1
  152. package/dist-esm/config/Options/shape/donut.js +1 -1
  153. package/dist-esm/config/Options/shape/funnel.js +1 -1
  154. package/dist-esm/config/Options/shape/gauge.js +1 -1
  155. package/dist-esm/config/Options/shape/line.js +1 -1
  156. package/dist-esm/config/Options/shape/pie.js +1 -1
  157. package/dist-esm/config/Options/shape/polar.js +1 -1
  158. package/dist-esm/config/Options/shape/radar.js +1 -1
  159. package/dist-esm/config/Options/shape/scatter.js +1 -1
  160. package/dist-esm/config/Options/shape/spline.js +1 -1
  161. package/dist-esm/config/Options/shape/treemap.js +1 -1
  162. package/dist-esm/config/Store/Element.js +1 -1
  163. package/dist-esm/config/Store/State.js +1 -1
  164. package/dist-esm/config/Store/Store.js +1 -1
  165. package/dist-esm/config/classes.js +1 -1
  166. package/dist-esm/config/config.js +1 -1
  167. package/dist-esm/config/const.js +17 -2
  168. package/dist-esm/config/resolver/axis.core.js +1 -1
  169. package/dist-esm/config/resolver/axis.js +1 -1
  170. package/dist-esm/config/resolver/canvas.js +1 -1
  171. package/dist-esm/config/resolver/canvasShape.js +1 -1
  172. package/dist-esm/config/resolver/category.js +1 -1
  173. package/dist-esm/config/resolver/export.js +1 -1
  174. package/dist-esm/config/resolver/flow.js +1 -1
  175. package/dist-esm/config/resolver/grid.js +1 -1
  176. package/dist-esm/config/resolver/interaction/selection.js +1 -1
  177. package/dist-esm/config/resolver/interaction/subchart.js +1 -1
  178. package/dist-esm/config/resolver/interaction/zoom.js +1 -1
  179. package/dist-esm/config/resolver/regions.js +1 -1
  180. package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
  181. package/dist-esm/config/resolver/shape/area.js +1 -1
  182. package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
  183. package/dist-esm/config/resolver/shape/bar.js +1 -1
  184. package/dist-esm/config/resolver/shape/bubble.js +1 -1
  185. package/dist-esm/config/resolver/shape/candlestick.js +1 -1
  186. package/dist-esm/config/resolver/shape/donut.js +1 -1
  187. package/dist-esm/config/resolver/shape/funnel.js +1 -1
  188. package/dist-esm/config/resolver/shape/gauge.js +1 -1
  189. package/dist-esm/config/resolver/shape/line.js +1 -1
  190. package/dist-esm/config/resolver/shape/pie.js +1 -1
  191. package/dist-esm/config/resolver/shape/polar.js +1 -1
  192. package/dist-esm/config/resolver/shape/radar.js +1 -1
  193. package/dist-esm/config/resolver/shape/scatter.js +1 -1
  194. package/dist-esm/config/resolver/shape/treemap.js +1 -1
  195. package/dist-esm/core.js +3 -3
  196. package/dist-esm/index.canvas.js +2 -1
  197. package/dist-esm/index.esm.js +2 -1
  198. package/dist-esm/module/Cache.js +1 -1
  199. package/dist-esm/module/browser.js +1 -1
  200. package/dist-esm/module/dsv.js +1 -1
  201. package/dist-esm/module/error.js +16 -3
  202. package/dist-esm/module/generator.js +1 -1
  203. package/dist-esm/module/sanitize.js +14 -18
  204. package/dist-esm/module/util/brush.js +1 -1
  205. package/dist-esm/module/util/dom.js +1 -1
  206. package/dist-esm/module/util/object.js +7 -4
  207. package/dist-esm/module/util/type-checks.js +1 -1
  208. package/dist-esm/module/worker.js +32 -22
  209. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  210. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  211. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  212. package/dist-esm/plugin/billboardjs-plugin-tableview.js +32 -21
  213. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  214. package/package.json +37 -11
  215. package/src/ChartInternal/Axis/AxisRenderer.ts +179 -105
  216. package/src/ChartInternal/ChartInternal.ts +11 -3
  217. package/src/ChartInternal/interactions/eventrect.ts +3 -1
  218. package/src/ChartInternal/shape/shape.ts +5 -3
  219. package/src/Plugin/tableview/Options.ts +17 -1
  220. package/src/Plugin/tableview/index.ts +1 -1
  221. package/src/canvas/CanvasEngine.ts +18 -5
  222. package/src/canvas/CanvasRenderer.ts +71 -36
  223. package/src/config/Options/axis/y2.ts +0 -13
  224. package/src/module/sanitize.ts +13 -20
  225. package/src/module/util/object.ts +4 -2
  226. package/src/module/worker.ts +34 -24
  227. package/types/index.d.ts +0 -3
  228. package/types/plugin/tableview/options.d.ts +5 -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $COMMON } from '../../config/classes.js';
@@ -25,6 +25,45 @@ class AxisRenderer {
25
25
  params;
26
26
  g;
27
27
  generatedTicks = [];
28
+ canReuseTickTextOnResize(isLeftRight) {
29
+ const { config, params } = this;
30
+ const { config: chartConfig, id, owner } = params;
31
+ const isX = /^(x|subX)$/.test(id);
32
+ const type = id === "subX" ? "x" : id;
33
+ const customTickFormat = id === "subX" ?
34
+ chartConfig.subchart_axis_x_tick_format || chartConfig.axis_x_tick_format :
35
+ chartConfig[`axis_${type}_tick_format`];
36
+ const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight &&
37
+ !(params.tickWidth > 0);
38
+ return !!(owner.state.resizing &&
39
+ !owner.state.flowing &&
40
+ !isFunction(chartConfig.axis_evalTextSize) &&
41
+ !customTickFormat &&
42
+ !params.tickTitle &&
43
+ !(isX && chartConfig.axis_x_tick_autorotate) &&
44
+ !categoryAutoWrap &&
45
+ config.withoutTransition);
46
+ }
47
+ canReuseTickNodesOnResize(tickNodes, ticks, isLeftRight, tickShow) {
48
+ if (tickShow.tick || !tickShow.text || !this.canReuseTickTextOnResize(isLeftRight) ||
49
+ tickNodes.size() !== ticks.length) {
50
+ return false;
51
+ }
52
+ const nodes = tickNodes.nodes();
53
+ for (let i = 0; i < ticks.length; i++) {
54
+ const current = nodes[i].__data__;
55
+ const next = ticks[i];
56
+ if (current instanceof Date || next instanceof Date) {
57
+ if (+current !== +next) {
58
+ return false;
59
+ }
60
+ }
61
+ else if (current !== next) {
62
+ return false;
63
+ }
64
+ }
65
+ return true;
66
+ }
28
67
  constructor(params = {}) {
29
68
  const config = {
30
69
  innerTickSize: AXIS_TICK_SIZE,
@@ -111,106 +150,121 @@ class AxisRenderer {
111
150
  // set generated ticks
112
151
  ctx.generatedTicks = ticks;
113
152
  // update selection
114
- let tick = g.selectAll(".tick")
115
- .data(ticks, scale1);
116
- // enter selection
117
- const tickEnter = tick
118
- .enter()
119
- .insert("g", ".domain")
120
- .attr("class", "tick");
121
- // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks.
122
- const tickExit = tick.exit().remove();
123
- // enter + update selection
124
- tick = tickEnter.merge(tick);
125
- tickShow.tick && tickEnter.append("line");
126
- tickShow.text && tickEnter.append("text");
127
- const tickText = tick.select("text");
128
- const counts = [];
129
- let sizeFor1Char = { w: 0, h: 0 };
130
- if (isFunction(evalTextSize)) {
131
- // set evalTextSize to dummy axis element to be used in .getMaxTickSize()
132
- sizeFor1Char = evalTextSize.bind(ctx.params.owner.api)(tickText.node(), id);
133
- if (this.classList.contains($COMMON.dummy)) {
134
- this.sizeFor1Char = sizeFor1Char;
135
- }
136
- }
137
- if (!sizeFor1Char || sizeFor1Char.w === 0 || sizeFor1Char.h === 0) {
138
- sizeFor1Char = ctx.helper.getSizeFor1Char(orient, tickText, !!evalTextSize);
153
+ let tick = g.selectAll(".tick");
154
+ const canReuseTickNodes = ctx.canReuseTickNodesOnResize(tick, ticks, isLeftRight || params.config.axis_rotated, tickShow);
155
+ if (canReuseTickNodes) {
156
+ tickTransform(tick, scale1);
139
157
  }
140
- let tspan = tickText
141
- .selectAll("tspan")
142
- .data((d, index) => {
143
- let split;
144
- if (params.tickMultiline) {
145
- split = splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w);
158
+ else {
159
+ tick = tick.data(ticks, scale1);
160
+ // enter selection
161
+ const tickEnter = tick
162
+ .enter()
163
+ .insert("g", ".domain")
164
+ .attr("class", "tick");
165
+ // MEMO: No exit transition. The reason is this transition affects max tick width calculation because old tick will be included in the ticks.
166
+ const tickExit = tick.exit().remove();
167
+ // enter + update selection
168
+ tick = tickEnter.merge(tick);
169
+ tickShow.tick && tickEnter.append("line");
170
+ tickShow.text && tickEnter.append("text");
171
+ const hasTickChange = !tickEnter.empty() || !tickExit.empty();
172
+ const reuseTickText = tickShow.text && !hasTickChange &&
173
+ ctx.canReuseTickTextOnResize(isLeftRight || params.config.axis_rotated);
174
+ let sizeFor1Char = { w: 0, h: 0 };
175
+ let textUpdate = tick.selectAll("text.__bb-empty");
176
+ if (tickShow.text && !reuseTickText) {
177
+ const tickText = tick.select("text");
178
+ const counts = [];
179
+ textUpdate = tickText;
180
+ if (isFunction(evalTextSize)) {
181
+ // set evalTextSize to dummy axis element to be used in .getMaxTickSize()
182
+ sizeFor1Char = evalTextSize.bind(ctx.params.owner.api)(tickText.node(), id);
183
+ if (this.classList.contains($COMMON.dummy)) {
184
+ this.sizeFor1Char = sizeFor1Char;
185
+ }
186
+ }
187
+ if (!sizeFor1Char || sizeFor1Char.w === 0 || sizeFor1Char.h === 0) {
188
+ sizeFor1Char = ctx.helper.getSizeFor1Char(orient, tickText, !!evalTextSize);
189
+ }
190
+ let tspan = tickText
191
+ .selectAll("tspan")
192
+ .data((d, index) => {
193
+ let split;
194
+ if (params.tickMultiline) {
195
+ split = splitTickText(d, scale1, ticks, isLeftRight, sizeFor1Char.w);
196
+ }
197
+ else {
198
+ const formatted = helper.textFormatted(d);
199
+ split = isArray(formatted) ? formatted.concat() : [formatted];
200
+ }
201
+ counts[index] = split.length;
202
+ return split.map(splitted => ({ index, splitted }));
203
+ });
204
+ tspan.exit().remove();
205
+ tspan = tspan
206
+ .enter()
207
+ .append("tspan")
208
+ .merge(tspan)
209
+ .text(d => d.splitted);
210
+ // set <tspan>'s position
211
+ tspan
212
+ .attr("x", isTopBottom ? 0 : tickLength * sign)
213
+ .attr("dx", (() => {
214
+ let dx = 0;
215
+ if (/(top|bottom)/.test(orient) && rotate) {
216
+ dx = 8 * Math.sin(Math.PI * (rotate / 180)) *
217
+ (orient === "top" ? -1 : 1);
218
+ }
219
+ return dx + (tickTextPos.x || 0);
220
+ })())
221
+ .attr("dy", (d, i) => {
222
+ const defValue = ".71em";
223
+ let dy = 0;
224
+ if (orient !== "top") {
225
+ dy = sizeFor1Char.h;
226
+ if (i === 0) {
227
+ dy = isLeftRight ?
228
+ -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) :
229
+ (tickTextPos.y === 0 ? defValue : 0);
230
+ }
231
+ }
232
+ return isNumber(dy) && tickTextPos.y ?
233
+ dy + tickTextPos.y :
234
+ dy || defValue;
235
+ });
146
236
  }
147
- else {
148
- const formatted = helper.textFormatted(d);
149
- split = isArray(formatted) ? formatted.concat() : [formatted];
237
+ const lineUpdate = tick.select("line");
238
+ tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
239
+ tickEnter.select("text").attr(axisPx, tickLength * sign);
240
+ ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
241
+ // Append <title> for tooltip display
242
+ if (params.tickTitle) {
243
+ const title = textUpdate.select("title");
244
+ const tickTitle = params.tickTitle;
245
+ (title.empty() ? textUpdate.append("title") : title)
246
+ .text(index => tickTitle[Number(index)]);
150
247
  }
151
- counts[index] = split.length;
152
- return split.map(splitted => ({ index, splitted }));
153
- });
154
- tspan.exit().remove();
155
- tspan = tspan
156
- .enter()
157
- .append("tspan")
158
- .merge(tspan)
159
- .text(d => d.splitted);
160
- // set <tspan>'s position
161
- tspan
162
- .attr("x", isTopBottom ? 0 : tickLength * sign)
163
- .attr("dx", (() => {
164
- let dx = 0;
165
- if (/(top|bottom)/.test(orient) && rotate) {
166
- dx = 8 * Math.sin(Math.PI * (rotate / 180)) *
167
- (orient === "top" ? -1 : 1);
248
+ if (scale1.bandwidth) {
249
+ const x = scale1;
250
+ const dx = x.bandwidth() / 2;
251
+ scale0 = d => x(d) + dx;
252
+ scale1 = scale0;
168
253
  }
169
- return dx + (tickTextPos.x || 0);
170
- })())
171
- .attr("dy", (d, i) => {
172
- const defValue = ".71em";
173
- let dy = 0;
174
- if (orient !== "top") {
175
- dy = sizeFor1Char.h;
176
- if (i === 0) {
177
- dy = isLeftRight ?
178
- -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) :
179
- (tickTextPos.y === 0 ? defValue : 0);
180
- }
254
+ else if (scale0.bandwidth) {
255
+ scale0 = scale1;
181
256
  }
182
- return isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || defValue;
183
- });
184
- const lineUpdate = tick.select("line");
185
- const textUpdate = tick.select("text");
186
- tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
187
- tickEnter.select("text").attr(axisPx, tickLength * sign);
188
- ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
189
- // Append <title> for tooltip display
190
- if (params.tickTitle) {
191
- const title = textUpdate.select("title");
192
- (title.empty() ? textUpdate.append("title") : title)
193
- .text(index => params.tickTitle[index]);
194
- }
195
- if (scale1.bandwidth) {
196
- const x = scale1;
197
- const dx = x.bandwidth() / 2;
198
- scale0 = d => x(d) + dx;
199
- scale1 = scale0;
200
- }
201
- else if (scale0.bandwidth) {
202
- scale0 = scale1;
203
- }
204
- else {
205
- tickTransform(tickExit, scale1);
257
+ else {
258
+ tickTransform(tickExit, scale1);
259
+ }
260
+ // when .flow(), it should follow flow's transition config
261
+ // otherwise make to use ChartInternals.$T()
262
+ tick = params.owner.state.flowing ?
263
+ helper.transitionise(tick) :
264
+ params.owner.$T(tick);
265
+ tickTransform(tickEnter, scale0);
266
+ tickTransform(tick.style("opacity", null), scale1);
206
267
  }
207
- // when .flow(), it should follow flow's transition config
208
- // otherwise make to use ChartInternals.$T()
209
- tick = params.owner.state.flowing ?
210
- helper.transitionise(tick) :
211
- params.owner.$T(tick);
212
- tickTransform(tickEnter, scale0);
213
- tickTransform(tick.style("opacity", null), scale1);
214
268
  }
215
269
  });
216
270
  this.g = $g;
@@ -297,7 +351,6 @@ class AxisRenderer {
297
351
  textUpdate
298
352
  .attr("x", 0)
299
353
  .attr("y", yForText(rotate))
300
- .style("text-anchor", textAnchorForText(rotate))
301
354
  .style("text-anchor", (d, i, { length }) => {
302
355
  if (!isRotated && i === 0 && (inner === true || inner.first)) {
303
356
  return "start";
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { getScale } from '../internals/scale.js';
11
11
  import { getBBox } from '../../module/util/dom.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
@@ -412,7 +412,7 @@ class ChartInternal {
412
412
  labelsBGColor || $$.hasLegendDefsPoint?.()) {
413
413
  $el.defs = $el.svg.append("defs");
414
414
  if (hasAxis) {
415
- ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
415
+ ["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
416
416
  $$.appendClip($el.defs, state.clip[v]);
417
417
  });
418
418
  }
@@ -713,11 +713,15 @@ class ChartInternal {
713
713
  list.forEach(v => resizeFunction.add(v));
714
714
  $$.resizeFunction = resizeFunction;
715
715
  // attach resize event
716
- if (resize_auto === "parent") {
717
- ($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$)))
716
+ if (resize_auto === "parent" && win.ResizeObserver) {
717
+ ($$.resizeFunction.resizeObserver = new win.ResizeObserver($$.resizeFunction.bind($$)))
718
718
  .observe($el.chart.node().parentNode);
719
719
  }
720
720
  else {
721
+ if (resize_auto === "parent") {
722
+ // ResizeObserver unavailable: parent-specific resize won't be detected
723
+ win.console?.warn?.("[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize.");
724
+ }
721
725
  win.addEventListener("resize", $$.resizeFunction);
722
726
  }
723
727
  }
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { csvParse, csvParseRows, tsvParse, tsvParseRows } from '../../module/dsv.js';
11
11
 
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { runWorker } from '../../module/worker.js';
11
11
  import { url, columns, rows, json } from './convert.helper.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $BAR, $COMMON, $CANDLESTICK } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $LEGEND } from '../../config/classes.js';
11
11
  import { KEY } from '../../module/Cache.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $DRAG, $SHAPE, $COMMON, $SELECT, $CIRCLE, $BAR } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $SHAPE, $COMMON, $EVENT } from '../../config/classes.js';
11
11
  import { getPointer, getScrollPosition, getBoundingRect } from '../../module/util/dom.js';
@@ -225,7 +225,7 @@ var eventrect = {
225
225
  // width/height must be part of the key: resize keeps the domain but moves coords.
226
226
  const xDomain = xScale?.domain();
227
227
  const fingerprint = xDomain ?
228
- `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${[...state.hiddenTargetIds].join(",")}` :
228
+ `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${state.dataGeneration}_${[...state.hiddenTargetIds].join(",")}` :
229
229
  null;
230
230
  if (fingerprint && fingerprint === state._eventRectFingerprint) {
231
231
  return;
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import CLASS from '../../config/classes.js';
11
11
  import { generateWait } from '../../module/generator.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { drag } from 'd3-drag';
11
11
  import { select } from 'd3-selection';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { brushY, brushX, brushSelection } from 'd3-brush';
11
11
  import { select } from 'd3-selection';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { drag } from 'd3-drag';
11
11
  import { zoomTransform, zoomIdentity, zoom as zoom$1 } from 'd3-zoom';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  /**
11
11
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import CLASS from '../../config/classes.js';
11
11
 
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  /**
11
11
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { scaleOrdinal } from 'd3-scale';
11
11
  import { select } from 'd3-selection';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { TYPE, TYPE_BY_CATEGORY } from '../../config/const.js';
11
11
  import { KEY } from '../../module/Cache.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { isArray, isValue, isObject, isFunction, isObjectType } from '../../module/util/type-checks.js';
11
11
 
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select, selectAll } from 'd3-selection';
11
11
  import { $GRID, $AXIS, $FOCUS, $COMMON } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select, namespaces } from 'd3-selection';
11
11
  import { $LEGEND, $FOCUS, $GAUGE } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { transition } from 'd3-transition';
11
11
  import { $TEXT, $COMMON, $SELECT } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $REGION } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { scaleUtc, scaleTime, scaleLog, scaleSymlog, scaleLinear } from 'd3-scale';
11
11
  import { parseDate } from '../../module/util/object.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $SELECT, $SHAPE } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { isNumber } from '../../module/util/type-checks.js';
11
11
 
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $SUBCHART, $AXIS } from '../../config/classes.js';
11
11
  import { document as doc } from '../../module/browser.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $SHAPE } from '../../config/classes.js';
11
11
  import { isFunction, isString } from '../../module/util/type-checks.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $ARC } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { selectAll, select } from 'd3-selection';
11
11
  import { $TEXT, $COMMON } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $TEXT } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $TEXT } from '../../config/classes.js';
11
11
  import { getElementPos, getBBox, setTextValue, getBoundingRect } from '../../module/util/dom.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $TOOLTIP, $ARC } from '../../config/classes.js';
@@ -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.0-next.3
8
+ * @version 4.0.0
9
9
  */
10
10
  import { $AXIS, $ARC } from '../../config/classes.js';
11
11
  import { asHalfPixel } from '../../module/util/type-checks.js';