billboard.js 3.14.3 → 3.15.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +155 -102
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +1367 -1014
- package/dist/billboard.pkgd.min.js +14 -14
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -9
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1204 -914
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1205 -915
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1206 -916
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1207 -917
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +8 -8
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1215 -918
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +6 -6
- 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/billboard.js +555 -482
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -88
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +13 -86
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -83
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +7 -70
- package/package.json +28 -28
- package/src/Chart/api/chart.ts +2 -0
- package/src/Chart/api/regions.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +68 -60
- package/src/ChartInternal/ChartInternal.ts +9 -4
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/internals/region.ts +69 -56
- package/src/config/Options/axis/y2.ts +13 -0
- package/src/config/Options/common/main.ts +32 -11
- package/types/options.d.ts +3 -1
- package/types/types.d.ts +0 -14
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.15.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -75,54 +75,10 @@ function getGlobal() {
|
|
|
75
75
|
Function("return this")();
|
|
76
76
|
}
|
|
77
77
|
var win = getGlobal();
|
|
78
|
-
var doc = win === null || win ===
|
|
78
|
+
var doc = win === null || win === void 0 ? void 0 : win.document;
|
|
79
79
|
|
|
80
80
|
var isDefined = function (v) { return typeof v !== "undefined"; };
|
|
81
81
|
var isObjectType = function (v) { return typeof v === "object"; };
|
|
82
|
-
/**
|
|
83
|
-
* Check if is array
|
|
84
|
-
* @param {Array} arr Data to be checked
|
|
85
|
-
* @returns {boolean}
|
|
86
|
-
* @private
|
|
87
|
-
*/
|
|
88
|
-
var isArray = function (arr) { return Array.isArray(arr); };
|
|
89
|
-
/**
|
|
90
|
-
* Check if is object
|
|
91
|
-
* @param {object} obj Data to be checked
|
|
92
|
-
* @returns {boolean}
|
|
93
|
-
* @private
|
|
94
|
-
*/
|
|
95
|
-
var isObject = function (obj) { return obj && !(obj === null || obj === undefined ? undefined : obj.nodeType) && isObjectType(obj) && !isArray(obj); };
|
|
96
|
-
/**
|
|
97
|
-
* Merge object returning new object
|
|
98
|
-
* @param {object} target Target object
|
|
99
|
-
* @param {object} objectN Source object
|
|
100
|
-
* @returns {object} merged target object
|
|
101
|
-
* @private
|
|
102
|
-
*/
|
|
103
|
-
function mergeObj(target) {
|
|
104
|
-
var objectN = [];
|
|
105
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
106
|
-
objectN[_i - 1] = arguments[_i];
|
|
107
|
-
}
|
|
108
|
-
if (!objectN.length || (objectN.length === 1 && !objectN[0])) {
|
|
109
|
-
return target;
|
|
110
|
-
}
|
|
111
|
-
var source = objectN.shift();
|
|
112
|
-
if (isObject(target) && isObject(source)) {
|
|
113
|
-
Object.keys(source).forEach(function (key) {
|
|
114
|
-
var value = source[key];
|
|
115
|
-
if (isObject(value)) {
|
|
116
|
-
!target[key] && (target[key] = {});
|
|
117
|
-
target[key] = mergeObj(target[key], value);
|
|
118
|
-
}
|
|
119
|
-
else {
|
|
120
|
-
target[key] = isArray(value) ? value.concat() : value;
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return mergeObj.apply(undefined, __spreadArray([target], objectN, false));
|
|
125
|
-
}
|
|
126
82
|
// emulate event
|
|
127
83
|
({
|
|
128
84
|
mouse: (function () {
|
|
@@ -138,14 +94,14 @@ function mergeObj(target) {
|
|
|
138
94
|
// eslint-disable-next-line no-new
|
|
139
95
|
new MouseEvent("t");
|
|
140
96
|
return function (el, eventType, params) {
|
|
141
|
-
if (params ===
|
|
97
|
+
if (params === void 0) { params = getParams(); }
|
|
142
98
|
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
143
99
|
};
|
|
144
100
|
}
|
|
145
101
|
catch (_a) {
|
|
146
102
|
// Polyfills DOM4 MouseEvent
|
|
147
103
|
return function (el, eventType, params) {
|
|
148
|
-
if (params ===
|
|
104
|
+
if (params === void 0) { params = getParams(); }
|
|
149
105
|
var mouseEvent = doc.createEvent("MouseEvent");
|
|
150
106
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
151
107
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
@@ -153,26 +109,7 @@ function mergeObj(target) {
|
|
|
153
109
|
el.dispatchEvent(mouseEvent);
|
|
154
110
|
};
|
|
155
111
|
}
|
|
156
|
-
})()
|
|
157
|
-
touch: function (el, eventType, params) {
|
|
158
|
-
var touchObj = new Touch(mergeObj({
|
|
159
|
-
identifier: Date.now(),
|
|
160
|
-
target: el,
|
|
161
|
-
radiusX: 2.5,
|
|
162
|
-
radiusY: 2.5,
|
|
163
|
-
rotationAngle: 10,
|
|
164
|
-
force: 0.5
|
|
165
|
-
}, params));
|
|
166
|
-
el.dispatchEvent(new TouchEvent(eventType, {
|
|
167
|
-
cancelable: true,
|
|
168
|
-
bubbles: true,
|
|
169
|
-
shiftKey: true,
|
|
170
|
-
touches: [touchObj],
|
|
171
|
-
targetTouches: [],
|
|
172
|
-
changedTouches: [touchObj]
|
|
173
|
-
}));
|
|
174
|
-
}
|
|
175
|
-
});
|
|
112
|
+
})()});
|
|
176
113
|
|
|
177
114
|
/**
|
|
178
115
|
* Load configuration option
|
|
@@ -233,7 +170,7 @@ var Plugin = /** @class */ (function () {
|
|
|
233
170
|
* @private
|
|
234
171
|
*/
|
|
235
172
|
function Plugin(options) {
|
|
236
|
-
if (options ===
|
|
173
|
+
if (options === void 0) { options = {}; }
|
|
237
174
|
this.options = options;
|
|
238
175
|
}
|
|
239
176
|
/**
|
|
@@ -267,7 +204,7 @@ var Plugin = /** @class */ (function () {
|
|
|
267
204
|
delete _this[key];
|
|
268
205
|
});
|
|
269
206
|
};
|
|
270
|
-
Plugin.version = "3.
|
|
207
|
+
Plugin.version = "3.15.0-next.2";
|
|
271
208
|
return Plugin;
|
|
272
209
|
}());
|
|
273
210
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0-next.2",
|
|
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",
|
|
@@ -102,29 +102,29 @@
|
|
|
102
102
|
"d3-zoom": "^3.0.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@commitlint/cli": "^19.
|
|
106
|
-
"@commitlint/config-conventional": "^19.
|
|
107
|
-
"@eslint/js": "^9.
|
|
108
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
105
|
+
"@commitlint/cli": "^19.8.0",
|
|
106
|
+
"@commitlint/config-conventional": "^19.8.0",
|
|
107
|
+
"@eslint/js": "^9.22.0",
|
|
108
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
109
109
|
"@rollup/plugin-replace": "^6.0.2",
|
|
110
110
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
111
111
|
"@semantic-release/changelog": "^6.0.3",
|
|
112
112
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
113
|
-
"@semantic-release/exec": "^
|
|
113
|
+
"@semantic-release/exec": "^7.0.3",
|
|
114
114
|
"@semantic-release/git": "^10.0.1",
|
|
115
115
|
"@semantic-release/npm": "^12.0.1",
|
|
116
116
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
117
117
|
"@testing-library/dom": "^10.4.0",
|
|
118
|
-
"@testing-library/react": "^16.
|
|
118
|
+
"@testing-library/react": "^16.2.0",
|
|
119
119
|
"@types/d3": "^7.4.3",
|
|
120
|
-
"@types/sinon": "^17.0.
|
|
121
|
-
"@vitest/browser": "^
|
|
122
|
-
"@vitest/coverage-istanbul": "^
|
|
123
|
-
"@vitest/ui": "^
|
|
120
|
+
"@types/sinon": "^17.0.4",
|
|
121
|
+
"@vitest/browser": "^3.0.8",
|
|
122
|
+
"@vitest/coverage-istanbul": "^3.0.8",
|
|
123
|
+
"@vitest/ui": "^3.0.8",
|
|
124
124
|
"better-docs": "^2.7.3",
|
|
125
125
|
"clean-webpack-plugin": "^4.0.0",
|
|
126
|
-
"cloc": "2.
|
|
127
|
-
"core-js": "^3.
|
|
126
|
+
"cloc": "2.4.0-cloc",
|
|
127
|
+
"core-js": "^3.41.0",
|
|
128
128
|
"coveralls": "^3.1.1",
|
|
129
129
|
"cross-env": "^7.0.3",
|
|
130
130
|
"css-loader": "^7.1.2",
|
|
@@ -133,31 +133,31 @@
|
|
|
133
133
|
"d3-format": "^3.1.0",
|
|
134
134
|
"d3-polygon": "^3.0.1",
|
|
135
135
|
"docdash": "^2.0.2",
|
|
136
|
-
"dprint": "^0.
|
|
137
|
-
"esbuild-loader": "^4.
|
|
138
|
-
"eslint": "^9.
|
|
136
|
+
"dprint": "^0.49.0",
|
|
137
|
+
"esbuild-loader": "^4.3.0",
|
|
138
|
+
"eslint": "^9.22.0",
|
|
139
139
|
"eslint-plugin-import": "^2.31.0",
|
|
140
|
-
"eslint-plugin-jsdoc": "^50.6.
|
|
140
|
+
"eslint-plugin-jsdoc": "^50.6.6",
|
|
141
141
|
"husky": "^9.1.7",
|
|
142
142
|
"jsdoc": "^4.0.4",
|
|
143
|
-
"lint-staged": "^15.
|
|
143
|
+
"lint-staged": "^15.5.0",
|
|
144
144
|
"mini-css-extract-plugin": "^2.9.2",
|
|
145
|
-
"playwright": "^1.
|
|
145
|
+
"playwright": "^1.51.0",
|
|
146
146
|
"regenerator-runtime": "^0.14.1",
|
|
147
|
-
"rollup": "^4.
|
|
148
|
-
"rollup-plugin-delete": "^
|
|
149
|
-
"sass": "^1.
|
|
150
|
-
"sass-loader": "^16.0.
|
|
151
|
-
"semantic-release": "^24.2.
|
|
147
|
+
"rollup": "^4.35.0",
|
|
148
|
+
"rollup-plugin-delete": "^3.0.1",
|
|
149
|
+
"sass": "^1.85.1",
|
|
150
|
+
"sass-loader": "^16.0.5",
|
|
151
|
+
"semantic-release": "^24.2.3",
|
|
152
152
|
"simulant": "^0.2.2",
|
|
153
153
|
"sinon": "^19.0.2",
|
|
154
154
|
"string-replace-loader": "^3.1.0",
|
|
155
155
|
"style-loader": "^4.0.0",
|
|
156
156
|
"tslib": "^2.8.1",
|
|
157
|
-
"typescript": "^5.
|
|
158
|
-
"typescript-eslint": "^8.
|
|
159
|
-
"vitest": "^
|
|
160
|
-
"webpack": "^5.
|
|
157
|
+
"typescript": "^5.8.2",
|
|
158
|
+
"typescript-eslint": "^8.26.1",
|
|
159
|
+
"vitest": "^3.0.8",
|
|
160
|
+
"webpack": "^5.98.0",
|
|
161
161
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
162
162
|
"webpack-clean": "^1.2.5",
|
|
163
163
|
"webpack-cli": "^6.0.1",
|
package/src/Chart/api/chart.ts
CHANGED
|
@@ -105,6 +105,7 @@ export default {
|
|
|
105
105
|
|
|
106
106
|
if (notEmpty($$)) {
|
|
107
107
|
$$.callPluginHook("$willDestroy");
|
|
108
|
+
|
|
108
109
|
$$.charts.splice($$.charts.indexOf(this), 1);
|
|
109
110
|
|
|
110
111
|
// detach events
|
|
@@ -114,6 +115,7 @@ export default {
|
|
|
114
115
|
svg.select("*").interrupt();
|
|
115
116
|
$$.resizeFunction.clear();
|
|
116
117
|
|
|
118
|
+
$$.resizeFunction.resizeObserver?.disconnect();
|
|
117
119
|
window.removeEventListener("resize", $$.resizeFunction);
|
|
118
120
|
chart.classed("bb", false)
|
|
119
121
|
.style("position", null)
|
package/src/Chart/api/regions.ts
CHANGED
|
@@ -36,7 +36,7 @@ function regionsFn(regions: RegionsParam, isAdd = false): RegionsParam {
|
|
|
36
36
|
* @function regions
|
|
37
37
|
* @instance
|
|
38
38
|
* @memberof Chart
|
|
39
|
-
* @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as regions.
|
|
39
|
+
* @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as [regions](./Options.html#.regions) option.
|
|
40
40
|
* @returns {Array} regions
|
|
41
41
|
* @example
|
|
42
42
|
* // Show 2 regions
|
|
@@ -65,7 +65,7 @@ extend(regions, {
|
|
|
65
65
|
* @function regions․add
|
|
66
66
|
* @instance
|
|
67
67
|
* @memberof Chart
|
|
68
|
-
* @param {Array|object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
|
|
68
|
+
* @param {Array|object} regions New region will be added. The format of this argument is the same as [regions](./Options.html#.regions) and it's possible to give an Object if only one region will be added.
|
|
69
69
|
* @returns {Array} regions
|
|
70
70
|
* @example
|
|
71
71
|
* // Add a new region
|
|
@@ -132,14 +132,12 @@ class Axis {
|
|
|
132
132
|
init() {
|
|
133
133
|
const $$ = this.owner;
|
|
134
134
|
const {config, $el: {main, axis}, state: {clip}} = $$;
|
|
135
|
-
const isRotated = config.axis_rotated;
|
|
136
135
|
const target = ["x", "y"];
|
|
137
136
|
|
|
138
137
|
config.axis_y2_show && target.push("y2");
|
|
139
138
|
|
|
140
139
|
target.forEach(v => {
|
|
141
140
|
const classAxis = this.getAxisClassName(v);
|
|
142
|
-
const classLabel = $AXIS[`axis${v.toUpperCase()}Label`];
|
|
143
141
|
|
|
144
142
|
axis[v] = main.append("g")
|
|
145
143
|
.attr("class", classAxis)
|
|
@@ -157,17 +155,8 @@ class Axis {
|
|
|
157
155
|
.attr("transform", $$.getTranslate(v))
|
|
158
156
|
.style("visibility", config[`axis_${v}_show`] ? null : "hidden");
|
|
159
157
|
|
|
160
|
-
axis[v].append("text")
|
|
161
|
-
.attr("class", classLabel)
|
|
162
|
-
.attr("transform", ["rotate(-90)", null][
|
|
163
|
-
v === "x" ? +!isRotated : +isRotated
|
|
164
|
-
])
|
|
165
|
-
.style("text-anchor", () => this.textAnchorForAxisLabel(v));
|
|
166
|
-
|
|
167
158
|
this.generateAxes(v);
|
|
168
159
|
});
|
|
169
|
-
|
|
170
|
-
config.axis_tooltip && this.setAxisTooltip();
|
|
171
160
|
}
|
|
172
161
|
|
|
173
162
|
/**
|
|
@@ -537,36 +526,36 @@ class Axis {
|
|
|
537
526
|
return x;
|
|
538
527
|
}
|
|
539
528
|
|
|
540
|
-
|
|
529
|
+
textAnchorForAxisLabel(id: string) {
|
|
541
530
|
const $$ = this.owner;
|
|
542
531
|
const position = this.getAxisLabelPosition(id);
|
|
543
|
-
let
|
|
532
|
+
let anchor = position.isMiddle ? "middle" : "end";
|
|
544
533
|
|
|
545
534
|
if (this.isHorizontal($$, id !== "x")) {
|
|
546
|
-
|
|
547
|
-
position.
|
|
535
|
+
anchor = position.isLeft ? "start" : (
|
|
536
|
+
position.isCenter ? "middle" : "end"
|
|
548
537
|
);
|
|
549
|
-
} else if (position.
|
|
550
|
-
|
|
538
|
+
} else if (position.isBottom) {
|
|
539
|
+
anchor = "start";
|
|
551
540
|
}
|
|
552
541
|
|
|
553
|
-
return
|
|
542
|
+
return anchor;
|
|
554
543
|
}
|
|
555
544
|
|
|
556
|
-
|
|
545
|
+
dxForAxisLabel(id: string) {
|
|
557
546
|
const $$ = this.owner;
|
|
558
547
|
const position = this.getAxisLabelPosition(id);
|
|
559
|
-
let
|
|
548
|
+
let dx = position.isBottom ? "0.5em" : "0";
|
|
560
549
|
|
|
561
550
|
if (this.isHorizontal($$, id !== "x")) {
|
|
562
|
-
|
|
563
|
-
position.
|
|
551
|
+
dx = position.isLeft ? "0.5em" : (
|
|
552
|
+
position.isRight ? "-0.5em" : "0"
|
|
564
553
|
);
|
|
565
|
-
} else if (position.
|
|
566
|
-
|
|
554
|
+
} else if (position.isTop) {
|
|
555
|
+
dx = "-0.5em";
|
|
567
556
|
}
|
|
568
557
|
|
|
569
|
-
return
|
|
558
|
+
return dx;
|
|
570
559
|
}
|
|
571
560
|
|
|
572
561
|
dyForAxisLabel(id: AxisType) {
|
|
@@ -808,27 +797,43 @@ class Axis {
|
|
|
808
797
|
return maxOverflow + tickOffset;
|
|
809
798
|
}
|
|
810
799
|
|
|
811
|
-
|
|
800
|
+
/**
|
|
801
|
+
* Update axis label text
|
|
802
|
+
* @param {boolean} withTransition Weather update with transition
|
|
803
|
+
* @private
|
|
804
|
+
*/
|
|
805
|
+
updateLabels(withTransition: boolean): void {
|
|
812
806
|
const $$ = this.owner;
|
|
813
|
-
const {$el: {main}, $T} = $$;
|
|
814
|
-
|
|
815
|
-
const labels = {
|
|
816
|
-
x: main.select(`.${$AXIS.axisX} .${$AXIS.axisXLabel}`),
|
|
817
|
-
y: main.select(`.${$AXIS.axisY} .${$AXIS.axisYLabel}`),
|
|
818
|
-
y2: main.select(`.${$AXIS.axisY2} .${$AXIS.axisY2Label}`)
|
|
819
|
-
};
|
|
807
|
+
const {config, $el: {main}, $T} = $$;
|
|
808
|
+
const isRotated = config.axis_rotated;
|
|
820
809
|
|
|
821
|
-
|
|
822
|
-
.
|
|
823
|
-
|
|
810
|
+
["x", "y", "y2"].forEach((id: AxisType) => {
|
|
811
|
+
const text = this.getLabelText(id);
|
|
812
|
+
const selector = `axis${capitalize(id)}`;
|
|
813
|
+
const classLabel = $AXIS[`${selector}Label`];
|
|
814
|
+
|
|
815
|
+
if (text) {
|
|
816
|
+
let axisLabel = main.select(`text.${classLabel}`);
|
|
817
|
+
|
|
818
|
+
// generate eleement if not exists
|
|
819
|
+
if (axisLabel.empty()) {
|
|
820
|
+
axisLabel = main.select(`g.${$AXIS[selector]}`)
|
|
821
|
+
.insert("text", ":first-child")
|
|
822
|
+
.attr("class", classLabel)
|
|
823
|
+
.attr("transform", ["rotate(-90)", null][
|
|
824
|
+
id === "x" ? +!isRotated : +isRotated
|
|
825
|
+
])
|
|
826
|
+
.style("text-anchor", () => this.textAnchorForAxisLabel(id));
|
|
827
|
+
}
|
|
824
828
|
|
|
825
829
|
// @check $$.$T(node, withTransition)
|
|
826
|
-
$T(
|
|
827
|
-
.attr("x", () => this.xForAxisLabel(
|
|
828
|
-
.attr("dx", () => this.dxForAxisLabel(
|
|
829
|
-
.attr("dy", () => this.dyForAxisLabel(
|
|
830
|
-
.text(
|
|
831
|
-
}
|
|
830
|
+
$T(axisLabel, withTransition)
|
|
831
|
+
.attr("x", () => this.xForAxisLabel(id))
|
|
832
|
+
.attr("dx", () => this.dxForAxisLabel(id))
|
|
833
|
+
.attr("dy", () => this.dyForAxisLabel(id))
|
|
834
|
+
.text(text);
|
|
835
|
+
}
|
|
836
|
+
});
|
|
832
837
|
}
|
|
833
838
|
|
|
834
839
|
/**
|
|
@@ -910,7 +915,7 @@ class Axis {
|
|
|
910
915
|
|
|
911
916
|
redraw(transitions, isHidden, isInit) {
|
|
912
917
|
const $$ = this.owner;
|
|
913
|
-
const {config, $el} = $$;
|
|
918
|
+
const {config, state, $el} = $$;
|
|
914
919
|
const opacity = isHidden ? "0" : null;
|
|
915
920
|
|
|
916
921
|
["x", "y", "y2", "subX"].forEach(id => {
|
|
@@ -928,6 +933,7 @@ class Axis {
|
|
|
928
933
|
});
|
|
929
934
|
|
|
930
935
|
this.updateAxes();
|
|
936
|
+
!state.rendered && config.axis_tooltip && this.setAxisTooltip();
|
|
931
937
|
}
|
|
932
938
|
|
|
933
939
|
/**
|
|
@@ -1089,24 +1095,26 @@ class Axis {
|
|
|
1089
1095
|
);
|
|
1090
1096
|
|
|
1091
1097
|
["x", "y", "y2"].forEach(v => {
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1098
|
+
if (isString(bgColor) || bgColor[v]) {
|
|
1099
|
+
axisTooltip[v] = axis[v]?.append("text")
|
|
1100
|
+
.classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true)
|
|
1101
|
+
.attr("filter", $$.updateTextBGColor({id: v}, bgColor));
|
|
1102
|
+
|
|
1103
|
+
if (isRotated) {
|
|
1104
|
+
const pos = v === "x" ? "x" : "y";
|
|
1105
|
+
const val = v === "y" ? "1.15em" : (v === "x" ? "-0.3em" : "-0.4em");
|
|
1106
|
+
|
|
1107
|
+
axisTooltip[v]?.attr(pos, val)
|
|
1108
|
+
.attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em")
|
|
1109
|
+
.style("text-anchor", v === "x" ? "end" : null);
|
|
1110
|
+
} else {
|
|
1111
|
+
const pos = v === "x" ? "y" : "x";
|
|
1112
|
+
const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
|
|
1106
1113
|
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1114
|
+
axisTooltip[v]?.attr(pos, val)
|
|
1115
|
+
.attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em")
|
|
1116
|
+
.style("text-anchor", v === "y" ? "end" : null);
|
|
1117
|
+
}
|
|
1110
1118
|
}
|
|
1111
1119
|
});
|
|
1112
1120
|
}
|
|
@@ -439,7 +439,7 @@ export default class ChartInternal {
|
|
|
439
439
|
$el.defs = $el.svg.append("defs");
|
|
440
440
|
|
|
441
441
|
if (hasAxis) {
|
|
442
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
|
|
442
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
|
|
443
443
|
$$.appendClip($el.defs, state.clip[v]);
|
|
444
444
|
});
|
|
445
445
|
}
|
|
@@ -787,13 +787,13 @@ export default class ChartInternal {
|
|
|
787
787
|
|
|
788
788
|
bindResize(): void {
|
|
789
789
|
const $$ = <any>this;
|
|
790
|
-
const {config, state} = $$;
|
|
790
|
+
const {$el, config, state} = $$;
|
|
791
791
|
const resizeFunction = generateResize(config.resize_timer);
|
|
792
792
|
const list: Function[] = [];
|
|
793
793
|
|
|
794
794
|
list.push(() => callFn(config.onresize, $$.api));
|
|
795
795
|
|
|
796
|
-
if (config.resize_auto
|
|
796
|
+
if (/^(true|parent)$/.test(config.resize_auto)) {
|
|
797
797
|
list.push(() => {
|
|
798
798
|
state.resizing = true;
|
|
799
799
|
|
|
@@ -818,7 +818,12 @@ export default class ChartInternal {
|
|
|
818
818
|
$$.resizeFunction = resizeFunction;
|
|
819
819
|
|
|
820
820
|
// attach resize event
|
|
821
|
-
|
|
821
|
+
if (config.resize_auto === "parent") {
|
|
822
|
+
($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$)))
|
|
823
|
+
.observe($el.chart.node().parentNode);
|
|
824
|
+
} else {
|
|
825
|
+
window.addEventListener("resize", $$.resizeFunction);
|
|
826
|
+
}
|
|
822
827
|
}
|
|
823
828
|
|
|
824
829
|
/**
|