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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +268 -107
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +16 -16
- package/dist/billboard.pkgd.js +3198 -1755
- package/dist/billboard.pkgd.min.js +23 -23
- package/dist/billboard.react.js +28 -49
- package/dist/billboard.react.min.js +2 -2
- package/dist/billboard.worker.js +1 -1
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +14 -31
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +14 -31
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +21 -35
- package/dist/plugin/billboardjs-plugin-stanford.min.js +7 -7
- package/dist/plugin/billboardjs-plugin-tableview.js +15 -30
- package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
- package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -30
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2959 -1684
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2960 -1685
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2961 -1686
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -18
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2962 -1687
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2963 -1688
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +9 -7
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +3 -3
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +1 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +1 -1
- package/dist-esm/Chart/api/subchart.js +1 -1
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +11 -9
- package/dist-esm/Chart/api/zoom.js +8 -7
- package/dist-esm/ChartInternal/Axis/Axis.js +7 -6
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +32 -8
- package/dist-esm/ChartInternal/data/convert.helper.js +7 -5
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +64 -33
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
- package/dist-esm/ChartInternal/interactions/flow.js +17 -15
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +8 -6
- package/dist-esm/ChartInternal/interactions/zoom.js +8 -6
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +13 -9
- package/dist-esm/ChartInternal/internals/format.js +5 -3
- package/dist-esm/ChartInternal/internals/grid.js +5 -4
- package/dist-esm/ChartInternal/internals/legend.js +8 -7
- package/dist-esm/ChartInternal/internals/redraw.js +2 -2
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +56 -10
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/subchart.util.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +12 -9
- package/dist-esm/ChartInternal/internals/text.util.js +4 -4
- package/dist-esm/ChartInternal/internals/title.js +3 -2
- package/dist-esm/ChartInternal/internals/tooltip.js +25 -20
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +3 -2
- package/dist-esm/ChartInternal/shape/area.js +3 -2
- package/dist-esm/ChartInternal/shape/bar.js +1 -1
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +3 -2
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +3 -2
- package/dist-esm/ChartInternal/shape/point.js +1 -1
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +3 -2
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +27 -21
- package/dist-esm/canvas/CanvasEngine.js +1 -1
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +1 -1
- package/dist-esm/canvas/CanvasTheme.js +7 -8
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +3 -2
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +4 -4
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -13
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +44 -2
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +4 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +1 -1
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +17 -12
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +5 -4
- package/dist-esm/index.canvas.js +1 -1
- package/dist-esm/index.esm.js +1 -1
- package/dist-esm/module/Cache.js +2 -2
- package/dist-esm/module/browser.js +2 -2
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +1 -1
- package/dist-esm/module/generator.js +16 -3
- package/dist-esm/module/sanitize.js +1 -1
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +9 -7
- package/dist-esm/module/util/object.js +1 -1
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +1 -1
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -40
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -41
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist-esm/react/index.js +1 -1
- package/package.json +36 -36
- package/src/Chart/api/chart.ts +1 -0
- package/src/Chart/api/data.ts +5 -3
- package/src/ChartInternal/ChartInternal.ts +72 -25
- package/src/ChartInternal/data/data.ts +68 -34
- package/src/ChartInternal/internals/redraw.ts +8 -1
- package/src/ChartInternal/internals/size.ts +99 -2
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/main.ts +43 -1
- package/src/config/Store/State.ts +4 -0
- package/src/config/const.ts +4 -0
- package/src/config/resolver/canvas.ts +3 -0
- package/src/module/Cache.ts +1 -1
- package/src/module/generator.ts +27 -2
- 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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
178
|
+
static version = "4.1.0";
|
|
179
179
|
/**
|
|
180
180
|
* Constructor
|
|
181
181
|
* @param {Any} options config option object
|
package/dist-esm/react/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "4.1.0
|
|
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.
|
|
135
|
-
"@commitlint/config-conventional": "^21.
|
|
134
|
+
"@commitlint/cli": "^21.2.2",
|
|
135
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
136
136
|
"@eslint/js": "^10.0.1",
|
|
137
|
-
"@playwright/test": "^1.
|
|
138
|
-
"@semantic-release/changelog": "^
|
|
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": "^
|
|
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.
|
|
144
|
+
"@storybook/react-vite": "^10.6.0",
|
|
145
145
|
"@testing-library/dom": "^10.4.1",
|
|
146
|
-
"@testing-library/react": "^16.3.
|
|
146
|
+
"@testing-library/react": "^16.3.3",
|
|
147
147
|
"@types/d3": "^7.4.3",
|
|
148
|
-
"@types/react": "^19.
|
|
149
|
-
"@types/react-dom": "^19.
|
|
150
|
-
"@types/sinon": "^
|
|
151
|
-
"@vitest/browser": "^
|
|
152
|
-
"@vitest/browser-playwright": "^
|
|
153
|
-
"@vitest/coverage-istanbul": "^
|
|
154
|
-
"@vitest/ui": "^
|
|
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.
|
|
158
|
+
"core-js": "^3.50.0",
|
|
159
159
|
"cross-env": "^10.1.0",
|
|
160
|
-
"css-loader": "^7.1.
|
|
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.
|
|
165
|
+
"dprint": "^0.57.4",
|
|
166
166
|
"esbuild-loader": "^4.5.0",
|
|
167
|
-
"eslint": "^10.
|
|
167
|
+
"eslint": "^10.10.0",
|
|
168
168
|
"eslint-plugin-import": "^2.32.0",
|
|
169
|
-
"eslint-plugin-jsdoc": "^
|
|
169
|
+
"eslint-plugin-jsdoc": "^64.3.9",
|
|
170
170
|
"husky": "^9.1.7",
|
|
171
171
|
"jsdoc": "^4.0.5",
|
|
172
|
-
"lint-staged": "^17.
|
|
172
|
+
"lint-staged": "^17.5.1",
|
|
173
173
|
"mini-css-extract-plugin": "^2.10.2",
|
|
174
|
-
"playwright": "^1.
|
|
175
|
-
"react": "^19.
|
|
176
|
-
"react-dom": "^19.
|
|
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.
|
|
179
|
-
"sass": "^1.
|
|
180
|
-
"sass-loader": "^17.0.
|
|
181
|
-
"semantic-release": "^25.0.
|
|
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.
|
|
184
|
-
"storybook": "^10.
|
|
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.
|
|
190
|
-
"vitest": "^
|
|
191
|
-
"webpack": "^5.
|
|
192
|
-
"webpack-bundle-analyzer": "^5.3.
|
|
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.
|
|
195
|
-
"webpack-dev-server": "^
|
|
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"
|
package/src/Chart/api/chart.ts
CHANGED
|
@@ -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);
|
package/src/Chart/api/data.ts
CHANGED
|
@@ -83,9 +83,11 @@ extend(data, {
|
|
|
83
83
|
values = [];
|
|
84
84
|
|
|
85
85
|
targets.forEach(v => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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", "
|
|
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
|
|
880
|
-
const
|
|
889
|
+
const {resize_auto, resize_live} = config;
|
|
890
|
+
const isAutoResize = /^(true|parent)$/.test(resize_auto);
|
|
881
891
|
const list: (() => void)[] = [];
|
|
882
892
|
|
|
883
|
-
|
|
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
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
900
|
+
if (
|
|
901
|
+
!state.resizePreview &&
|
|
902
|
+
prevWidth === state.current.width &&
|
|
903
|
+
prevHeight === state.current.height
|
|
904
|
+
) {
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
890
907
|
|
|
891
|
-
|
|
908
|
+
state.resizing = true;
|
|
909
|
+
state.dirty.size = true;
|
|
892
910
|
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
)
|
|
897
|
-
|
|
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
|
-
|
|
917
|
+
$$.api.flush(false);
|
|
901
918
|
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
$$.updateSizes();
|
|
905
|
-
state.isCanvasMode ? $$.updateHtmlLegend?.() : $$.updateLegend();
|
|
906
|
-
}
|
|
919
|
+
return true;
|
|
920
|
+
};
|
|
907
921
|
|
|
908
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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;
|