billboard.js 3.14.1 → 3.14.3
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 +79 -41
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +9 -9
- package/dist/billboard.pkgd.js +79 -41
- package/dist/billboard.pkgd.min.js +9 -9
- 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 +9 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +9 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +9 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +9 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +9 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +7 -7
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +9 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +9 -3
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- 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 +460 -420
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +88 -15
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +86 -13
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +83 -10
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +70 -7
- package/package.json +29 -29
- package/src/ChartInternal/Axis/Axis.ts +23 -0
- package/src/ChartInternal/data/data.ts +5 -4
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/interactions/subchart.ts +2 -25
- package/src/ChartInternal/interactions/zoom.ts +21 -0
- package/src/ChartInternal/internals/tooltip.ts +25 -15
- package/src/config/Options/axis/x.ts +2 -1
- package/src/config/Options/shape/gauge.ts +3 -2
- package/src/module/util.ts +10 -2
- package/types/axis.d.ts +2 -2
- package/types/options.shape.d.ts +3 -2
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.14.
|
|
8
|
+
* @version 3.14.3
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -75,10 +75,54 @@ 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 === undefined ? undefined : 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
|
+
}
|
|
82
126
|
// emulate event
|
|
83
127
|
({
|
|
84
128
|
mouse: (function () {
|
|
@@ -94,14 +138,14 @@ var isObjectType = function (v) { return typeof v === "object"; };
|
|
|
94
138
|
// eslint-disable-next-line no-new
|
|
95
139
|
new MouseEvent("t");
|
|
96
140
|
return function (el, eventType, params) {
|
|
97
|
-
if (params ===
|
|
141
|
+
if (params === undefined) { params = getParams(); }
|
|
98
142
|
el.dispatchEvent(new MouseEvent(eventType, params));
|
|
99
143
|
};
|
|
100
144
|
}
|
|
101
145
|
catch (_a) {
|
|
102
146
|
// Polyfills DOM4 MouseEvent
|
|
103
147
|
return function (el, eventType, params) {
|
|
104
|
-
if (params ===
|
|
148
|
+
if (params === undefined) { params = getParams(); }
|
|
105
149
|
var mouseEvent = doc.createEvent("MouseEvent");
|
|
106
150
|
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
|
|
107
151
|
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, win, 0, // the event's mouse click count
|
|
@@ -109,7 +153,26 @@ var isObjectType = function (v) { return typeof v === "object"; };
|
|
|
109
153
|
el.dispatchEvent(mouseEvent);
|
|
110
154
|
};
|
|
111
155
|
}
|
|
112
|
-
})()
|
|
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
|
+
});
|
|
113
176
|
|
|
114
177
|
/**
|
|
115
178
|
* Load configuration option
|
|
@@ -170,7 +233,7 @@ var Plugin = /** @class */ (function () {
|
|
|
170
233
|
* @private
|
|
171
234
|
*/
|
|
172
235
|
function Plugin(options) {
|
|
173
|
-
if (options ===
|
|
236
|
+
if (options === undefined) { options = {}; }
|
|
174
237
|
this.options = options;
|
|
175
238
|
}
|
|
176
239
|
/**
|
|
@@ -204,7 +267,7 @@ var Plugin = /** @class */ (function () {
|
|
|
204
267
|
delete _this[key];
|
|
205
268
|
});
|
|
206
269
|
};
|
|
207
|
-
Plugin.version = "3.14.
|
|
270
|
+
Plugin.version = "3.14.3";
|
|
208
271
|
return Plugin;
|
|
209
272
|
}());
|
|
210
273
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.3",
|
|
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,25 +102,25 @@
|
|
|
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": "^
|
|
109
|
-
"@rollup/plugin-replace": "^6.0.
|
|
110
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
105
|
+
"@commitlint/cli": "^19.6.1",
|
|
106
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
107
|
+
"@eslint/js": "^9.17.0",
|
|
108
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
109
|
+
"@rollup/plugin-replace": "^6.0.2",
|
|
110
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
111
111
|
"@semantic-release/changelog": "^6.0.3",
|
|
112
|
-
"@semantic-release/commit-analyzer": "^13.0.
|
|
112
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
113
113
|
"@semantic-release/exec": "^6.0.3",
|
|
114
114
|
"@semantic-release/git": "^10.0.1",
|
|
115
115
|
"@semantic-release/npm": "^12.0.1",
|
|
116
|
-
"@semantic-release/release-notes-generator": "^14.0.
|
|
116
|
+
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
117
117
|
"@testing-library/dom": "^10.4.0",
|
|
118
|
-
"@testing-library/react": "^16.0
|
|
118
|
+
"@testing-library/react": "^16.1.0",
|
|
119
119
|
"@types/d3": "^7.4.3",
|
|
120
120
|
"@types/sinon": "^17.0.3",
|
|
121
|
-
"@vitest/browser": "^2.1.
|
|
122
|
-
"@vitest/coverage-istanbul": "^2.1.
|
|
123
|
-
"@vitest/ui": "^2.1.
|
|
121
|
+
"@vitest/browser": "^2.1.8",
|
|
122
|
+
"@vitest/coverage-istanbul": "^2.1.8",
|
|
123
|
+
"@vitest/ui": "^2.1.8",
|
|
124
124
|
"better-docs": "^2.7.3",
|
|
125
125
|
"clean-webpack-plugin": "^4.0.0",
|
|
126
126
|
"cloc": "2.2.0-cloc",
|
|
@@ -133,36 +133,36 @@
|
|
|
133
133
|
"d3-format": "^3.1.0",
|
|
134
134
|
"d3-polygon": "^3.0.1",
|
|
135
135
|
"docdash": "^2.0.2",
|
|
136
|
-
"dprint": "^0.
|
|
136
|
+
"dprint": "^0.48.0",
|
|
137
137
|
"esbuild-loader": "^4.2.2",
|
|
138
|
-
"eslint": "^9.
|
|
138
|
+
"eslint": "^9.17.0",
|
|
139
139
|
"eslint-plugin-import": "^2.31.0",
|
|
140
|
-
"eslint-plugin-jsdoc": "^50.
|
|
141
|
-
"husky": "^9.1.
|
|
140
|
+
"eslint-plugin-jsdoc": "^50.6.1",
|
|
141
|
+
"husky": "^9.1.7",
|
|
142
142
|
"jsdoc": "^4.0.4",
|
|
143
|
-
"lint-staged": "^15.
|
|
143
|
+
"lint-staged": "^15.3.0",
|
|
144
144
|
"mini-css-extract-plugin": "^2.9.2",
|
|
145
|
-
"playwright": "^1.
|
|
145
|
+
"playwright": "^1.49.1",
|
|
146
146
|
"regenerator-runtime": "^0.14.1",
|
|
147
|
-
"rollup": "^4.
|
|
147
|
+
"rollup": "^4.30.0",
|
|
148
148
|
"rollup-plugin-delete": "^2.1.0",
|
|
149
|
-
"sass": "^1.
|
|
150
|
-
"sass-loader": "^16.0.
|
|
151
|
-
"semantic-release": "^24.2.
|
|
149
|
+
"sass": "^1.83.1",
|
|
150
|
+
"sass-loader": "^16.0.4",
|
|
151
|
+
"semantic-release": "^24.2.1",
|
|
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": "^2.1.
|
|
160
|
-
"webpack": "^5.
|
|
157
|
+
"typescript": "^5.7.2",
|
|
158
|
+
"typescript-eslint": "^8.19.1",
|
|
159
|
+
"vitest": "^2.1.8",
|
|
160
|
+
"webpack": "^5.97.1",
|
|
161
161
|
"webpack-bundle-analyzer": "^4.10.2",
|
|
162
162
|
"webpack-clean": "^1.2.5",
|
|
163
|
-
"webpack-cli": "^
|
|
163
|
+
"webpack-cli": "^6.0.1",
|
|
164
164
|
"webpack-common-shake": "^2.1.0",
|
|
165
|
-
"webpack-dev-server": "^5.
|
|
165
|
+
"webpack-dev-server": "^5.2.0",
|
|
166
166
|
"webpack-merge": "^6.0.1",
|
|
167
167
|
"webpackbar": "^7.0.0",
|
|
168
168
|
"write-file-webpack-plugin": "^4.5.1"
|
|
@@ -106,6 +106,29 @@ class Axis {
|
|
|
106
106
|
return type;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Get extent value
|
|
111
|
+
* @returns {Array} default extent
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
public getExtent(): number[] {
|
|
115
|
+
const $$ = this.owner;
|
|
116
|
+
const {config, scale} = $$;
|
|
117
|
+
let extent = config.axis_x_extent;
|
|
118
|
+
|
|
119
|
+
if (extent) {
|
|
120
|
+
if (isFunction(extent)) {
|
|
121
|
+
extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);
|
|
122
|
+
} else if (this.isTimeSeries() && extent.every(isNaN)) {
|
|
123
|
+
const fn = parseDate.bind($$);
|
|
124
|
+
|
|
125
|
+
extent = extent.map(v => scale.subX(fn(v)));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return extent;
|
|
130
|
+
}
|
|
131
|
+
|
|
109
132
|
init() {
|
|
110
133
|
const $$ = this.owner;
|
|
111
134
|
const {config, $el: {main, axis}, state: {clip}} = $$;
|
|
@@ -730,14 +730,15 @@ export default {
|
|
|
730
730
|
event.changedTouches[0] :
|
|
731
731
|
event;
|
|
732
732
|
|
|
733
|
-
let point = isRotated ?
|
|
734
|
-
e.clientY + scrollPos.y - rect.top :
|
|
735
|
-
e.clientX + scrollPos.x - rect.left;
|
|
733
|
+
let point = isRotated ? e.clientY + scrollPos.y : e.clientX + scrollPos.x;
|
|
736
734
|
|
|
737
735
|
if (hasViewBox($el.svg)) {
|
|
738
736
|
const pos = [point, 0];
|
|
737
|
+
|
|
739
738
|
isRotated && pos.reverse();
|
|
740
|
-
point = getTransformCTM($el.
|
|
739
|
+
point = getTransformCTM($el.eventRect.node(), ...pos)[isRotated ? "y" : "x"];
|
|
740
|
+
} else {
|
|
741
|
+
point -= isRotated ? rect.top : rect.left;
|
|
741
742
|
}
|
|
742
743
|
|
|
743
744
|
index = findIndex(
|
|
@@ -226,7 +226,7 @@ export default {
|
|
|
226
226
|
let y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
|
|
227
227
|
|
|
228
228
|
if (hasViewBox(svg)) {
|
|
229
|
-
const ctm = getTransformCTM($$.$el.
|
|
229
|
+
const ctm = getTransformCTM($$.$el.eventRect.node(), x, y, false);
|
|
230
230
|
|
|
231
231
|
x = ctm.x;
|
|
232
232
|
y = ctm.y;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {brushSelection as d3BrushSelection, brushX as d3BrushX, brushY as d3BrushY} from "d3-brush";
|
|
6
6
|
import {select as d3Select} from "d3-selection";
|
|
7
7
|
import CLASS from "../../config/classes";
|
|
8
|
-
import {brushEmpty, capitalize, isArray
|
|
8
|
+
import {brushEmpty, capitalize, isArray} from "../../module/util";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
/**
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
92
92
|
// set the brush extent
|
|
93
93
|
$$.brush.scale = function(scale) {
|
|
94
94
|
const h = config.subchart_size_height;
|
|
95
|
-
let extent = $$.getExtent();
|
|
95
|
+
let extent = $$.axis.getExtent();
|
|
96
96
|
|
|
97
97
|
if (!extent && scale.range) {
|
|
98
98
|
extent = [[0, 0], [scale.range()[1], h]];
|
|
@@ -373,28 +373,5 @@ export default {
|
|
|
373
373
|
|
|
374
374
|
subchart.main.attr("transform", $$.getTranslate("context"));
|
|
375
375
|
subXAxis.attr("transform", $$.getTranslate("subX"));
|
|
376
|
-
},
|
|
377
|
-
|
|
378
|
-
/**
|
|
379
|
-
* Get extent value
|
|
380
|
-
* @returns {Array} default extent
|
|
381
|
-
* @private
|
|
382
|
-
*/
|
|
383
|
-
getExtent(): number[] {
|
|
384
|
-
const $$ = this;
|
|
385
|
-
const {config, scale} = $$;
|
|
386
|
-
let extent = config.axis_x_extent;
|
|
387
|
-
|
|
388
|
-
if (extent) {
|
|
389
|
-
if (isFunction(extent)) {
|
|
390
|
-
extent = extent.bind($$.api)($$.getXDomain($$.data.targets), scale.subX);
|
|
391
|
-
} else if ($$.axis.isTimeSeries() && extent.every(isNaN)) {
|
|
392
|
-
const fn = parseDate.bind($$);
|
|
393
|
-
|
|
394
|
-
extent = extent.map(v => scale.subX(fn(v)));
|
|
395
|
-
}
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
return extent;
|
|
399
376
|
}
|
|
400
377
|
};
|
|
@@ -367,6 +367,7 @@ export default {
|
|
|
367
367
|
let start = 0;
|
|
368
368
|
let end = 0;
|
|
369
369
|
let zoomRect;
|
|
370
|
+
let extent;
|
|
370
371
|
|
|
371
372
|
const prop = {
|
|
372
373
|
axis: isRotated ? "y" : "x",
|
|
@@ -377,6 +378,9 @@ export default {
|
|
|
377
378
|
$$.zoomBehaviour = d3Drag()
|
|
378
379
|
.clickDistance(4)
|
|
379
380
|
.on("start", function(event) {
|
|
381
|
+
// get extent at first zooming, when is zoomed do not consider
|
|
382
|
+
extent = $$.scale.zoom ? null : $$.axis.getExtent();
|
|
383
|
+
|
|
380
384
|
state.event = event;
|
|
381
385
|
$$.setDragStatus(true);
|
|
382
386
|
$$.unselectRect();
|
|
@@ -390,6 +394,15 @@ export default {
|
|
|
390
394
|
}
|
|
391
395
|
|
|
392
396
|
start = getPointer(event, this as SVGAElement)[prop.index];
|
|
397
|
+
|
|
398
|
+
if (extent) {
|
|
399
|
+
if (start < extent[0]) {
|
|
400
|
+
start = extent[0];
|
|
401
|
+
} else if (start > extent[1]) {
|
|
402
|
+
start = extent[1];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
|
|
393
406
|
end = start;
|
|
394
407
|
|
|
395
408
|
zoomRect
|
|
@@ -401,6 +414,14 @@ export default {
|
|
|
401
414
|
.on("drag", function(event) {
|
|
402
415
|
end = getPointer(event, this as SVGAElement)[prop.index];
|
|
403
416
|
|
|
417
|
+
if (extent) {
|
|
418
|
+
if (end > extent[1]) {
|
|
419
|
+
end = extent[1];
|
|
420
|
+
} else if (end < extent[0]) {
|
|
421
|
+
end = extent[0];
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
404
425
|
zoomRect
|
|
405
426
|
.attr(prop.axis, Math.min(start, end))
|
|
406
427
|
.attr(prop.attr, Math.abs(end - start));
|
|
@@ -362,16 +362,21 @@ export default {
|
|
|
362
362
|
}
|
|
363
363
|
},
|
|
364
364
|
|
|
365
|
+
/**
|
|
366
|
+
* Get tooltip position when svg has vieBox attribute
|
|
367
|
+
* @param {number} tWidth Tooltip width value
|
|
368
|
+
* @param {number} tHeight Tooltip height value
|
|
369
|
+
* @param {object} currPos Current event position value from SVG coordinate
|
|
370
|
+
* @returns {object} top, left value
|
|
371
|
+
*/
|
|
365
372
|
getTooltipPositionViewBox(tWidth: number, tHeight: number,
|
|
366
373
|
currPos: {[key: string]: number}): {top: number, left: number} {
|
|
367
374
|
const $$ = this;
|
|
368
|
-
const {$el: {eventRect,
|
|
375
|
+
const {$el: {eventRect, svg}, config, state} = $$;
|
|
369
376
|
|
|
370
377
|
const isRotated = config.axis_rotated;
|
|
371
|
-
const hasArcType = $$.hasArcType(
|
|
372
|
-
|
|
373
|
-
const target = (state.hasRadar ? main : eventRect)?.node() ?? state.event.target;
|
|
374
|
-
const size = 38; // getTransformCTM($el.svg.node(), 10, 0, false).x;
|
|
378
|
+
const hasArcType = $$.hasArcType() || state.hasFunnel || state.hasTreemap;
|
|
379
|
+
const target = (hasArcType ? svg : eventRect)?.node() ?? state.event.target;
|
|
375
380
|
|
|
376
381
|
let {x, y} = currPos;
|
|
377
382
|
|
|
@@ -380,25 +385,30 @@ export default {
|
|
|
380
385
|
y = isRotated ? currPos.xAxis : y;
|
|
381
386
|
}
|
|
382
387
|
|
|
383
|
-
// currPos
|
|
388
|
+
// currPos value based on SVG coordinate
|
|
384
389
|
const ctm = getTransformCTM(target, x, y, false);
|
|
390
|
+
const rect = target.getBoundingClientRect();
|
|
391
|
+
const size = getTransformCTM(target, 20, 0, false).x;
|
|
385
392
|
|
|
386
393
|
let top = ctm.y;
|
|
387
|
-
let left = ctm.x + size;
|
|
394
|
+
let left = ctm.x + (tWidth / 2) + size;
|
|
388
395
|
|
|
389
396
|
if (hasArcType) {
|
|
390
|
-
|
|
391
|
-
|
|
397
|
+
if (state.hasFunnel || state.hasTreemap || state.hasRadar) {
|
|
398
|
+
left -= (tWidth / 2) + size;
|
|
399
|
+
top += tHeight;
|
|
400
|
+
} else {
|
|
401
|
+
top += rect.height / 2;
|
|
402
|
+
left += (rect.width / 2) - (tWidth - size);
|
|
403
|
+
}
|
|
392
404
|
}
|
|
393
405
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
if (left + tWidth > rect.right) {
|
|
397
|
-
left = rect.right - tWidth - size;
|
|
406
|
+
if (left + tWidth > rect.width) {
|
|
407
|
+
left = rect.width - tWidth - size;
|
|
398
408
|
}
|
|
399
409
|
|
|
400
|
-
if (top + tHeight > rect.
|
|
401
|
-
top -= tHeight
|
|
410
|
+
if (top + tHeight > rect.height) {
|
|
411
|
+
top -= tHeight * 2;
|
|
402
412
|
}
|
|
403
413
|
|
|
404
414
|
return {
|
|
@@ -635,7 +635,8 @@ export default {
|
|
|
635
635
|
axis_x_height: <number | undefined>undefined,
|
|
636
636
|
|
|
637
637
|
/**
|
|
638
|
-
* Set
|
|
638
|
+
* Set extent for subchart and zoom(drag only). This can be an array or function that returns an array.
|
|
639
|
+
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
639
640
|
* @name axis․x․extent
|
|
640
641
|
* @memberof Options
|
|
641
642
|
* @type {Array|Function}
|
|
@@ -27,8 +27,9 @@ export default {
|
|
|
27
27
|
* @property {number} [gauge.expand.rate=0.98] Set expand rate.
|
|
28
28
|
* @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
|
|
29
29
|
* @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
|
|
30
|
-
* -
|
|
31
|
-
*
|
|
30
|
+
* - **Note:** Only works for single data series.
|
|
31
|
+
* - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
|
|
32
|
+
* - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
|
|
32
33
|
* @property {number} [gauge.min=0] Set min value of the gauge.
|
|
33
34
|
* @property {number} [gauge.max=100] Set max value of the gauge.
|
|
34
35
|
* @property {number} [gauge.startingAngle=-1 * Math.PI / 2] Set starting angle where data draws.
|
package/src/module/util.ts
CHANGED
|
@@ -551,10 +551,18 @@ function getScrollPosition(node: HTMLElement) {
|
|
|
551
551
|
function getTransformCTM(node: SVGGraphicsElement, x = 0, y = 0, inverse = true): DOMPoint {
|
|
552
552
|
const point = new DOMPoint(x, y);
|
|
553
553
|
const screen = <DOMMatrix>node.getScreenCTM();
|
|
554
|
-
|
|
555
|
-
return point.matrixTransform(
|
|
554
|
+
const res = point.matrixTransform(
|
|
556
555
|
inverse ? screen?.inverse() : screen
|
|
557
556
|
);
|
|
557
|
+
|
|
558
|
+
if (inverse === false) {
|
|
559
|
+
const rect = node.getBoundingClientRect();
|
|
560
|
+
|
|
561
|
+
res.x -= rect.x;
|
|
562
|
+
res.y -= rect.y;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return res;
|
|
558
566
|
}
|
|
559
567
|
|
|
560
568
|
/**
|
package/types/axis.d.ts
CHANGED
|
@@ -121,8 +121,8 @@ export interface xAxisConfiguration extends AxisConfigurationBase {
|
|
|
121
121
|
height?: number;
|
|
122
122
|
|
|
123
123
|
/**
|
|
124
|
-
* Set
|
|
125
|
-
*
|
|
124
|
+
* Set extent for subchart and zoom(drag only). This can be an array or function that returns an array.
|
|
125
|
+
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
126
126
|
*/
|
|
127
127
|
extent?: Array<number|string> | (
|
|
128
128
|
(
|
package/types/options.shape.d.ts
CHANGED
|
@@ -440,8 +440,9 @@ export interface GaugeOptions {
|
|
|
440
440
|
|
|
441
441
|
/**
|
|
442
442
|
* Enforce to given min/max value.
|
|
443
|
-
*
|
|
444
|
-
*
|
|
443
|
+
* **Note:** Only works for single data series.
|
|
444
|
+
* - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
|
|
445
|
+
* - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
|
|
445
446
|
*/
|
|
446
447
|
enforceMinMax?: boolean;
|
|
447
448
|
|