@visactor/vchart 1.7.1-alpha.0 → 1.7.1
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/build/es5/index.js +1 -1
- package/build/index.js +170 -66
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/base-chart.js +4 -6
- package/cjs/chart/base-chart.js.map +1 -1
- package/cjs/chart/interface/chart.d.ts +7 -1
- package/cjs/chart/interface/chart.js.map +1 -1
- package/cjs/chart/interface/common.d.ts +1 -1
- package/cjs/chart/interface/common.js.map +1 -1
- package/cjs/chart/sequence/sequence.js +1 -2
- package/cjs/chart/sequence/sequence.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.js +1 -2
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/tooltip/handler/base.d.ts +15 -1
- package/cjs/component/tooltip/handler/base.js +84 -7
- package/cjs/component/tooltip/handler/base.js.map +1 -1
- package/cjs/component/tooltip/tooltip.js +5 -4
- package/cjs/component/tooltip/tooltip.js.map +1 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/index.js.map +1 -1
- package/cjs/model/interface.d.ts +2 -1
- package/cjs/model/interface.js.map +1 -1
- package/cjs/series/base/base-series.js +8 -7
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/pie/pie.d.ts +1 -0
- package/cjs/series/pie/pie.js +12 -0
- package/cjs/series/pie/pie.js.map +1 -1
- package/cjs/util/space.d.ts +1 -0
- package/cjs/util/space.js +10 -3
- package/cjs/util/space.js.map +1 -1
- package/esm/chart/base-chart.js +4 -6
- package/esm/chart/base-chart.js.map +1 -1
- package/esm/chart/interface/chart.d.ts +7 -1
- package/esm/chart/interface/chart.js.map +1 -1
- package/esm/chart/interface/common.d.ts +1 -1
- package/esm/chart/interface/common.js.map +1 -1
- package/esm/chart/sequence/sequence.js +1 -2
- package/esm/chart/sequence/sequence.js.map +1 -1
- package/esm/component/axis/cartesian/axis.js +1 -2
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/tooltip/handler/base.d.ts +15 -1
- package/esm/component/tooltip/handler/base.js +83 -6
- package/esm/component/tooltip/handler/base.js.map +1 -1
- package/esm/component/tooltip/tooltip.js +4 -4
- package/esm/component/tooltip/tooltip.js.map +1 -1
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/index.js.map +1 -1
- package/esm/model/interface.d.ts +2 -1
- package/esm/model/interface.js.map +1 -1
- package/esm/series/base/base-series.js +8 -7
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/pie/pie.d.ts +1 -0
- package/esm/series/pie/pie.js +12 -0
- package/esm/series/pie/pie.js.map +1 -1
- package/esm/util/space.d.ts +1 -0
- package/esm/util/space.js +7 -0
- package/esm/util/space.js.map +1 -1
- package/package.json +11 -11
package/build/index.js
CHANGED
|
@@ -27528,6 +27528,20 @@
|
|
|
27528
27528
|
const { x: x0, y: y0 } = point;
|
|
27529
27529
|
return x0 < x + width && y0 < y + height && y0 > y && x0 > x;
|
|
27530
27530
|
}
|
|
27531
|
+
function isPointInTriangle(point, v1, v2, v3) {
|
|
27532
|
+
const { x: x0, y: y0 } = point;
|
|
27533
|
+
const { x: x1, y: y1 } = v1;
|
|
27534
|
+
const { x: x2, y: y2 } = v2;
|
|
27535
|
+
const { x: x3, y: y3 } = v3;
|
|
27536
|
+
const divisor = (y2 - y3) * (x1 - x3) + (x3 - x2) * (y1 - y3);
|
|
27537
|
+
if (!divisor) {
|
|
27538
|
+
return false;
|
|
27539
|
+
}
|
|
27540
|
+
const a = ((y2 - y3) * (x0 - x3) + (x3 - x2) * (y0 - y3)) / divisor;
|
|
27541
|
+
const b = ((y3 - y1) * (x0 - x3) + (x1 - x3) * (y0 - y3)) / divisor;
|
|
27542
|
+
const c = 1 - a - b;
|
|
27543
|
+
return a >= 0 && a <= 1 && b >= 0 && b <= 1 && c >= 0 && c <= 1;
|
|
27544
|
+
}
|
|
27531
27545
|
function isPercent(v) {
|
|
27532
27546
|
if (!isString$1(v)) {
|
|
27533
27547
|
return false;
|
|
@@ -28767,30 +28781,6 @@
|
|
|
28767
28781
|
}), graphicAttributes[name] = storedAttrs, storedAttrs;
|
|
28768
28782
|
}
|
|
28769
28783
|
const transformsByType = {
|
|
28770
|
-
[GrammarMarkType.largeRects]: [{
|
|
28771
|
-
channels: ["x", "y", "y1", "x1", "width", "height"],
|
|
28772
|
-
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
28773
|
-
graphicAttributes.x = 0, graphicAttributes.y = 0;
|
|
28774
|
-
}
|
|
28775
|
-
}],
|
|
28776
|
-
[GrammarMarkType.largeSymbols]: [{
|
|
28777
|
-
channels: ["x", "y", "size"],
|
|
28778
|
-
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
28779
|
-
graphicAttributes.x = 0, graphicAttributes.y = 0;
|
|
28780
|
-
}
|
|
28781
|
-
}],
|
|
28782
|
-
[GrammarMarkType.area]: [{
|
|
28783
|
-
channels: ["x", "y", "x1", "y1"],
|
|
28784
|
-
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
28785
|
-
graphicAttributes.x = 0, graphicAttributes.y = 0, graphicAttributes.x1 = 0, graphicAttributes.y1 = 0;
|
|
28786
|
-
}
|
|
28787
|
-
}],
|
|
28788
|
-
[GrammarMarkType.line]: [{
|
|
28789
|
-
channels: ["x", "y", "defined"],
|
|
28790
|
-
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
28791
|
-
graphicAttributes.x = 0, graphicAttributes.y = 0;
|
|
28792
|
-
}
|
|
28793
|
-
}],
|
|
28794
28784
|
[GrammarMarkType.rect]: [{
|
|
28795
28785
|
channels: ["x", "y", "x1", "y1", "width", "height"],
|
|
28796
28786
|
transform: (graphicAttributes, nextAttrs, storedAttrs) => {
|
|
@@ -28921,13 +28911,19 @@
|
|
|
28921
28911
|
startIndex: index
|
|
28922
28912
|
}));
|
|
28923
28913
|
}), segments.length >= 2 ? segments.map(entry => {
|
|
28924
|
-
const res = transformAttributes(GrammarMarkType.line, entry.attrs, element);
|
|
28914
|
+
const res = transformAttributes(GrammarMarkType.line, parseCollectionMarkAttributes(entry.attrs), element);
|
|
28925
28915
|
return res.points = points.slice(entry.startIndex, isNil$1(entry.endIndex) ? points.length : entry.endIndex), res;
|
|
28926
28916
|
}) : null;
|
|
28927
28917
|
}
|
|
28928
28918
|
function getLinePointsFromSegments(segments) {
|
|
28929
28919
|
return segments ? segments.reduce((points, segment) => points.concat(segment.points), []) : null;
|
|
28930
28920
|
}
|
|
28921
|
+
function parseCollectionMarkAttributes(itemNextAttrs) {
|
|
28922
|
+
const result = {};
|
|
28923
|
+
return itemNextAttrs ? (Object.keys(itemNextAttrs).forEach(key => {
|
|
28924
|
+
"x" !== key && "y" !== key && "x1" !== key && "y1" !== key && "defined" !== key && "size" !== key && "width" !== key && "height" !== key && "context" !== key && (result[key] = itemNextAttrs[key]);
|
|
28925
|
+
}), result) : result;
|
|
28926
|
+
}
|
|
28931
28927
|
|
|
28932
28928
|
let Element$1 = class Element {
|
|
28933
28929
|
constructor(mark) {
|
|
@@ -29094,7 +29090,7 @@
|
|
|
29094
29090
|
enableSegments = this.mark.getSpec().enableSegments,
|
|
29095
29091
|
itemNextAttrs = items.map(item => item.nextAttrs),
|
|
29096
29092
|
isProgressive = this.mark.isProgressive();
|
|
29097
|
-
if (nextAttrs =
|
|
29093
|
+
if (nextAttrs = parseCollectionMarkAttributes(nextAttrs), markType === GrammarMarkType.line || markType === GrammarMarkType.area) {
|
|
29098
29094
|
const linePoints = getLinePoints(items, !0, lastPoints, markType === GrammarMarkType.area);
|
|
29099
29095
|
if (enableSegments && !isProgressive) {
|
|
29100
29096
|
const points = linePoints && 0 !== linePoints.length ? linePoints : getLinePointsFromSegments(lastSegments),
|
|
@@ -58630,7 +58626,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
58630
58626
|
};
|
|
58631
58627
|
registerVChartCore();
|
|
58632
58628
|
|
|
58633
|
-
const version = "1.7.1
|
|
58629
|
+
const version = "1.7.1";
|
|
58634
58630
|
|
|
58635
58631
|
class ChartData {
|
|
58636
58632
|
get dataList() {
|
|
@@ -59224,7 +59220,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
59224
59220
|
this._event = new Event$1(option.eventDispatcher, option.mode);
|
|
59225
59221
|
this._dataSet = option.dataSet;
|
|
59226
59222
|
this._chartData = new ChartData(this._dataSet, (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError);
|
|
59227
|
-
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError });
|
|
59223
|
+
this._modelOption = Object.assign(Object.assign({}, option), { mode: this._option.mode, map: this._idMap, getChartLayoutRect: () => this._layoutRect, getChartViewRect: () => this._viewRect, getChart: () => this, globalScale: this._globalScale, onError: (_c = this._option) === null || _c === void 0 ? void 0 : _c.onError, getSeriesData: this._chartData.getSeriesData.bind(this._chartData) });
|
|
59228
59224
|
this._spec = spec;
|
|
59229
59225
|
}
|
|
59230
59226
|
created() {
|
|
@@ -59302,11 +59298,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
59302
59298
|
});
|
|
59303
59299
|
}
|
|
59304
59300
|
_createSeries(seriesSpec) {
|
|
59305
|
-
seriesSpec.forEach((
|
|
59306
|
-
const spec = Object.assign({}, _spec);
|
|
59307
|
-
if (!spec.data) {
|
|
59308
|
-
spec.data = this._chartData.getSeriesData(spec.dataId, spec.dataIndex);
|
|
59309
|
-
}
|
|
59301
|
+
seriesSpec.forEach((spec, index) => {
|
|
59310
59302
|
if (this._option.animation === false) {
|
|
59311
59303
|
spec.animation = false;
|
|
59312
59304
|
}
|
|
@@ -59323,7 +59315,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
59323
59315
|
if (!region) {
|
|
59324
59316
|
return;
|
|
59325
59317
|
}
|
|
59326
|
-
const series = Factory.createSeries(spec.type, spec, Object.assign(Object.assign({}, this._modelOption), { region, specIndex: index, globalScale: this._globalScale,
|
|
59318
|
+
const series = Factory.createSeries(spec.type, spec, Object.assign(Object.assign({}, this._modelOption), { region, specIndex: index, globalScale: this._globalScale, sourceDataList: this._chartData.dataList }));
|
|
59327
59319
|
if (series) {
|
|
59328
59320
|
series.created();
|
|
59329
59321
|
this._series.push(series);
|
|
@@ -61091,13 +61083,14 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61091
61083
|
}
|
|
61092
61084
|
}
|
|
61093
61085
|
initData() {
|
|
61094
|
-
var _a, _b, _c, _d;
|
|
61095
|
-
|
|
61096
|
-
|
|
61097
|
-
|
|
61086
|
+
var _a, _b, _c, _d, _e;
|
|
61087
|
+
const d = (_a = this._spec.data) !== null && _a !== void 0 ? _a : this._option.getSeriesData(this._spec.dataId, this._spec.dataIndex);
|
|
61088
|
+
if (d) {
|
|
61089
|
+
this._rawData = dataToDataView(d, this._dataSet, this._option.sourceDataList, {
|
|
61090
|
+
onError: (_b = this._option) === null || _b === void 0 ? void 0 : _b.onError
|
|
61098
61091
|
});
|
|
61099
61092
|
}
|
|
61100
|
-
(
|
|
61093
|
+
(_c = this._rawData) === null || _c === void 0 ? void 0 : _c.target.addListener('change', this.rawDataUpdate.bind(this));
|
|
61101
61094
|
this._addDataIndexAndKey();
|
|
61102
61095
|
if (this._rawData) {
|
|
61103
61096
|
if (this._stack) {
|
|
@@ -61113,9 +61106,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61113
61106
|
this._viewDataFilter.target.removeListener('change', viewData.reRunAllTransform);
|
|
61114
61107
|
}
|
|
61115
61108
|
}
|
|
61116
|
-
if (this._invalidType === 'zero' && ((
|
|
61109
|
+
if (this._invalidType === 'zero' && ((_d = this._rawData) === null || _d === void 0 ? void 0 : _d.dataSet)) {
|
|
61117
61110
|
registerDataSetInstanceTransform(this._rawData.dataSet, 'invalidTravel', invalidTravel);
|
|
61118
|
-
(
|
|
61111
|
+
(_e = this._rawData) === null || _e === void 0 ? void 0 : _e.transform({
|
|
61119
61112
|
type: 'invalidTravel',
|
|
61120
61113
|
options: {
|
|
61121
61114
|
config: () => {
|
|
@@ -61361,7 +61354,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
61361
61354
|
});
|
|
61362
61355
|
}
|
|
61363
61356
|
else if (!parentMark && (!isNil$1(spec.dataId) || !isNil$1(spec.dataIndex))) {
|
|
61364
|
-
const dataView = this._option.getSeriesData(spec.
|
|
61357
|
+
const dataView = this._option.getSeriesData(spec.dataId, spec.dataIndex);
|
|
61365
61358
|
if (dataView === this._rawData) {
|
|
61366
61359
|
mark.setDataView(this.getViewData(), this.getViewDataProductId());
|
|
61367
61360
|
}
|
|
@@ -66324,6 +66317,15 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
66324
66317
|
y: (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.centerY) !== null && _d !== void 0 ? _d : this._region.getLayoutRect().height / 2
|
|
66325
66318
|
};
|
|
66326
66319
|
}
|
|
66320
|
+
_buildMarkAttributeContext() {
|
|
66321
|
+
super._buildMarkAttributeContext();
|
|
66322
|
+
this._markAttributeContext.getCenter = () => {
|
|
66323
|
+
return {
|
|
66324
|
+
x: () => { var _a, _b; return (_b = (_a = this._center) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : this._region.getLayoutRect().width / 2; },
|
|
66325
|
+
y: () => { var _a, _b; return (_b = (_a = this._center) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : this._region.getLayoutRect().height / 2; }
|
|
66326
|
+
};
|
|
66327
|
+
};
|
|
66328
|
+
}
|
|
66327
66329
|
setAttrFromSpec() {
|
|
66328
66330
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
66329
66331
|
super.setAttrFromSpec();
|
|
@@ -68539,9 +68541,6 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
68539
68541
|
}
|
|
68540
68542
|
_createSeries(seriesSpec) {
|
|
68541
68543
|
seriesSpec.forEach((spec, index) => {
|
|
68542
|
-
if (!spec.data) {
|
|
68543
|
-
spec.data = this._chartData.getSeriesData(spec.dataId, spec.dataIndex);
|
|
68544
|
-
}
|
|
68545
68544
|
if (spec.type === exports.SeriesTypeEnum.link) {
|
|
68546
68545
|
spec.dotSeriesSpec = this._spec.series[spec.dotSeriesIndex];
|
|
68547
68546
|
}
|
|
@@ -77593,10 +77592,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
77593
77592
|
nodeMap: nodeMap
|
|
77594
77593
|
};
|
|
77595
77594
|
}
|
|
77596
|
-
|
|
77597
|
-
|
|
77598
|
-
|
|
77599
|
-
const links = [],
|
|
77595
|
+
computeSourceTargetNodeLinks(data) {
|
|
77596
|
+
const nodes = [],
|
|
77597
|
+
links = [],
|
|
77600
77598
|
nodeMap = {};
|
|
77601
77599
|
data.nodes && data.nodes.forEach((node, index) => {
|
|
77602
77600
|
const nodeElement = {
|
|
@@ -77611,7 +77609,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
77611
77609
|
nodeMap[nodeElement.key] = nodeElement, nodes.push(nodeElement);
|
|
77612
77610
|
});
|
|
77613
77611
|
const invalidLinks = [];
|
|
77614
|
-
|
|
77612
|
+
return data.links.forEach((link, index) => {
|
|
77615
77613
|
if (isNil$1(link.source) || isNil$1(link.target)) return;
|
|
77616
77614
|
if (data.nodes && (!nodeMap[link.source] || !nodeMap[link.target])) return;
|
|
77617
77615
|
data.nodes || nodeMap[link.source] || (nodeMap[link.source] = {
|
|
@@ -77642,11 +77640,22 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
77642
77640
|
}), this.options.divideNodeValueToLink && invalidLinks.length && invalidLinks.forEach(link => {
|
|
77643
77641
|
const values = [calcDivideValue(nodeMap[link.source]), calcDivideValue(nodeMap[link.target], !0)].filter(entry => !isNil$1(entry));
|
|
77644
77642
|
values.length && (link.value = minInArray(values));
|
|
77645
|
-
}),
|
|
77643
|
+
}), {
|
|
77644
|
+
nodeMap: nodeMap,
|
|
77645
|
+
nodes: nodes,
|
|
77646
|
+
links: links
|
|
77647
|
+
};
|
|
77648
|
+
}
|
|
77649
|
+
computeNodeLinks(data) {
|
|
77650
|
+
let res;
|
|
77651
|
+
"links" in data ? res = this.computeSourceTargetNodeLinks(data) : (this._isHierarchic = !0, res = this.computeHierarchicNodeLinks(data.nodes));
|
|
77652
|
+
let nodes = res.nodes;
|
|
77653
|
+
const links = res.links;
|
|
77654
|
+
if (this.options.linkSortBy) for (let i = 0, len = nodes.length; i < len; i++) nodes[i].sourceLinks.sort(this.options.linkSortBy), nodes[i].targetLinks.sort(this.options.linkSortBy);
|
|
77646
77655
|
return this.options.dropIsolatedNode && (nodes = nodes.filter(node => node.targetLinks.length || node.sourceLinks.length)), {
|
|
77647
77656
|
nodes: nodes,
|
|
77648
77657
|
links: links,
|
|
77649
|
-
nodeMap: nodeMap
|
|
77658
|
+
nodeMap: res.nodeMap
|
|
77650
77659
|
};
|
|
77651
77660
|
}
|
|
77652
77661
|
computeNodeValues(nodes) {
|
|
@@ -81278,10 +81287,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
81278
81287
|
const axisComponent = product.getGroupGraphicItem();
|
|
81279
81288
|
const spec = mergeSpec(Object.assign({}, this.getLayoutStartPoint()), this._axisStyle, attrs, { line: { visible: false } });
|
|
81280
81289
|
const updateBounds = axisComponent.getBoundsWithoutRender(spec);
|
|
81290
|
+
hasBounds = true;
|
|
81291
|
+
this._latestBounds = updateBounds;
|
|
81281
81292
|
if (isFinite(updateBounds.width())) {
|
|
81282
81293
|
result = this._appendAxisUnit(updateBounds, isX);
|
|
81283
|
-
hasBounds = true;
|
|
81284
|
-
this._latestBounds = updateBounds;
|
|
81285
81294
|
}
|
|
81286
81295
|
}
|
|
81287
81296
|
if (!hasBounds) {
|
|
@@ -84031,8 +84040,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84031
84040
|
let changePositionOnly = !!params.changePositionOnly;
|
|
84032
84041
|
if (!params.changePositionOnly || ((_a = this._cacheActualTooltip) === null || _a === void 0 ? void 0 : _a.activeType) !== activeType) {
|
|
84033
84042
|
changePositionOnly = false;
|
|
84034
|
-
this.
|
|
84035
|
-
this._cacheActualTooltip = undefined;
|
|
84043
|
+
this._clearCacheOfContent();
|
|
84036
84044
|
}
|
|
84037
84045
|
if (changePositionOnly && this._cacheViewSpec && this._cacheActualTooltip) {
|
|
84038
84046
|
return this.changeTooltipPosition(changePositionOnly, data, params);
|
|
@@ -84046,8 +84054,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84046
84054
|
return TooltipResult.failed;
|
|
84047
84055
|
}
|
|
84048
84056
|
if (!visible) {
|
|
84049
|
-
this.
|
|
84050
|
-
this._cacheActualTooltip = undefined;
|
|
84057
|
+
this._clearAllCache();
|
|
84051
84058
|
if (tooltipSpec.handler) {
|
|
84052
84059
|
return (_c = (_b = (_a = tooltipSpec.handler).hideTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : TooltipResult.success;
|
|
84053
84060
|
}
|
|
@@ -84101,6 +84108,21 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84101
84108
|
if (!spec || !actualTooltip) {
|
|
84102
84109
|
return TooltipResult.failed;
|
|
84103
84110
|
}
|
|
84111
|
+
if (spec.enterable) {
|
|
84112
|
+
if (!this._isPointerEscaped && this._isPointerMovingToTooltip(params)) {
|
|
84113
|
+
if (!this._isTooltipPaused) {
|
|
84114
|
+
this._isTooltipPaused = true;
|
|
84115
|
+
this._cachePointerTimer = setTimeout(() => {
|
|
84116
|
+
this._isPointerEscaped = true;
|
|
84117
|
+
}, 300);
|
|
84118
|
+
}
|
|
84119
|
+
return TooltipResult.success;
|
|
84120
|
+
}
|
|
84121
|
+
this._isTooltipPaused = false;
|
|
84122
|
+
this._isPointerEscaped = false;
|
|
84123
|
+
clearTimeout(this._cachePointerTimer);
|
|
84124
|
+
this._cachePointerPosition = this._getPointerPositionRelativeToTooltipParent(params);
|
|
84125
|
+
}
|
|
84104
84126
|
const activeType = actualTooltip.activeType;
|
|
84105
84127
|
if (spec.handler) {
|
|
84106
84128
|
return (_c = (_b = (_a = spec.handler).showTooltip) === null || _b === void 0 ? void 0 : _b.call(_a, activeType, data, params)) !== null && _c !== void 0 ? _c : TooltipResult.success;
|
|
@@ -84141,6 +84163,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84141
84163
|
const { offsetX, offsetY } = this._option;
|
|
84142
84164
|
const tooltipSpec = this._cacheViewSpec;
|
|
84143
84165
|
if (!tooltipSpec) {
|
|
84166
|
+
this._cacheTooltipPosition = undefined;
|
|
84144
84167
|
return invalidPosition;
|
|
84145
84168
|
}
|
|
84146
84169
|
const { activeType, data } = actualTooltip;
|
|
@@ -84407,7 +84430,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84407
84430
|
detectTopLast();
|
|
84408
84431
|
break;
|
|
84409
84432
|
}
|
|
84410
|
-
|
|
84433
|
+
const result = { x, y };
|
|
84434
|
+
this._cacheTooltipPosition = result;
|
|
84435
|
+
this._cacheTooltipSize = { width: tooltipBoxWidth, height: tooltipBoxHeight };
|
|
84436
|
+
return result;
|
|
84411
84437
|
};
|
|
84412
84438
|
this._component = component;
|
|
84413
84439
|
this._chartOption = component.getOption();
|
|
@@ -84422,8 +84448,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84422
84448
|
}
|
|
84423
84449
|
release() {
|
|
84424
84450
|
var _a, _b, _c;
|
|
84425
|
-
this.
|
|
84426
|
-
this._cacheActualTooltip = undefined;
|
|
84451
|
+
this._clearAllCache();
|
|
84427
84452
|
const spec = (_a = this._component.getSpec()) !== null && _a !== void 0 ? _a : {};
|
|
84428
84453
|
if (spec.handler) {
|
|
84429
84454
|
(_c = (_b = spec.handler).release) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
@@ -84432,6 +84457,23 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84432
84457
|
this._removeTooltip();
|
|
84433
84458
|
this._isReleased = true;
|
|
84434
84459
|
}
|
|
84460
|
+
_clearAllCache() {
|
|
84461
|
+
this._clearCacheOfContent();
|
|
84462
|
+
this._clearCacheOfPosition();
|
|
84463
|
+
}
|
|
84464
|
+
_clearCacheOfContent() {
|
|
84465
|
+
this._cacheViewSpec = undefined;
|
|
84466
|
+
this._cacheActualTooltip = undefined;
|
|
84467
|
+
}
|
|
84468
|
+
_clearCacheOfPosition() {
|
|
84469
|
+
this._isTooltipPaused = false;
|
|
84470
|
+
this._isPointerEscaped = false;
|
|
84471
|
+
clearTimeout(this._cachePointerTimer);
|
|
84472
|
+
this._cachePointerTimer = -1;
|
|
84473
|
+
this._cachePointerPosition = undefined;
|
|
84474
|
+
this._cacheTooltipPosition = undefined;
|
|
84475
|
+
this._cacheTooltipSize = undefined;
|
|
84476
|
+
}
|
|
84435
84477
|
_throttle(callback) {
|
|
84436
84478
|
const tooltipSpec = this._component.getSpec();
|
|
84437
84479
|
let wait;
|
|
@@ -84464,6 +84506,68 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
84464
84506
|
height: (_f = (_e = this._attributes) === null || _e === void 0 ? void 0 : _e.panel) === null || _f === void 0 ? void 0 : _f.height
|
|
84465
84507
|
};
|
|
84466
84508
|
}
|
|
84509
|
+
_getPointerPositionRelativeToTooltipParent(params) {
|
|
84510
|
+
var _a, _b;
|
|
84511
|
+
let { canvasX: x, canvasY: y } = params.event;
|
|
84512
|
+
const invalidPosition = {
|
|
84513
|
+
x: Infinity,
|
|
84514
|
+
y: Infinity
|
|
84515
|
+
};
|
|
84516
|
+
const tooltipSpec = this._cacheViewSpec;
|
|
84517
|
+
const isCanvas = tooltipSpec.renderMode === 'canvas';
|
|
84518
|
+
const tooltipParentElement = this._getParentElement(tooltipSpec);
|
|
84519
|
+
let relativePosOffset = { x: 0, y: 0 };
|
|
84520
|
+
let tooltipParentElementRect = { x: 0, y: 0 };
|
|
84521
|
+
let chartElementScale = 1;
|
|
84522
|
+
let tooltipParentElementScale = 1;
|
|
84523
|
+
if (isTrueBrowser(this._env) && !tooltipSpec.confine) {
|
|
84524
|
+
if (!isCanvas) {
|
|
84525
|
+
tooltipParentElementRect = (_a = tooltipParentElement === null || tooltipParentElement === void 0 ? void 0 : tooltipParentElement.getBoundingClientRect()) !== null && _a !== void 0 ? _a : invalidPosition;
|
|
84526
|
+
const chartElement = ((_b = this._compiler.getCanvas()) !== null && _b !== void 0 ? _b : this._chartContainer);
|
|
84527
|
+
const chartElementRect = chartElement === null || chartElement === void 0 ? void 0 : chartElement.getBoundingClientRect();
|
|
84528
|
+
relativePosOffset = {
|
|
84529
|
+
x: chartElementRect.x - tooltipParentElementRect.x,
|
|
84530
|
+
y: chartElementRect.y - tooltipParentElementRect.y
|
|
84531
|
+
};
|
|
84532
|
+
chartElementScale = getScale(chartElement, chartElementRect);
|
|
84533
|
+
tooltipParentElementScale = getScale(tooltipParentElement, tooltipParentElementRect);
|
|
84534
|
+
}
|
|
84535
|
+
}
|
|
84536
|
+
x *= chartElementScale;
|
|
84537
|
+
y *= chartElementScale;
|
|
84538
|
+
if (isTrueBrowser(this._env)) {
|
|
84539
|
+
x += relativePosOffset.x;
|
|
84540
|
+
y += relativePosOffset.y;
|
|
84541
|
+
}
|
|
84542
|
+
x /= tooltipParentElementScale;
|
|
84543
|
+
y /= tooltipParentElementScale;
|
|
84544
|
+
return { x, y };
|
|
84545
|
+
}
|
|
84546
|
+
_isPointerMovingToTooltip(params) {
|
|
84547
|
+
if (!this._cacheTooltipPosition || !this._cacheTooltipSize || !this._cachePointerPosition) {
|
|
84548
|
+
return false;
|
|
84549
|
+
}
|
|
84550
|
+
const { width: tooltipWidth, height: tooltipHeight } = this._cacheTooltipSize;
|
|
84551
|
+
const { x: tooltipX = 0, y: tooltipY } = this._cacheTooltipPosition;
|
|
84552
|
+
const pos = this._getPointerPositionRelativeToTooltipParent(params);
|
|
84553
|
+
if (isPointInRect(pos, {
|
|
84554
|
+
x: tooltipX,
|
|
84555
|
+
y: tooltipY,
|
|
84556
|
+
width: tooltipWidth,
|
|
84557
|
+
height: tooltipHeight
|
|
84558
|
+
})) {
|
|
84559
|
+
return true;
|
|
84560
|
+
}
|
|
84561
|
+
const a = { x: tooltipX, y: tooltipY };
|
|
84562
|
+
const b = { x: a.x + tooltipWidth, y: a.y };
|
|
84563
|
+
const c = { x: a.x, y: a.y + tooltipHeight };
|
|
84564
|
+
const d = { x: b.x, y: c.y };
|
|
84565
|
+
const oldPos = this._cachePointerPosition;
|
|
84566
|
+
return (isPointInTriangle(pos, oldPos, a, b) ||
|
|
84567
|
+
isPointInTriangle(pos, oldPos, c, d) ||
|
|
84568
|
+
isPointInTriangle(pos, oldPos, a, d) ||
|
|
84569
|
+
isPointInTriangle(pos, oldPos, b, c));
|
|
84570
|
+
}
|
|
84467
84571
|
_getParentElement(spec) {
|
|
84468
84572
|
return spec.parentElement;
|
|
84469
84573
|
}
|
|
@@ -86239,19 +86343,19 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86239
86343
|
var _a, _b;
|
|
86240
86344
|
if (this._spec.enterable && this._spec.renderMode === 'html') {
|
|
86241
86345
|
const { event } = params;
|
|
86242
|
-
let
|
|
86346
|
+
let newTarget;
|
|
86243
86347
|
if (isValid$1(event.nativeEvent)) {
|
|
86244
86348
|
const nativeEvent = event.nativeEvent;
|
|
86245
|
-
|
|
86349
|
+
newTarget = nativeEvent.relatedTarget;
|
|
86246
86350
|
if (nativeEvent.composedPath && nativeEvent.composedPath().length > 0) {
|
|
86247
|
-
|
|
86351
|
+
newTarget = nativeEvent.composedPath()[0];
|
|
86248
86352
|
}
|
|
86249
86353
|
}
|
|
86250
86354
|
else {
|
|
86251
|
-
|
|
86355
|
+
newTarget = event.relatedTarget;
|
|
86252
86356
|
}
|
|
86253
86357
|
const container = (_b = (_a = this.tooltipHandler) === null || _a === void 0 ? void 0 : _a.getTooltipContainer) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
86254
|
-
if (isValid$1(container) && isValid$1(
|
|
86358
|
+
if (isValid$1(container) && isValid$1(newTarget) && hasParentElement(newTarget, container)) {
|
|
86255
86359
|
return true;
|
|
86256
86360
|
}
|
|
86257
86361
|
}
|