billboard.js 3.9.0 → 3.9.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 +5 -1
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +321 -210
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +1443 -480
- package/dist/billboard.pkgd.min.js +2 -2
- 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 +3 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1124 -272
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1126 -274
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1126 -274
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1127 -275
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1126 -274
- 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-esm/billboard.js +242 -136
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +25 -25
- package/src/Chart/api/load.ts +4 -2
- package/src/Chart/api/tooltip.ts +11 -3
- package/src/ChartInternal/data/data.ts +31 -24
- package/src/ChartInternal/interactions/eventrect.ts +82 -12
- package/src/ChartInternal/interactions/interaction.ts +2 -57
- package/src/ChartInternal/internals/redraw.ts +2 -0
- package/src/ChartInternal/internals/tooltip.ts +112 -42
- package/src/ChartInternal/shape/arc.ts +20 -2
- package/src/ChartInternal/shape/line.ts +0 -1
- package/src/ChartInternal/shape/point.ts +20 -2
- package/src/ChartInternal/shape/radar.ts +5 -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.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -104,7 +104,7 @@ var Plugin = /** @class */ (function () {
|
|
|
104
104
|
delete _this[key];
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
-
Plugin.version = "3.9.
|
|
107
|
+
Plugin.version = "3.9.2";
|
|
108
108
|
return Plugin;
|
|
109
109
|
}());
|
|
110
110
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -279,7 +279,7 @@ var Plugin = /** @class */ (function () {
|
|
|
279
279
|
delete _this[key];
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
|
-
Plugin.version = "3.9.
|
|
282
|
+
Plugin.version = "3.9.2";
|
|
283
283
|
return Plugin;
|
|
284
284
|
}());
|
|
285
285
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -487,7 +487,7 @@ var Plugin = /** @class */ (function () {
|
|
|
487
487
|
delete _this[key];
|
|
488
488
|
});
|
|
489
489
|
};
|
|
490
|
-
Plugin.version = "3.9.
|
|
490
|
+
Plugin.version = "3.9.2";
|
|
491
491
|
return Plugin;
|
|
492
492
|
}());
|
|
493
493
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -121,7 +121,7 @@ var Plugin = /** @class */ (function () {
|
|
|
121
121
|
delete _this[key];
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
|
-
Plugin.version = "3.9.
|
|
124
|
+
Plugin.version = "3.9.2";
|
|
125
125
|
return Plugin;
|
|
126
126
|
}());
|
|
127
127
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.9.
|
|
8
|
+
* @version 3.9.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -263,7 +263,7 @@ var Plugin = /** @class */ (function () {
|
|
|
263
263
|
delete _this[key];
|
|
264
264
|
});
|
|
265
265
|
};
|
|
266
|
-
Plugin.version = "3.9.
|
|
266
|
+
Plugin.version = "3.9.2";
|
|
267
267
|
return Plugin;
|
|
268
268
|
}());
|
|
269
269
|
var Plugin$1 = Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.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,34 +102,34 @@
|
|
|
102
102
|
"d3-zoom": "^3.0.0"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@babel/core": "^7.22.
|
|
106
|
-
"@babel/eslint-parser": "^7.22.
|
|
105
|
+
"@babel/core": "^7.22.9",
|
|
106
|
+
"@babel/eslint-parser": "^7.22.9",
|
|
107
107
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
108
108
|
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
109
|
-
"@babel/plugin-transform-runtime": "^7.22.
|
|
110
|
-
"@babel/preset-env": "^7.22.
|
|
109
|
+
"@babel/plugin-transform-runtime": "^7.22.9",
|
|
110
|
+
"@babel/preset-env": "^7.22.9",
|
|
111
111
|
"@babel/preset-typescript": "^7.22.5",
|
|
112
|
-
"@babel/runtime": "^7.22.
|
|
113
|
-
"@commitlint/cli": "17.6.
|
|
114
|
-
"@commitlint/config-conventional": "^17.6.
|
|
112
|
+
"@babel/runtime": "^7.22.6",
|
|
113
|
+
"@commitlint/cli": "17.6.7",
|
|
114
|
+
"@commitlint/config-conventional": "^17.6.7",
|
|
115
115
|
"@rollup/plugin-babel": "^6.0.3",
|
|
116
116
|
"@rollup/plugin-node-resolve": "^15.0.2",
|
|
117
117
|
"@rollup/plugin-replace": "^5.0.2",
|
|
118
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
118
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
119
119
|
"@semantic-release/changelog": "^6.0.3",
|
|
120
120
|
"@semantic-release/commit-analyzer": "^10.0.1",
|
|
121
121
|
"@semantic-release/exec": "^6.0.3",
|
|
122
122
|
"@semantic-release/git": "^10.0.1",
|
|
123
123
|
"@semantic-release/npm": "^10.0.4",
|
|
124
|
-
"@semantic-release/release-notes-generator": "^11.0.
|
|
124
|
+
"@semantic-release/release-notes-generator": "^11.0.4",
|
|
125
125
|
"@types/chai": "^4.3.5",
|
|
126
126
|
"@types/d3": "^7.4.0",
|
|
127
127
|
"@types/mocha": "^10.0.1",
|
|
128
128
|
"@types/sinon": "^10.0.15",
|
|
129
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
130
|
-
"@typescript-eslint/parser": "^
|
|
129
|
+
"@typescript-eslint/eslint-plugin": "^6.2.1",
|
|
130
|
+
"@typescript-eslint/parser": "^6.2.1",
|
|
131
131
|
"babel-helper-modules": "^6.0.0",
|
|
132
|
-
"babel-loader": "^9.1.
|
|
132
|
+
"babel-loader": "^9.1.3",
|
|
133
133
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
134
134
|
"babel-plugin-minify-constant-folding": "^0.5.0",
|
|
135
135
|
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
|
@@ -143,7 +143,7 @@
|
|
|
143
143
|
"chai": "^4.3.7",
|
|
144
144
|
"clean-webpack-plugin": "^4.0.0",
|
|
145
145
|
"cloc": "^2.11.0",
|
|
146
|
-
"core-js": "^3.
|
|
146
|
+
"core-js": "^3.32.0",
|
|
147
147
|
"coveralls": "^3.1.1",
|
|
148
148
|
"cross-env": "^7.0.3",
|
|
149
149
|
"css-loader": "^6.8.1",
|
|
@@ -154,16 +154,16 @@
|
|
|
154
154
|
"d3-polygon": "^3.0.1",
|
|
155
155
|
"docdash": "^2.0.1",
|
|
156
156
|
"dtslint": "^4.2.1",
|
|
157
|
-
"eslint": "^8.
|
|
157
|
+
"eslint": "^8.46.0",
|
|
158
158
|
"eslint-config-naver": "^2.1.0",
|
|
159
|
-
"eslint-plugin-import": "^2.
|
|
160
|
-
"eslint-plugin-jsdoc": "^46.
|
|
159
|
+
"eslint-plugin-import": "^2.28.0",
|
|
160
|
+
"eslint-plugin-jsdoc": "^46.4.5",
|
|
161
161
|
"eslint-webpack-plugin": "^4.0.1",
|
|
162
162
|
"exports-loader": "^4.0.0",
|
|
163
163
|
"hammer-simulator": "0.0.1",
|
|
164
164
|
"husky": "^8.0.3",
|
|
165
165
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
166
|
-
"istanbul-lib-instrument": "^
|
|
166
|
+
"istanbul-lib-instrument": "^6.0.0",
|
|
167
167
|
"jsdoc": "^4.0.2",
|
|
168
168
|
"karma": "^6.4.2",
|
|
169
169
|
"karma-chai": "^0.1.0",
|
|
@@ -175,25 +175,25 @@
|
|
|
175
175
|
"karma-sinon": "^1.0.5",
|
|
176
176
|
"karma-sourcemap-loader": "^0.4.0",
|
|
177
177
|
"karma-webpack": "^5.0.0",
|
|
178
|
-
"lint-staged": "^13.2.
|
|
178
|
+
"lint-staged": "^13.2.3",
|
|
179
179
|
"lite-fixture": "^1.0.2",
|
|
180
180
|
"mini-css-extract-plugin": "^2.7.6",
|
|
181
181
|
"mocha": "^10.2.0",
|
|
182
182
|
"node-sass": "^9.0.0",
|
|
183
183
|
"regenerator-runtime": "^0.13.11",
|
|
184
|
-
"rollup": "^3.
|
|
184
|
+
"rollup": "^3.27.0",
|
|
185
185
|
"rollup-plugin-delete": "^2.0.0",
|
|
186
186
|
"sass-loader": "^13.3.2",
|
|
187
|
-
"semantic-release": "^21.0.
|
|
187
|
+
"semantic-release": "^21.0.7",
|
|
188
188
|
"simulant": "^0.2.2",
|
|
189
|
-
"sinon": "^15.
|
|
189
|
+
"sinon": "^15.2.0",
|
|
190
190
|
"string-replace-loader": "^3.1.0",
|
|
191
191
|
"style-loader": "^3.3.3",
|
|
192
192
|
"taffydb": "^2.7.3",
|
|
193
193
|
"terser-webpack-plugin": "^5.3.9",
|
|
194
|
-
"tslib": "^2.
|
|
195
|
-
"typescript": "5.1.
|
|
196
|
-
"webpack": "^5.
|
|
194
|
+
"tslib": "^2.6.1",
|
|
195
|
+
"typescript": "5.1.6",
|
|
196
|
+
"webpack": "^5.88.2",
|
|
197
197
|
"webpack-bundle-analyzer": "^4.9.0",
|
|
198
198
|
"webpack-clean": "^1.2.5",
|
|
199
199
|
"webpack-cli": "^5.1.4",
|
package/src/Chart/api/load.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import {requestIdleCallback} from "../../module/browser";
|
|
6
|
-
import {isString, isArray} from "../../module/util";
|
|
6
|
+
import {isString, isArray, isEmpty} from "../../module/util";
|
|
7
7
|
import {callDone} from "../../ChartInternal/data/load";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
@@ -182,7 +182,6 @@ export default {
|
|
|
182
182
|
requestIdleCallback(() => $$.loadFromArgs(args));
|
|
183
183
|
});
|
|
184
184
|
} else {
|
|
185
|
-
$$.api.tooltip.hide();
|
|
186
185
|
$$.loadFromArgs(args);
|
|
187
186
|
}
|
|
188
187
|
},
|
|
@@ -216,6 +215,9 @@ export default {
|
|
|
216
215
|
const $$ = this.internal;
|
|
217
216
|
let args = argsValue || {};
|
|
218
217
|
|
|
218
|
+
// hide possible tooltip display when data is completely unloaded
|
|
219
|
+
isEmpty(args) && this.tooltip.hide();
|
|
220
|
+
|
|
219
221
|
if (isArray(args)) {
|
|
220
222
|
args = {ids: args};
|
|
221
223
|
} else if (isString(args)) {
|
package/src/Chart/api/tooltip.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import {isDefined} from "../../module/util";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Define tooltip
|
|
@@ -48,6 +48,10 @@ const tooltip = {
|
|
|
48
48
|
* }
|
|
49
49
|
* });
|
|
50
50
|
*
|
|
51
|
+
* // for Arc types, specify 'id' or 'index'
|
|
52
|
+
* chart.tooltip.show({ data: { id: "data2" }});
|
|
53
|
+
* chart.tooltip.show({ data: { index: 2 }});
|
|
54
|
+
*
|
|
51
55
|
* // when data.xs is used
|
|
52
56
|
* chart.tooltip.show({
|
|
53
57
|
* data: {
|
|
@@ -80,7 +84,7 @@ const tooltip = {
|
|
|
80
84
|
// determine focus data
|
|
81
85
|
if (args.data) {
|
|
82
86
|
const {data} = args;
|
|
83
|
-
const y = $$.getYScaleById(data.id)(data.value);
|
|
87
|
+
const y = $$.getYScaleById(data.id)?.(data.value);
|
|
84
88
|
|
|
85
89
|
if (hasTreemap && data.id) {
|
|
86
90
|
eventReceiver.rect = $el.main.select(`${$$.selectorTarget(data.id, undefined, "rect")}`);
|
|
@@ -92,7 +96,11 @@ const tooltip = {
|
|
|
92
96
|
mouse = [0, y];
|
|
93
97
|
}
|
|
94
98
|
|
|
95
|
-
index =
|
|
99
|
+
index = data.index ?? (
|
|
100
|
+
$$.hasArcType() && data.id ?
|
|
101
|
+
$$.getArcElementByIdOrIndex(data.id)?.datum().index :
|
|
102
|
+
$$.getIndexByX(data.x)
|
|
103
|
+
);
|
|
96
104
|
}
|
|
97
105
|
} else if (isDefined(args.x)) {
|
|
98
106
|
index = $$.getIndexByX(args.x);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
+
import {select as d3Select} from "d3-selection";
|
|
5
6
|
import {$BAR, $CANDLESTICK, $COMMON} from "../../config/classes";
|
|
6
7
|
import {KEY} from "../../module/Cache";
|
|
7
8
|
import type {IData, IDataPoint, IDataRow} from "./IData";
|
|
@@ -664,18 +665,34 @@ export default {
|
|
|
664
665
|
*/
|
|
665
666
|
getDataIndexFromEvent(event): number {
|
|
666
667
|
const $$ = this;
|
|
667
|
-
const {config, state: {inputType, eventReceiver: {coords, rect}}} = $$;
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
668
|
+
const {config, state: {hasRadar, inputType, eventReceiver: {coords, rect}}} = $$;
|
|
669
|
+
let index;
|
|
670
|
+
|
|
671
|
+
if (hasRadar) {
|
|
672
|
+
let target = event.target;
|
|
673
|
+
|
|
674
|
+
// in case of multilined axis text
|
|
675
|
+
if (/tspan/i.test(target.tagName)) {
|
|
676
|
+
target = target.parentNode;
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
const d: any = d3Select(target).datum();
|
|
680
|
+
|
|
681
|
+
index = d && Object.keys(d).length === 1 ? d.index : undefined;
|
|
682
|
+
} else {
|
|
683
|
+
const isRotated = config.axis_rotated;
|
|
684
|
+
|
|
685
|
+
// get data based on the mouse coords
|
|
686
|
+
const e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event;
|
|
687
|
+
|
|
688
|
+
index = findIndex(
|
|
689
|
+
coords,
|
|
690
|
+
isRotated ? e.clientY - rect.top : e.clientX - rect.left,
|
|
691
|
+
0,
|
|
692
|
+
coords.length - 1,
|
|
693
|
+
isRotated
|
|
694
|
+
);
|
|
695
|
+
}
|
|
679
696
|
|
|
680
697
|
return index;
|
|
681
698
|
},
|
|
@@ -740,19 +757,9 @@ export default {
|
|
|
740
757
|
|
|
741
758
|
findClosest(values, pos: [number, number]): IDataRow | undefined {
|
|
742
759
|
const $$ = this;
|
|
743
|
-
const {
|
|
760
|
+
const {$el: {main}} = $$;
|
|
744
761
|
const data = values.filter(v => v && isValue(v.value));
|
|
745
|
-
const getSensitivity = (d: IDataPoint) => {
|
|
746
|
-
let sensitivity = config.point_sensitivity;
|
|
747
|
-
|
|
748
|
-
if (isFunction(sensitivity)) {
|
|
749
|
-
sensitivity = sensitivity.call($$.api, d);
|
|
750
|
-
} else if (sensitivity === "radius") {
|
|
751
|
-
sensitivity = d.r;
|
|
752
|
-
}
|
|
753
762
|
|
|
754
|
-
return sensitivity;
|
|
755
|
-
};
|
|
756
763
|
let minDist;
|
|
757
764
|
let closest;
|
|
758
765
|
|
|
@@ -776,7 +783,7 @@ export default {
|
|
|
776
783
|
.forEach((v: IDataPoint) => {
|
|
777
784
|
const d = $$.dist(v, pos);
|
|
778
785
|
|
|
779
|
-
minDist =
|
|
786
|
+
minDist = $$.getPointSensitivity(v);
|
|
780
787
|
|
|
781
788
|
if (d < minDist) {
|
|
782
789
|
minDist = d;
|
|
@@ -61,7 +61,7 @@ export default {
|
|
|
61
61
|
$el.eventRect = eventRectUpdate;
|
|
62
62
|
|
|
63
63
|
if ($$.state.inputType === "touch" && !$el.svg.on("touchstart.eventRect") && !$$.hasArcType()) {
|
|
64
|
-
$$.bindTouchOnEventRect(
|
|
64
|
+
$$.bindTouchOnEventRect();
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// when initilazed with empty data and data loaded later, need to update eventRect
|
|
@@ -87,12 +87,12 @@ export default {
|
|
|
87
87
|
$$.updateEventRectData();
|
|
88
88
|
},
|
|
89
89
|
|
|
90
|
-
bindTouchOnEventRect(
|
|
90
|
+
bindTouchOnEventRect(): void {
|
|
91
91
|
const $$ = this;
|
|
92
92
|
const {config, state, $el: {eventRect, svg}} = $$;
|
|
93
93
|
|
|
94
94
|
const selectRect = context => {
|
|
95
|
-
if (isMultipleX) {
|
|
95
|
+
if ($$.isMultipleX()) {
|
|
96
96
|
$$.selectRectForMultipleXs(context);
|
|
97
97
|
} else {
|
|
98
98
|
const index = $$.getDataIndexFromEvent(state.event);
|
|
@@ -101,7 +101,7 @@ export default {
|
|
|
101
101
|
|
|
102
102
|
index === -1 ?
|
|
103
103
|
$$.unselectRect() :
|
|
104
|
-
$$.selectRectForSingle(context,
|
|
104
|
+
$$.selectRectForSingle(context, index);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
|
|
@@ -313,7 +313,74 @@ export default {
|
|
|
313
313
|
});
|
|
314
314
|
},
|
|
315
315
|
|
|
316
|
-
|
|
316
|
+
/**
|
|
317
|
+
* Seletct rect for single x value
|
|
318
|
+
* @param {d3Selection} context Event rect element
|
|
319
|
+
* @param {number} index x Axis index
|
|
320
|
+
* @private
|
|
321
|
+
*/
|
|
322
|
+
selectRectForSingle(context: SVGRectElement, index: number): void {
|
|
323
|
+
const $$ = this;
|
|
324
|
+
const {config, $el: {main, circle}} = $$;
|
|
325
|
+
const isSelectionEnabled = config.data_selection_enabled;
|
|
326
|
+
const isSelectionGrouped = config.data_selection_grouped;
|
|
327
|
+
const isSelectable = config.data_selection_isselectable;
|
|
328
|
+
const isTooltipGrouped = config.tooltip_grouped;
|
|
329
|
+
const selectedData = $$.getAllValuesOnIndex(index);
|
|
330
|
+
|
|
331
|
+
if (isTooltipGrouped) {
|
|
332
|
+
$$.showTooltip(selectedData, context);
|
|
333
|
+
$$.showGridFocus?.(selectedData);
|
|
334
|
+
|
|
335
|
+
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// remove possible previous focused state
|
|
341
|
+
!circle && main.selectAll(`.${$COMMON.EXPANDED}:not(.${$SHAPE.shape}-${index})`).classed($COMMON.EXPANDED, false);
|
|
342
|
+
|
|
343
|
+
const shapeAtIndex = main.selectAll(`.${$SHAPE.shape}-${index}`)
|
|
344
|
+
.classed($COMMON.EXPANDED, true)
|
|
345
|
+
.style("cursor", isSelectable ? "pointer" : null)
|
|
346
|
+
.filter(function(d) {
|
|
347
|
+
return $$.isWithinShape(this, d);
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
351
|
+
$$.hideGridFocus?.();
|
|
352
|
+
$$.hideTooltip();
|
|
353
|
+
|
|
354
|
+
!isSelectionGrouped && $$.setExpand(index);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
shapeAtIndex
|
|
358
|
+
.call(selected => {
|
|
359
|
+
const d = selected.data();
|
|
360
|
+
|
|
361
|
+
if (isSelectionEnabled &&
|
|
362
|
+
(isSelectionGrouped || isSelectable?.bind($$.api)(d))
|
|
363
|
+
) {
|
|
364
|
+
context.style.cursor = "pointer";
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
if (!isTooltipGrouped) {
|
|
368
|
+
$$.showTooltip(d, context);
|
|
369
|
+
$$.showGridFocus?.(d);
|
|
370
|
+
$$.unexpandCircles?.();
|
|
371
|
+
|
|
372
|
+
selected.each(d => $$.setExpand(index, d.id));
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Select rect for multiple x values
|
|
379
|
+
* @param {d3Selection} context Event rect element
|
|
380
|
+
* @param {boolean} [triggerEvent=true] Whether trigger event or not
|
|
381
|
+
* @private
|
|
382
|
+
*/
|
|
383
|
+
selectRectForMultipleXs(context: SVGRectElement, triggerEvent = true): void {
|
|
317
384
|
const $$ = this;
|
|
318
385
|
const {config, state} = $$;
|
|
319
386
|
const targetsToShow = $$.filterTargetsToShow($$.data.targets);
|
|
@@ -326,7 +393,7 @@ export default {
|
|
|
326
393
|
const mouse = getPointer(state.event, context);
|
|
327
394
|
const closest = $$.findClosestFromTargets(targetsToShow, mouse);
|
|
328
395
|
|
|
329
|
-
if (state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
|
|
396
|
+
if (triggerEvent && state.mouseover && (!closest || closest.id !== state.mouseover.id)) {
|
|
330
397
|
config.data_onout.call($$.api, state.mouseover);
|
|
331
398
|
state.mouseover = undefined;
|
|
332
399
|
}
|
|
@@ -351,11 +418,13 @@ export default {
|
|
|
351
418
|
// Show xgrid focus line
|
|
352
419
|
$$.showGridFocus(selectedData);
|
|
353
420
|
|
|
421
|
+
const dist = $$.dist(closest, mouse);
|
|
422
|
+
|
|
354
423
|
// Show cursor as pointer if point is close to mouse position
|
|
355
|
-
if ($$.isBarType(closest.id) ||
|
|
424
|
+
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
356
425
|
$$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
|
|
357
426
|
|
|
358
|
-
if (!state.mouseover) {
|
|
427
|
+
if (triggerEvent && !state.mouseover) {
|
|
359
428
|
config.data_onover.call($$.api, closest);
|
|
360
429
|
state.mouseover = closest;
|
|
361
430
|
}
|
|
@@ -445,10 +514,11 @@ export default {
|
|
|
445
514
|
}
|
|
446
515
|
}
|
|
447
516
|
|
|
517
|
+
const eventOnSameIdx = config.tooltip_grouped && index === eventReceiver.currentIdx;
|
|
518
|
+
|
|
448
519
|
// do nothing while dragging/flowing
|
|
449
|
-
if (state.dragging || state.flowing || $$.hasArcType() ||
|
|
450
|
-
|
|
451
|
-
) {
|
|
520
|
+
if (state.dragging || state.flowing || $$.hasArcType() || eventOnSameIdx) {
|
|
521
|
+
eventOnSameIdx && $$.setTooltipPosition();
|
|
452
522
|
return;
|
|
453
523
|
}
|
|
454
524
|
|
|
@@ -458,7 +528,7 @@ export default {
|
|
|
458
528
|
}
|
|
459
529
|
|
|
460
530
|
index === -1 ?
|
|
461
|
-
$$.unselectRect() : $$.selectRectForSingle(this,
|
|
531
|
+
$$.unselectRect() : $$.selectRectForSingle(this, index);
|
|
462
532
|
|
|
463
533
|
// As of individual data point(or <path>) element can't bind mouseover/out event
|
|
464
534
|
// to determine current interacting element, so use 'mousemove' event instead.
|
|
@@ -10,61 +10,6 @@ import {emulateEvent, getPointer, isNumber, isObject} from "../../module/util";
|
|
|
10
10
|
import type {IArcDataRow} from "../data/IData";
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
-
selectRectForSingle(context, eventRect, index: number): void {
|
|
14
|
-
const $$ = this;
|
|
15
|
-
const {config, $el: {main, circle}} = $$;
|
|
16
|
-
const isSelectionEnabled = config.data_selection_enabled;
|
|
17
|
-
const isSelectionGrouped = config.data_selection_grouped;
|
|
18
|
-
const isSelectable = config.data_selection_isselectable;
|
|
19
|
-
const isTooltipGrouped = config.tooltip_grouped;
|
|
20
|
-
const selectedData = $$.getAllValuesOnIndex(index);
|
|
21
|
-
|
|
22
|
-
if (isTooltipGrouped) {
|
|
23
|
-
$$.showTooltip(selectedData, context);
|
|
24
|
-
$$.showGridFocus?.(selectedData);
|
|
25
|
-
|
|
26
|
-
if (!isSelectionEnabled || isSelectionGrouped) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// remove possible previous focused state
|
|
32
|
-
!circle && main.selectAll(`.${$COMMON.EXPANDED}:not(.${$SHAPE.shape}-${index})`).classed($COMMON.EXPANDED, false);
|
|
33
|
-
|
|
34
|
-
const shapeAtIndex = main.selectAll(`.${$SHAPE.shape}-${index}`)
|
|
35
|
-
.classed($COMMON.EXPANDED, true)
|
|
36
|
-
.style("cursor", isSelectable ? "pointer" : null)
|
|
37
|
-
.filter(function(d) {
|
|
38
|
-
return $$.isWithinShape(this, d);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
42
|
-
$$.hideGridFocus?.();
|
|
43
|
-
$$.hideTooltip();
|
|
44
|
-
|
|
45
|
-
!isSelectionGrouped && $$.setExpand(index);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
shapeAtIndex
|
|
49
|
-
.call(selected => {
|
|
50
|
-
const d = selected.data();
|
|
51
|
-
|
|
52
|
-
if (isSelectionEnabled &&
|
|
53
|
-
(isSelectionGrouped || isSelectable?.bind($$.api)(d))
|
|
54
|
-
) {
|
|
55
|
-
eventRect.style("cursor", "pointer");
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (!isTooltipGrouped) {
|
|
59
|
-
$$.showTooltip(d, context);
|
|
60
|
-
$$.showGridFocus?.(d);
|
|
61
|
-
$$.unexpandCircles?.();
|
|
62
|
-
|
|
63
|
-
selected.each(d => $$.setExpand(index, d.id));
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
},
|
|
67
|
-
|
|
68
13
|
/**
|
|
69
14
|
* Expand data shape/point
|
|
70
15
|
* @param {number} index Index number
|
|
@@ -225,11 +170,11 @@ export default {
|
|
|
225
170
|
const $$ = this;
|
|
226
171
|
const {config, state: {
|
|
227
172
|
eventReceiver, hasAxis, hasRadar, hasTreemap
|
|
228
|
-
}, $el: {eventRect,
|
|
173
|
+
}, $el: {eventRect, radar, treemap}} = $$;
|
|
229
174
|
const element = (
|
|
230
175
|
(hasTreemap && eventReceiver.rect) ||
|
|
231
176
|
(hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`)) || (
|
|
232
|
-
eventRect ||
|
|
177
|
+
eventRect || $$.getArcElementByIdOrIndex?.(index)
|
|
233
178
|
)
|
|
234
179
|
)?.node();
|
|
235
180
|
|