@visactor/vchart 1.13.21-alpha.1 → 1.13.21-alpha.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/build/es5/index.js +1 -1
- package/build/index.es.js +267 -20
- package/build/index.js +268 -19
- package/build/index.min.js +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/chart/sankey/sankey-transformer.js +1 -1
- package/cjs/chart/sankey/sankey-transformer.js.map +1 -1
- package/cjs/constant/funnel.js +2 -1
- package/cjs/constant/sunburst.js +1 -2
- 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/core/interface.js +2 -1
- package/cjs/core/vchart.d.ts +2 -0
- package/cjs/core/vchart.js +4 -2
- package/cjs/core/vchart.js.map +1 -1
- package/cjs/data/transforms/sankey.d.ts +2 -0
- package/cjs/data/transforms/sankey.js +2 -1
- package/cjs/data/transforms/sankey.js.map +1 -1
- package/cjs/plugin/chart/index.d.ts +1 -0
- package/cjs/plugin/chart/index.js +1 -1
- package/cjs/plugin/chart/index.js.map +1 -1
- package/cjs/plugin/chart/plugin-service.d.ts +1 -0
- package/cjs/plugin/chart/plugin-service.js +3 -0
- package/cjs/plugin/chart/plugin-service.js.map +1 -1
- package/cjs/plugin/chart/scroll/index.js.map +1 -1
- package/cjs/plugin/chart/scroll/scroll.d.ts +16 -2
- package/cjs/plugin/chart/scroll/scroll.js +98 -23
- package/cjs/plugin/chart/scroll/scroll.js.map +1 -1
- package/cjs/series/sankey/interface.d.ts +4 -0
- package/cjs/series/sankey/interface.js.map +1 -1
- package/cjs/series/sankey/sankey.js +3 -1
- package/cjs/series/sankey/sankey.js.map +1 -1
- package/esm/chart/sankey/sankey-transformer.js +1 -1
- package/esm/chart/sankey/sankey-transformer.js.map +1 -1
- package/esm/constant/funnel.js +2 -1
- package/esm/constant/sunburst.js +1 -2
- 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/core/interface.js +2 -1
- package/esm/core/vchart.d.ts +2 -0
- package/esm/core/vchart.js +4 -2
- package/esm/core/vchart.js.map +1 -1
- package/esm/data/transforms/sankey.d.ts +2 -0
- package/esm/data/transforms/sankey.js +2 -1
- package/esm/data/transforms/sankey.js.map +1 -1
- package/esm/plugin/chart/index.d.ts +1 -0
- package/esm/plugin/chart/index.js +2 -0
- package/esm/plugin/chart/index.js.map +1 -1
- package/esm/plugin/chart/plugin-service.d.ts +1 -0
- package/esm/plugin/chart/plugin-service.js +3 -0
- package/esm/plugin/chart/plugin-service.js.map +1 -1
- package/esm/plugin/chart/scroll/index.js.map +1 -1
- package/esm/plugin/chart/scroll/scroll.d.ts +16 -2
- package/esm/plugin/chart/scroll/scroll.js +102 -23
- package/esm/plugin/chart/scroll/scroll.js.map +1 -1
- package/esm/series/sankey/interface.d.ts +4 -0
- package/esm/series/sankey/interface.js.map +1 -1
- package/esm/series/sankey/sankey.js +3 -1
- package/esm/series/sankey/sankey.js.map +1 -1
- package/package.json +10 -10
package/build/index.js
CHANGED
|
@@ -31839,8 +31839,8 @@
|
|
|
31839
31839
|
style: {}
|
|
31840
31840
|
};
|
|
31841
31841
|
const SCROLLBAR_START_EVENT = "scrollDown";
|
|
31842
|
-
const SCROLLBAR_EVENT$
|
|
31843
|
-
const SCROLLBAR_END_EVENT$
|
|
31842
|
+
const SCROLLBAR_EVENT$2 = "scrollDrag";
|
|
31843
|
+
const SCROLLBAR_END_EVENT$2 = "scrollUp";
|
|
31844
31844
|
|
|
31845
31845
|
function getEndTriggersOfDrag() {
|
|
31846
31846
|
return "browser" === vglobal.env ? ["pointerup", "pointerleave", "pointercancel"] : ["pointerup", "pointerleave", "pointerupoutside"];
|
|
@@ -31935,7 +31935,7 @@
|
|
|
31935
31935
|
preScrollRange = this.getScrollRange(),
|
|
31936
31936
|
[currentPos, currentScrollValue] = this._computeScrollValue(e),
|
|
31937
31937
|
range = [preScrollRange[0] + currentScrollValue, preScrollRange[1] + currentScrollValue];
|
|
31938
|
-
this._prePos = null, this._dispatchEvent(SCROLLBAR_END_EVENT$
|
|
31938
|
+
this._prePos = null, this._dispatchEvent(SCROLLBAR_END_EVENT$2, {
|
|
31939
31939
|
pre: preRange,
|
|
31940
31940
|
value: clampRange$1(range, limitRange[0], limitRange[1])
|
|
31941
31941
|
}), this._clearDragEvents();
|
|
@@ -31963,7 +31963,7 @@
|
|
|
31963
31963
|
}, !0), this.stage && !this.stage.autoRender && this.stage.renderNextFrame();
|
|
31964
31964
|
}
|
|
31965
31965
|
}
|
|
31966
|
-
this.attribute.range = currScrollRange, realTime && this._dispatchEvent(SCROLLBAR_EVENT$
|
|
31966
|
+
this.attribute.range = currScrollRange, realTime && this._dispatchEvent(SCROLLBAR_EVENT$2, {
|
|
31967
31967
|
pre: preRange,
|
|
31968
31968
|
value: currScrollRange
|
|
31969
31969
|
});
|
|
@@ -32202,7 +32202,7 @@
|
|
|
32202
32202
|
scrollbar.setAttribute("visibleAll", !0);
|
|
32203
32203
|
}), scrollbar.addEventListener("pointerout", () => {
|
|
32204
32204
|
scrollbar.setAttribute("visibleAll", !0);
|
|
32205
|
-
}), scrollbar.addEventListener("scrollUp", this.handleScrollBarChange), scrollbar.addEventListener(SCROLLBAR_EVENT$
|
|
32205
|
+
}), scrollbar.addEventListener("scrollUp", this.handleScrollBarChange), scrollbar.addEventListener(SCROLLBAR_EVENT$2, this.handleScrollBarChange);
|
|
32206
32206
|
}
|
|
32207
32207
|
addOrUpdateScroll(showH, showV, container, scrollContainer) {
|
|
32208
32208
|
if (showH) {
|
|
@@ -62894,6 +62894,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
62894
62894
|
super();
|
|
62895
62895
|
this.globalInstance = globalInstance;
|
|
62896
62896
|
}
|
|
62897
|
+
getPlugin(name) {
|
|
62898
|
+
return this._plugins.find(plugin => plugin.name === name);
|
|
62899
|
+
}
|
|
62897
62900
|
onInit(chartSpec) {
|
|
62898
62901
|
this._plugins.forEach(plugin => {
|
|
62899
62902
|
plugin.onInit && plugin.onInit(this, chartSpec);
|
|
@@ -63054,6 +63057,9 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
63054
63057
|
getDataSet() {
|
|
63055
63058
|
return this._dataSet;
|
|
63056
63059
|
}
|
|
63060
|
+
get chartPlugin() {
|
|
63061
|
+
return this._chartPlugin;
|
|
63062
|
+
}
|
|
63057
63063
|
constructor(spec, options) {
|
|
63058
63064
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
63059
63065
|
this.id = createID();
|
|
@@ -64274,7 +64280,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
64274
64280
|
};
|
|
64275
64281
|
registerVChartCore();
|
|
64276
64282
|
|
|
64277
|
-
const version = "1.13.21-alpha.
|
|
64283
|
+
const version = "1.13.21-alpha.3";
|
|
64278
64284
|
|
|
64279
64285
|
const addVChartProperty = (data, op) => {
|
|
64280
64286
|
const context = op.beforeCall();
|
|
@@ -85803,7 +85809,10 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
85803
85809
|
this._ascendingSourceBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.source], this._nodeMap[b.source]) || a.index - b.index, this._ascendingTargetBreadth = (a, b) => ascendingNodeBreadth(this._nodeMap[a.target], this._nodeMap[b.target]) || a.index - b.index, this.options = Object.assign({}, SankeyLayout.defaultOptions, options);
|
|
85804
85810
|
const keyOption = this.options.nodeKey,
|
|
85805
85811
|
keyFunc = isFunction$1(keyOption) ? keyOption : keyOption ? field$3(keyOption) : null;
|
|
85806
|
-
this._getNodeKey = keyFunc
|
|
85812
|
+
this._getNodeKey = keyFunc;
|
|
85813
|
+
const depthOption = this.options.depthKey,
|
|
85814
|
+
depthFunc = isFunction$1(depthOption) ? depthOption : depthOption ? field$3(depthOption) : null;
|
|
85815
|
+
this._getNodeDepth = depthFunc, this._logger = Logger.getInstance(), this._alignFunc = isFunction$1(this.options.setNodeLayer) ? node => this.options.setNodeLayer(node.datum) : alignFunctions[this.options.nodeAlign];
|
|
85807
85816
|
}
|
|
85808
85817
|
layout(data, config) {
|
|
85809
85818
|
if (!data) return null;
|
|
@@ -85908,11 +85917,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
85908
85917
|
calculateNodeValue(originalNodes);
|
|
85909
85918
|
const doSubTree = (subTree, depth, parents) => {
|
|
85910
85919
|
subTree.forEach((node, index) => {
|
|
85920
|
+
var _a;
|
|
85911
85921
|
const nodeKey = this._getNodeKey ? this._getNodeKey(node) : parents ? `${parents[parents.length - 1].key}-${index}` : `${depth}-${index}`,
|
|
85912
85922
|
nodeValue = isNil$1(node.value) ? 0 : toValidNumber$1(node.value);
|
|
85913
85923
|
if (nodeMap[nodeKey]) nodeMap[nodeKey].value = void 0;else {
|
|
85914
85924
|
const nodeElement = {
|
|
85915
|
-
depth: depth,
|
|
85925
|
+
depth: this._getNodeDepth && null !== (_a = this._getNodeDepth(node)) && void 0 !== _a ? _a : depth,
|
|
85916
85926
|
datum: node,
|
|
85917
85927
|
index: index,
|
|
85918
85928
|
key: nodeKey,
|
|
@@ -86030,7 +86040,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86030
86040
|
}
|
|
86031
86041
|
}
|
|
86032
86042
|
computeNodeDepths(nodes) {
|
|
86033
|
-
var _a;
|
|
86043
|
+
var _a, _b;
|
|
86034
86044
|
const n = nodes.length;
|
|
86035
86045
|
let next,
|
|
86036
86046
|
nextMap,
|
|
@@ -86042,9 +86052,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86042
86052
|
next = [], nextMap = {};
|
|
86043
86053
|
for (let i = 0, curLen = current.length; i < curLen; i++) {
|
|
86044
86054
|
const node = current[i];
|
|
86045
|
-
if (node
|
|
86046
|
-
const
|
|
86047
|
-
|
|
86055
|
+
if (node) {
|
|
86056
|
+
const tempDepth = setNodeLayer && null !== (_a = setNodeLayer(node.datum)) && void 0 !== _a ? _a : depth;
|
|
86057
|
+
if (node.depth = this._getNodeDepth && null !== (_b = this._getNodeDepth(node.datum)) && void 0 !== _b ? _b : tempDepth, setNodeLayer && (maxDepth = Math.max(node.depth, maxDepth)), node.sourceLinks && node.sourceLinks.length) for (let j = 0, linkLen = node.sourceLinks.length; j < linkLen; j++) {
|
|
86058
|
+
const link = node.sourceLinks[j];
|
|
86059
|
+
nextMap[link.target] || (next.push(this._nodeMap[link.target]), nextMap[link.target] = !0);
|
|
86060
|
+
}
|
|
86048
86061
|
}
|
|
86049
86062
|
}
|
|
86050
86063
|
current = next, depth += 1;
|
|
@@ -86448,7 +86461,12 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86448
86461
|
}
|
|
86449
86462
|
const layout = new SankeyLayout(op);
|
|
86450
86463
|
const result = [];
|
|
86451
|
-
|
|
86464
|
+
if (op.customLayout) {
|
|
86465
|
+
result.push(op.customLayout(layout, originalData, view, op));
|
|
86466
|
+
}
|
|
86467
|
+
else {
|
|
86468
|
+
result.push(layout.layout(originalData, view));
|
|
86469
|
+
}
|
|
86452
86470
|
return result;
|
|
86453
86471
|
};
|
|
86454
86472
|
|
|
@@ -86768,6 +86786,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86768
86786
|
maxLinkHeight: this._spec.maxLinkHeight,
|
|
86769
86787
|
iterations: this._spec.iterations,
|
|
86770
86788
|
nodeKey: this._spec.nodeKey,
|
|
86789
|
+
depthKey: this._spec.depthKey,
|
|
86771
86790
|
linkSortBy: this._spec.linkSortBy,
|
|
86772
86791
|
nodeSortBy: this._spec.nodeSortBy,
|
|
86773
86792
|
setNodeLayer: this._spec.setNodeLayer,
|
|
@@ -86776,7 +86795,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
86776
86795
|
linkHeight: this._spec.linkHeight,
|
|
86777
86796
|
equalNodeHeight: this._spec.equalNodeHeight,
|
|
86778
86797
|
linkOverlap: this._spec.linkOverlap,
|
|
86779
|
-
inverse: this._spec.inverse
|
|
86798
|
+
inverse: this._spec.inverse,
|
|
86799
|
+
customLayout: this._spec.customLayout
|
|
86780
86800
|
},
|
|
86781
86801
|
level: TransformLevel.sankeyLayout
|
|
86782
86802
|
});
|
|
@@ -92710,6 +92730,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92710
92730
|
'linkOverlap',
|
|
92711
92731
|
'iterations',
|
|
92712
92732
|
'nodeKey',
|
|
92733
|
+
'depthKey',
|
|
92713
92734
|
'linkSortBy',
|
|
92714
92735
|
'nodeSortBy',
|
|
92715
92736
|
'setNodeLayer',
|
|
@@ -92717,7 +92738,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
92717
92738
|
'link',
|
|
92718
92739
|
'emphasis',
|
|
92719
92740
|
'inverse',
|
|
92720
|
-
'overflow'
|
|
92741
|
+
'overflow',
|
|
92742
|
+
'customLayout'
|
|
92721
92743
|
]);
|
|
92722
92744
|
return series;
|
|
92723
92745
|
}
|
|
@@ -97500,8 +97522,8 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
97500
97522
|
Factory$1.registerComponent(DataZoom.type, DataZoom);
|
|
97501
97523
|
};
|
|
97502
97524
|
|
|
97503
|
-
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
97504
|
-
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
97525
|
+
const SCROLLBAR_EVENT$1 = 'scrollDrag';
|
|
97526
|
+
const SCROLLBAR_END_EVENT$1 = 'scrollUp';
|
|
97505
97527
|
class ScrollBar extends DataFilterBaseComponent {
|
|
97506
97528
|
constructor(spec, options) {
|
|
97507
97529
|
var _a;
|
|
@@ -97571,11 +97593,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
97571
97593
|
else {
|
|
97572
97594
|
const container = this.getContainer();
|
|
97573
97595
|
this._component = new ScrollBar$1(attrs);
|
|
97574
|
-
this._component.addEventListener(SCROLLBAR_EVENT, (e) => {
|
|
97596
|
+
this._component.addEventListener(SCROLLBAR_EVENT$1, (e) => {
|
|
97575
97597
|
const value = e.detail.value;
|
|
97576
97598
|
this._handleChange(value[0], value[1]);
|
|
97577
97599
|
});
|
|
97578
|
-
this._component.addEventListener(SCROLLBAR_END_EVENT, (e) => {
|
|
97600
|
+
this._component.addEventListener(SCROLLBAR_END_EVENT$1, (e) => {
|
|
97579
97601
|
const value = e.detail.value;
|
|
97580
97602
|
this._handleChange(value[0], value[1]);
|
|
97581
97603
|
});
|
|
@@ -104669,6 +104691,231 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
104669
104691
|
registerChartPlugin(MediaQuery);
|
|
104670
104692
|
};
|
|
104671
104693
|
|
|
104694
|
+
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
104695
|
+
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
104696
|
+
const DefaultTheme = {
|
|
104697
|
+
size: 10,
|
|
104698
|
+
railStyle: undefined,
|
|
104699
|
+
sliderStyle: undefined
|
|
104700
|
+
};
|
|
104701
|
+
class ScrollPlugin extends BasePlugin {
|
|
104702
|
+
constructor() {
|
|
104703
|
+
super(ScrollPlugin.type);
|
|
104704
|
+
this.type = 'chartScroll';
|
|
104705
|
+
this.name = ScrollPlugin.type;
|
|
104706
|
+
this._lastScrollX = 0;
|
|
104707
|
+
this._lastScrollY = 0;
|
|
104708
|
+
this._scrollLimit = {
|
|
104709
|
+
x: {
|
|
104710
|
+
min: 0,
|
|
104711
|
+
max: 0,
|
|
104712
|
+
size: 0,
|
|
104713
|
+
percent: 0
|
|
104714
|
+
},
|
|
104715
|
+
y: {
|
|
104716
|
+
min: 0,
|
|
104717
|
+
max: 0,
|
|
104718
|
+
size: 0,
|
|
104719
|
+
percent: 0
|
|
104720
|
+
}
|
|
104721
|
+
};
|
|
104722
|
+
this.onWheel = (e) => {
|
|
104723
|
+
var _a, _b;
|
|
104724
|
+
const scrollX = e.deltaX;
|
|
104725
|
+
const scrollY = e.deltaY;
|
|
104726
|
+
const rootMark = this.getRootMark();
|
|
104727
|
+
if (!rootMark) {
|
|
104728
|
+
return;
|
|
104729
|
+
}
|
|
104730
|
+
const { percent: yPercent, y } = (_a = this._computeFinalScrollY(rootMark.attribute.y - scrollY)) !== null && _a !== void 0 ? _a : {};
|
|
104731
|
+
const { percent: xPercent, x } = (_b = this._computeFinalScrollX(rootMark.attribute.x - scrollX)) !== null && _b !== void 0 ? _b : {};
|
|
104732
|
+
const eventResult = {};
|
|
104733
|
+
if (isValidNumber$1(x)) {
|
|
104734
|
+
this._updateScrollX(rootMark, x, xPercent);
|
|
104735
|
+
eventResult.x = x;
|
|
104736
|
+
}
|
|
104737
|
+
if (isValidNumber$1(y)) {
|
|
104738
|
+
this._updateScrollY(rootMark, y, yPercent);
|
|
104739
|
+
eventResult.y = y;
|
|
104740
|
+
}
|
|
104741
|
+
this._event.emit('chartScroll', eventResult);
|
|
104742
|
+
};
|
|
104743
|
+
}
|
|
104744
|
+
onInit(service, chartSpec) {
|
|
104745
|
+
var _a;
|
|
104746
|
+
this._spec = (_a = chartSpec[ScrollPlugin.type]) !== null && _a !== void 0 ? _a : {};
|
|
104747
|
+
this._service = service;
|
|
104748
|
+
this._bindEvent(service);
|
|
104749
|
+
}
|
|
104750
|
+
onLayoutRectUpdate(service) {
|
|
104751
|
+
const viewBoxSize = service.globalInstance.getChart().getViewRect();
|
|
104752
|
+
const canvasSize = service.globalInstance.getChart().getCanvasRect();
|
|
104753
|
+
this._scrollLimit.x.min = Math.min(canvasSize.width - viewBoxSize.width, 0);
|
|
104754
|
+
this._scrollLimit.x.percent = Math.abs(canvasSize.width / viewBoxSize.width);
|
|
104755
|
+
this._scrollLimit.x.size = viewBoxSize.width;
|
|
104756
|
+
this._scrollLimit.y.min = Math.min(canvasSize.height - viewBoxSize.height, 0);
|
|
104757
|
+
this._scrollLimit.y.percent = Math.abs(canvasSize.height / viewBoxSize.height);
|
|
104758
|
+
this._scrollLimit.y.size = viewBoxSize.height;
|
|
104759
|
+
if (!this._event) {
|
|
104760
|
+
this._event = new Event$1(this._service.globalInstance.getChart().getOption().eventDispatcher, null);
|
|
104761
|
+
}
|
|
104762
|
+
}
|
|
104763
|
+
onAfterRender() {
|
|
104764
|
+
const rootMark = this.getRootMark();
|
|
104765
|
+
if (rootMark) {
|
|
104766
|
+
if (!this._xScrollComponent) {
|
|
104767
|
+
this._updateScrollX(rootMark, 0, 0);
|
|
104768
|
+
}
|
|
104769
|
+
if (!this._yScrollComponent) {
|
|
104770
|
+
this._updateScrollY(rootMark, 0, 0);
|
|
104771
|
+
}
|
|
104772
|
+
}
|
|
104773
|
+
}
|
|
104774
|
+
release() {
|
|
104775
|
+
var _a;
|
|
104776
|
+
(_a = this._service.globalInstance.getStage()) === null || _a === void 0 ? void 0 : _a.off('wheel', this.onWheel);
|
|
104777
|
+
}
|
|
104778
|
+
_bindEvent(service) {
|
|
104779
|
+
var _a;
|
|
104780
|
+
(_a = service.globalInstance.getStage()) === null || _a === void 0 ? void 0 : _a.on('wheel', this.onWheel);
|
|
104781
|
+
}
|
|
104782
|
+
getRootMark() {
|
|
104783
|
+
var _a;
|
|
104784
|
+
return (_a = this._service.globalInstance.getStage()) === null || _a === void 0 ? void 0 : _a.find(node => node.name === 'root', true);
|
|
104785
|
+
}
|
|
104786
|
+
_computeFinalScrollY(y) {
|
|
104787
|
+
var _a;
|
|
104788
|
+
if (this._lastScrollY === y) {
|
|
104789
|
+
return null;
|
|
104790
|
+
}
|
|
104791
|
+
this._lastScrollY = y;
|
|
104792
|
+
if (((_a = this._spec.y) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
104793
|
+
return null;
|
|
104794
|
+
}
|
|
104795
|
+
const finalY = Math.max(this._scrollLimit.y.min, Math.min(y, this._scrollLimit.y.max));
|
|
104796
|
+
const percent = Math.abs(finalY / this._scrollLimit.y.size);
|
|
104797
|
+
return {
|
|
104798
|
+
y: finalY,
|
|
104799
|
+
percent
|
|
104800
|
+
};
|
|
104801
|
+
}
|
|
104802
|
+
_computeFinalScrollX(x) {
|
|
104803
|
+
var _a;
|
|
104804
|
+
if (this._lastScrollX === x) {
|
|
104805
|
+
return null;
|
|
104806
|
+
}
|
|
104807
|
+
this._lastScrollX = x;
|
|
104808
|
+
if (((_a = this._spec.x) === null || _a === void 0 ? void 0 : _a.enable) === false) {
|
|
104809
|
+
return null;
|
|
104810
|
+
}
|
|
104811
|
+
const finalX = Math.max(this._scrollLimit.x.min, Math.min(x, this._scrollLimit.x.max));
|
|
104812
|
+
const percent = Math.abs(finalX / this._scrollLimit.x.size);
|
|
104813
|
+
return {
|
|
104814
|
+
x: finalX,
|
|
104815
|
+
percent
|
|
104816
|
+
};
|
|
104817
|
+
}
|
|
104818
|
+
_updateScrollY(rootMark, y, percent) {
|
|
104819
|
+
const yScrollComponent = this._getYScrollComponent();
|
|
104820
|
+
yScrollComponent.setAttribute('range', [percent, percent + this._scrollLimit.y.percent]);
|
|
104821
|
+
rootMark.setAttributes({
|
|
104822
|
+
y: y
|
|
104823
|
+
});
|
|
104824
|
+
}
|
|
104825
|
+
_getYScrollComponent() {
|
|
104826
|
+
var _a, _b, _c, _d, _e;
|
|
104827
|
+
if (!this._yScrollComponent) {
|
|
104828
|
+
const canvasSize = this._service.globalInstance.getChart().getCanvasRect();
|
|
104829
|
+
const viewSize = this._service.globalInstance.getChart().getViewRect();
|
|
104830
|
+
const _f = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.y) !== null && _b !== void 0 ? _b : {}, rest = __rest$e(_f, ["enable"]);
|
|
104831
|
+
this._yScrollComponent = new ScrollBar$1(Object.assign(Object.assign({}, rest), { zIndex: 9999, x: canvasSize.width - DefaultTheme.size, y: 0, width: DefaultTheme.size, height: canvasSize.height, range: [0, canvasSize.height / viewSize.height], direction: 'vertical', delayTime: (_c = rest === null || rest === void 0 ? void 0 : rest.delayTime) !== null && _c !== void 0 ? _c : 30, realTime: (_d = rest === null || rest === void 0 ? void 0 : rest.realTime) !== null && _d !== void 0 ? _d : true, railStyle: DefaultTheme.railStyle, sliderStyle: DefaultTheme.sliderStyle }));
|
|
104832
|
+
this._yScrollComponent.addEventListener(SCROLLBAR_EVENT, (e) => {
|
|
104833
|
+
var _a;
|
|
104834
|
+
const value = e.detail.value;
|
|
104835
|
+
const { percent, y } = (_a = this._computeFinalScrollY(-value[0] * this._scrollLimit.y.size)) !== null && _a !== void 0 ? _a : {};
|
|
104836
|
+
if (percent !== undefined && y !== undefined) {
|
|
104837
|
+
this._updateScrollY(this.getRootMark(), y, percent);
|
|
104838
|
+
this._event.emit('chartScroll', { y });
|
|
104839
|
+
}
|
|
104840
|
+
});
|
|
104841
|
+
this._yScrollComponent.addEventListener(SCROLLBAR_END_EVENT, (e) => {
|
|
104842
|
+
var _a;
|
|
104843
|
+
const value = e.detail.value;
|
|
104844
|
+
const { percent, y } = (_a = this._computeFinalScrollY(-value[0] * this._scrollLimit.y.size)) !== null && _a !== void 0 ? _a : {};
|
|
104845
|
+
if (percent !== undefined && y !== undefined) {
|
|
104846
|
+
this._updateScrollY(this.getRootMark(), y, percent);
|
|
104847
|
+
this._event.emit('chartScroll', { y });
|
|
104848
|
+
}
|
|
104849
|
+
});
|
|
104850
|
+
(_e = this.getRootMark().parent) === null || _e === void 0 ? void 0 : _e.addChild(this._yScrollComponent);
|
|
104851
|
+
}
|
|
104852
|
+
return this._yScrollComponent;
|
|
104853
|
+
}
|
|
104854
|
+
_updateScrollX(rootMark, x, percent) {
|
|
104855
|
+
const xScrollComponent = this._getXScrollComponent();
|
|
104856
|
+
xScrollComponent.setAttribute('range', [percent, percent + this._scrollLimit.x.percent]);
|
|
104857
|
+
rootMark.setAttributes({
|
|
104858
|
+
x: x
|
|
104859
|
+
});
|
|
104860
|
+
}
|
|
104861
|
+
_getXScrollComponent() {
|
|
104862
|
+
var _a, _b, _c, _d, _e;
|
|
104863
|
+
if (!this._xScrollComponent) {
|
|
104864
|
+
const canvasSize = this._service.globalInstance.getChart().getCanvasRect();
|
|
104865
|
+
const viewSize = this._service.globalInstance.getChart().getViewRect();
|
|
104866
|
+
const _f = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.x) !== null && _b !== void 0 ? _b : {}, rest = __rest$e(_f, ["enable"]);
|
|
104867
|
+
this._xScrollComponent = new ScrollBar$1(Object.assign(Object.assign({}, rest), { zIndex: 9999, x: 0, y: canvasSize.height - DefaultTheme.size, width: canvasSize.width, height: DefaultTheme.size, range: [0, canvasSize.width / viewSize.width], direction: 'horizontal', delayTime: (_c = rest === null || rest === void 0 ? void 0 : rest.delayTime) !== null && _c !== void 0 ? _c : 30, realTime: (_d = rest === null || rest === void 0 ? void 0 : rest.realTime) !== null && _d !== void 0 ? _d : true, sliderStyle: DefaultTheme.sliderStyle, railStyle: DefaultTheme.railStyle }));
|
|
104868
|
+
this._xScrollComponent.addEventListener(SCROLLBAR_EVENT, (e) => {
|
|
104869
|
+
var _a;
|
|
104870
|
+
const value = e.detail.value;
|
|
104871
|
+
const { percent, x } = (_a = this._computeFinalScrollX(-value[0] * this._scrollLimit.x.size)) !== null && _a !== void 0 ? _a : {};
|
|
104872
|
+
if (percent !== undefined && x !== undefined) {
|
|
104873
|
+
this._updateScrollX(this.getRootMark(), x, percent);
|
|
104874
|
+
this._event.emit('chartScroll', { x });
|
|
104875
|
+
}
|
|
104876
|
+
});
|
|
104877
|
+
this._xScrollComponent.addEventListener(SCROLLBAR_END_EVENT, (e) => {
|
|
104878
|
+
var _a;
|
|
104879
|
+
const value = e.detail.value;
|
|
104880
|
+
const { percent, x } = (_a = this._computeFinalScrollX(-value[0] * this._scrollLimit.x.size)) !== null && _a !== void 0 ? _a : {};
|
|
104881
|
+
if (percent !== undefined && x !== undefined) {
|
|
104882
|
+
this._updateScrollX(this.getRootMark(), x, percent);
|
|
104883
|
+
this._event.emit('chartScroll', { x });
|
|
104884
|
+
}
|
|
104885
|
+
});
|
|
104886
|
+
(_e = this.getRootMark().parent) === null || _e === void 0 ? void 0 : _e.addChild(this._xScrollComponent);
|
|
104887
|
+
}
|
|
104888
|
+
return this._xScrollComponent;
|
|
104889
|
+
}
|
|
104890
|
+
scrollTo({ x, y }) {
|
|
104891
|
+
var _a, _b;
|
|
104892
|
+
const rootMark = this.getRootMark();
|
|
104893
|
+
if (rootMark) {
|
|
104894
|
+
if (x !== undefined) {
|
|
104895
|
+
const { x: finalX, percent } = (_a = this._computeFinalScrollX(x)) !== null && _a !== void 0 ? _a : {};
|
|
104896
|
+
if (finalX !== undefined && percent !== undefined) {
|
|
104897
|
+
this._updateScrollX(rootMark, finalX, percent);
|
|
104898
|
+
}
|
|
104899
|
+
}
|
|
104900
|
+
if (y !== undefined) {
|
|
104901
|
+
const { y: finalY, percent } = (_b = this._computeFinalScrollY(y)) !== null && _b !== void 0 ? _b : {};
|
|
104902
|
+
if (finalY !== undefined && percent !== undefined) {
|
|
104903
|
+
this._updateScrollY(rootMark, finalY, percent);
|
|
104904
|
+
}
|
|
104905
|
+
}
|
|
104906
|
+
}
|
|
104907
|
+
}
|
|
104908
|
+
}
|
|
104909
|
+
ScrollPlugin.pluginType = 'chart';
|
|
104910
|
+
ScrollPlugin.type = 'chartScroll';
|
|
104911
|
+
const registerScrollPlugin = (theme) => {
|
|
104912
|
+
var _a, _b, _c, _d, _e;
|
|
104913
|
+
DefaultTheme.size = (_a = theme === null || theme === void 0 ? void 0 : theme.size) !== null && _a !== void 0 ? _a : DefaultTheme.size;
|
|
104914
|
+
DefaultTheme.railStyle = merge$1({}, (_b = DefaultTheme.railStyle) !== null && _b !== void 0 ? _b : {}, (_c = theme === null || theme === void 0 ? void 0 : theme.railStyle) !== null && _c !== void 0 ? _c : {});
|
|
104915
|
+
DefaultTheme.sliderStyle = merge$1({}, (_d = DefaultTheme.sliderStyle) !== null && _d !== void 0 ? _d : {}, (_e = theme === null || theme === void 0 ? void 0 : theme.sliderStyle) !== null && _e !== void 0 ? _e : {});
|
|
104916
|
+
registerChartPlugin(ScrollPlugin);
|
|
104917
|
+
};
|
|
104918
|
+
|
|
104672
104919
|
exports.Arc3dMark = Arc3dMark;
|
|
104673
104920
|
exports.ArcMark = ArcMark;
|
|
104674
104921
|
exports.AreaChart = AreaChart;
|
|
@@ -104821,6 +105068,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
104821
105068
|
exports.ScatterChart = ScatterChart;
|
|
104822
105069
|
exports.ScatterSeries = ScatterSeries;
|
|
104823
105070
|
exports.ScrollBar = ScrollBar;
|
|
105071
|
+
exports.ScrollPlugin = ScrollPlugin;
|
|
104824
105072
|
exports.SequenceChart = SequenceChart;
|
|
104825
105073
|
exports.StreamLight = StreamLight;
|
|
104826
105074
|
exports.SunburstChart = SunburstChart;
|
|
@@ -105009,6 +105257,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
|
|
|
105009
105257
|
exports.registerScatterChart = registerScatterChart;
|
|
105010
105258
|
exports.registerScatterSeries = registerScatterSeries;
|
|
105011
105259
|
exports.registerScrollBar = registerScrollBar;
|
|
105260
|
+
exports.registerScrollPlugin = registerScrollPlugin;
|
|
105012
105261
|
exports.registerSequenceChart = registerSequenceChart;
|
|
105013
105262
|
exports.registerSunBurstSeries = registerSunBurstSeries;
|
|
105014
105263
|
exports.registerSunburstChart = registerSunburstChart;
|