billboard.js 4.1.0-next.2 → 4.1.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 (233) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +268 -107
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +16 -16
  5. package/dist/billboard.pkgd.js +3198 -1755
  6. package/dist/billboard.pkgd.min.js +23 -23
  7. package/dist/billboard.react.js +28 -49
  8. package/dist/billboard.react.min.js +2 -2
  9. package/dist/billboard.worker.js +1 -1
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.js +14 -31
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-sparkline.js +14 -31
  13. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-stanford.js +21 -35
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +7 -7
  16. package/dist/plugin/billboardjs-plugin-tableview.js +15 -30
  17. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  18. package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -30
  19. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2959 -1684
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2960 -1685
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2961 -1686
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2962 -1687
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2963 -1688
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  30. package/dist/theme/dark.css +1 -1
  31. package/dist/theme/dark.min.css +1 -1
  32. package/dist/theme/datalab.css +1 -1
  33. package/dist/theme/datalab.min.css +1 -1
  34. package/dist/theme/graph.css +1 -1
  35. package/dist/theme/graph.min.css +1 -1
  36. package/dist/theme/insight.css +1 -1
  37. package/dist/theme/insight.min.css +1 -1
  38. package/dist/theme/modern.css +1 -1
  39. package/dist/theme/modern.min.css +1 -1
  40. package/dist-esm/Chart/Chart.js +1 -1
  41. package/dist-esm/Chart/api/axis.js +1 -1
  42. package/dist-esm/Chart/api/category.js +1 -1
  43. package/dist-esm/Chart/api/chart.js +9 -7
  44. package/dist-esm/Chart/api/color.js +1 -1
  45. package/dist-esm/Chart/api/data.js +3 -3
  46. package/dist-esm/Chart/api/export.js +1 -1
  47. package/dist-esm/Chart/api/flow.js +1 -1
  48. package/dist-esm/Chart/api/focus.js +1 -1
  49. package/dist-esm/Chart/api/grid.js +1 -1
  50. package/dist-esm/Chart/api/group.js +1 -1
  51. package/dist-esm/Chart/api/legend.js +1 -1
  52. package/dist-esm/Chart/api/load.js +1 -1
  53. package/dist-esm/Chart/api/regions.js +1 -1
  54. package/dist-esm/Chart/api/selection.js +1 -1
  55. package/dist-esm/Chart/api/show.js +1 -1
  56. package/dist-esm/Chart/api/stubs.js +1 -1
  57. package/dist-esm/Chart/api/subchart.js +1 -1
  58. package/dist-esm/Chart/api/tooltip.js +1 -1
  59. package/dist-esm/Chart/api/x.js +11 -9
  60. package/dist-esm/Chart/api/zoom.js +8 -7
  61. package/dist-esm/ChartInternal/Axis/Axis.js +7 -6
  62. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
  63. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  64. package/dist-esm/ChartInternal/ChartInternal.js +32 -8
  65. package/dist-esm/ChartInternal/data/convert.helper.js +7 -5
  66. package/dist-esm/ChartInternal/data/convert.js +1 -1
  67. package/dist-esm/ChartInternal/data/data.js +64 -33
  68. package/dist-esm/ChartInternal/data/load.js +1 -1
  69. package/dist-esm/ChartInternal/interactions/drag.js +1 -1
  70. package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
  71. package/dist-esm/ChartInternal/interactions/flow.js +17 -15
  72. package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
  73. package/dist-esm/ChartInternal/interactions/subchart.js +8 -6
  74. package/dist-esm/ChartInternal/interactions/zoom.js +8 -6
  75. package/dist-esm/ChartInternal/internals/category.js +1 -1
  76. package/dist-esm/ChartInternal/internals/class.js +1 -1
  77. package/dist-esm/ChartInternal/internals/clip.js +1 -1
  78. package/dist-esm/ChartInternal/internals/color.js +1 -1
  79. package/dist-esm/ChartInternal/internals/domain.js +13 -9
  80. package/dist-esm/ChartInternal/internals/format.js +5 -3
  81. package/dist-esm/ChartInternal/internals/grid.js +5 -4
  82. package/dist-esm/ChartInternal/internals/legend.js +8 -7
  83. package/dist-esm/ChartInternal/internals/redraw.js +2 -2
  84. package/dist-esm/ChartInternal/internals/region.js +1 -1
  85. package/dist-esm/ChartInternal/internals/scale.js +1 -1
  86. package/dist-esm/ChartInternal/internals/selection.js +1 -1
  87. package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
  88. package/dist-esm/ChartInternal/internals/size.js +56 -10
  89. package/dist-esm/ChartInternal/internals/style.js +1 -1
  90. package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
  91. package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
  92. package/dist-esm/ChartInternal/internals/text.js +12 -9
  93. package/dist-esm/ChartInternal/internals/text.util.js +4 -4
  94. package/dist-esm/ChartInternal/internals/title.js +3 -2
  95. package/dist-esm/ChartInternal/internals/tooltip.js +25 -20
  96. package/dist-esm/ChartInternal/internals/transform.js +1 -1
  97. package/dist-esm/ChartInternal/internals/type.js +1 -1
  98. package/dist-esm/ChartInternal/shape/arc.js +3 -2
  99. package/dist-esm/ChartInternal/shape/area.js +3 -2
  100. package/dist-esm/ChartInternal/shape/bar.js +1 -1
  101. package/dist-esm/ChartInternal/shape/bubble.js +1 -1
  102. package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
  103. package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
  104. package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
  105. package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
  106. package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
  107. package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
  108. package/dist-esm/ChartInternal/shape/core/path.js +1 -1
  109. package/dist-esm/ChartInternal/shape/core/point.js +1 -1
  110. package/dist-esm/ChartInternal/shape/core/treemap.js +3 -2
  111. package/dist-esm/ChartInternal/shape/funnel.js +1 -1
  112. package/dist-esm/ChartInternal/shape/gauge.js +1 -1
  113. package/dist-esm/ChartInternal/shape/line.js +3 -2
  114. package/dist-esm/ChartInternal/shape/point.js +1 -1
  115. package/dist-esm/ChartInternal/shape/polar.js +1 -1
  116. package/dist-esm/ChartInternal/shape/radar.js +1 -1
  117. package/dist-esm/ChartInternal/shape/shape.js +3 -2
  118. package/dist-esm/ChartInternal/shape/treemap.js +1 -1
  119. package/dist-esm/canvas/CanvasAxisRenderer.js +27 -21
  120. package/dist-esm/canvas/CanvasEngine.js +1 -1
  121. package/dist-esm/canvas/CanvasPainter.js +1 -1
  122. package/dist-esm/canvas/CanvasRenderer.js +1 -1
  123. package/dist-esm/canvas/CanvasTheme.js +7 -8
  124. package/dist-esm/canvas/HitDetector.js +1 -1
  125. package/dist-esm/canvas/axisTicks.js +3 -2
  126. package/dist-esm/canvas/classes.js +1 -1
  127. package/dist-esm/canvas/color.js +1 -1
  128. package/dist-esm/canvas/geometry.js +1 -1
  129. package/dist-esm/canvas/labels.js +4 -4
  130. package/dist-esm/canvas/pointPattern.js +1 -1
  131. package/dist-esm/canvas/util.js +1 -1
  132. package/dist-esm/config/Options/Options.js +1 -1
  133. package/dist-esm/config/Options/axis/axis.js +1 -1
  134. package/dist-esm/config/Options/axis/x.js +1 -1
  135. package/dist-esm/config/Options/axis/y.js +1 -1
  136. package/dist-esm/config/Options/axis/y2.js +1 -13
  137. package/dist-esm/config/Options/common/boost.js +1 -1
  138. package/dist-esm/config/Options/common/color.js +1 -1
  139. package/dist-esm/config/Options/common/grid.js +1 -1
  140. package/dist-esm/config/Options/common/legend.js +1 -1
  141. package/dist-esm/config/Options/common/main.js +44 -2
  142. package/dist-esm/config/Options/common/point.js +1 -1
  143. package/dist-esm/config/Options/common/title.js +1 -1
  144. package/dist-esm/config/Options/common/tooltip.js +1 -1
  145. package/dist-esm/config/Options/data/axis.js +1 -1
  146. package/dist-esm/config/Options/data/data.js +1 -1
  147. package/dist-esm/config/Options/data/selection.js +1 -1
  148. package/dist-esm/config/Options/interaction/interaction.js +1 -1
  149. package/dist-esm/config/Options/interaction/subchart.js +1 -1
  150. package/dist-esm/config/Options/interaction/zoom.js +1 -1
  151. package/dist-esm/config/Options/shape/arc.js +1 -1
  152. package/dist-esm/config/Options/shape/area.js +1 -1
  153. package/dist-esm/config/Options/shape/bar.js +1 -1
  154. package/dist-esm/config/Options/shape/bubble.js +1 -1
  155. package/dist-esm/config/Options/shape/candlestick.js +1 -1
  156. package/dist-esm/config/Options/shape/donut.js +1 -1
  157. package/dist-esm/config/Options/shape/funnel.js +1 -1
  158. package/dist-esm/config/Options/shape/gauge.js +1 -1
  159. package/dist-esm/config/Options/shape/line.js +1 -1
  160. package/dist-esm/config/Options/shape/pie.js +1 -1
  161. package/dist-esm/config/Options/shape/polar.js +1 -1
  162. package/dist-esm/config/Options/shape/radar.js +1 -1
  163. package/dist-esm/config/Options/shape/scatter.js +1 -1
  164. package/dist-esm/config/Options/shape/spline.js +1 -1
  165. package/dist-esm/config/Options/shape/treemap.js +1 -1
  166. package/dist-esm/config/Store/Element.js +1 -1
  167. package/dist-esm/config/Store/State.js +4 -1
  168. package/dist-esm/config/Store/Store.js +1 -1
  169. package/dist-esm/config/classes.js +1 -1
  170. package/dist-esm/config/config.js +1 -1
  171. package/dist-esm/config/const.js +1 -1
  172. package/dist-esm/config/resolver/axis.core.js +1 -1
  173. package/dist-esm/config/resolver/axis.js +1 -1
  174. package/dist-esm/config/resolver/canvas.js +17 -12
  175. package/dist-esm/config/resolver/canvasShape.js +1 -1
  176. package/dist-esm/config/resolver/category.js +1 -1
  177. package/dist-esm/config/resolver/export.js +1 -1
  178. package/dist-esm/config/resolver/flow.js +1 -1
  179. package/dist-esm/config/resolver/grid.js +1 -1
  180. package/dist-esm/config/resolver/interaction/selection.js +1 -1
  181. package/dist-esm/config/resolver/interaction/subchart.js +1 -1
  182. package/dist-esm/config/resolver/interaction/zoom.js +1 -1
  183. package/dist-esm/config/resolver/regions.js +1 -1
  184. package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
  185. package/dist-esm/config/resolver/shape/area.js +1 -1
  186. package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
  187. package/dist-esm/config/resolver/shape/bar.js +1 -1
  188. package/dist-esm/config/resolver/shape/bubble.js +1 -1
  189. package/dist-esm/config/resolver/shape/candlestick.js +1 -1
  190. package/dist-esm/config/resolver/shape/donut.js +1 -1
  191. package/dist-esm/config/resolver/shape/funnel.js +1 -1
  192. package/dist-esm/config/resolver/shape/gauge.js +1 -1
  193. package/dist-esm/config/resolver/shape/line.js +1 -1
  194. package/dist-esm/config/resolver/shape/pie.js +1 -1
  195. package/dist-esm/config/resolver/shape/polar.js +1 -1
  196. package/dist-esm/config/resolver/shape/radar.js +1 -1
  197. package/dist-esm/config/resolver/shape/scatter.js +1 -1
  198. package/dist-esm/config/resolver/shape/treemap.js +1 -1
  199. package/dist-esm/core.js +5 -4
  200. package/dist-esm/index.canvas.js +1 -1
  201. package/dist-esm/index.esm.js +1 -1
  202. package/dist-esm/module/Cache.js +2 -2
  203. package/dist-esm/module/browser.js +2 -2
  204. package/dist-esm/module/dsv.js +1 -1
  205. package/dist-esm/module/error.js +1 -1
  206. package/dist-esm/module/generator.js +16 -3
  207. package/dist-esm/module/sanitize.js +1 -1
  208. package/dist-esm/module/util/brush.js +1 -1
  209. package/dist-esm/module/util/dom.js +9 -7
  210. package/dist-esm/module/util/object.js +1 -1
  211. package/dist-esm/module/util/type-checks.js +1 -1
  212. package/dist-esm/module/worker.js +1 -1
  213. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  214. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -40
  215. package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -41
  216. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  217. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  218. package/dist-esm/react/index.js +1 -1
  219. package/package.json +36 -36
  220. package/src/Chart/api/chart.ts +1 -0
  221. package/src/Chart/api/data.ts +5 -3
  222. package/src/ChartInternal/ChartInternal.ts +72 -25
  223. package/src/ChartInternal/data/data.ts +68 -34
  224. package/src/ChartInternal/internals/redraw.ts +8 -1
  225. package/src/ChartInternal/internals/size.ts +99 -2
  226. package/src/config/Options/axis/y2.ts +0 -13
  227. package/src/config/Options/common/main.ts +43 -1
  228. package/src/config/Store/State.ts +4 -0
  229. package/src/config/const.ts +4 -0
  230. package/src/config/resolver/canvas.ts +3 -0
  231. package/src/module/Cache.ts +1 -1
  232. package/src/module/generator.ts +27 -2
  233. package/types/options.d.ts +38 -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.1.0-next.2
8
+ * @version 4.1.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -31,20 +31,6 @@ const isEmptyObject = (obj) => {
31
31
  return true;
32
32
  };
33
33
  const isEmpty = (o) => isUndefined(o) || o === null || isString(o) && o.length === 0 || isObjectType(o) && !(o instanceof Date) && isEmptyObject(o) || isNumber(o) && isNaN(o);
34
- /**
35
- * Check if is array
36
- * @param {Array} arr Data to be checked
37
- * @returns {boolean}
38
- * @private
39
- */
40
- const isArray = (arr) => Array.isArray(arr);
41
- /**
42
- * Check if is object
43
- * @param {object} obj Data to be checked
44
- * @returns {boolean}
45
- * @private
46
- */
47
- const isObject = (obj) => obj && !obj?.nodeType && isObjectType(obj) && !isArray(obj);
48
34
  //#endregion
49
35
  //#region src/module/browser.ts
50
36
  /**
@@ -84,30 +70,6 @@ function getFallback(w) {
84
70
  const win = getGlobal();
85
71
  const doc = win?.document;
86
72
  const [requestAnimationFrame, cancelAnimationFrame, requestIdleCallback, cancelIdleCallback] = getFallback(win);
87
- //#endregion
88
- //#region src/module/util/object.ts
89
- /**
90
- * Merge object returning new object
91
- * @param {object} target Target object
92
- * @param {object} objectN Source object
93
- * @returns {object} merged target object
94
- * @private
95
- */
96
- function mergeObj(target, ...objectN) {
97
- if (!objectN.length || objectN.length === 1 && !objectN[0]) return target;
98
- const source = objectN.shift();
99
- if (isObject(target) && isObject(source)) Object.keys(source).forEach((key) => {
100
- if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
101
- const value = source[key];
102
- if (value instanceof Date) target[key] = new Date(value.getTime());
103
- else if (isObject(value)) {
104
- !target[key] && (target[key] = {});
105
- target[key] = mergeObj(target[key], value);
106
- } else target[key] = isArray(value) ? value.concat() : value;
107
- }
108
- });
109
- return mergeObj(target, ...objectN);
110
- }
111
73
  /**
112
74
  * Get range
113
75
  * @param {number} start Start number
@@ -238,7 +200,7 @@ var Plugin = class {
238
200
  $$;
239
201
  options;
240
202
  config;
241
- static version = "4.1.0-next.2";
203
+ static version = "4.1.0";
242
204
  /**
243
205
  * Constructor
244
206
  * @param {Any} options config option object
@@ -424,7 +386,8 @@ var ColorScale = class {
424
386
  if (this.colorScale) this.colorScale.remove();
425
387
  this.colorScale = $$.$el.svg.append("g").attr("width", 50).attr("height", height).attr("class", classes_default.colorScale);
426
388
  this.colorScale.append("g").attr("transform", `translate(0, ${config.padding_top})`).selectAll("bars").data(points).enter().append("rect").attr("y", (d, i) => i * barHeight).attr("x", 0).attr("width", barWidth).attr("height", barHeight).attr("fill", (d) => inverseScale(d));
427
- const legendAxis = axisRight(scaleSymlog().domain([target.minEpochs, target.maxEpochs]).range([points[0] + config.padding_top + points[points.length - 1] + barHeight - 1, points[0] + config.padding_top]));
389
+ const axisScale = scaleSymlog().domain([target.minEpochs, target.maxEpochs]).range([points[0] + config.padding_top + points[points.length - 1] + barHeight - 1, points[0] + config.padding_top]);
390
+ const legendAxis = axisRight(axisScale);
428
391
  const scaleFormat = config.scale_format;
429
392
  if (scaleFormat === "pow10") legendAxis.tickValues([
430
393
  1,
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.0-next.2
8
+ * @version 4.1.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -428,7 +428,7 @@ var Plugin = class {
428
428
  $$;
429
429
  options;
430
430
  config;
431
- static version = "4.1.0-next.2";
431
+ static version = "4.1.0";
432
432
  /**
433
433
  * Constructor
434
434
  * @param {Any} options config option object
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.0-next.2
8
+ * @version 4.1.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -175,7 +175,7 @@ var Plugin = class {
175
175
  $$;
176
176
  options;
177
177
  config;
178
- static version = "4.1.0-next.2";
178
+ static version = "4.1.0";
179
179
  /**
180
180
  * Constructor
181
181
  * @param {Any} options config option object
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.1.0-next.2
8
+ * @version 4.1.0
9
9
  */
10
10
  import { createElement, forwardRef, useEffect, useImperativeHandle, useRef } from "react";
11
11
  //#region src/react/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "4.1.0-next.2",
3
+ "version": "4.1.0",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -131,68 +131,68 @@
131
131
  }
132
132
  },
133
133
  "devDependencies": {
134
- "@commitlint/cli": "^21.1.0",
135
- "@commitlint/config-conventional": "^21.1.0",
134
+ "@commitlint/cli": "^21.2.2",
135
+ "@commitlint/config-conventional": "^21.2.2",
136
136
  "@eslint/js": "^10.0.1",
137
- "@playwright/test": "^1.61.1",
138
- "@semantic-release/changelog": "^6.0.3",
137
+ "@playwright/test": "^1.63.0",
138
+ "@semantic-release/changelog": "^7.0.0",
139
139
  "@semantic-release/commit-analyzer": "^13.0.1",
140
140
  "@semantic-release/exec": "^7.1.0",
141
- "@semantic-release/git": "^10.0.1",
141
+ "@semantic-release/git": "^11.0.1",
142
142
  "@semantic-release/npm": "^13.1.5",
143
143
  "@semantic-release/release-notes-generator": "^14.1.1",
144
- "@storybook/react-vite": "^10.5.5",
144
+ "@storybook/react-vite": "^10.6.0",
145
145
  "@testing-library/dom": "^10.4.1",
146
- "@testing-library/react": "^16.3.2",
146
+ "@testing-library/react": "^16.3.3",
147
147
  "@types/d3": "^7.4.3",
148
- "@types/react": "^19.2.17",
149
- "@types/react-dom": "^19.2.3",
150
- "@types/sinon": "^21.0.1",
151
- "@vitest/browser": "^4.1.9",
152
- "@vitest/browser-playwright": "^4.1.9",
153
- "@vitest/coverage-istanbul": "^4.1.9",
154
- "@vitest/ui": "^4.1.9",
148
+ "@types/react": "^19.3.0",
149
+ "@types/react-dom": "^19.3.0",
150
+ "@types/sinon": "^22.0.0",
151
+ "@vitest/browser": "^5.0.0",
152
+ "@vitest/browser-playwright": "^5.0.0",
153
+ "@vitest/coverage-istanbul": "^5.0.0",
154
+ "@vitest/ui": "^5.0.0",
155
155
  "better-docs": "^2.7.3",
156
156
  "clean-webpack-plugin": "^4.0.0",
157
157
  "cloc": "2.6.0-cloc",
158
- "core-js": "^3.49.0",
158
+ "core-js": "^3.50.0",
159
159
  "cross-env": "^10.1.0",
160
- "css-loader": "^7.1.4",
160
+ "css-loader": "^7.1.5",
161
161
  "d3-delaunay": "^6.0.4",
162
162
  "d3-format": "^3.1.2",
163
163
  "d3-time": "^3.1.0",
164
164
  "docdash": "^2.0.2",
165
- "dprint": "^0.54.0",
165
+ "dprint": "^0.57.4",
166
166
  "esbuild-loader": "^4.5.0",
167
- "eslint": "^10.5.0",
167
+ "eslint": "^10.10.0",
168
168
  "eslint-plugin-import": "^2.32.0",
169
- "eslint-plugin-jsdoc": "^63.0.8",
169
+ "eslint-plugin-jsdoc": "^64.3.9",
170
170
  "husky": "^9.1.7",
171
171
  "jsdoc": "^4.0.5",
172
- "lint-staged": "^17.0.8",
172
+ "lint-staged": "^17.5.1",
173
173
  "mini-css-extract-plugin": "^2.10.2",
174
- "playwright": "^1.61.1",
175
- "react": "^19.2.8",
176
- "react-dom": "^19.2.8",
174
+ "playwright": "^1.63.0",
175
+ "react": "^19.3.0",
176
+ "react-dom": "^19.3.0",
177
177
  "regenerator-runtime": "^0.14.1",
178
- "rolldown": "^1.1.5",
179
- "sass": "^1.101.0",
180
- "sass-loader": "^17.0.0",
181
- "semantic-release": "^25.0.5",
178
+ "rolldown": "^1.2.8",
179
+ "sass": "^1.104.0",
180
+ "sass-loader": "^17.0.1",
181
+ "semantic-release": "^25.0.9",
182
182
  "simulant": "^0.2.2",
183
- "sinon": "^22.0.0",
184
- "storybook": "^10.5.5",
183
+ "sinon": "^22.1.0",
184
+ "storybook": "^10.6.0",
185
185
  "string-replace-loader": "^3.3.0",
186
186
  "style-loader": "^4.0.0",
187
187
  "tslib": "^2.8.1",
188
188
  "typescript": "^6.0.3",
189
- "typescript-eslint": "^8.62.0",
190
- "vitest": "^4.1.9",
191
- "webpack": "^5.108.0",
192
- "webpack-bundle-analyzer": "^5.3.0",
189
+ "typescript-eslint": "^8.70.0",
190
+ "vitest": "^5.0.0",
191
+ "webpack": "^5.110.3",
192
+ "webpack-bundle-analyzer": "^5.3.3",
193
193
  "webpack-clean": "^1.2.5",
194
- "webpack-cli": "^7.0.3",
195
- "webpack-dev-server": "^5.2.5",
194
+ "webpack-cli": "^7.2.3",
195
+ "webpack-dev-server": "^6.0.0",
196
196
  "webpack-merge": "^6.0.1",
197
197
  "webpackbar": "^7.0.0",
198
198
  "write-file-webpack-plugin": "^4.5.1"
@@ -148,6 +148,7 @@ export default {
148
148
  $$.canvasRenderer?.destroy();
149
149
  $$.canvasEngine?.destroy();
150
150
  $$.resizeFunction?.clear();
151
+ $$.resizeFunction?.clearLive?.();
151
152
 
152
153
  $$.resizeFunction?.resizeObserver?.disconnect();
153
154
  $$.resizeFunction && window.removeEventListener("resize", $$.resizeFunction);
@@ -83,9 +83,11 @@ extend(data, {
83
83
  values = [];
84
84
 
85
85
  targets.forEach(v => {
86
- const dataValue = v.values.map(d => d.value);
87
-
88
- flat ? (values = values.concat(dataValue)) : values.push(dataValue);
86
+ if (flat) {
87
+ v.values.forEach(d => values.push(d.value));
88
+ } else {
89
+ values.push(v.values.map(d => d.value));
90
+ }
89
91
  });
90
92
  }
91
93
  }
@@ -12,6 +12,7 @@ import {
12
12
  } from "d3-time-format";
13
13
  import type {d3Selection, d3Transition} from "../../types/types";
14
14
  import {$CIRCLE, $COMMON, $TEXT} from "../config/classes";
15
+ import {RESIZE_FRAME_BUDGET} from "../config/const";
15
16
  import Options from "../config/Options/Options";
16
17
  import Store from "../config/Store/Store";
17
18
  import {document, window} from "../module/browser";
@@ -60,6 +61,15 @@ import transform from "./internals/transform";
60
61
  import typeInternals from "./internals/type";
61
62
  import shape from "./shape/shape";
62
63
 
64
+ /**
65
+ * Get the current time in ms.
66
+ * @returns {number} Timestamp
67
+ * @private
68
+ */
69
+ function getTime(): number {
70
+ return window.performance?.now?.() ?? Date.now();
71
+ }
72
+
63
73
  /**
64
74
  * Get SVG-only chart type reason for canvas render fallback.
65
75
  * @param {object} $$ ChartInternal instance
@@ -532,7 +542,7 @@ export default class ChartInternal {
532
542
  $el.defs = $el.svg.append("defs");
533
543
 
534
544
  if (hasAxis) {
535
- ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
545
+ ["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
536
546
  $$.appendClip($el.defs, state.clip[v]);
537
547
  });
538
548
  }
@@ -876,42 +886,79 @@ export default class ChartInternal {
876
886
  bindResize(): void {
877
887
  const $$ = <any>this;
878
888
  const {$el, config, state} = $$;
879
- const resizeFunction = generateResize(config.resize_timer);
880
- const {resize_auto} = config;
889
+ const {resize_auto, resize_live} = config;
890
+ const isAutoResize = /^(true|parent)$/.test(resize_auto);
881
891
  const list: (() => void)[] = [];
882
892
 
883
- list.push(() => callFn(config.onresize, $$.api));
893
+ const redrawOnResize = (): boolean => {
894
+ // Skip resize if dimensions haven't changed
895
+ const prevWidth = state.current.width;
896
+ const prevHeight = state.current.height;
897
+
898
+ $$.setContainerSize();
884
899
 
885
- if (/^(true|parent)$/.test(resize_auto)) {
886
- list.push(() => {
887
- // Skip resize if dimensions haven't changed
888
- const prevWidth = state.current.width;
889
- const prevHeight = state.current.height;
900
+ if (
901
+ !state.resizePreview &&
902
+ prevWidth === state.current.width &&
903
+ prevHeight === state.current.height
904
+ ) {
905
+ return false;
906
+ }
890
907
 
891
- $$.setContainerSize();
908
+ state.resizing = true;
909
+ state.dirty.size = true;
892
910
 
893
- if (
894
- prevWidth === state.current.width &&
895
- prevHeight === state.current.height
896
- ) {
897
- return;
898
- }
911
+ // https://github.com/naver/billboard.js/issues/2650
912
+ if (config.legend_show) {
913
+ $$.updateSizes();
914
+ state.isCanvasMode ? $$.updateHtmlLegend?.() : $$.updateLegend();
915
+ }
899
916
 
900
- state.resizing = true;
917
+ $$.api.flush(false);
901
918
 
902
- // https://github.com/naver/billboard.js/issues/2650
903
- if (config.legend_show) {
904
- $$.updateSizes();
905
- state.isCanvasMode ? $$.updateHtmlLegend?.() : $$.updateLegend();
906
- }
919
+ return true;
920
+ };
907
921
 
908
- $$.api.flush(false);
909
- });
910
- }
922
+ // Called on every animation frame while resizing, before the delayed call.
923
+ // Redraws when the chart draws within a frame, and stretches the rendering
924
+ // when it doesn't: the size follows the container either way.
925
+ const liveResize = () => {
926
+ // Decided once per resize and kept until it settles, as alternating exact
927
+ // and stretched frames jitters. The measured time outlives the resize, so a
928
+ // chart already known to be expensive stretches from the very first frame.
929
+ if (state.resizeLiveScale === null) {
930
+ state.resizeLiveScale = state.resizeRedrawTime > RESIZE_FRAME_BUDGET;
931
+ }
932
+
933
+ if (state.resizeLiveScale) {
934
+ $$.previewResize();
935
+ return;
936
+ }
937
+
938
+ const start = getTime();
939
+
940
+ if (redrawOnResize()) {
941
+ state.resizeRedrawTime = getTime() - start;
942
+
943
+ // A redraw that missed the frame stretches the rest of this resize. The
944
+ // switch only goes this way, so frames can't alternate exact/stretched.
945
+ state.resizeLiveScale = state.resizeRedrawTime > RESIZE_FRAME_BUDGET;
946
+ }
947
+ };
948
+
949
+ const resizeFunction = generateResize(
950
+ config.resize_timer,
951
+ isAutoResize && resize_live ? liveResize : undefined
952
+ );
953
+
954
+ list.push(() => callFn(config.onresize, $$.api));
955
+
956
+ isAutoResize && list.push(redrawOnResize);
911
957
 
912
958
  list.push(() => {
913
959
  callFn(config.onresized, $$.api);
914
960
  state.resizing = false;
961
+ state.resizeLiveScale = null;
915
962
  });
916
963
 
917
964
  // add resize functions
@@ -402,7 +402,8 @@ export default {
402
402
  const $$ = this;
403
403
  const {config} = $$;
404
404
  const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
405
- let sum = $$.cache.get(cacheKey);
405
+ const cached = $$.cache.get(cacheKey);
406
+ let sum = cached?.generation === $$.state.dataGeneration ? cached.value : null;
406
407
 
407
408
  if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
408
409
  sum = [];
@@ -434,12 +435,74 @@ export default {
434
435
  });
435
436
  });
436
437
 
437
- $$.cache.add(cacheKey, sum);
438
+ $$.cache.add(cacheKey, {generation: $$.state.dataGeneration, value: sum});
438
439
  }
439
440
 
440
441
  return sum;
441
442
  },
442
443
 
444
+ /**
445
+ * Get per-index totals excluding hidden series, cached until data or visibility changes.
446
+ * @param {string} targetId Target ID for per-group normalization
447
+ * @returns {Array|null} Visible totals, or null for an ungrouped target
448
+ * @private
449
+ */
450
+ getVisibleTotalPerIndex(targetId?: string) {
451
+ const $$ = this;
452
+ const {api, config, state, cache} = $$;
453
+ let cached = cache.get(KEY.visibleTotalPerIndex);
454
+
455
+ if (!cached || cached.generation !== state.dataGeneration) {
456
+ cached = cache.add(KEY.visibleTotalPerIndex, {
457
+ generation: state.dataGeneration,
458
+ values: new Map()
459
+ });
460
+ }
461
+
462
+ if (cached.values.has(targetId)) {
463
+ return cached.values.get(targetId);
464
+ }
465
+
466
+ const dataValues = api.data.values.bind(api);
467
+ const {hiddenTargetIds} = state;
468
+
469
+ // For normalized stack per group, get total per group
470
+ let total = $$.getTotalPerIndex(targetId);
471
+
472
+ // If total is null, the data is not in any group - don't normalize
473
+ if (total === null) {
474
+ cached.values.set(targetId, total);
475
+ return total;
476
+ }
477
+
478
+ if (hiddenTargetIds.size) {
479
+ // When normalized per group, only subtract hidden data from the same group
480
+ let hiddenIds: string[] = [...hiddenTargetIds];
481
+
482
+ if (targetId) {
483
+ const group = config.data_groups.find(g => g.indexOf(targetId) >= 0);
484
+ if (group) {
485
+ // Only consider hidden IDs in the same group
486
+ hiddenIds = hiddenIds.filter(id => group.indexOf(id) >= 0);
487
+ }
488
+ }
489
+
490
+ if (hiddenIds.length) {
491
+ let hiddenSum = dataValues(hiddenIds, false);
492
+
493
+ if (hiddenSum.length) {
494
+ hiddenSum = hiddenSum
495
+ .reduce((acc, curr) => acc.map((v, i) => (isNumber(v) ? v : 0) + curr[i]));
496
+
497
+ total = total.map((v, i) => v - hiddenSum[i]);
498
+ }
499
+ }
500
+ }
501
+
502
+ cached.values.set(targetId, total);
503
+ return total;
504
+ },
505
+
443
506
  /**
444
507
  * Get total data sum
445
508
  * @param {boolean} subtractHidden Subtract hidden data from total
@@ -657,10 +720,12 @@ export default {
657
720
 
658
721
  addHiddenTargetIds(targetIds: string[]): void {
659
722
  this.addTargetIds("hiddenTargetIds", targetIds);
723
+ this.cache.remove(KEY.visibleTotalPerIndex);
660
724
  },
661
725
 
662
726
  removeHiddenTargetIds(targetIds: string[]): void {
663
727
  this.removeTargetIds("hiddenTargetIds", targetIds);
728
+ this.cache.remove(KEY.visibleTotalPerIndex);
664
729
  },
665
730
 
666
731
  addHiddenLegendIds(targetIds: string[]): void {
@@ -1345,45 +1410,14 @@ export default {
1345
1410
  ratio = (d.endAngle - d.startAngle) / arcLength;
1346
1411
  }
1347
1412
  } else if (type === "index") {
1348
- const dataValues = api.data.values.bind(api);
1349
- const {hiddenTargetIds} = state;
1350
-
1351
- // For normalized stack per group, get total per group
1352
- let total = this.getTotalPerIndex(
1413
+ const total = $$.getVisibleTotalPerIndex(
1353
1414
  $$.isStackNormalizedPerGroup() ? d.id : undefined
1354
1415
  );
1355
1416
 
1356
- // If total is null, the data is not in any group - don't normalize
1357
1417
  if (total === null) {
1358
1418
  return ratio;
1359
1419
  }
1360
1420
 
1361
- if (hiddenTargetIds.size) {
1362
- // When normalized per group, only subtract hidden data from the same group
1363
- let hiddenIds: string[] = [...hiddenTargetIds];
1364
-
1365
- if ($$.isStackNormalizedPerGroup() && d.id) {
1366
- const group = config.data_groups.find(g => g.indexOf(d.id) >= 0);
1367
- if (group) {
1368
- // Only consider hidden IDs in the same group
1369
- hiddenIds = hiddenIds.filter(id => group.indexOf(id) >= 0);
1370
- }
1371
- }
1372
-
1373
- if (hiddenIds.length) {
1374
- let hiddenSum = dataValues(hiddenIds, false);
1375
-
1376
- if (hiddenSum.length) {
1377
- hiddenSum = hiddenSum
1378
- .reduce((acc, curr) =>
1379
- acc.map((v, i) => (isNumber(v) ? v : 0) + curr[i])
1380
- );
1381
-
1382
- total = total.map((v, i) => v - hiddenSum[i]);
1383
- }
1384
- }
1385
- }
1386
-
1387
1421
  const divisor = total[d.index];
1388
1422
 
1389
1423
  d.ratio = isNumber(d.value) && total && divisor ? d.value / divisor : 0;
@@ -90,7 +90,14 @@ export default {
90
90
  state._cachedDrawShape = shape;
91
91
  }
92
92
 
93
- $$.updateHtmlLegend?.();
93
+ // Legend contents and dimensions were updated before updateSizes().
94
+ // Only its position depends on the newly computed chart margins.
95
+ if (
96
+ config.legend_show && $el.legend &&
97
+ !(config.legend_contents_bindto && config.legend_contents_template)
98
+ ) {
99
+ $$.positionHtmlLegend?.();
100
+ }
94
101
  $$.resizeCanvas?.();
95
102
 
96
103
  state.canvasFocusKey = null;