@visactor/vchart 2.0.8 → 2.0.10-alpha.0
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 +944 -587
- package/build/index.js +944 -587
- package/build/index.min.js +2 -2
- package/build/tsconfig.tsbuildinfo +1 -1
- package/cjs/animation/config.d.ts +1 -0
- package/cjs/animation/config.js +13 -1
- package/cjs/animation/config.js.map +1 -1
- package/cjs/compile/compiler.d.ts +5 -0
- package/cjs/compile/compiler.js +42 -4
- package/cjs/compile/compiler.js.map +1 -1
- package/cjs/compile/interface/compilable-item.d.ts +2 -0
- package/cjs/compile/interface/compilable-item.js.map +1 -1
- package/cjs/component/axis/base-axis.d.ts +1 -1
- package/cjs/component/axis/base-axis.js +3 -3
- package/cjs/component/axis/base-axis.js.map +1 -1
- package/cjs/component/axis/cartesian/axis.d.ts +1 -1
- package/cjs/component/axis/cartesian/axis.js.map +1 -1
- package/cjs/component/axis/cartesian/band-axis.d.ts +1 -1
- package/cjs/component/axis/cartesian/band-axis.js.map +1 -1
- package/cjs/component/axis/interface/common.d.ts +1 -0
- package/cjs/component/axis/interface/common.js.map +1 -1
- package/cjs/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/cjs/component/axis/mixin/band-axis-mixin.js +10 -4
- package/cjs/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js +15 -1
- package/cjs/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/cjs/component/axis/polar/axis.d.ts +1 -1
- package/cjs/component/axis/polar/axis.js.map +1 -1
- package/cjs/component/axis/polar/band-axis.d.ts +1 -1
- package/cjs/component/axis/polar/band-axis.js.map +1 -1
- package/cjs/component/brush/brush.js +6 -5
- package/cjs/component/brush/brush.js.map +1 -1
- package/cjs/component/custom-mark/custom-mark.js +2 -2
- package/cjs/component/custom-mark/custom-mark.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-base-component.d.ts +31 -52
- package/cjs/component/data-zoom/data-filter-base-component.js +164 -240
- package/cjs/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/cjs/component/data-zoom/data-filter-event.d.ts +53 -0
- package/cjs/component/data-zoom/data-filter-event.js +112 -0
- package/cjs/component/data-zoom/data-filter-event.js.map +1 -0
- package/cjs/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
- package/cjs/component/data-zoom/data-zoom/data-zoom.js +129 -84
- package/cjs/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js +35 -36
- package/cjs/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/cjs/component/data-zoom/util.d.ts +14 -0
- package/cjs/component/data-zoom/util.js +81 -7
- package/cjs/component/data-zoom/util.js.map +1 -1
- package/cjs/component/marker/utils.js +1 -1
- package/cjs/component/marker/utils.js.map +1 -1
- package/cjs/component/tooltip/utils/show-tooltip.js +3 -3
- package/cjs/component/tooltip/utils/show-tooltip.js.map +1 -1
- package/cjs/constant/event.d.ts +1 -0
- package/cjs/constant/event.js +8 -8
- package/cjs/constant/event.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/mark/base/base-mark.d.ts +2 -1
- package/cjs/mark/base/base-mark.js +7 -3
- package/cjs/mark/base/base-mark.js.map +1 -1
- package/cjs/mark/interface/common.d.ts +1 -0
- package/cjs/mark/interface/common.js.map +1 -1
- package/cjs/plugin/other.js +2 -1
- package/cjs/plugin/other.js.map +1 -1
- package/cjs/series/bar/bar.js +1 -1
- package/cjs/series/bar/bar.js.map +1 -1
- package/cjs/series/base/base-series.d.ts +1 -0
- package/cjs/series/base/base-series.js +10 -5
- package/cjs/series/base/base-series.js.map +1 -1
- package/cjs/series/dot/dot.js +6 -2
- package/cjs/series/dot/dot.js.map +1 -1
- package/cjs/series/util/stack.js +1 -1
- package/cjs/series/util/stack.js.map +1 -1
- package/cjs/typings/spec/common.js.map +1 -1
- package/esm/animation/config.d.ts +1 -0
- package/esm/animation/config.js +8 -1
- package/esm/animation/config.js.map +1 -1
- package/esm/compile/compiler.d.ts +5 -0
- package/esm/compile/compiler.js +44 -4
- package/esm/compile/compiler.js.map +1 -1
- package/esm/compile/interface/compilable-item.d.ts +2 -0
- package/esm/compile/interface/compilable-item.js.map +1 -1
- package/esm/component/axis/base-axis.d.ts +1 -1
- package/esm/component/axis/base-axis.js +3 -3
- package/esm/component/axis/base-axis.js.map +1 -1
- package/esm/component/axis/cartesian/axis.d.ts +1 -1
- package/esm/component/axis/cartesian/axis.js.map +1 -1
- package/esm/component/axis/cartesian/band-axis.d.ts +1 -1
- package/esm/component/axis/cartesian/band-axis.js.map +1 -1
- package/esm/component/axis/interface/common.d.ts +1 -0
- package/esm/component/axis/interface/common.js.map +1 -1
- package/esm/component/axis/mixin/band-axis-mixin.d.ts +2 -0
- package/esm/component/axis/mixin/band-axis-mixin.js +10 -4
- package/esm/component/axis/mixin/band-axis-mixin.js.map +1 -1
- package/esm/component/axis/mixin/linear-axis-mixin.d.ts +5 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js +15 -1
- package/esm/component/axis/mixin/linear-axis-mixin.js.map +1 -1
- package/esm/component/axis/polar/axis.d.ts +1 -1
- package/esm/component/axis/polar/axis.js.map +1 -1
- package/esm/component/axis/polar/band-axis.d.ts +1 -1
- package/esm/component/axis/polar/band-axis.js.map +1 -1
- package/esm/component/brush/brush.js +6 -4
- package/esm/component/brush/brush.js.map +1 -1
- package/esm/component/custom-mark/custom-mark.js +2 -2
- package/esm/component/custom-mark/custom-mark.js.map +1 -1
- package/esm/component/data-zoom/data-filter-base-component.d.ts +31 -52
- package/esm/component/data-zoom/data-filter-base-component.js +155 -232
- package/esm/component/data-zoom/data-filter-base-component.js.map +1 -1
- package/esm/component/data-zoom/data-filter-event.d.ts +53 -0
- package/esm/component/data-zoom/data-filter-event.js +108 -0
- package/esm/component/data-zoom/data-filter-event.js.map +1 -0
- package/esm/component/data-zoom/data-zoom/data-zoom.d.ts +23 -12
- package/esm/component/data-zoom/data-zoom/data-zoom.js +125 -82
- package/esm/component/data-zoom/data-zoom/data-zoom.js.map +1 -1
- package/esm/component/data-zoom/scroll-bar/scroll-bar.d.ts +4 -3
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js +36 -36
- package/esm/component/data-zoom/scroll-bar/scroll-bar.js.map +1 -1
- package/esm/component/data-zoom/util.d.ts +14 -0
- package/esm/component/data-zoom/util.js +63 -7
- package/esm/component/data-zoom/util.js.map +1 -1
- package/esm/component/marker/utils.js +1 -1
- package/esm/component/marker/utils.js.map +1 -1
- package/esm/component/tooltip/utils/show-tooltip.js +3 -3
- package/esm/component/tooltip/utils/show-tooltip.js.map +1 -1
- package/esm/constant/event.d.ts +1 -0
- package/esm/constant/event.js +8 -8
- package/esm/constant/event.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/mark/base/base-mark.d.ts +2 -1
- package/esm/mark/base/base-mark.js +7 -3
- package/esm/mark/base/base-mark.js.map +1 -1
- package/esm/mark/interface/common.d.ts +1 -0
- package/esm/mark/interface/common.js.map +1 -1
- package/esm/plugin/other.js +2 -2
- package/esm/plugin/other.js.map +1 -1
- package/esm/series/bar/bar.js +2 -2
- package/esm/series/bar/bar.js.map +1 -1
- package/esm/series/base/base-series.d.ts +1 -0
- package/esm/series/base/base-series.js +9 -5
- package/esm/series/base/base-series.js.map +1 -1
- package/esm/series/dot/dot.js +6 -2
- package/esm/series/dot/dot.js.map +1 -1
- package/esm/series/util/stack.js +2 -2
- package/esm/series/util/stack.js.map +1 -1
- package/esm/typings/spec/common.js.map +1 -1
- package/package.json +6 -6
package/build/index.es.js
CHANGED
|
@@ -18042,9 +18042,10 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
18042
18042
|
}
|
|
18043
18043
|
updateSymbolAABBBoundsAccurate(attribute, symbolTheme, aabbBounds) {
|
|
18044
18044
|
const {
|
|
18045
|
-
|
|
18046
|
-
|
|
18047
|
-
|
|
18045
|
+
size = symbolTheme.size
|
|
18046
|
+
} = attribute,
|
|
18047
|
+
symbolClass = this.getParsedPath();
|
|
18048
|
+
return symbolClass ? (symbolClass.bounds(size, aabbBounds), aabbBounds) : aabbBounds;
|
|
18048
18049
|
}
|
|
18049
18050
|
needUpdateTags(keys) {
|
|
18050
18051
|
return super.needUpdateTags(keys, SYMBOL_UPDATE_TAG_KEY);
|
|
@@ -18053,8 +18054,9 @@ let Symbol$1 = class Symbol extends Graphic {
|
|
|
18053
18054
|
return super.needUpdateTag(key, SYMBOL_UPDATE_TAG_KEY);
|
|
18054
18055
|
}
|
|
18055
18056
|
toCustomPath() {
|
|
18056
|
-
const symbolInstance = this.getParsedPath()
|
|
18057
|
-
|
|
18057
|
+
const symbolInstance = this.getParsedPath();
|
|
18058
|
+
if (!symbolInstance) return null;
|
|
18059
|
+
const size = this.attribute.size,
|
|
18058
18060
|
formattedSize = isArray$1(size) ? size : [size, size];
|
|
18059
18061
|
return symbolInstance.path ? new CustomPath2D().fromCustomPath2D(symbolInstance.path, 0, 0, formattedSize[0], formattedSize[1]) : new CustomPath2D().fromString(symbolInstance.pathStr, 0, 0, formattedSize[0], formattedSize[1]);
|
|
18060
18062
|
}
|
|
@@ -24019,7 +24021,7 @@ class Stage extends Group$1 {
|
|
|
24019
24021
|
}));
|
|
24020
24022
|
}
|
|
24021
24023
|
enableAutoRefresh() {
|
|
24022
|
-
this.autoRefresh || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
|
|
24024
|
+
this.autoRefresh || "node" === this.global.env || (this.autoRefresh = !0, this.pluginService.register(new AutoRefreshPlugin()));
|
|
24023
24025
|
}
|
|
24024
24026
|
disableAutoRefresh() {
|
|
24025
24027
|
this.autoRefresh && (this.autoRefresh = !1, this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach(plugin => {
|
|
@@ -42398,7 +42400,7 @@ const polarAngleAxisDiscreteTicks = (scale, op) => {
|
|
|
42398
42400
|
labelStyle: labelStyle
|
|
42399
42401
|
} = op,
|
|
42400
42402
|
radius = null == getRadius ? void 0 : getRadius();
|
|
42401
|
-
if (!radius) return convertDomainToTickData(scale.domain());
|
|
42403
|
+
if (!radius || radius <= 0) return convertDomainToTickData(scale.domain());
|
|
42402
42404
|
let scaleTicks;
|
|
42403
42405
|
if (isValid$1(tickStep)) scaleTicks = scale.stepTicks(tickStep);else if (isValid$1(forceTickCount)) scaleTicks = scale.forceTicks(forceTickCount);else if (isValid$1(tickCount)) {
|
|
42404
42406
|
const range = scale.range(),
|
|
@@ -43196,7 +43198,16 @@ class LabelBase extends AnimateComponent {
|
|
|
43196
43198
|
data = data.filter(d => !seenIds.has(d.id) && seenIds.add(d.id));
|
|
43197
43199
|
}
|
|
43198
43200
|
let labels = this._initText(data);
|
|
43199
|
-
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels)
|
|
43201
|
+
labels = isFunction$1(customLayoutFunc) ? customLayoutFunc(data, labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this) : this._layout(labels);
|
|
43202
|
+
const filteredLabels = [],
|
|
43203
|
+
overlapLabels = labels;
|
|
43204
|
+
if (!isBoolean$1(overlap) && isFunction$1(overlap.filterBeforeOverlap)) {
|
|
43205
|
+
const getRelatedGraphic = this.getRelatedGraphic.bind(this);
|
|
43206
|
+
labels.forEach(label => {
|
|
43207
|
+
overlap.filterBeforeOverlap(label, getRelatedGraphic, this) ? overlapLabels.push(label) : filteredLabels.push(label);
|
|
43208
|
+
});
|
|
43209
|
+
}
|
|
43210
|
+
isFunction$1(customOverlapFunc) ? labels = customOverlapFunc(overlapLabels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this).concat(filteredLabels) : !1 !== overlap && (labels = this._overlapping(overlapLabels).concat(filteredLabels)), isFunction$1(this.attribute.onAfterOverlapping) && this.attribute.onAfterOverlapping(labels, this.getRelatedGraphic.bind(this), this._isCollectionBase ? d => this._idToPoint.get(d.id) : null, this), labels && labels.length && labels.forEach(label => {
|
|
43200
43211
|
this._bindEvent(label), this._setStatesOfText(label);
|
|
43201
43212
|
}), !1 !== smartInvert && this._smartInvert(labels), this._renderLabels(labels), !1 !== this._enableAnimation && this._baseMarks.forEach((mark, index) => {
|
|
43202
43213
|
mark.initAttributes(markAttributeList[index]);
|
|
@@ -43570,20 +43581,23 @@ class LabelBase extends AnimateComponent {
|
|
|
43570
43581
|
{
|
|
43571
43582
|
enter: enter
|
|
43572
43583
|
} = this._animationConfig;
|
|
43573
|
-
[text, labelLine].filter(Boolean).forEach(item =>
|
|
43574
|
-
|
|
43575
|
-
|
|
43576
|
-
|
|
43577
|
-
|
|
43578
|
-
|
|
43579
|
-
|
|
43580
|
-
|
|
43581
|
-
|
|
43582
|
-
|
|
43583
|
-
|
|
43584
|
-
|
|
43585
|
-
|
|
43586
|
-
|
|
43584
|
+
[text, labelLine].filter(Boolean).forEach(item => {
|
|
43585
|
+
var _a;
|
|
43586
|
+
null === (_a = item.setFinalAttributes) || void 0 === _a || _a.call(item, item.attribute), item.applyAnimationState(["enter"], [{
|
|
43587
|
+
name: "enter",
|
|
43588
|
+
animation: Object.assign(Object.assign({}, enter), {
|
|
43589
|
+
type: "labelEnter",
|
|
43590
|
+
selfOnly: !0,
|
|
43591
|
+
customParameters: {
|
|
43592
|
+
relatedGraphic: relatedGraphic,
|
|
43593
|
+
relatedGraphics: this._idToGraphic,
|
|
43594
|
+
config: Object.assign(Object.assign({}, enter), {
|
|
43595
|
+
type: item === text ? enter.type : "fadeIn"
|
|
43596
|
+
})
|
|
43597
|
+
}
|
|
43598
|
+
})
|
|
43599
|
+
}]);
|
|
43600
|
+
});
|
|
43587
43601
|
}
|
|
43588
43602
|
_runUpdateAnimation(prevLabel, currentLabel) {
|
|
43589
43603
|
const {
|
|
@@ -45465,15 +45479,18 @@ class DataZoomRenderer {
|
|
|
45465
45479
|
pickable: !1
|
|
45466
45480
|
}, selectedBackgroundChartStyle.area));
|
|
45467
45481
|
}
|
|
45468
|
-
_computeBasePoints() {
|
|
45482
|
+
_computeBasePoints(points) {
|
|
45469
45483
|
const {
|
|
45470
45484
|
orient: orient
|
|
45471
45485
|
} = this.attribute,
|
|
45472
|
-
|
|
45473
|
-
|
|
45474
|
-
|
|
45475
|
-
|
|
45476
|
-
|
|
45486
|
+
key = "bottom" === orient || "top" === orient ? "x" : "y";
|
|
45487
|
+
let lastPointSide = Math.sign(points[points.length - 1][key] - points[0][key]);
|
|
45488
|
+
0 === lastPointSide && (lastPointSide = 1);
|
|
45489
|
+
const {
|
|
45490
|
+
position: position,
|
|
45491
|
+
width: width,
|
|
45492
|
+
height: height
|
|
45493
|
+
} = this._getLayoutAttrFromConfig();
|
|
45477
45494
|
let basePointStart, basePointEnd;
|
|
45478
45495
|
return this._isHorizontal ? (basePointStart = [{
|
|
45479
45496
|
x: position.x,
|
|
@@ -45493,7 +45510,10 @@ class DataZoomRenderer {
|
|
|
45493
45510
|
}], basePointEnd = [{
|
|
45494
45511
|
x: position.x,
|
|
45495
45512
|
y: position.y
|
|
45496
|
-
}]), {
|
|
45513
|
+
}]), Math.sign(basePointEnd[0][key] - basePointStart[0][key]) !== lastPointSide ? {
|
|
45514
|
+
basePointStart: basePointEnd,
|
|
45515
|
+
basePointEnd: basePointStart
|
|
45516
|
+
} : {
|
|
45497
45517
|
basePointStart: basePointStart,
|
|
45498
45518
|
basePointEnd: basePointEnd
|
|
45499
45519
|
};
|
|
@@ -45516,7 +45536,7 @@ class DataZoomRenderer {
|
|
|
45516
45536
|
const {
|
|
45517
45537
|
basePointStart: basePointStart,
|
|
45518
45538
|
basePointEnd: basePointEnd
|
|
45519
|
-
} = this._computeBasePoints();
|
|
45539
|
+
} = this._computeBasePoints(previewPoints);
|
|
45520
45540
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
45521
45541
|
}
|
|
45522
45542
|
_getPreviewAreaPoints() {
|
|
@@ -45531,7 +45551,7 @@ class DataZoomRenderer {
|
|
|
45531
45551
|
const {
|
|
45532
45552
|
basePointStart: basePointStart,
|
|
45533
45553
|
basePointEnd: basePointEnd
|
|
45534
|
-
} = this._computeBasePoints();
|
|
45554
|
+
} = this._computeBasePoints(previewPoints);
|
|
45535
45555
|
return basePointStart.concat(previewPoints).concat(basePointEnd);
|
|
45536
45556
|
}
|
|
45537
45557
|
renderText() {
|
|
@@ -45944,11 +45964,12 @@ let DataZoom$1 = class DataZoom extends AbstractComponent {
|
|
|
45944
45964
|
})));
|
|
45945
45965
|
}
|
|
45946
45966
|
setAttributes(params, forceUpdateTag) {
|
|
45967
|
+
var _a, _b;
|
|
45947
45968
|
const {
|
|
45948
45969
|
start: start,
|
|
45949
45970
|
end: end
|
|
45950
45971
|
} = this.attribute;
|
|
45951
|
-
start && (this._state.start = start), end && (this._state.end = end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
45972
|
+
start && (this._state.start = null !== (_a = params.start) && void 0 !== _a ? _a : start), end && (this._state.end = null !== (_b = params.end) && void 0 !== _b ? _b : end), this._renderer.setAttributes(this._getRendererAttrs()), this._interaction.setAttributes(this._getInteractionAttrs()), super.setAttributes(params, forceUpdateTag);
|
|
45952
45973
|
}
|
|
45953
45974
|
render() {
|
|
45954
45975
|
this._layoutCacheFromConfig = null, this._container = this.createOrUpdateChild("datazoom-container", {}, "group"), this._renderer.renderDataZoom(), this._interaction.setAttributes(this._getInteractionAttrs());
|
|
@@ -53702,6 +53723,7 @@ var ChartEvent;
|
|
|
53702
53723
|
ChartEvent["markDeltaYUpdate"] = "markDeltaYUpdate";
|
|
53703
53724
|
ChartEvent["viewDataLabelUpdate"] = "viewDataLabelUpdate";
|
|
53704
53725
|
ChartEvent["scaleDomainUpdate"] = "scaleDomainUpdate";
|
|
53726
|
+
ChartEvent["scaleRawDomainUpdate"] = "scaleRawDomainUpdate";
|
|
53705
53727
|
ChartEvent["scaleUpdate"] = "scaleUpdate";
|
|
53706
53728
|
ChartEvent["dataZoomChange"] = "dataZoomChange";
|
|
53707
53729
|
ChartEvent["drill"] = "drill";
|
|
@@ -54723,6 +54745,7 @@ class Compiler {
|
|
|
54723
54745
|
var _a, _b, _c, _d, _e, _f;
|
|
54724
54746
|
(_b = (_a = this._option.performanceHook) === null || _a === void 0 ? void 0 : _a.beforeDoRender) === null || _b === void 0 ? void 0 : _b.call(_a, this._compileChart.getOption().globalInstance);
|
|
54725
54747
|
if (this._stage) {
|
|
54748
|
+
this.runStageAnimation();
|
|
54726
54749
|
this._rootMarks.forEach(g => {
|
|
54727
54750
|
traverseGroupMark(g, m => {
|
|
54728
54751
|
if (m.needClear) {
|
|
@@ -54765,6 +54788,7 @@ class Compiler {
|
|
|
54765
54788
|
this.handleLayoutEnd();
|
|
54766
54789
|
}
|
|
54767
54790
|
this.findProgressiveMarks();
|
|
54791
|
+
this.updateStateAnimation();
|
|
54768
54792
|
this._doRender(true);
|
|
54769
54793
|
this.doPreProgressive();
|
|
54770
54794
|
log(`--- start of renderMarks(${this._count}) ---`);
|
|
@@ -54810,6 +54834,67 @@ class Compiler {
|
|
|
54810
54834
|
this.renderMarks();
|
|
54811
54835
|
}
|
|
54812
54836
|
}
|
|
54837
|
+
setStageAnimationConfig(config) {
|
|
54838
|
+
const animationConfig = {};
|
|
54839
|
+
Object.keys(config).forEach(key => {
|
|
54840
|
+
const value = config[key];
|
|
54841
|
+
if (isArray$1(value)) {
|
|
54842
|
+
animationConfig[key] = value.map(item => {
|
|
54843
|
+
var _a;
|
|
54844
|
+
const options = (_a = item.options) !== null && _a !== void 0 ? _a : {};
|
|
54845
|
+
return Object.assign(Object.assign({}, item), { options: (...args) => {
|
|
54846
|
+
const _options = typeof options === 'function' ? options(...args) : options;
|
|
54847
|
+
return Object.assign({}, _options);
|
|
54848
|
+
} });
|
|
54849
|
+
});
|
|
54850
|
+
}
|
|
54851
|
+
else {
|
|
54852
|
+
animationConfig[key] = Object.assign({}, config[key]);
|
|
54853
|
+
}
|
|
54854
|
+
});
|
|
54855
|
+
this._stateAnimationConfig = animationConfig;
|
|
54856
|
+
}
|
|
54857
|
+
updateStateAnimation() {
|
|
54858
|
+
const allMarks = [];
|
|
54859
|
+
this._rootMarks.forEach(mark => {
|
|
54860
|
+
traverseGroupMark(mark, m => {
|
|
54861
|
+
allMarks.push(m);
|
|
54862
|
+
});
|
|
54863
|
+
});
|
|
54864
|
+
const markAnimationStates = allMarks.map(mark => mark.getAnimationState());
|
|
54865
|
+
const animationState = markAnimationStates.every(state => state === AnimationStateEnum.appear)
|
|
54866
|
+
? AnimationStateEnum.appear
|
|
54867
|
+
: markAnimationStates.every(state => state === AnimationStateEnum.disappear)
|
|
54868
|
+
? AnimationStateEnum.disappear
|
|
54869
|
+
: AnimationStateEnum.none;
|
|
54870
|
+
if (!this._stage.context) {
|
|
54871
|
+
this._stage.context = {};
|
|
54872
|
+
}
|
|
54873
|
+
this._stage.context.animationState = animationState;
|
|
54874
|
+
}
|
|
54875
|
+
runStageAnimation() {
|
|
54876
|
+
var _a;
|
|
54877
|
+
const animationState = (_a = this._stage.context) === null || _a === void 0 ? void 0 : _a.animationState;
|
|
54878
|
+
if (!this._stateAnimationConfig || animationState === AnimationStateEnum.none) {
|
|
54879
|
+
return;
|
|
54880
|
+
}
|
|
54881
|
+
const animationConfigs = array(this._stateAnimationConfig[animationState]).filter(config => config.type);
|
|
54882
|
+
if (!animationConfigs.length) {
|
|
54883
|
+
return;
|
|
54884
|
+
}
|
|
54885
|
+
if (animationState === AnimationStateEnum.appear) {
|
|
54886
|
+
this._stage.stopAnimationState(AnimationStateEnum.disappear);
|
|
54887
|
+
}
|
|
54888
|
+
else if (animationState === AnimationStateEnum.disappear) {
|
|
54889
|
+
this._stage.stopAnimationState(AnimationStateEnum.appear);
|
|
54890
|
+
}
|
|
54891
|
+
this._stage.applyAnimationState([animationState], [
|
|
54892
|
+
{
|
|
54893
|
+
name: animationState,
|
|
54894
|
+
animation: animationConfigs
|
|
54895
|
+
}
|
|
54896
|
+
]);
|
|
54897
|
+
}
|
|
54813
54898
|
updateViewBox(viewBox, reRender = true) {
|
|
54814
54899
|
if (!this._stage) {
|
|
54815
54900
|
return;
|
|
@@ -58279,6 +58364,15 @@ class BaseMark extends GrammarItem {
|
|
|
58279
58364
|
: () => 'key';
|
|
58280
58365
|
this._dataByGroup = groupData(data, this._groupKeyGetter);
|
|
58281
58366
|
}
|
|
58367
|
+
getAnimationState() {
|
|
58368
|
+
const graphicsAnimationStates = this._graphics.map(g => g.context.animationState);
|
|
58369
|
+
const animationState = graphicsAnimationStates.every(state => state === AnimationStateEnum.appear)
|
|
58370
|
+
? AnimationStateEnum.appear
|
|
58371
|
+
: graphicsAnimationStates.every(state => state === AnimationStateEnum.disappear)
|
|
58372
|
+
? AnimationStateEnum.disappear
|
|
58373
|
+
: graphicsAnimationStates[0];
|
|
58374
|
+
return animationState !== null && animationState !== void 0 ? animationState : AnimationStateEnum.none;
|
|
58375
|
+
}
|
|
58282
58376
|
createAnimationStateList(type, animationConfig) {
|
|
58283
58377
|
var _a;
|
|
58284
58378
|
let config = animationConfig[type];
|
|
@@ -58533,14 +58627,14 @@ class BaseMark extends GrammarItem {
|
|
|
58533
58627
|
_runApplyGraphic(graphics) {
|
|
58534
58628
|
const hasAnimation = this.hasAnimation();
|
|
58535
58629
|
graphics.forEach((g, index) => {
|
|
58536
|
-
var _a;
|
|
58630
|
+
var _a, _b;
|
|
58537
58631
|
const finalAttrs = g.context.finalAttrs;
|
|
58538
58632
|
const hasStateAnimation = this.hasAnimationByState(g.context.animationState);
|
|
58539
58633
|
if (!g.setAttributes) {
|
|
58540
58634
|
const mockGraphic = g;
|
|
58541
58635
|
g = this._createGraphic(finalAttrs);
|
|
58542
58636
|
if (hasAnimation) {
|
|
58543
|
-
g.setFinalAttributes(finalAttrs);
|
|
58637
|
+
(_a = g.setFinalAttributes) === null || _a === void 0 ? void 0 : _a.call(g, finalAttrs);
|
|
58544
58638
|
}
|
|
58545
58639
|
g.context = mockGraphic.context;
|
|
58546
58640
|
g.context.diffAttrs = finalAttrs;
|
|
@@ -58548,7 +58642,7 @@ class BaseMark extends GrammarItem {
|
|
|
58548
58642
|
if (gIndex >= 0) {
|
|
58549
58643
|
this._graphics[gIndex] = g;
|
|
58550
58644
|
}
|
|
58551
|
-
if ((
|
|
58645
|
+
if ((_b = this.renderContext) === null || _b === void 0 ? void 0 : _b.progressive) {
|
|
58552
58646
|
const groupIndex = this._dataByGroup ? this._dataByGroup.keys.indexOf(g.context.groupKey) : 0;
|
|
58553
58647
|
const group = groupIndex >= 0 ? this._product.getChildAt(groupIndex) : null;
|
|
58554
58648
|
if (group) {
|
|
@@ -59402,10 +59496,20 @@ const registerLineOrAreaAnimation = () => {
|
|
|
59402
59496
|
const registerPolygonAnimation = () => {
|
|
59403
59497
|
AnimateExecutor.registerBuiltInAnimate('growPointsOut', GrowPointsOut);
|
|
59404
59498
|
};
|
|
59499
|
+
const registerStageAnimation = () => {
|
|
59500
|
+
AnimateExecutor.registerBuiltInAnimate('distortion', Distortion);
|
|
59501
|
+
AnimateExecutor.registerBuiltInAnimate('particle', Particle);
|
|
59502
|
+
AnimateExecutor.registerBuiltInAnimate('pixelation', Pixelation);
|
|
59503
|
+
AnimateExecutor.registerBuiltInAnimate('gaussianBlur', GaussianBlur);
|
|
59504
|
+
AnimateExecutor.registerBuiltInAnimate('glitch', Glitch);
|
|
59505
|
+
AnimateExecutor.registerBuiltInAnimate('grayscale', Grayscale);
|
|
59506
|
+
AnimateExecutor.registerBuiltInAnimate('dissolve', Dissolve);
|
|
59507
|
+
};
|
|
59405
59508
|
|
|
59406
59509
|
const registerAnimate = () => {
|
|
59407
59510
|
registerAnimate$1();
|
|
59408
59511
|
registerBuiltInAnimation();
|
|
59512
|
+
registerStageAnimation();
|
|
59409
59513
|
};
|
|
59410
59514
|
const registerDragPlugin = () => {
|
|
59411
59515
|
Factory.registerStageEventPlugin('drag', DragNDrop);
|
|
@@ -61290,7 +61394,7 @@ const lookup = (data, opt) => {
|
|
|
61290
61394
|
});
|
|
61291
61395
|
};
|
|
61292
61396
|
|
|
61293
|
-
const version = "2.0.
|
|
61397
|
+
const version = "2.0.10-alpha.0";
|
|
61294
61398
|
|
|
61295
61399
|
const addVChartProperty = (data, op) => {
|
|
61296
61400
|
const context = op.beforeCall();
|
|
@@ -62340,6 +62444,7 @@ class BaseSeries extends BaseModel {
|
|
|
62340
62444
|
this.initMarkState();
|
|
62341
62445
|
if (hasAnimation) {
|
|
62342
62446
|
this.initAnimation();
|
|
62447
|
+
this.initStageAnimation();
|
|
62343
62448
|
}
|
|
62344
62449
|
this.afterInitMark();
|
|
62345
62450
|
this.initEvent();
|
|
@@ -62660,7 +62765,7 @@ class BaseSeries extends BaseModel {
|
|
|
62660
62765
|
if (isValid$1(spec.id)) {
|
|
62661
62766
|
mark.setUserId(spec.id);
|
|
62662
62767
|
}
|
|
62663
|
-
if (options.hasAnimation) {
|
|
62768
|
+
if (options.hasAnimation && spec.animation !== false) {
|
|
62664
62769
|
const config = animationConfig({}, userAnimationConfig(spec.type, spec, this._markAttributeContext));
|
|
62665
62770
|
mark.setAnimationConfig(config);
|
|
62666
62771
|
}
|
|
@@ -62670,7 +62775,7 @@ class BaseSeries extends BaseModel {
|
|
|
62670
62775
|
this._createExtensionMark(s, mark, namePrefix, i, options);
|
|
62671
62776
|
});
|
|
62672
62777
|
}
|
|
62673
|
-
|
|
62778
|
+
if (!isNil$1(spec.dataId) || !isNil$1(spec.dataIndex)) {
|
|
62674
62779
|
const dataView = this._option.getSeriesData(spec.dataId, spec.dataIndex);
|
|
62675
62780
|
if (dataView === this._rawData) {
|
|
62676
62781
|
mark.setData(this._data);
|
|
@@ -62796,6 +62901,13 @@ class BaseSeries extends BaseModel {
|
|
|
62796
62901
|
}
|
|
62797
62902
|
initAnimation() {
|
|
62798
62903
|
}
|
|
62904
|
+
initStageAnimation() {
|
|
62905
|
+
const compiler = this._option.getCompiler();
|
|
62906
|
+
if (!(compiler === null || compiler === void 0 ? void 0 : compiler.setStageAnimationConfig)) {
|
|
62907
|
+
return;
|
|
62908
|
+
}
|
|
62909
|
+
compiler.setStageAnimationConfig(animationConfig({}, userAnimationConfig('stage', this._spec, this._markAttributeContext), null));
|
|
62910
|
+
}
|
|
62799
62911
|
initMarkState() {
|
|
62800
62912
|
this.initSeriesStyleState();
|
|
62801
62913
|
}
|
|
@@ -65666,7 +65778,7 @@ class AxisComponent extends BaseComponent {
|
|
|
65666
65778
|
const viewData = s.getViewData();
|
|
65667
65779
|
if (rawData) {
|
|
65668
65780
|
field.forEach(f => {
|
|
65669
|
-
data.push(s.getRawDataStatisticsByField(f,
|
|
65781
|
+
data.push(s.getRawDataStatisticsByField(f, !!isContinuous(this._scale.type)));
|
|
65670
65782
|
});
|
|
65671
65783
|
}
|
|
65672
65784
|
else if (viewData && viewData.latestData && viewData.latestData.length) {
|
|
@@ -65968,7 +66080,7 @@ class AxisComponent extends BaseComponent {
|
|
|
65968
66080
|
_getGridAttributes() {
|
|
65969
66081
|
const spec = this._spec;
|
|
65970
66082
|
return {
|
|
65971
|
-
alternateColor: spec.grid.alternateColor,
|
|
66083
|
+
alternateColor: isFunction$1(spec.grid.alternateColor) ? spec.grid.alternateColor() : spec.grid.alternateColor,
|
|
65972
66084
|
alignWithLabel: spec.grid.alignWithLabel,
|
|
65973
66085
|
style: isFunction$1(spec.grid.style)
|
|
65974
66086
|
? (datum, index) => {
|
|
@@ -65982,7 +66094,9 @@ class AxisComponent extends BaseComponent {
|
|
|
65982
66094
|
: {
|
|
65983
66095
|
type: 'line',
|
|
65984
66096
|
visible: spec.subGrid.visible,
|
|
65985
|
-
alternateColor: spec.subGrid.alternateColor
|
|
66097
|
+
alternateColor: isFunction$1(spec.subGrid.alternateColor)
|
|
66098
|
+
? spec.subGrid.alternateColor()
|
|
66099
|
+
: spec.subGrid.alternateColor,
|
|
65986
66100
|
style: transformToGraphic(spec.subGrid.style)
|
|
65987
66101
|
}
|
|
65988
66102
|
};
|
|
@@ -66929,8 +67043,12 @@ const DEFAULT_TICK_COUNT = 5;
|
|
|
66929
67043
|
class LinearAxisMixin {
|
|
66930
67044
|
constructor() {
|
|
66931
67045
|
this._extend = {};
|
|
67046
|
+
this._rawDomain = [];
|
|
66932
67047
|
this.niceLabelFormatter = null;
|
|
66933
67048
|
}
|
|
67049
|
+
getRawDomain() {
|
|
67050
|
+
return this._rawDomain;
|
|
67051
|
+
}
|
|
66934
67052
|
setExtraAttrFromSpec() {
|
|
66935
67053
|
isValid$1(this._spec.nice) && (this._nice = this._spec.nice);
|
|
66936
67054
|
isValid$1(this._spec.zero) && (this._zero = this._spec.zero);
|
|
@@ -67197,9 +67315,13 @@ class LinearAxisMixin {
|
|
|
67197
67315
|
}
|
|
67198
67316
|
}
|
|
67199
67317
|
updateScaleDomain() {
|
|
67318
|
+
var _a;
|
|
67200
67319
|
if (!this.isSeriesDataEnable()) {
|
|
67201
67320
|
return;
|
|
67202
67321
|
}
|
|
67322
|
+
if (!((_a = this._rawDomain) === null || _a === void 0 ? void 0 : _a.length) && this._scale) {
|
|
67323
|
+
this._updateRawDomain();
|
|
67324
|
+
}
|
|
67203
67325
|
const data = this.collectData();
|
|
67204
67326
|
const domain = this.computeLinearDomain(data);
|
|
67205
67327
|
this.updateScaleDomainByModel(domain);
|
|
@@ -67234,6 +67356,15 @@ class LinearAxisMixin {
|
|
|
67234
67356
|
return value;
|
|
67235
67357
|
};
|
|
67236
67358
|
}
|
|
67359
|
+
_updateRawDomain() {
|
|
67360
|
+
const data = this.collectData(0, true);
|
|
67361
|
+
const domain = this.computeLinearDomain(data);
|
|
67362
|
+
this._rawDomain = domain;
|
|
67363
|
+
this.event.emit(ChartEvent.scaleRawDomainUpdate, { model: this });
|
|
67364
|
+
}
|
|
67365
|
+
_clearRawDomain() {
|
|
67366
|
+
this._rawDomain = [];
|
|
67367
|
+
}
|
|
67237
67368
|
}
|
|
67238
67369
|
|
|
67239
67370
|
const axisLinear = {
|
|
@@ -67465,6 +67596,7 @@ const registerCartesianLinearAxis = () => {
|
|
|
67465
67596
|
class BandAxisMixin {
|
|
67466
67597
|
constructor() {
|
|
67467
67598
|
this._rawDomainIndex = [];
|
|
67599
|
+
this._rawDomain = [];
|
|
67468
67600
|
}
|
|
67469
67601
|
_initData() {
|
|
67470
67602
|
var _a;
|
|
@@ -67516,6 +67648,9 @@ class BandAxisMixin {
|
|
|
67516
67648
|
tickTransform && (tickTransform.options = this._tickTransformOption());
|
|
67517
67649
|
}
|
|
67518
67650
|
}
|
|
67651
|
+
getRawDomain() {
|
|
67652
|
+
return this._rawDomain;
|
|
67653
|
+
}
|
|
67519
67654
|
dataToPosition(values, cfg = {}) {
|
|
67520
67655
|
var _a, _b;
|
|
67521
67656
|
if (values.length === 0 || this._scales.length === 0) {
|
|
@@ -67653,6 +67788,7 @@ class BandAxisMixin {
|
|
|
67653
67788
|
}
|
|
67654
67789
|
_updateRawDomain() {
|
|
67655
67790
|
this._rawDomainIndex = [];
|
|
67791
|
+
this._rawDomain = [];
|
|
67656
67792
|
const userDomain = this._spec.domain;
|
|
67657
67793
|
for (let i = 0; i < this._scales.length; i++) {
|
|
67658
67794
|
if (userDomain && userDomain.length && i === 0) {
|
|
@@ -67662,12 +67798,15 @@ class BandAxisMixin {
|
|
|
67662
67798
|
const data = this.collectData(i, true);
|
|
67663
67799
|
const domain = this.computeBandDomain(data);
|
|
67664
67800
|
this._rawDomainIndex[i] = {};
|
|
67801
|
+
this._rawDomain[i] = domain;
|
|
67665
67802
|
domain.forEach((d, _i) => (this._rawDomainIndex[i][d] = _i));
|
|
67666
67803
|
}
|
|
67667
67804
|
}
|
|
67805
|
+
this.event.emit(ChartEvent.scaleRawDomainUpdate, { model: this });
|
|
67668
67806
|
}
|
|
67669
67807
|
_clearRawDomain() {
|
|
67670
67808
|
this._rawDomainIndex = [];
|
|
67809
|
+
this._rawDomain = [];
|
|
67671
67810
|
}
|
|
67672
67811
|
}
|
|
67673
67812
|
|
|
@@ -72005,7 +72144,10 @@ function computeOneDatumY(obj, lastY, s, context, seriesScale, isFirst) {
|
|
|
72005
72144
|
lastY = y1;
|
|
72006
72145
|
}
|
|
72007
72146
|
let height = Math.abs(y1 - y);
|
|
72008
|
-
if (height
|
|
72147
|
+
if (height <= 0 && !isValueInScaleDomain(obj[s.getStackValueField()], seriesScale)) {
|
|
72148
|
+
height = 0;
|
|
72149
|
+
}
|
|
72150
|
+
else if (height < barMinHeight) {
|
|
72009
72151
|
height = barMinHeight;
|
|
72010
72152
|
}
|
|
72011
72153
|
let flag = 1;
|
|
@@ -72354,7 +72496,10 @@ class BarSeries extends CartesianSeries {
|
|
|
72354
72496
|
const y1 = valueInScaleRange(this[startMethod](datum), seriesScale, useWholeRange);
|
|
72355
72497
|
const y = valueInScaleRange(this[endMethod](datum), seriesScale, useWholeRange);
|
|
72356
72498
|
let height = Math.abs(y1 - y);
|
|
72357
|
-
if (height
|
|
72499
|
+
if (height <= 0 && !isValueInScaleDomain(datum[this.getStackValueField()], seriesScale)) {
|
|
72500
|
+
height = 0;
|
|
72501
|
+
}
|
|
72502
|
+
else if (height < barMinHeight) {
|
|
72358
72503
|
height = barMinHeight;
|
|
72359
72504
|
}
|
|
72360
72505
|
let flag = 1;
|
|
@@ -79372,13 +79517,14 @@ class DotSeries extends CartesianSeries {
|
|
|
79372
79517
|
});
|
|
79373
79518
|
}
|
|
79374
79519
|
initMarkStyle() {
|
|
79520
|
+
var _a;
|
|
79375
79521
|
const clipMark = this._clipMark;
|
|
79376
79522
|
if (clipMark) {
|
|
79377
79523
|
this.setMarkStyle(clipMark, {
|
|
79378
|
-
x: -this._spec.leftAppendPadding,
|
|
79524
|
+
x: -((_a = this._spec.leftAppendPadding) !== null && _a !== void 0 ? _a : 0),
|
|
79379
79525
|
y: 0,
|
|
79380
79526
|
width: 10000,
|
|
79381
|
-
height: this._spec.clipHeight
|
|
79527
|
+
height: () => { var _a; return (_a = this._spec.clipHeight) !== null && _a !== void 0 ? _a : this._region.getLayoutRect().height; }
|
|
79382
79528
|
}, 'normal', AttributeLevel.Series);
|
|
79383
79529
|
clipMark.setMarkConfig({ interactive: false, clip: true });
|
|
79384
79530
|
}
|
|
@@ -94978,7 +95124,7 @@ const hasData = (data) => {
|
|
|
94978
95124
|
return Object.keys(data).length > 0;
|
|
94979
95125
|
};
|
|
94980
95126
|
function showTooltip(datum, options, component) {
|
|
94981
|
-
var _a, _b, _c;
|
|
95127
|
+
var _a, _b, _c, _d, _e, _f;
|
|
94982
95128
|
const opt = Object.assign({ regionIndex: 0 }, options);
|
|
94983
95129
|
const componentOptions = component.getOption();
|
|
94984
95130
|
const region = componentOptions.getRegionsInUserIdOrIndex(isValid$1(opt.regionId) ? [opt.regionId] : undefined, isValid$1(opt.regionIndex) ? [opt.regionIndex] : undefined)[0];
|
|
@@ -95061,7 +95207,7 @@ function showTooltip(datum, options, component) {
|
|
|
95061
95207
|
}),
|
|
95062
95208
|
item: undefined
|
|
95063
95209
|
};
|
|
95064
|
-
component.processor.dimension.showTooltip(mockDimensionInfo, mockParams, false);
|
|
95210
|
+
(_e = (_d = (_c = component.processor) === null || _c === void 0 ? void 0 : _c.dimension) === null || _d === void 0 ? void 0 : _d.showTooltip) === null || _e === void 0 ? void 0 : _e.call(_d, mockDimensionInfo, mockParams, false);
|
|
95065
95211
|
const vchart = componentOptions.globalInstance;
|
|
95066
95212
|
if (VChart.globalConfig.uniqueTooltip) {
|
|
95067
95213
|
VChart.hideTooltip(vchart.id);
|
|
@@ -95090,7 +95236,7 @@ function showTooltip(datum, options, component) {
|
|
|
95090
95236
|
changePositionOnly: false,
|
|
95091
95237
|
tooltip: null,
|
|
95092
95238
|
dimensionInfo: mockDimensionInfo,
|
|
95093
|
-
chart: (
|
|
95239
|
+
chart: (_f = componentOptions.globalInstance.getChart()) !== null && _f !== void 0 ? _f : undefined,
|
|
95094
95240
|
datum: mockDatum,
|
|
95095
95241
|
model: info.series,
|
|
95096
95242
|
source: Event_Source_Type.chart,
|
|
@@ -97043,17 +97189,26 @@ const dataFilterWithNewDomain = (data, op) => {
|
|
|
97043
97189
|
return data.filter(filter);
|
|
97044
97190
|
};
|
|
97045
97191
|
const dataFilterComputeDomain = (data, op) => {
|
|
97046
|
-
const { stateFields, valueFields, dataCollection, isCategoryState } = op.input;
|
|
97192
|
+
const { stateFields, valueFields, dataCollection, isCategoryState, seriesCollection } = op.input;
|
|
97047
97193
|
const { stateField, valueField } = op.output;
|
|
97048
97194
|
const resultObj = {};
|
|
97195
|
+
const resultKeys = [];
|
|
97049
97196
|
const resultData = [];
|
|
97050
97197
|
const stateValues = [];
|
|
97051
97198
|
let hasLockDomain = false;
|
|
97199
|
+
let isAllLinearValue = false;
|
|
97052
97200
|
dataCollection.forEach((dv, i) => {
|
|
97053
97201
|
var _a;
|
|
97054
97202
|
if (isNil$1(stateFields[i])) {
|
|
97055
97203
|
return;
|
|
97056
97204
|
}
|
|
97205
|
+
const series = seriesCollection[i];
|
|
97206
|
+
if (series) {
|
|
97207
|
+
const statistics = series.getRawDataStatisticsByField(stateFields[i]);
|
|
97208
|
+
if (isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.max) && isValid$1(statistics === null || statistics === void 0 ? void 0 : statistics.min)) {
|
|
97209
|
+
isAllLinearValue = true;
|
|
97210
|
+
}
|
|
97211
|
+
}
|
|
97057
97212
|
const stateFieldInfo = (_a = dv.getFields()) === null || _a === void 0 ? void 0 : _a[stateFields[i]];
|
|
97058
97213
|
if (stateFieldInfo && stateFieldInfo.lockStatisticsByDomain) {
|
|
97059
97214
|
hasLockDomain = true;
|
|
@@ -97061,6 +97216,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97061
97216
|
if (isNil$1(resultObj[d])) {
|
|
97062
97217
|
stateValues.push(d);
|
|
97063
97218
|
resultObj[d] = 0;
|
|
97219
|
+
resultKeys.push(d);
|
|
97064
97220
|
}
|
|
97065
97221
|
});
|
|
97066
97222
|
}
|
|
@@ -97070,6 +97226,7 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97070
97226
|
if (isNil$1(resultObj[d[state]])) {
|
|
97071
97227
|
stateValues.push(d[state]);
|
|
97072
97228
|
resultObj[d[state]] = 0;
|
|
97229
|
+
resultKeys.push(d[state]);
|
|
97073
97230
|
}
|
|
97074
97231
|
if (!isNil$1(valueFields[i])) {
|
|
97075
97232
|
resultObj[d[state]] += isNaN(parseFloat(d[valueFields[i]])) ? 1 : parseFloat(d[valueFields[i]]);
|
|
@@ -97080,9 +97237,9 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97080
97237
|
});
|
|
97081
97238
|
const sortedStateValues = hasLockDomain
|
|
97082
97239
|
? stateValues
|
|
97083
|
-
: isCategoryState === false
|
|
97240
|
+
: isCategoryState === false || isAllLinearValue
|
|
97084
97241
|
? stateValues.sort((a, b) => a - b)
|
|
97085
|
-
:
|
|
97242
|
+
: resultKeys;
|
|
97086
97243
|
sortedStateValues.forEach(state => {
|
|
97087
97244
|
const res = { [stateField]: state };
|
|
97088
97245
|
if (valueField) {
|
|
@@ -97092,17 +97249,83 @@ const dataFilterComputeDomain = (data, op) => {
|
|
|
97092
97249
|
});
|
|
97093
97250
|
return resultData;
|
|
97094
97251
|
};
|
|
97095
|
-
|
|
97096
|
-
|
|
97097
|
-
|
|
97098
|
-
|
|
97252
|
+
const statePointToData = (state, scale, reverse) => {
|
|
97253
|
+
const domain = scale.domain();
|
|
97254
|
+
if (isContinuous(scale.type)) {
|
|
97255
|
+
if (reverse) {
|
|
97256
|
+
return domain[0] + (last(domain) - domain[0]) * (1 - state);
|
|
97257
|
+
}
|
|
97258
|
+
return domain[0] + (last(domain) - domain[0]) * state;
|
|
97099
97259
|
}
|
|
97100
|
-
|
|
97101
|
-
|
|
97102
|
-
|
|
97103
|
-
|
|
97104
|
-
|
|
97260
|
+
let range = scale.range();
|
|
97261
|
+
if (reverse) {
|
|
97262
|
+
range = range.slice().reverse();
|
|
97263
|
+
}
|
|
97264
|
+
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
97265
|
+
return scale.invert(posInRange);
|
|
97266
|
+
};
|
|
97267
|
+
const dataToStatePoint = (data, scale, isHorizontal) => {
|
|
97268
|
+
const pos = scale.scale(data);
|
|
97269
|
+
let range = scale.range();
|
|
97270
|
+
if (!isHorizontal && isContinuous(scale.type)) {
|
|
97271
|
+
range = range.slice().reverse();
|
|
97272
|
+
}
|
|
97273
|
+
return Math.max(0, Math.min(1, (pos - range[0]) / (last(range) - range[0])));
|
|
97274
|
+
};
|
|
97275
|
+
const isReverse = (axisComponent, isHorizontal) => {
|
|
97276
|
+
const axis = axisComponent;
|
|
97277
|
+
if (!axis) {
|
|
97278
|
+
return false;
|
|
97105
97279
|
}
|
|
97280
|
+
const axisScale = axis.getScale();
|
|
97281
|
+
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || isHorizontal);
|
|
97282
|
+
};
|
|
97283
|
+
const getAxisBandSize = (axisSpec) => {
|
|
97284
|
+
const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
|
|
97285
|
+
const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
|
|
97286
|
+
const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
|
|
97287
|
+
if (bandSize || minBandSize || maxBandSize) {
|
|
97288
|
+
return { bandSize, maxBandSize, minBandSize };
|
|
97289
|
+
}
|
|
97290
|
+
return undefined;
|
|
97291
|
+
};
|
|
97292
|
+
const modeCheck = (statePoint, mode, spec) => {
|
|
97293
|
+
if (statePoint === 'start') {
|
|
97294
|
+
return (mode === 'percent' && isValid$1(spec.start)) || (mode === 'value' && isValid$1(spec.startValue));
|
|
97295
|
+
}
|
|
97296
|
+
return (mode === 'percent' && isValid$1(spec.end)) || (mode === 'value' && isValid$1(spec.endValue));
|
|
97297
|
+
};
|
|
97298
|
+
const parseDomainFromState = (startValue, endValue, scale) => {
|
|
97299
|
+
if (isContinuous(scale.type)) {
|
|
97300
|
+
return [Math.min(endValue, startValue), Math.max(endValue, startValue)];
|
|
97301
|
+
}
|
|
97302
|
+
const allDomain = scale.domain();
|
|
97303
|
+
const startIndex = allDomain.indexOf(startValue);
|
|
97304
|
+
const endIndex = allDomain.indexOf(endValue);
|
|
97305
|
+
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97306
|
+
};
|
|
97307
|
+
const parseDomainFromStateAndValue = (start, startValue, end, endValue, scale) => {
|
|
97308
|
+
if (isContinuous(scale.type)) {
|
|
97309
|
+
const domain = scale.domain();
|
|
97310
|
+
const min = domain[0];
|
|
97311
|
+
const total = last(domain) - min;
|
|
97312
|
+
const resultStart = isValid$1(start) ? min + total * start : +startValue;
|
|
97313
|
+
const resultEnd = isValid$1(end) ? min + total * end : +endValue;
|
|
97314
|
+
return [Math.min(resultEnd, resultStart), Math.max(resultEnd, resultStart)];
|
|
97315
|
+
}
|
|
97316
|
+
const allDomain = scale.domain();
|
|
97317
|
+
const range = scale.range();
|
|
97318
|
+
const rangeSize = range[range.length - 1] - range[0];
|
|
97319
|
+
const startIndex = isValid$1(start)
|
|
97320
|
+
? allDomain.indexOf(scale.invert(rangeSize * start + range[0]))
|
|
97321
|
+
: allDomain.indexOf(startValue);
|
|
97322
|
+
const endIndex = isValid$1(end)
|
|
97323
|
+
? allDomain.indexOf(scale.invert(rangeSize * end + range[0]))
|
|
97324
|
+
: allDomain.indexOf(endValue);
|
|
97325
|
+
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97326
|
+
};
|
|
97327
|
+
|
|
97328
|
+
class DataFilterEvent {
|
|
97106
97329
|
enableInteraction() {
|
|
97107
97330
|
this._activeRoam = true;
|
|
97108
97331
|
}
|
|
@@ -97110,19 +97333,203 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97110
97333
|
this._activeRoam = false;
|
|
97111
97334
|
}
|
|
97112
97335
|
zoomIn(location) {
|
|
97113
|
-
this.
|
|
97336
|
+
this.handleChartZoom({
|
|
97114
97337
|
zoomDelta: 1.2,
|
|
97115
97338
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97116
97339
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97117
97340
|
});
|
|
97118
97341
|
}
|
|
97119
97342
|
zoomOut(location) {
|
|
97120
|
-
this.
|
|
97343
|
+
this.handleChartZoom({
|
|
97121
97344
|
zoomDelta: 0.8,
|
|
97122
97345
|
zoomX: location === null || location === void 0 ? void 0 : location.x,
|
|
97123
97346
|
zoomY: location === null || location === void 0 ? void 0 : location.y
|
|
97124
97347
|
});
|
|
97125
97348
|
}
|
|
97349
|
+
constructor(type, spec, handleChange, getLayoutRect, getState, getRegions, getOption, getEvent) {
|
|
97350
|
+
this._activeRoam = true;
|
|
97351
|
+
this._zoomAttr = {
|
|
97352
|
+
enable: true,
|
|
97353
|
+
rate: 1,
|
|
97354
|
+
focus: true
|
|
97355
|
+
};
|
|
97356
|
+
this._dragAttr = {
|
|
97357
|
+
enable: true,
|
|
97358
|
+
rate: 1,
|
|
97359
|
+
reverse: true
|
|
97360
|
+
};
|
|
97361
|
+
this._scrollAttr = {
|
|
97362
|
+
enable: true,
|
|
97363
|
+
rate: 1,
|
|
97364
|
+
reverse: true
|
|
97365
|
+
};
|
|
97366
|
+
this.initZoomEvent = () => {
|
|
97367
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
97368
|
+
const delayType = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType) !== null && _b !== void 0 ? _b : 'throttle';
|
|
97369
|
+
const delayTime = isValid$1((_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayType) ? ((_e = (_d = this._spec) === null || _d === void 0 ? void 0 : _d.delayTime) !== null && _e !== void 0 ? _e : 30) : 0;
|
|
97370
|
+
const realTime = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.realTime) !== null && _g !== void 0 ? _g : true;
|
|
97371
|
+
const option = { delayType, delayTime, realTime, allowComponentZoom: true };
|
|
97372
|
+
if (this._zoomAttr.enable) {
|
|
97373
|
+
this.initZoomEventOfRegions(this.getRegions(), null, this.handleChartZoom, option);
|
|
97374
|
+
}
|
|
97375
|
+
if (this._scrollAttr.enable) {
|
|
97376
|
+
this.initScrollEventOfRegions(this.getRegions(), null, this.handleChartScroll, option);
|
|
97377
|
+
}
|
|
97378
|
+
if (this._dragAttr.enable) {
|
|
97379
|
+
this.initDragEventOfRegions(this.getRegions(), null, this.handleChartDrag, option);
|
|
97380
|
+
}
|
|
97381
|
+
};
|
|
97382
|
+
this.handleChartZoom = (params, e) => {
|
|
97383
|
+
var _a, _b;
|
|
97384
|
+
if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
|
|
97385
|
+
return;
|
|
97386
|
+
}
|
|
97387
|
+
const { zoomDelta, zoomX, zoomY } = params;
|
|
97388
|
+
const { x, y } = this.getRegions()[0].getLayoutStartPoint();
|
|
97389
|
+
const { width, height } = this.getRegions()[0].getLayoutRect();
|
|
97390
|
+
const delta = Math.abs(this.getState().start - this.getState().end);
|
|
97391
|
+
const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
|
|
97392
|
+
if (delta >= 1 && zoomDelta < 1) {
|
|
97393
|
+
return;
|
|
97394
|
+
}
|
|
97395
|
+
if (delta <= 0.01 && zoomDelta > 1) {
|
|
97396
|
+
return;
|
|
97397
|
+
}
|
|
97398
|
+
const focusLoc = this._isHorizontal ? zoomX : zoomY;
|
|
97399
|
+
const totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
97400
|
+
let startValue = totalValue / 2;
|
|
97401
|
+
let endValue = totalValue / 2;
|
|
97402
|
+
if (focusLoc) {
|
|
97403
|
+
const startLoc = this._isHorizontal ? x : y;
|
|
97404
|
+
const endLoc = this._isHorizontal ? width : height;
|
|
97405
|
+
startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97406
|
+
endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97407
|
+
}
|
|
97408
|
+
const start = clamp$1(this.getState().start + startValue, 0, 1);
|
|
97409
|
+
const end = clamp$1(this.getState().end - endValue, 0, 1);
|
|
97410
|
+
this._handleChange(Math.min(start, end), Math.max(start, end), true);
|
|
97411
|
+
};
|
|
97412
|
+
this.handleChartScroll = (params, e) => {
|
|
97413
|
+
var _a;
|
|
97414
|
+
if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
|
|
97415
|
+
return false;
|
|
97416
|
+
}
|
|
97417
|
+
const { scrollX, scrollY } = params;
|
|
97418
|
+
let value = this._isHorizontal ? scrollX : scrollY;
|
|
97419
|
+
const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
|
|
97420
|
+
if (!this._scrollAttr.reverse) {
|
|
97421
|
+
value = -value;
|
|
97422
|
+
}
|
|
97423
|
+
if (active) {
|
|
97424
|
+
this.handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97425
|
+
}
|
|
97426
|
+
const hasChange = this.getState().start !== 0 && this.getState().end !== 1;
|
|
97427
|
+
return active && hasChange;
|
|
97428
|
+
};
|
|
97429
|
+
this.handleChartDrag = (delta, e) => {
|
|
97430
|
+
var _a;
|
|
97431
|
+
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
97432
|
+
return;
|
|
97433
|
+
}
|
|
97434
|
+
const [dx, dy] = delta;
|
|
97435
|
+
let value = this._isHorizontal ? dx : dy;
|
|
97436
|
+
if (this._dragAttr.reverse) {
|
|
97437
|
+
value = -value;
|
|
97438
|
+
}
|
|
97439
|
+
this.handleChartMove(value, (_a = this._dragAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97440
|
+
};
|
|
97441
|
+
this.handleChartMove = (value, rate) => {
|
|
97442
|
+
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
97443
|
+
if (Math.abs(value) >= 1e-6) {
|
|
97444
|
+
if (value > 0 && this.getState().end < 1) {
|
|
97445
|
+
const moveDelta = Math.min(1 - this.getState().end, value / totalValue) * rate;
|
|
97446
|
+
this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
|
|
97447
|
+
}
|
|
97448
|
+
else if (value < 0 && this.getState().start > 0) {
|
|
97449
|
+
const moveDelta = Math.max(-this.getState().start, value / totalValue) * rate;
|
|
97450
|
+
this._handleChange(this.getState().start + moveDelta, this.getState().end + moveDelta, true);
|
|
97451
|
+
}
|
|
97452
|
+
}
|
|
97453
|
+
return false;
|
|
97454
|
+
};
|
|
97455
|
+
this._type = type;
|
|
97456
|
+
this._spec = spec;
|
|
97457
|
+
this._handleChange = handleChange;
|
|
97458
|
+
this.getLayoutRect = getLayoutRect;
|
|
97459
|
+
this.getState = getState;
|
|
97460
|
+
this.getRegions = getRegions;
|
|
97461
|
+
this._regions = getRegions();
|
|
97462
|
+
this.getOption = getOption;
|
|
97463
|
+
this._option = getOption();
|
|
97464
|
+
this.getEvent = getEvent;
|
|
97465
|
+
this._isHorizontal = getDirectionByOrient(getOrient(spec)) === "horizontal";
|
|
97466
|
+
}
|
|
97467
|
+
setEventAttrFromSpec() {
|
|
97468
|
+
if (this._spec.roamZoom === true || this._spec.roamZoom) {
|
|
97469
|
+
this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
|
|
97470
|
+
}
|
|
97471
|
+
else {
|
|
97472
|
+
this._zoomAttr.enable = false;
|
|
97473
|
+
}
|
|
97474
|
+
if (this._spec.roamDrag === true || this._spec.roamDrag) {
|
|
97475
|
+
this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
|
|
97476
|
+
}
|
|
97477
|
+
else {
|
|
97478
|
+
this._dragAttr.enable = false;
|
|
97479
|
+
}
|
|
97480
|
+
if (this._spec.roamScroll === true || this._spec.roamScroll) {
|
|
97481
|
+
this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
|
|
97482
|
+
}
|
|
97483
|
+
else {
|
|
97484
|
+
this._scrollAttr.enable = false;
|
|
97485
|
+
}
|
|
97486
|
+
if (isBoolean$1(this._spec.roam)) {
|
|
97487
|
+
this._zoomAttr.enable = this._type === 'scrollBar' ? false : this._spec.roam;
|
|
97488
|
+
this._dragAttr.enable = this._spec.roam;
|
|
97489
|
+
this._scrollAttr.enable = this._spec.roam;
|
|
97490
|
+
}
|
|
97491
|
+
if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
|
|
97492
|
+
this.initZoomable(this.getEvent(), this._option.mode);
|
|
97493
|
+
}
|
|
97494
|
+
}
|
|
97495
|
+
}
|
|
97496
|
+
mixin(DataFilterEvent, Zoomable);
|
|
97497
|
+
|
|
97498
|
+
class DataFilterBaseComponent extends BaseComponent {
|
|
97499
|
+
get isHorizontal() {
|
|
97500
|
+
return this._isHorizontal;
|
|
97501
|
+
}
|
|
97502
|
+
get stateScale() {
|
|
97503
|
+
return this._stateScale;
|
|
97504
|
+
}
|
|
97505
|
+
get relatedAxisComponent() {
|
|
97506
|
+
return this._relatedAxisComponent;
|
|
97507
|
+
}
|
|
97508
|
+
setStartAndEnd(start, end, rangeMode = ['percent', 'percent']) {
|
|
97509
|
+
const [startMode = 'percent', endMode = 'percent'] = rangeMode;
|
|
97510
|
+
const startPercent = (startMode === 'percent' ? start : dataToStatePoint(start, this._stateScale, this._isHorizontal));
|
|
97511
|
+
const endPercent = (endMode === 'percent' ? end : dataToStatePoint(end, this._stateScale, this._isHorizontal));
|
|
97512
|
+
this._handleChange(startPercent, endPercent, true);
|
|
97513
|
+
}
|
|
97514
|
+
enableInteraction() {
|
|
97515
|
+
this._dataFilterEvent.enableInteraction();
|
|
97516
|
+
}
|
|
97517
|
+
disableInteraction() {
|
|
97518
|
+
this._dataFilterEvent.disableInteraction();
|
|
97519
|
+
}
|
|
97520
|
+
zoomIn(location) {
|
|
97521
|
+
this._dataFilterEvent.zoomIn(location);
|
|
97522
|
+
}
|
|
97523
|
+
zoomOut(location) {
|
|
97524
|
+
this._dataFilterEvent.zoomOut(location);
|
|
97525
|
+
}
|
|
97526
|
+
_initEvent() {
|
|
97527
|
+
var _a;
|
|
97528
|
+
this._dataFilterEvent.initZoomEvent();
|
|
97529
|
+
(_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.event.on(ChartEvent.scaleRawDomainUpdate, ({ model }) => {
|
|
97530
|
+
console.log('scaleRawDomainUpdate', model.getRawDomain());
|
|
97531
|
+
});
|
|
97532
|
+
}
|
|
97126
97533
|
_handleChange(start, end, updateComponent) {
|
|
97127
97534
|
var _a, _b;
|
|
97128
97535
|
const zoomLock = (_b = (_a = this._spec) === null || _a === void 0 ? void 0 : _a.zoomLock) !== null && _b !== void 0 ? _b : false;
|
|
@@ -97136,18 +97543,10 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97136
97543
|
this._spanCache = end - start;
|
|
97137
97544
|
}
|
|
97138
97545
|
}
|
|
97139
|
-
_isReverse() {
|
|
97140
|
-
const axis = this._relatedAxisComponent;
|
|
97141
|
-
if (!axis) {
|
|
97142
|
-
return false;
|
|
97143
|
-
}
|
|
97144
|
-
const axisScale = axis.getScale();
|
|
97145
|
-
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || this._isHorizontal);
|
|
97146
|
-
}
|
|
97147
97546
|
_updateRangeFactor(tag) {
|
|
97148
97547
|
const axis = this._relatedAxisComponent;
|
|
97149
97548
|
const axisScale = axis.getScale();
|
|
97150
|
-
const reverse = this.
|
|
97549
|
+
const reverse = isReverse(axis, this._isHorizontal);
|
|
97151
97550
|
const newRangeFactor = reverse ? [1 - this._end, 1 - this._start] : [this._start, this._end];
|
|
97152
97551
|
if (reverse) {
|
|
97153
97552
|
switch (tag) {
|
|
@@ -97194,23 +97593,16 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97194
97593
|
this._orient = 'left';
|
|
97195
97594
|
this._cacheVisibility = undefined;
|
|
97196
97595
|
this._dataUpdating = false;
|
|
97596
|
+
this._hasInitStateScale = false;
|
|
97197
97597
|
this._shouldChange = true;
|
|
97198
97598
|
this._stateField = 'x';
|
|
97199
|
-
this.
|
|
97200
|
-
|
|
97201
|
-
|
|
97202
|
-
|
|
97203
|
-
|
|
97204
|
-
|
|
97205
|
-
|
|
97206
|
-
enable: true,
|
|
97207
|
-
rate: 1,
|
|
97208
|
-
reverse: true
|
|
97209
|
-
};
|
|
97210
|
-
this._scrollAttr = {
|
|
97211
|
-
enable: true,
|
|
97212
|
-
rate: 1,
|
|
97213
|
-
reverse: true
|
|
97599
|
+
this._handleStateChange = (startValue, endValue, tag) => {
|
|
97600
|
+
var _a, _b;
|
|
97601
|
+
this._startValue = startValue;
|
|
97602
|
+
this._endValue = endValue;
|
|
97603
|
+
this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
|
|
97604
|
+
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
|
|
97605
|
+
return true;
|
|
97214
97606
|
};
|
|
97215
97607
|
this.effect = {
|
|
97216
97608
|
onZoomChange: (tag) => {
|
|
@@ -97219,7 +97611,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97219
97611
|
if (axis && this._filterMode === 'axis') {
|
|
97220
97612
|
const axisScale = axis.getScale();
|
|
97221
97613
|
const axisSpec = axis.getSpec();
|
|
97222
|
-
if (this._auto &&
|
|
97614
|
+
if (this._auto && getAxisBandSize(axisSpec) && this._spec.ignoreBandSize) {
|
|
97223
97615
|
axisScale.bandwidth('auto');
|
|
97224
97616
|
axisScale.maxBandwidth('auto');
|
|
97225
97617
|
axisScale.minBandwidth('auto');
|
|
@@ -97250,92 +97642,14 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97250
97642
|
}
|
|
97251
97643
|
};
|
|
97252
97644
|
this._visible = true;
|
|
97253
|
-
this._handleStateChange = (startValue, endValue, tag) => {
|
|
97254
|
-
var _a, _b;
|
|
97255
|
-
this._startValue = startValue;
|
|
97256
|
-
this._endValue = endValue;
|
|
97257
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97258
|
-
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a, tag);
|
|
97259
|
-
return true;
|
|
97260
|
-
};
|
|
97261
|
-
this._handleChartZoom = (params, e) => {
|
|
97262
|
-
var _a, _b;
|
|
97263
|
-
if (!this._activeRoam || (this._zoomAttr.filter && !this._zoomAttr.filter(params, e))) {
|
|
97264
|
-
return;
|
|
97265
|
-
}
|
|
97266
|
-
const { zoomDelta, zoomX, zoomY } = params;
|
|
97267
|
-
const { x, y } = this._regions[0].getLayoutStartPoint();
|
|
97268
|
-
const { width, height } = this._regions[0].getLayoutRect();
|
|
97269
|
-
const delta = Math.abs(this._start - this._end);
|
|
97270
|
-
const zoomRate = (_b = (_a = this._spec.roamZoom) === null || _a === void 0 ? void 0 : _a.rate) !== null && _b !== void 0 ? _b : 1;
|
|
97271
|
-
if (delta >= 1 && zoomDelta < 1) {
|
|
97272
|
-
return;
|
|
97273
|
-
}
|
|
97274
|
-
if (delta <= 0.01 && zoomDelta > 1) {
|
|
97275
|
-
return;
|
|
97276
|
-
}
|
|
97277
|
-
const focusLoc = this._isHorizontal ? zoomX : zoomY;
|
|
97278
|
-
const totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
97279
|
-
let startValue = totalValue / 2;
|
|
97280
|
-
let endValue = totalValue / 2;
|
|
97281
|
-
if (focusLoc) {
|
|
97282
|
-
const startLoc = this._isHorizontal ? x : y;
|
|
97283
|
-
const endLoc = this._isHorizontal ? width : height;
|
|
97284
|
-
startValue = (Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97285
|
-
endValue = (Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc)) * totalValue;
|
|
97286
|
-
}
|
|
97287
|
-
const start = clamp$1(this._start + startValue, 0, 1);
|
|
97288
|
-
const end = clamp$1(this._end - endValue, 0, 1);
|
|
97289
|
-
this._handleChange(Math.min(start, end), Math.max(start, end), true);
|
|
97290
|
-
};
|
|
97291
|
-
this._handleChartScroll = (params, e) => {
|
|
97292
|
-
var _a;
|
|
97293
|
-
if (!this._activeRoam || (this._scrollAttr.filter && !this._scrollAttr.filter(params, e))) {
|
|
97294
|
-
return false;
|
|
97295
|
-
}
|
|
97296
|
-
const { scrollX, scrollY } = params;
|
|
97297
|
-
let value = this._isHorizontal ? scrollX : scrollY;
|
|
97298
|
-
const active = this._isHorizontal ? abs$1(scrollX / scrollY) >= 0.5 : abs$1(scrollY / scrollX) >= 0.5;
|
|
97299
|
-
if (!this._scrollAttr.reverse) {
|
|
97300
|
-
value = -value;
|
|
97301
|
-
}
|
|
97302
|
-
if (active) {
|
|
97303
|
-
this._handleChartMove(value, (_a = this._scrollAttr.rate) !== null && _a !== void 0 ? _a : 1);
|
|
97304
|
-
}
|
|
97305
|
-
const hasChange = this._start !== 0 && this._end !== 1;
|
|
97306
|
-
return active && hasChange;
|
|
97307
|
-
};
|
|
97308
|
-
this._handleChartDrag = (delta, e) => {
|
|
97309
|
-
var _a, _b;
|
|
97310
|
-
if (!this._activeRoam || (this._dragAttr.filter && !this._dragAttr.filter(delta, e))) {
|
|
97311
|
-
return;
|
|
97312
|
-
}
|
|
97313
|
-
if ((_a = this._spec.roamDrag) === null || _a === void 0 ? void 0 : _a.autoVisible) {
|
|
97314
|
-
this.show();
|
|
97315
|
-
}
|
|
97316
|
-
const [dx, dy] = delta;
|
|
97317
|
-
let value = this._isHorizontal ? dx : dy;
|
|
97318
|
-
if (this._dragAttr.reverse) {
|
|
97319
|
-
value = -value;
|
|
97320
|
-
}
|
|
97321
|
-
this._handleChartMove(value, (_b = this._dragAttr.rate) !== null && _b !== void 0 ? _b : 1);
|
|
97322
|
-
};
|
|
97323
|
-
this._handleChartMove = (value, rate) => {
|
|
97324
|
-
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
97325
|
-
if (Math.abs(value) >= 1e-6) {
|
|
97326
|
-
if (value > 0 && this._end < 1) {
|
|
97327
|
-
const moveDelta = Math.min(1 - this._end, value / totalValue) * rate;
|
|
97328
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97329
|
-
}
|
|
97330
|
-
else if (value < 0 && this._start > 0) {
|
|
97331
|
-
const moveDelta = Math.max(-this._start, value / totalValue) * rate;
|
|
97332
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, true);
|
|
97333
|
-
}
|
|
97334
|
-
}
|
|
97335
|
-
return false;
|
|
97336
|
-
};
|
|
97337
97645
|
this._orient = getOrient(spec);
|
|
97338
97646
|
this._isHorizontal = getDirectionByOrient(this._orient) === "horizontal";
|
|
97647
|
+
this._dataFilterEvent = new DataFilterEvent(this.type, this._spec, this._handleChange.bind(this), this.getLayoutRect.bind(this), () => {
|
|
97648
|
+
return {
|
|
97649
|
+
start: this._start,
|
|
97650
|
+
end: this._end
|
|
97651
|
+
};
|
|
97652
|
+
}, () => this._regions, (() => this._option).bind(this), () => this.event);
|
|
97339
97653
|
}
|
|
97340
97654
|
created() {
|
|
97341
97655
|
super.created();
|
|
@@ -97350,6 +97664,88 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97350
97664
|
super.initLayout();
|
|
97351
97665
|
this._layout && (this._layout.layoutOrient = this._orient);
|
|
97352
97666
|
}
|
|
97667
|
+
init(option) {
|
|
97668
|
+
super.init(option);
|
|
97669
|
+
this._addTransformToSeries();
|
|
97670
|
+
if (this._start !== 0 || this._end !== 1) {
|
|
97671
|
+
this.effect.onZoomChange();
|
|
97672
|
+
}
|
|
97673
|
+
}
|
|
97674
|
+
_compareSpec(spec, prevSpec) {
|
|
97675
|
+
const result = super._compareSpec(spec, prevSpec);
|
|
97676
|
+
if (!result.reMake && !isEqual(prevSpec, spec)) {
|
|
97677
|
+
result.reRender = true;
|
|
97678
|
+
result.reMake = true;
|
|
97679
|
+
}
|
|
97680
|
+
return result;
|
|
97681
|
+
}
|
|
97682
|
+
reInit(spec) {
|
|
97683
|
+
super.reInit(spec);
|
|
97684
|
+
this._marks.forEach(g => {
|
|
97685
|
+
g.getMarks().forEach(m => {
|
|
97686
|
+
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
97687
|
+
});
|
|
97688
|
+
});
|
|
97689
|
+
}
|
|
97690
|
+
onLayoutStart(layoutRect, viewRect) {
|
|
97691
|
+
super.onLayoutStart(layoutRect, viewRect);
|
|
97692
|
+
const isShown = this._autoUpdate(layoutRect);
|
|
97693
|
+
this._autoVisible(isShown);
|
|
97694
|
+
this._dataUpdating = false;
|
|
97695
|
+
}
|
|
97696
|
+
updateLayoutAttribute() {
|
|
97697
|
+
this._visible && this._createOrUpdateComponent();
|
|
97698
|
+
if (!this._hasInitStateScale) {
|
|
97699
|
+
if (this._start !== 0 || this._end !== 1) {
|
|
97700
|
+
this._newDomain = parseDomainFromStateAndValue(this._spec.start, this._startValue, this._spec.end, this._endValue, this._stateScale);
|
|
97701
|
+
this.effect.onZoomChange();
|
|
97702
|
+
}
|
|
97703
|
+
this._hasInitStateScale = true;
|
|
97704
|
+
}
|
|
97705
|
+
}
|
|
97706
|
+
_initAfterLayout() {
|
|
97707
|
+
this._stateScale = null;
|
|
97708
|
+
this._initStateScale();
|
|
97709
|
+
this._updateScaleRange();
|
|
97710
|
+
this._setStateFromAxis();
|
|
97711
|
+
}
|
|
97712
|
+
_beforeLayoutEnd() {
|
|
97713
|
+
if (!this._hasInitStateScale) {
|
|
97714
|
+
this._initAfterLayout();
|
|
97715
|
+
}
|
|
97716
|
+
else {
|
|
97717
|
+
this._updateScaleRange();
|
|
97718
|
+
}
|
|
97719
|
+
}
|
|
97720
|
+
onLayoutEnd() {
|
|
97721
|
+
var _a;
|
|
97722
|
+
this._beforeLayoutEnd();
|
|
97723
|
+
const isShown = !(this._start === 0 && this._end === 1);
|
|
97724
|
+
this._autoVisible(isShown);
|
|
97725
|
+
super.onLayoutEnd();
|
|
97726
|
+
(_a = this._relatedAxisComponent) === null || _a === void 0 ? void 0 : _a.updateScaleRange();
|
|
97727
|
+
}
|
|
97728
|
+
getBoundsInRect(rect) {
|
|
97729
|
+
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
97730
|
+
if (this._isHorizontal) {
|
|
97731
|
+
result.y2 = result.y1 + this._height;
|
|
97732
|
+
result.x2 = result.x1 + rect.width;
|
|
97733
|
+
}
|
|
97734
|
+
else {
|
|
97735
|
+
result.x2 = result.x1 + this._width;
|
|
97736
|
+
result.y2 = result.y1 + rect.height;
|
|
97737
|
+
}
|
|
97738
|
+
return result;
|
|
97739
|
+
}
|
|
97740
|
+
setAttrFromSpec() {
|
|
97741
|
+
var _a;
|
|
97742
|
+
super.setAttrFromSpec();
|
|
97743
|
+
this._dataFilterEvent.setEventAttrFromSpec();
|
|
97744
|
+
this._field = this._spec.field;
|
|
97745
|
+
this._width = this._computeWidth();
|
|
97746
|
+
this._height = this._computeHeight();
|
|
97747
|
+
this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
|
|
97748
|
+
}
|
|
97353
97749
|
_setAxisFromSpec() {
|
|
97354
97750
|
if (isValid$1(this._spec.axisId)) {
|
|
97355
97751
|
this._relatedAxisComponent = this._option.getComponentByUserId(this._spec.axisId);
|
|
@@ -97359,7 +97755,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97359
97755
|
}
|
|
97360
97756
|
if (isNil$1(this._spec.field) && !this._relatedAxisComponent) {
|
|
97361
97757
|
const axes = this._option.getComponentsByKey('axes');
|
|
97362
|
-
const sameOrientAxis = axes.find((cm) => cm._orient === this._orient);
|
|
97758
|
+
const sameOrientAxis = axes.find((cm) => getDirectionByOrient(cm._orient) === getDirectionByOrient(this._orient));
|
|
97363
97759
|
if (sameOrientAxis) {
|
|
97364
97760
|
this._relatedAxisComponent = sameOrientAxis;
|
|
97365
97761
|
}
|
|
@@ -97410,33 +97806,9 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97410
97806
|
}
|
|
97411
97807
|
return;
|
|
97412
97808
|
}
|
|
97413
|
-
onDataUpdate() {
|
|
97414
|
-
var _a;
|
|
97415
|
-
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
97416
|
-
this._stateScale.domain(domain, false);
|
|
97417
|
-
this._handleChange(this._start, this._end, true);
|
|
97418
|
-
if (this._spec.auto && !isEqual(this._domainCache, domain)) {
|
|
97419
|
-
this._domainCache = domain;
|
|
97420
|
-
this._dataUpdating = true;
|
|
97421
|
-
(_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
|
|
97422
|
-
}
|
|
97423
|
-
}
|
|
97424
|
-
_computeDomainOfStateScale(isContinuous) {
|
|
97425
|
-
if (this._spec.customDomain) {
|
|
97426
|
-
return this._spec.customDomain;
|
|
97427
|
-
}
|
|
97428
|
-
const domain = this._data.getLatestData().map((d) => d[this._stateField]);
|
|
97429
|
-
if (isContinuous) {
|
|
97430
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97431
|
-
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
|
|
97432
|
-
}
|
|
97433
|
-
return domain;
|
|
97434
|
-
}
|
|
97435
|
-
_initEvent() {
|
|
97436
|
-
this._initCommonEvent();
|
|
97437
|
-
}
|
|
97438
97809
|
_initData() {
|
|
97439
97810
|
const dataCollection = [];
|
|
97811
|
+
const seriesCollection = [];
|
|
97440
97812
|
const stateFields = [];
|
|
97441
97813
|
const valueFields = [];
|
|
97442
97814
|
let isCategoryState;
|
|
@@ -97465,6 +97837,8 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97465
97837
|
? xAxisHelper
|
|
97466
97838
|
: yAxisHelper;
|
|
97467
97839
|
const valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
|
|
97840
|
+
const isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type);
|
|
97841
|
+
const isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
|
|
97468
97842
|
dataCollection.push(s.getRawData());
|
|
97469
97843
|
const seriesSpec = s.getSpec();
|
|
97470
97844
|
const xField = s.coordinate === 'cartesian'
|
|
@@ -97475,16 +97849,17 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97475
97849
|
: array((_b = seriesSpec.radiusField) !== null && _b !== void 0 ? _b : seriesSpec.valueField);
|
|
97476
97850
|
originalStateFields[s.id] =
|
|
97477
97851
|
s.type === 'link' ? ['from_xField'] : stateAxisHelper === xAxisHelper ? xField : yField;
|
|
97478
|
-
if (
|
|
97852
|
+
if (isValidateStateAxis) {
|
|
97479
97853
|
isCategoryState = false;
|
|
97480
97854
|
stateFields.push(originalStateFields[s.id]);
|
|
97481
97855
|
}
|
|
97482
97856
|
else {
|
|
97857
|
+
isCategoryState = true;
|
|
97483
97858
|
stateFields.push(originalStateFields[s.id][0]);
|
|
97484
97859
|
}
|
|
97485
97860
|
if (this._valueField) {
|
|
97486
97861
|
const valueField = s.type === 'link' ? ['from_yField'] : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
97487
|
-
if (
|
|
97862
|
+
if (isValidateValueAxis) {
|
|
97488
97863
|
valueFields.push(...valueField);
|
|
97489
97864
|
}
|
|
97490
97865
|
}
|
|
@@ -97497,6 +97872,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97497
97872
|
else {
|
|
97498
97873
|
eachSeries(this._regions, s => {
|
|
97499
97874
|
dataCollection.push(s.getRawData());
|
|
97875
|
+
seriesCollection.push(s);
|
|
97500
97876
|
stateFields.push(this._field);
|
|
97501
97877
|
if (this._valueField) {
|
|
97502
97878
|
valueFields.push(this._spec.valueField);
|
|
@@ -97515,6 +97891,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97515
97891
|
options: {
|
|
97516
97892
|
input: {
|
|
97517
97893
|
dataCollection: dataCollection,
|
|
97894
|
+
seriesCollection,
|
|
97518
97895
|
stateFields,
|
|
97519
97896
|
valueFields,
|
|
97520
97897
|
isCategoryState
|
|
@@ -97529,136 +97906,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97529
97906
|
data.reRunAllTransform();
|
|
97530
97907
|
dataSet.multipleDataViewAddListener(dataCollection, 'change', this._handleDataCollectionChange.bind(this));
|
|
97531
97908
|
}
|
|
97532
|
-
setAttrFromSpec() {
|
|
97533
|
-
var _a;
|
|
97534
|
-
super.setAttrFromSpec();
|
|
97535
|
-
if (this._spec.roamZoom === true || this._spec.roamZoom) {
|
|
97536
|
-
this._zoomAttr = merge$1({}, this._zoomAttr, this._spec.roamZoom);
|
|
97537
|
-
}
|
|
97538
|
-
else {
|
|
97539
|
-
this._zoomAttr.enable = false;
|
|
97540
|
-
}
|
|
97541
|
-
if (this._spec.roamDrag === true || this._spec.roamDrag) {
|
|
97542
|
-
this._dragAttr = merge$1({}, this._dragAttr, this._spec.roamDrag);
|
|
97543
|
-
}
|
|
97544
|
-
else {
|
|
97545
|
-
this._dragAttr.enable = false;
|
|
97546
|
-
}
|
|
97547
|
-
if (this._spec.roamScroll === true || this._spec.roamScroll) {
|
|
97548
|
-
this._scrollAttr = merge$1({}, this._scrollAttr, this._spec.roamScroll);
|
|
97549
|
-
}
|
|
97550
|
-
else {
|
|
97551
|
-
this._scrollAttr.enable = false;
|
|
97552
|
-
}
|
|
97553
|
-
this._field = this._spec.field;
|
|
97554
|
-
this._width = this._computeWidth();
|
|
97555
|
-
this._height = this._computeHeight();
|
|
97556
|
-
this._visible = (_a = this._spec.visible) !== null && _a !== void 0 ? _a : true;
|
|
97557
|
-
}
|
|
97558
|
-
statePointToData(state) {
|
|
97559
|
-
const scale = this._stateScale;
|
|
97560
|
-
const domain = scale.domain();
|
|
97561
|
-
if (isContinuous(scale.type)) {
|
|
97562
|
-
if (this._isReverse()) {
|
|
97563
|
-
return domain[0] + (last(domain) - domain[0]) * (1 - state);
|
|
97564
|
-
}
|
|
97565
|
-
return domain[0] + (last(domain) - domain[0]) * state;
|
|
97566
|
-
}
|
|
97567
|
-
let range = scale.range();
|
|
97568
|
-
if (this._isReverse()) {
|
|
97569
|
-
range = range.slice().reverse();
|
|
97570
|
-
}
|
|
97571
|
-
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
97572
|
-
return scale.invert(posInRange);
|
|
97573
|
-
}
|
|
97574
|
-
dataToStatePoint(data) {
|
|
97575
|
-
const scale = this._stateScale;
|
|
97576
|
-
const pos = scale.scale(data);
|
|
97577
|
-
let range = scale.range();
|
|
97578
|
-
if (!this._isHorizontal && isContinuous(scale.type)) {
|
|
97579
|
-
range = range.slice().reverse();
|
|
97580
|
-
}
|
|
97581
|
-
return (pos - range[0]) / (last(range) - range[0]);
|
|
97582
|
-
}
|
|
97583
|
-
_modeCheck(statePoint, mode) {
|
|
97584
|
-
if (statePoint === 'start') {
|
|
97585
|
-
return (mode === 'percent' && isValid$1(this._spec.start)) || (mode === 'value' && isValid$1(this._spec.startValue));
|
|
97586
|
-
}
|
|
97587
|
-
return (mode === 'percent' && isValid$1(this._spec.end)) || (mode === 'value' && isValid$1(this._spec.endValue));
|
|
97588
|
-
}
|
|
97589
|
-
_setStateFromSpec() {
|
|
97590
|
-
var _a, _b;
|
|
97591
|
-
this._auto = !!this._spec.auto;
|
|
97592
|
-
let start;
|
|
97593
|
-
let end;
|
|
97594
|
-
if (this._spec.rangeMode) {
|
|
97595
|
-
const [startMode, endMode] = this._spec.rangeMode;
|
|
97596
|
-
if (this._modeCheck('start', startMode) && this._modeCheck('end', endMode)) {
|
|
97597
|
-
start = startMode === 'percent' ? this._spec.start : this.dataToStatePoint(this._spec.startValue);
|
|
97598
|
-
end = endMode === 'percent' ? this._spec.end : this.dataToStatePoint(this._spec.endValue);
|
|
97599
|
-
}
|
|
97600
|
-
}
|
|
97601
|
-
else {
|
|
97602
|
-
start = this._spec.start
|
|
97603
|
-
? this._spec.start
|
|
97604
|
-
: this._spec.startValue
|
|
97605
|
-
? this.dataToStatePoint(this._spec.startValue)
|
|
97606
|
-
: 0;
|
|
97607
|
-
end = this._spec.end ? this._spec.end : this._spec.endValue ? this.dataToStatePoint(this._spec.endValue) : 1;
|
|
97608
|
-
}
|
|
97609
|
-
this._startValue = this.statePointToData(start);
|
|
97610
|
-
this._endValue = this.statePointToData(end);
|
|
97611
|
-
this._start = start;
|
|
97612
|
-
this._end = end;
|
|
97613
|
-
this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
|
|
97614
|
-
this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
|
|
97615
|
-
if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
|
|
97616
|
-
if (this._spec.minValueSpan) {
|
|
97617
|
-
this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97618
|
-
}
|
|
97619
|
-
if (this._spec.maxValueSpan) {
|
|
97620
|
-
this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
97621
|
-
}
|
|
97622
|
-
}
|
|
97623
|
-
this._minSpan = Math.max(0, this._minSpan);
|
|
97624
|
-
this._maxSpan = Math.min(this._maxSpan, 1);
|
|
97625
|
-
if ((!this._relatedAxisComponent || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
|
|
97626
|
-
this._newDomain = this._parseDomainFromState(this._startValue, this._endValue);
|
|
97627
|
-
}
|
|
97628
|
-
}
|
|
97629
|
-
_parseFieldOfSeries(s) {
|
|
97630
|
-
var _a;
|
|
97631
|
-
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97632
|
-
}
|
|
97633
|
-
_initStateScale() {
|
|
97634
|
-
const defaultRange = [0, 1];
|
|
97635
|
-
if (this._relatedAxisComponent) {
|
|
97636
|
-
const scale = this._relatedAxisComponent.getScale();
|
|
97637
|
-
const isContinuousScale = isContinuous(scale.type);
|
|
97638
|
-
const domain = this._computeDomainOfStateScale(isContinuousScale);
|
|
97639
|
-
this._stateScale = scale.clone();
|
|
97640
|
-
if (isContinuousScale) {
|
|
97641
|
-
const domainNum = domain.map((n) => n * 1);
|
|
97642
|
-
this._stateScale
|
|
97643
|
-
.domain(domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [0, 1], true)
|
|
97644
|
-
.range(defaultRange);
|
|
97645
|
-
}
|
|
97646
|
-
else {
|
|
97647
|
-
this._stateScale.domain(domain, true).range(defaultRange);
|
|
97648
|
-
}
|
|
97649
|
-
}
|
|
97650
|
-
else {
|
|
97651
|
-
this._stateScale = new BandScale();
|
|
97652
|
-
this._stateScale.domain(this._computeDomainOfStateScale(), true).range(defaultRange);
|
|
97653
|
-
}
|
|
97654
|
-
}
|
|
97655
|
-
init(option) {
|
|
97656
|
-
super.init(option);
|
|
97657
|
-
this._addTransformToSeries();
|
|
97658
|
-
if (this._start !== 0 || this._end !== 1) {
|
|
97659
|
-
this.effect.onZoomChange();
|
|
97660
|
-
}
|
|
97661
|
-
}
|
|
97662
97909
|
_addTransformToSeries() {
|
|
97663
97910
|
if (!this._relatedAxisComponent || this._filterMode !== 'axis') {
|
|
97664
97911
|
registerDataSetInstanceTransform(this._option.dataSet, 'dataFilterWithNewDomain', dataFilterWithNewDomain);
|
|
@@ -97697,59 +97944,116 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97697
97944
|
});
|
|
97698
97945
|
}
|
|
97699
97946
|
}
|
|
97700
|
-
|
|
97701
|
-
|
|
97702
|
-
|
|
97703
|
-
|
|
97704
|
-
|
|
97947
|
+
onDataUpdate() {
|
|
97948
|
+
var _a;
|
|
97949
|
+
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
97950
|
+
this._stateScale.domain(domain, false);
|
|
97951
|
+
this._handleChange(this._start, this._end, true);
|
|
97952
|
+
if (this._spec.auto && !isEqual(this._domainCache, domain)) {
|
|
97953
|
+
this._domainCache = domain;
|
|
97954
|
+
this._dataUpdating = true;
|
|
97955
|
+
(_a = this.getChart()) === null || _a === void 0 ? void 0 : _a.setLayoutTag(true, null, false);
|
|
97705
97956
|
}
|
|
97706
|
-
return result;
|
|
97707
97957
|
}
|
|
97708
|
-
|
|
97709
|
-
|
|
97710
|
-
this.
|
|
97711
|
-
g.getMarks().forEach(m => {
|
|
97712
|
-
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
97713
|
-
});
|
|
97714
|
-
});
|
|
97958
|
+
_parseFieldOfSeries(s) {
|
|
97959
|
+
var _a;
|
|
97960
|
+
return (_a = this._originalStateFields) === null || _a === void 0 ? void 0 : _a[s.id];
|
|
97715
97961
|
}
|
|
97716
|
-
|
|
97717
|
-
|
|
97718
|
-
|
|
97962
|
+
_setStateFromSpec() {
|
|
97963
|
+
this._auto = !!this._spec.auto;
|
|
97964
|
+
let start;
|
|
97965
|
+
let end;
|
|
97966
|
+
if (this._spec.rangeMode) {
|
|
97967
|
+
const [startMode, endMode] = this._spec.rangeMode;
|
|
97968
|
+
if (modeCheck('start', startMode, this._spec) && modeCheck('end', endMode, this._spec)) {
|
|
97969
|
+
start =
|
|
97970
|
+
startMode === 'percent'
|
|
97971
|
+
? this._spec.start
|
|
97972
|
+
: dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal);
|
|
97973
|
+
end =
|
|
97974
|
+
endMode === 'percent'
|
|
97975
|
+
? this._spec.end
|
|
97976
|
+
: dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal);
|
|
97977
|
+
}
|
|
97978
|
+
}
|
|
97979
|
+
else {
|
|
97980
|
+
start = this._spec.start
|
|
97981
|
+
? this._spec.start
|
|
97982
|
+
: this._spec.startValue
|
|
97983
|
+
? dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal)
|
|
97984
|
+
: 0;
|
|
97985
|
+
end = this._spec.end
|
|
97986
|
+
? this._spec.end
|
|
97987
|
+
: this._spec.endValue
|
|
97988
|
+
? dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal)
|
|
97989
|
+
: 1;
|
|
97719
97990
|
}
|
|
97720
|
-
|
|
97721
|
-
|
|
97722
|
-
const endIndex = allDomain.indexOf(endValue);
|
|
97723
|
-
return allDomain.slice(Math.min(startIndex, endIndex), Math.max(startIndex, endIndex) + 1);
|
|
97991
|
+
this._start = Math.max(0, Math.min(1, start));
|
|
97992
|
+
this._end = Math.max(0, Math.min(1, end));
|
|
97724
97993
|
}
|
|
97725
|
-
|
|
97726
|
-
var _a, _b
|
|
97727
|
-
|
|
97728
|
-
const
|
|
97729
|
-
|
|
97730
|
-
|
|
97731
|
-
|
|
97732
|
-
|
|
97733
|
-
|
|
97734
|
-
|
|
97735
|
-
|
|
97736
|
-
|
|
97737
|
-
|
|
97738
|
-
|
|
97739
|
-
|
|
97740
|
-
|
|
97741
|
-
|
|
97742
|
-
|
|
97743
|
-
|
|
97744
|
-
|
|
97745
|
-
|
|
97994
|
+
_setStateFromAxis() {
|
|
97995
|
+
var _a, _b;
|
|
97996
|
+
this._setStateFromSpec();
|
|
97997
|
+
const axis = this._relatedAxisComponent;
|
|
97998
|
+
this._startValue = statePointToData(this._start, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
97999
|
+
this._endValue = statePointToData(this._end, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
98000
|
+
this._minSpan = (_a = this._spec.minSpan) !== null && _a !== void 0 ? _a : 0;
|
|
98001
|
+
this._maxSpan = (_b = this._spec.maxSpan) !== null && _b !== void 0 ? _b : 1;
|
|
98002
|
+
if (isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain())) {
|
|
98003
|
+
if (this._spec.minValueSpan) {
|
|
98004
|
+
this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
98005
|
+
}
|
|
98006
|
+
if (this._spec.maxValueSpan) {
|
|
98007
|
+
this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]);
|
|
98008
|
+
}
|
|
98009
|
+
}
|
|
98010
|
+
this._minSpan = Math.max(0, this._minSpan);
|
|
98011
|
+
this._maxSpan = Math.min(this._maxSpan, 1);
|
|
98012
|
+
if (!axis) {
|
|
98013
|
+
return;
|
|
98014
|
+
}
|
|
98015
|
+
if ((!axis || this._filterMode !== 'axis') && (this._start !== 0 || this._end !== 1)) {
|
|
98016
|
+
this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale);
|
|
97746
98017
|
}
|
|
97747
98018
|
}
|
|
97748
|
-
|
|
97749
|
-
|
|
97750
|
-
|
|
98019
|
+
_initStateScale() {
|
|
98020
|
+
var _a, _b, _c, _d, _e, _f;
|
|
98021
|
+
const defaultRange = [0, 1];
|
|
98022
|
+
if (this._relatedAxisComponent) {
|
|
98023
|
+
const scale = this._relatedAxisComponent.getScale().clone();
|
|
98024
|
+
this._stateScale = scale;
|
|
98025
|
+
(_b = (_a = scale).maxBandwidth) === null || _b === void 0 ? void 0 : _b.call(_a, 'auto', true);
|
|
98026
|
+
(_d = (_c = scale).minBandwidth) === null || _d === void 0 ? void 0 : _d.call(_c, 'auto', true);
|
|
98027
|
+
(_f = (_e = scale).bandwidth) === null || _f === void 0 ? void 0 : _f.call(_e, 'auto', true);
|
|
98028
|
+
scale.rangeFactor(defaultRange, true).range(defaultRange);
|
|
97751
98029
|
}
|
|
97752
|
-
|
|
98030
|
+
else {
|
|
98031
|
+
let fieldLinear = true;
|
|
98032
|
+
if (this._field) {
|
|
98033
|
+
eachSeries(this._regions, s => {
|
|
98034
|
+
const stats = s.getRawDataStatisticsByField(this._field);
|
|
98035
|
+
if (!isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.min) || !isValidNumber$1(stats === null || stats === void 0 ? void 0 : stats.max)) {
|
|
98036
|
+
fieldLinear = false;
|
|
98037
|
+
}
|
|
98038
|
+
}, {
|
|
98039
|
+
userId: this._seriesUserId,
|
|
98040
|
+
specIndex: this._seriesIndex
|
|
98041
|
+
});
|
|
98042
|
+
}
|
|
98043
|
+
this._stateScale = fieldLinear ? new LinearScale() : new BandScale();
|
|
98044
|
+
this._stateScale.domain(this._computeDomainOfStateScale(fieldLinear), true).range(defaultRange);
|
|
98045
|
+
}
|
|
98046
|
+
}
|
|
98047
|
+
_computeDomainOfStateScale(isContinuous) {
|
|
98048
|
+
if (this._spec.customDomain) {
|
|
98049
|
+
return this._spec.customDomain;
|
|
98050
|
+
}
|
|
98051
|
+
const domain = this._data.getLatestData().map((d) => d[this._stateField]);
|
|
98052
|
+
if (isContinuous) {
|
|
98053
|
+
const domainNum = domain.map((n) => n * 1);
|
|
98054
|
+
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : [-Infinity, Infinity];
|
|
98055
|
+
}
|
|
98056
|
+
return domain;
|
|
97753
98057
|
}
|
|
97754
98058
|
_autoVisible(isShown) {
|
|
97755
98059
|
if (!this._auto) {
|
|
@@ -97768,29 +98072,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97768
98072
|
[sizeKey]: AttributeLevel.Built_In
|
|
97769
98073
|
});
|
|
97770
98074
|
}
|
|
97771
|
-
onLayoutStart(layoutRect, viewRect) {
|
|
97772
|
-
super.onLayoutStart(layoutRect, viewRect);
|
|
97773
|
-
const isShown = this._autoUpdate(layoutRect);
|
|
97774
|
-
this._autoVisible(isShown);
|
|
97775
|
-
this._dataUpdating = false;
|
|
97776
|
-
}
|
|
97777
|
-
onLayoutEnd() {
|
|
97778
|
-
const isShown = !(this._start === 0 && this._end === 1);
|
|
97779
|
-
this._autoVisible(isShown);
|
|
97780
|
-
super.onLayoutEnd();
|
|
97781
|
-
}
|
|
97782
|
-
getBoundsInRect(rect) {
|
|
97783
|
-
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
97784
|
-
if (this._isHorizontal) {
|
|
97785
|
-
result.y2 = result.y1 + this._height;
|
|
97786
|
-
result.x2 = result.x1 + rect.width;
|
|
97787
|
-
}
|
|
97788
|
-
else {
|
|
97789
|
-
result.x2 = result.x1 + this._width;
|
|
97790
|
-
result.y2 = result.y1 + rect.height;
|
|
97791
|
-
}
|
|
97792
|
-
return result;
|
|
97793
|
-
}
|
|
97794
98075
|
hide() {
|
|
97795
98076
|
var _a;
|
|
97796
98077
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.hideAll();
|
|
@@ -97799,15 +98080,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97799
98080
|
var _a;
|
|
97800
98081
|
(_a = this._component) === null || _a === void 0 ? void 0 : _a.showAll();
|
|
97801
98082
|
}
|
|
97802
|
-
_getAxisBandSize(axisSpec) {
|
|
97803
|
-
const bandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.bandSize;
|
|
97804
|
-
const maxBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.maxBandSize;
|
|
97805
|
-
const minBandSize = axisSpec === null || axisSpec === void 0 ? void 0 : axisSpec.minBandSize;
|
|
97806
|
-
if (bandSize || minBandSize || maxBandSize) {
|
|
97807
|
-
return { bandSize, maxBandSize, minBandSize };
|
|
97808
|
-
}
|
|
97809
|
-
return undefined;
|
|
97810
|
-
}
|
|
97811
98083
|
_autoUpdate(rect) {
|
|
97812
98084
|
var _a, _b, _c, _d, _e, _f;
|
|
97813
98085
|
if (!this._auto) {
|
|
@@ -97817,7 +98089,7 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97817
98089
|
const axis = this._relatedAxisComponent;
|
|
97818
98090
|
const axisSpec = axis === null || axis === void 0 ? void 0 : axis.getSpec();
|
|
97819
98091
|
const axisScale = axis === null || axis === void 0 ? void 0 : axis.getScale();
|
|
97820
|
-
const bandSizeResult =
|
|
98092
|
+
const bandSizeResult = getAxisBandSize(axisSpec);
|
|
97821
98093
|
if (!this._dataUpdating &&
|
|
97822
98094
|
isDiscrete(axisScale.type) &&
|
|
97823
98095
|
(rect === null || rect === void 0 ? void 0 : rect.height) === ((_a = this._cacheRect) === null || _a === void 0 ? void 0 : _a.height) &&
|
|
@@ -97864,9 +98136,6 @@ class DataFilterBaseComponent extends BaseComponent {
|
|
|
97864
98136
|
_getNeedClearVRenderComponents() {
|
|
97865
98137
|
return [this._component];
|
|
97866
98138
|
}
|
|
97867
|
-
clear() {
|
|
97868
|
-
this._throttledHide = null;
|
|
97869
|
-
}
|
|
97870
98139
|
}
|
|
97871
98140
|
mixin(DataFilterBaseComponent, Zoomable);
|
|
97872
98141
|
|
|
@@ -98012,14 +98281,14 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98012
98281
|
this.layoutType = 'region-relative';
|
|
98013
98282
|
this._isReverseCache = false;
|
|
98014
98283
|
this._dataToPositionX = (datum) => {
|
|
98015
|
-
const offsetLeft = this.
|
|
98284
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98016
98285
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98017
98286
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98018
98287
|
const xField = this._isHorizontal ? this._stateField : this._valueField;
|
|
98019
98288
|
return xScale.scale(datum[xField]) + this.getLayoutStartPoint().x + offsetLeft + offsetHandler;
|
|
98020
98289
|
};
|
|
98021
98290
|
this._dataToPositionX2 = (datum) => {
|
|
98022
|
-
const offsetLeft = this.
|
|
98291
|
+
const offsetLeft = !this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98023
98292
|
const offsetHandler = this._isHorizontal ? this._startHandlerSize / 2 : 0;
|
|
98024
98293
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98025
98294
|
const min = xScale.domain()[0];
|
|
@@ -98028,63 +98297,146 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98028
98297
|
this._dataToPositionY = (datum) => {
|
|
98029
98298
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98030
98299
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98031
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98300
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98032
98301
|
const yField = this._isHorizontal ? this._valueField : this._stateField;
|
|
98033
98302
|
return yScale.scale(datum[yField]) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98034
98303
|
};
|
|
98035
98304
|
this._dataToPositionY2 = (datum) => {
|
|
98036
98305
|
const offsetTop = this._isHorizontal ? this._middleHandlerSize : 0;
|
|
98037
98306
|
const offsetHandler = this._isHorizontal ? 0 : this._startHandlerSize / 2;
|
|
98038
|
-
const yScale = this._isHorizontal ? this._valueScale : this.
|
|
98307
|
+
const yScale = this._isHorizontal ? this._valueScale : this._getPreviewStateScale();
|
|
98039
98308
|
const min = yScale.domain()[0];
|
|
98040
98309
|
return yScale.scale(min) + this.getLayoutStartPoint().y + offsetTop + offsetHandler;
|
|
98041
98310
|
};
|
|
98042
98311
|
this._valueField = 'y';
|
|
98043
98312
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'filter';
|
|
98044
98313
|
}
|
|
98314
|
+
_handleChange(start, end, updateComponent, tag) {
|
|
98315
|
+
super._handleChange(start, end, updateComponent);
|
|
98316
|
+
if (this._shouldChange) {
|
|
98317
|
+
if (updateComponent && this._component) {
|
|
98318
|
+
this._component.setStartAndEnd(start, end);
|
|
98319
|
+
}
|
|
98320
|
+
else {
|
|
98321
|
+
const axis = this._relatedAxisComponent;
|
|
98322
|
+
const startValue = statePointToData(start, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
98323
|
+
const endValue = statePointToData(end, this._stateScale, isReverse(axis, this._isHorizontal));
|
|
98324
|
+
if (!isValid$1(startValue) || !isValid$1(endValue)) {
|
|
98325
|
+
return;
|
|
98326
|
+
}
|
|
98327
|
+
this._start = start;
|
|
98328
|
+
this._end = end;
|
|
98329
|
+
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98330
|
+
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98331
|
+
: this._handleStateChange(startValue, endValue, tag);
|
|
98332
|
+
if (hasChange) {
|
|
98333
|
+
this.event.emit(ChartEvent.dataZoomChange, {
|
|
98334
|
+
model: this,
|
|
98335
|
+
value: {
|
|
98336
|
+
filterData: this._filterMode !== 'axis',
|
|
98337
|
+
start,
|
|
98338
|
+
end,
|
|
98339
|
+
startValue: this._startValue,
|
|
98340
|
+
endValue: this._endValue,
|
|
98341
|
+
newDomain: this._newDomain
|
|
98342
|
+
}
|
|
98343
|
+
});
|
|
98344
|
+
}
|
|
98345
|
+
}
|
|
98346
|
+
}
|
|
98347
|
+
}
|
|
98348
|
+
_handleDataCollectionChange() {
|
|
98349
|
+
const data = this._data.getDataView();
|
|
98350
|
+
data.reRunAllTransform();
|
|
98351
|
+
const domain = this._computeDomainOfValueScale();
|
|
98352
|
+
if (domain) {
|
|
98353
|
+
if (!this._valueScale) {
|
|
98354
|
+
this._valueScale = new LinearScale();
|
|
98355
|
+
}
|
|
98356
|
+
this._valueScale.domain(domain);
|
|
98357
|
+
this._updateValueScaleRange();
|
|
98358
|
+
if (this._component) {
|
|
98359
|
+
this._createOrUpdateComponent(true);
|
|
98360
|
+
}
|
|
98361
|
+
}
|
|
98362
|
+
}
|
|
98045
98363
|
created() {
|
|
98046
98364
|
super.created();
|
|
98047
98365
|
this._initValueScale();
|
|
98048
98366
|
}
|
|
98367
|
+
updateLayoutAttribute() {
|
|
98368
|
+
if (this._cacheVisibility !== false) {
|
|
98369
|
+
super.updateLayoutAttribute();
|
|
98370
|
+
}
|
|
98371
|
+
}
|
|
98372
|
+
_beforeLayoutEnd() {
|
|
98373
|
+
super._beforeLayoutEnd();
|
|
98374
|
+
const axis = this._relatedAxisComponent;
|
|
98375
|
+
if ((isReverse(axis, this._isHorizontal) && !this._isReverseCache) || this._auto) {
|
|
98376
|
+
this._isReverseCache = isReverse(axis, this._isHorizontal);
|
|
98377
|
+
this.effect.onZoomChange();
|
|
98378
|
+
}
|
|
98379
|
+
}
|
|
98380
|
+
clear() {
|
|
98381
|
+
if (this._component) {
|
|
98382
|
+
const container = this.getContainer();
|
|
98383
|
+
this._component.removeAllChild();
|
|
98384
|
+
if (container) {
|
|
98385
|
+
container.removeChild(this._component);
|
|
98386
|
+
}
|
|
98387
|
+
this._component = null;
|
|
98388
|
+
}
|
|
98389
|
+
super.clear();
|
|
98390
|
+
}
|
|
98391
|
+
getBoundsInRect(rect) {
|
|
98392
|
+
var _a, _b, _c, _d;
|
|
98393
|
+
const result = { x1: this.getLayoutStartPoint().x, y1: this.getLayoutStartPoint().y, x2: 0, y2: 0 };
|
|
98394
|
+
const startHandlerScaleXSize = this._startHandlerSize * ((_a = this._spec.startHandler.style.scaleX) !== null && _a !== void 0 ? _a : 1);
|
|
98395
|
+
const startHandlerScaleYSize = this._startHandlerSize * ((_b = this._spec.startHandler.style.scaleY) !== null && _b !== void 0 ? _b : 1);
|
|
98396
|
+
const endHandlerScaleXSize = this._endHandlerSize * ((_c = this._spec.endHandler.style.scaleX) !== null && _c !== void 0 ? _c : 1);
|
|
98397
|
+
const endHandlerScaleYSize = this._endHandlerSize * ((_d = this._spec.endHandler.style.scaleY) !== null && _d !== void 0 ? _d : 1);
|
|
98398
|
+
const extendWidth = !this._visible
|
|
98399
|
+
? 0
|
|
98400
|
+
: this._isHorizontal
|
|
98401
|
+
? (startHandlerScaleXSize - this._startHandlerSize) / 2 + (endHandlerScaleXSize - this._endHandlerSize) / 2
|
|
98402
|
+
: (Math.max(startHandlerScaleXSize, endHandlerScaleXSize) - this._width) / 2;
|
|
98403
|
+
const extendHeight = !this._visible
|
|
98404
|
+
? 0
|
|
98405
|
+
: this._isHorizontal
|
|
98406
|
+
? (Math.max(startHandlerScaleYSize, endHandlerScaleYSize) - this._height) / 2
|
|
98407
|
+
: (startHandlerScaleYSize - this._startHandlerSize) / 2 + (endHandlerScaleYSize - this._endHandlerSize) / 2;
|
|
98408
|
+
if (this._isHorizontal) {
|
|
98409
|
+
result.y2 = result.y1 + this._height + extendHeight;
|
|
98410
|
+
result.x2 = result.x1 + rect.width + extendWidth;
|
|
98411
|
+
}
|
|
98412
|
+
else {
|
|
98413
|
+
result.x2 = result.x1 + this._width + extendWidth;
|
|
98414
|
+
result.y2 = result.y1 + rect.height + extendHeight;
|
|
98415
|
+
}
|
|
98416
|
+
return result;
|
|
98417
|
+
}
|
|
98049
98418
|
setAttrFromSpec() {
|
|
98050
98419
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
98051
98420
|
super.setAttrFromSpec();
|
|
98052
|
-
|
|
98053
|
-
this._zoomAttr.enable = this._spec.roam;
|
|
98054
|
-
this._dragAttr.enable = this._spec.roam;
|
|
98055
|
-
this._scrollAttr.enable = this._spec.roam;
|
|
98056
|
-
}
|
|
98057
|
-
if (this._zoomAttr.enable || this._dragAttr.enable || this._scrollAttr.enable) {
|
|
98058
|
-
this.initZoomable(this.event, this._option.mode);
|
|
98059
|
-
}
|
|
98421
|
+
const componentSize = this._isHorizontal ? Number(this._spec.height) : Number(this._spec.width);
|
|
98060
98422
|
this._backgroundSize = (_b = (_a = this._spec.background) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 30;
|
|
98061
98423
|
this._middleHandlerSize = this._computeMiddleHandlerSize();
|
|
98062
|
-
this._width = this._computeWidth();
|
|
98063
|
-
this._height = this._computeHeight();
|
|
98064
98424
|
if (isNil$1((_e = (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.startHandler) === null || _d === void 0 ? void 0 : _d.style) === null || _e === void 0 ? void 0 : _e.size)) {
|
|
98065
|
-
this._spec.startHandler.style.size =
|
|
98066
|
-
? this.
|
|
98067
|
-
:
|
|
98425
|
+
this._spec.startHandler.style.size = isNaN(componentSize)
|
|
98426
|
+
? this._backgroundSize
|
|
98427
|
+
: componentSize - this._middleHandlerSize;
|
|
98068
98428
|
}
|
|
98069
98429
|
if (isNil$1((_h = (_g = (_f = this._spec) === null || _f === void 0 ? void 0 : _f.endHandler) === null || _g === void 0 ? void 0 : _g.style) === null || _h === void 0 ? void 0 : _h.size)) {
|
|
98070
|
-
this._spec.endHandler.style.size =
|
|
98071
|
-
? this.
|
|
98072
|
-
:
|
|
98073
|
-
}
|
|
98074
|
-
const
|
|
98075
|
-
const
|
|
98076
|
-
this._startHandlerSize =
|
|
98077
|
-
this._endHandlerSize =
|
|
98078
|
-
|
|
98079
|
-
|
|
98080
|
-
this._updateScaleRange();
|
|
98081
|
-
if (this._isReverse() && !this._isReverseCache) {
|
|
98082
|
-
this._isReverseCache = this._isReverse();
|
|
98083
|
-
this.effect.onZoomChange();
|
|
98084
|
-
}
|
|
98085
|
-
if (this._cacheVisibility !== false) {
|
|
98086
|
-
super.onLayoutEnd();
|
|
98087
|
-
}
|
|
98430
|
+
this._spec.endHandler.style.size = isNaN(componentSize)
|
|
98431
|
+
? this._backgroundSize
|
|
98432
|
+
: componentSize - this._middleHandlerSize;
|
|
98433
|
+
}
|
|
98434
|
+
const startHandlerVisible = (_j = this._spec.startHandler.style.visible) !== null && _j !== void 0 ? _j : true;
|
|
98435
|
+
const endHandlerVisible = (_k = this._spec.endHandler.style.visible) !== null && _k !== void 0 ? _k : true;
|
|
98436
|
+
this._startHandlerSize = startHandlerVisible ? this._spec.startHandler.style.size : 0;
|
|
98437
|
+
this._endHandlerSize = endHandlerVisible ? this._spec.endHandler.style.size : 0;
|
|
98438
|
+
this._width = this._computeWidth();
|
|
98439
|
+
this._height = this._computeHeight();
|
|
98088
98440
|
}
|
|
98089
98441
|
_initValueScale() {
|
|
98090
98442
|
const domain = this._computeDomainOfValueScale();
|
|
@@ -98095,9 +98447,13 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98095
98447
|
}
|
|
98096
98448
|
}
|
|
98097
98449
|
_updateScaleRange() {
|
|
98098
|
-
|
|
98450
|
+
this._updateStateScaleRange();
|
|
98451
|
+
this._updateValueScaleRange();
|
|
98452
|
+
}
|
|
98453
|
+
_updateStateScaleRange() {
|
|
98454
|
+
var _a, _b, _c;
|
|
98099
98455
|
const handlerSize = this._startHandlerSize + this._endHandlerSize;
|
|
98100
|
-
if (!this._stateScale
|
|
98456
|
+
if (!this._stateScale) {
|
|
98101
98457
|
return;
|
|
98102
98458
|
}
|
|
98103
98459
|
let stateScaleRange;
|
|
@@ -98114,14 +98470,27 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98114
98470
|
stateScaleRange = this._visible
|
|
98115
98471
|
? [this._startHandlerSize / 2, compWidth - handlerSize + this._startHandlerSize / 2]
|
|
98116
98472
|
: defaultRange;
|
|
98117
|
-
this._stateScale.range(stateScaleRange);
|
|
98118
|
-
this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
|
|
98119
98473
|
}
|
|
98120
98474
|
else {
|
|
98121
98475
|
stateScaleRange = this._visible
|
|
98122
98476
|
? [this._startHandlerSize / 2, compHeight - handlerSize + this._startHandlerSize / 2]
|
|
98123
98477
|
: defaultRange;
|
|
98124
|
-
|
|
98478
|
+
}
|
|
98479
|
+
this._stateScale.range(stateScaleRange);
|
|
98480
|
+
(_c = this._previewStateScale) === null || _c === void 0 ? void 0 : _c.range(isReverse(this._relatedAxisComponent, this._isHorizontal)
|
|
98481
|
+
? stateScaleRange.reverse()
|
|
98482
|
+
: stateScaleRange);
|
|
98483
|
+
}
|
|
98484
|
+
_updateValueScaleRange() {
|
|
98485
|
+
if (!this._valueScale) {
|
|
98486
|
+
return;
|
|
98487
|
+
}
|
|
98488
|
+
const compWidth = this._computeWidth();
|
|
98489
|
+
const compHeight = this._computeHeight();
|
|
98490
|
+
if (this._isHorizontal) {
|
|
98491
|
+
this._valueScale.range([compHeight - this._middleHandlerSize, 0]);
|
|
98492
|
+
}
|
|
98493
|
+
else {
|
|
98125
98494
|
if (this.layoutOrient === 'left') {
|
|
98126
98495
|
this._valueScale.range([compWidth - this._middleHandlerSize, 0]);
|
|
98127
98496
|
}
|
|
@@ -98129,24 +98498,35 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98129
98498
|
this._valueScale.range([0, compWidth - this._middleHandlerSize]);
|
|
98130
98499
|
}
|
|
98131
98500
|
}
|
|
98132
|
-
if (this._component && this._cacheVisibility !== false) {
|
|
98133
|
-
this._component.setAttributes({
|
|
98134
|
-
size: {
|
|
98135
|
-
width: compWidth,
|
|
98136
|
-
height: compHeight
|
|
98137
|
-
},
|
|
98138
|
-
position: {
|
|
98139
|
-
x: this.getLayoutStartPoint().x,
|
|
98140
|
-
y: this.getLayoutStartPoint().y
|
|
98141
|
-
}
|
|
98142
|
-
});
|
|
98143
|
-
}
|
|
98144
98501
|
}
|
|
98145
98502
|
_computeDomainOfValueScale() {
|
|
98146
98503
|
const domain = this._data.getLatestData().map((d) => d[this._valueField]);
|
|
98147
98504
|
const domainNum = domain.map((n) => n * 1);
|
|
98148
98505
|
return domain.length ? [minInArray(domainNum), maxInArray(domainNum)] : null;
|
|
98149
98506
|
}
|
|
98507
|
+
_isScaleValid(scale) {
|
|
98508
|
+
if (!scale || !scale.domain()) {
|
|
98509
|
+
return false;
|
|
98510
|
+
}
|
|
98511
|
+
const domain = scale.domain();
|
|
98512
|
+
if (isContinuous(scale.type) && domain[0] === last(domain)) {
|
|
98513
|
+
return false;
|
|
98514
|
+
}
|
|
98515
|
+
if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
|
|
98516
|
+
return false;
|
|
98517
|
+
}
|
|
98518
|
+
return true;
|
|
98519
|
+
}
|
|
98520
|
+
_getXScale() {
|
|
98521
|
+
const bindScale = this._relatedAxisComponent.getScale();
|
|
98522
|
+
if (bindScale.type === this.stateScale.type && this._isHorizontal) {
|
|
98523
|
+
return this.stateScale;
|
|
98524
|
+
}
|
|
98525
|
+
return this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98526
|
+
}
|
|
98527
|
+
_getYScale() {
|
|
98528
|
+
return this._isHorizontal ? this._valueScale : this._stateScale;
|
|
98529
|
+
}
|
|
98150
98530
|
_computeMiddleHandlerSize() {
|
|
98151
98531
|
var _a, _b, _c, _d;
|
|
98152
98532
|
let size = 0;
|
|
@@ -98167,7 +98547,8 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98167
98547
|
if (this._isHorizontal) {
|
|
98168
98548
|
return this.getLayoutRect().width;
|
|
98169
98549
|
}
|
|
98170
|
-
return this.
|
|
98550
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98551
|
+
this._middleHandlerSize);
|
|
98171
98552
|
}
|
|
98172
98553
|
_computeHeight() {
|
|
98173
98554
|
if (this._visible === false) {
|
|
@@ -98177,23 +98558,11 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98177
98558
|
return this._spec.height;
|
|
98178
98559
|
}
|
|
98179
98560
|
if (this._isHorizontal) {
|
|
98180
|
-
return this.
|
|
98561
|
+
return (Math.max(this._startHandlerSize || 0, this._endHandlerSize || 0, this._backgroundSize || 0) +
|
|
98562
|
+
this._middleHandlerSize);
|
|
98181
98563
|
}
|
|
98182
98564
|
return this.getLayoutRect().height;
|
|
98183
98565
|
}
|
|
98184
|
-
_isScaleValid(scale) {
|
|
98185
|
-
if (!scale || !scale.domain()) {
|
|
98186
|
-
return false;
|
|
98187
|
-
}
|
|
98188
|
-
const domain = scale.domain();
|
|
98189
|
-
if (isContinuous(scale.type) && domain[0] === last(domain)) {
|
|
98190
|
-
return false;
|
|
98191
|
-
}
|
|
98192
|
-
if (isDiscrete(scale.type) && uniqArray(domain).length === 1) {
|
|
98193
|
-
return false;
|
|
98194
|
-
}
|
|
98195
|
-
return true;
|
|
98196
|
-
}
|
|
98197
98566
|
_getAttrs(isNeedPreview) {
|
|
98198
98567
|
var _a, _b, _c, _d, _e;
|
|
98199
98568
|
const spec = (_a = this._spec) !== null && _a !== void 0 ? _a : {};
|
|
@@ -98203,73 +98572,58 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98203
98572
|
}, orient: this._orient, size: {
|
|
98204
98573
|
width: this._computeWidth(),
|
|
98205
98574
|
height: this._computeHeight()
|
|
98206
|
-
}, showDetail: spec.showDetail, brushSelect: (_b = spec.brushSelect) !== null && _b !== void 0 ? _b : false, zoomLock: (_c = spec.zoomLock) !== null && _c !== void 0 ? _c : false, minSpan: this._minSpan, maxSpan: this._maxSpan, delayType: spec.delayType, delayTime: isValid$1(spec.delayType) ? (_d = spec.delayTime) !== null && _d !== void 0 ? _d : 30 : 0, realTime: (_e = spec.realTime) !== null && _e !== void 0 ? _e : true, previewData: isNeedPreview && this._data.getLatestData(), previewPointsX: isNeedPreview && this._dataToPositionX, previewPointsY: isNeedPreview && this._dataToPositionY, tolerance: this._spec.tolerance }, this._getComponentAttrs(isNeedPreview));
|
|
98575
|
+
}, showDetail: spec.showDetail, brushSelect: (_b = spec.brushSelect) !== null && _b !== void 0 ? _b : false, zoomLock: (_c = spec.zoomLock) !== null && _c !== void 0 ? _c : false, minSpan: this._minSpan, maxSpan: this._maxSpan, delayType: spec.delayType, delayTime: isValid$1(spec.delayType) ? ((_d = spec.delayTime) !== null && _d !== void 0 ? _d : 30) : 0, realTime: (_e = spec.realTime) !== null && _e !== void 0 ? _e : true, previewData: isNeedPreview && this._data.getLatestData(), previewPointsX: isNeedPreview && this._dataToPositionX, previewPointsY: isNeedPreview && this._dataToPositionY, tolerance: this._spec.tolerance, isReverse: isReverse(this._relatedAxisComponent, this._isHorizontal) }, this._getComponentAttrs(isNeedPreview));
|
|
98207
98576
|
}
|
|
98208
|
-
|
|
98577
|
+
_getLayoutAttrs() {
|
|
98578
|
+
return {
|
|
98579
|
+
position: {
|
|
98580
|
+
x: this.getLayoutStartPoint().x,
|
|
98581
|
+
y: this.getLayoutStartPoint().y
|
|
98582
|
+
},
|
|
98583
|
+
size: {
|
|
98584
|
+
width: this._computeWidth(),
|
|
98585
|
+
height: this._computeHeight()
|
|
98586
|
+
}
|
|
98587
|
+
};
|
|
98588
|
+
}
|
|
98589
|
+
_createOrUpdateComponent(changeData) {
|
|
98209
98590
|
if (this._visible) {
|
|
98210
98591
|
const xScale = this._isHorizontal ? this._stateScale : this._valueScale;
|
|
98211
98592
|
const yScale = this._isHorizontal ? this._valueScale : this._stateScale;
|
|
98212
98593
|
const isNeedPreview = this._isScaleValid(xScale) && this._isScaleValid(yScale) && this._spec.showBackgroundChart !== false;
|
|
98213
98594
|
const attrs = this._getAttrs(isNeedPreview);
|
|
98595
|
+
const axis = this._relatedAxisComponent;
|
|
98214
98596
|
if (this._component) {
|
|
98215
98597
|
this._component.setAttributes(attrs);
|
|
98598
|
+
if (changeData) {
|
|
98599
|
+
this._component.setPreviewData(this._data.getDataView().latestData);
|
|
98600
|
+
if (isNeedPreview) {
|
|
98601
|
+
if (this._isHorizontal) {
|
|
98602
|
+
this._component.setPreviewPointsY1(this._dataToPositionY2);
|
|
98603
|
+
}
|
|
98604
|
+
else {
|
|
98605
|
+
this._component.setPreviewPointsX1(this._dataToPositionX2);
|
|
98606
|
+
}
|
|
98607
|
+
this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
|
|
98608
|
+
}
|
|
98609
|
+
}
|
|
98216
98610
|
}
|
|
98217
98611
|
else {
|
|
98218
98612
|
const container = this.getContainer();
|
|
98219
98613
|
this._component = new DataZoom$1(attrs);
|
|
98614
|
+
this._component.setPreviewData(this._data.getDataView().latestData);
|
|
98220
98615
|
if (this._isHorizontal) {
|
|
98221
98616
|
isNeedPreview && this._component.setPreviewPointsY1(this._dataToPositionY2);
|
|
98222
98617
|
}
|
|
98223
98618
|
else {
|
|
98224
98619
|
isNeedPreview && this._component.setPreviewPointsX1(this._dataToPositionX2);
|
|
98225
98620
|
}
|
|
98226
|
-
this._component.setStatePointToData((state) => this.
|
|
98227
|
-
this._component.addEventListener('
|
|
98621
|
+
this._component.setStatePointToData((state) => statePointToData(state, this._stateScale, isReverse(axis, this._isHorizontal)));
|
|
98622
|
+
this._component.addEventListener('dataZoomChange', (e) => {
|
|
98228
98623
|
const { start, end, tag } = e.detail;
|
|
98229
98624
|
this._handleChange(start, end, undefined, tag);
|
|
98230
98625
|
});
|
|
98231
98626
|
container.add(this._component);
|
|
98232
|
-
this._updateScaleRange();
|
|
98233
|
-
}
|
|
98234
|
-
}
|
|
98235
|
-
}
|
|
98236
|
-
_handleChange(start, end, updateComponent, tag) {
|
|
98237
|
-
super._handleChange(start, end, updateComponent);
|
|
98238
|
-
if (this._shouldChange) {
|
|
98239
|
-
if (updateComponent && this._component) {
|
|
98240
|
-
this._component.setStartAndEnd(start, end);
|
|
98241
|
-
}
|
|
98242
|
-
this._start = start;
|
|
98243
|
-
this._end = end;
|
|
98244
|
-
const startValue = this.statePointToData(start);
|
|
98245
|
-
const endValue = this.statePointToData(end);
|
|
98246
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98247
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98248
|
-
: this._handleStateChange(startValue, endValue, tag);
|
|
98249
|
-
if (hasChange) {
|
|
98250
|
-
this.event.emit(ChartEvent.dataZoomChange, {
|
|
98251
|
-
model: this,
|
|
98252
|
-
value: {
|
|
98253
|
-
filterData: this._filterMode !== 'axis',
|
|
98254
|
-
start,
|
|
98255
|
-
end,
|
|
98256
|
-
startValue: this._startValue,
|
|
98257
|
-
endValue: this._endValue,
|
|
98258
|
-
newDomain: this._newDomain
|
|
98259
|
-
}
|
|
98260
|
-
});
|
|
98261
|
-
}
|
|
98262
|
-
}
|
|
98263
|
-
}
|
|
98264
|
-
_handleDataCollectionChange() {
|
|
98265
|
-
var _a;
|
|
98266
|
-
const data = this._data.getDataView();
|
|
98267
|
-
data.reRunAllTransform();
|
|
98268
|
-
(_a = this._component) === null || _a === void 0 ? void 0 : _a.setPreviewData(data.latestData);
|
|
98269
|
-
if (this._valueScale) {
|
|
98270
|
-
const domain = this._computeDomainOfValueScale();
|
|
98271
|
-
if (domain) {
|
|
98272
|
-
this._valueScale.domain(domain);
|
|
98273
98627
|
}
|
|
98274
98628
|
}
|
|
98275
98629
|
}
|
|
@@ -98331,16 +98685,23 @@ class DataZoom extends DataFilterBaseComponent {
|
|
|
98331
98685
|
_getNeedClearVRenderComponents() {
|
|
98332
98686
|
return [this._component];
|
|
98333
98687
|
}
|
|
98334
|
-
|
|
98335
|
-
|
|
98336
|
-
|
|
98337
|
-
this.
|
|
98338
|
-
|
|
98339
|
-
|
|
98688
|
+
onDataUpdate() {
|
|
98689
|
+
super.onDataUpdate();
|
|
98690
|
+
if (this._previewStateScale !== this._stateScale) {
|
|
98691
|
+
this._previewStateScale = null;
|
|
98692
|
+
}
|
|
98693
|
+
}
|
|
98694
|
+
_getPreviewStateScale() {
|
|
98695
|
+
if (!this._previewStateScale) {
|
|
98696
|
+
if (isReverse(this._relatedAxisComponent, this._isHorizontal)) {
|
|
98697
|
+
this._previewStateScale = this._stateScale.clone();
|
|
98698
|
+
this._previewStateScale.range(this._stateScale.range().reverse());
|
|
98699
|
+
}
|
|
98700
|
+
else {
|
|
98701
|
+
this._previewStateScale = this._stateScale;
|
|
98340
98702
|
}
|
|
98341
|
-
this._component = null;
|
|
98342
98703
|
}
|
|
98343
|
-
|
|
98704
|
+
return this._previewStateScale;
|
|
98344
98705
|
}
|
|
98345
98706
|
}
|
|
98346
98707
|
DataZoom.type = ComponentTypeEnum.dataZoom;
|
|
@@ -98385,24 +98746,53 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98385
98746
|
this.layoutType = 'region-relative';
|
|
98386
98747
|
this._filterMode = (_a = spec.filterMode) !== null && _a !== void 0 ? _a : 'axis';
|
|
98387
98748
|
}
|
|
98388
|
-
|
|
98389
|
-
super.
|
|
98390
|
-
|
|
98391
|
-
|
|
98392
|
-
|
|
98393
|
-
|
|
98749
|
+
_handleChange(start, end, updateComponent) {
|
|
98750
|
+
super._handleChange(start, end, updateComponent);
|
|
98751
|
+
const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
|
|
98752
|
+
if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
|
|
98753
|
+
if (updateComponent && this._component) {
|
|
98754
|
+
this._component.setAttribute('range', [start, end]);
|
|
98755
|
+
}
|
|
98756
|
+
this._start = start;
|
|
98757
|
+
this._end = end;
|
|
98758
|
+
const startValue = statePointToData(start, this._stateScale, false);
|
|
98759
|
+
const endValue = statePointToData(end, this._stateScale, false);
|
|
98760
|
+
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98761
|
+
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98762
|
+
: this._handleStateChange(startValue, endValue);
|
|
98763
|
+
if (hasChange) {
|
|
98764
|
+
this.event.emit(ChartEvent.scrollBarChange, {
|
|
98765
|
+
model: this,
|
|
98766
|
+
value: {
|
|
98767
|
+
filterData: this._filterMode !== 'axis',
|
|
98768
|
+
start: this._start,
|
|
98769
|
+
end: this._end,
|
|
98770
|
+
startValue: this._startValue,
|
|
98771
|
+
endValue: this._endValue,
|
|
98772
|
+
newDomain: this._newDomain
|
|
98773
|
+
}
|
|
98774
|
+
});
|
|
98775
|
+
}
|
|
98394
98776
|
}
|
|
98395
|
-
|
|
98396
|
-
|
|
98777
|
+
}
|
|
98778
|
+
_handleDataCollectionChange() {
|
|
98779
|
+
if (this._spec.auto) {
|
|
98780
|
+
const data = this._data.getDataView();
|
|
98781
|
+
data.reRunAllTransform();
|
|
98397
98782
|
}
|
|
98398
98783
|
}
|
|
98399
|
-
|
|
98784
|
+
_beforeLayoutEnd() {
|
|
98400
98785
|
var _a, _b;
|
|
98401
|
-
|
|
98786
|
+
super._beforeLayoutEnd();
|
|
98402
98787
|
(_b = (_a = this.effect).onZoomChange) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
98788
|
+
}
|
|
98789
|
+
onLayoutEnd() {
|
|
98790
|
+
this._updateComponentBounds();
|
|
98403
98791
|
super.onLayoutEnd();
|
|
98404
98792
|
}
|
|
98405
98793
|
_updateScaleRange() {
|
|
98794
|
+
}
|
|
98795
|
+
_updateComponentBounds() {
|
|
98406
98796
|
if (this._component) {
|
|
98407
98797
|
this._component.setAttributes({
|
|
98408
98798
|
x: this.getLayoutStartPoint().x,
|
|
@@ -98413,6 +98803,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98413
98803
|
}
|
|
98414
98804
|
}
|
|
98415
98805
|
_computeWidth() {
|
|
98806
|
+
if (this._visible === false) {
|
|
98807
|
+
return 0;
|
|
98808
|
+
}
|
|
98416
98809
|
if (isNumber$1(this._spec.width)) {
|
|
98417
98810
|
return this._spec.width;
|
|
98418
98811
|
}
|
|
@@ -98422,6 +98815,9 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98422
98815
|
return SCROLL_BAR_DEFAULT_SIZE;
|
|
98423
98816
|
}
|
|
98424
98817
|
_computeHeight() {
|
|
98818
|
+
if (this._visible === false) {
|
|
98819
|
+
return 0;
|
|
98820
|
+
}
|
|
98425
98821
|
if (isNumber$1(this._spec.height)) {
|
|
98426
98822
|
return this._spec.height;
|
|
98427
98823
|
}
|
|
@@ -98432,7 +98828,7 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98432
98828
|
}
|
|
98433
98829
|
_getAttrs() {
|
|
98434
98830
|
var _a, _b, _c, _d, _e, _f;
|
|
98435
|
-
return Object.assign({ zIndex: this.layoutZIndex, x: this.getLayoutStartPoint().x, y: this.getLayoutStartPoint().y, width: this.getLayoutRect().width, height: this.getLayoutRect().height, range: [this._start, this._end], direction: this._isHorizontal ? 'horizontal' : 'vertical', delayType: (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType, delayTime: isValid$1((_b = this._spec) === null || _b === void 0 ? void 0 : _b.delayType) ? (_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayTime) !== null && _d !== void 0 ? _d : 30 : 0, realTime: (_f = (_e = this._spec) === null || _e === void 0 ? void 0 : _e.realTime) !== null && _f !== void 0 ? _f : true }, this._getComponentAttrs());
|
|
98831
|
+
return Object.assign({ zIndex: this.layoutZIndex, x: this.getLayoutStartPoint().x, y: this.getLayoutStartPoint().y, width: this.getLayoutRect().width, height: this.getLayoutRect().height, range: [this._start, this._end], direction: this._isHorizontal ? 'horizontal' : 'vertical', delayType: (_a = this._spec) === null || _a === void 0 ? void 0 : _a.delayType, delayTime: isValid$1((_b = this._spec) === null || _b === void 0 ? void 0 : _b.delayType) ? ((_d = (_c = this._spec) === null || _c === void 0 ? void 0 : _c.delayTime) !== null && _d !== void 0 ? _d : 30) : 0, realTime: (_f = (_e = this._spec) === null || _e === void 0 ? void 0 : _e.realTime) !== null && _f !== void 0 ? _f : true }, this._getComponentAttrs());
|
|
98436
98832
|
}
|
|
98437
98833
|
_createOrUpdateComponent() {
|
|
98438
98834
|
const attrs = this._getAttrs();
|
|
@@ -98453,41 +98849,6 @@ class ScrollBar extends DataFilterBaseComponent {
|
|
|
98453
98849
|
container.add(this._component);
|
|
98454
98850
|
}
|
|
98455
98851
|
}
|
|
98456
|
-
_handleChange(start, end, updateComponent) {
|
|
98457
|
-
super._handleChange(start, end, updateComponent);
|
|
98458
|
-
const isSameScrollValue = isClose(this._start, start) && isClose(this._end, end);
|
|
98459
|
-
if (this._shouldChange && (!isSameScrollValue || this._spec.realTime === false)) {
|
|
98460
|
-
if (updateComponent && this._component) {
|
|
98461
|
-
this._component.setAttribute('range', [start, end]);
|
|
98462
|
-
}
|
|
98463
|
-
this._start = start;
|
|
98464
|
-
this._end = end;
|
|
98465
|
-
const startValue = this.statePointToData(start);
|
|
98466
|
-
const endValue = this.statePointToData(end);
|
|
98467
|
-
const hasChange = isFunction$1(this._spec.updateDataAfterChange)
|
|
98468
|
-
? this._spec.updateDataAfterChange(start, end, startValue, endValue)
|
|
98469
|
-
: this._handleStateChange(this.statePointToData(start), this.statePointToData(end));
|
|
98470
|
-
if (hasChange) {
|
|
98471
|
-
this.event.emit(ChartEvent.scrollBarChange, {
|
|
98472
|
-
model: this,
|
|
98473
|
-
value: {
|
|
98474
|
-
filterData: this._filterMode !== 'axis',
|
|
98475
|
-
start: this._start,
|
|
98476
|
-
end: this._end,
|
|
98477
|
-
startValue: this._startValue,
|
|
98478
|
-
endValue: this._endValue,
|
|
98479
|
-
newDomain: this._newDomain
|
|
98480
|
-
}
|
|
98481
|
-
});
|
|
98482
|
-
}
|
|
98483
|
-
}
|
|
98484
|
-
}
|
|
98485
|
-
_handleDataCollectionChange() {
|
|
98486
|
-
if (this._spec.auto) {
|
|
98487
|
-
const data = this._data.getDataView();
|
|
98488
|
-
data.reRunAllTransform();
|
|
98489
|
-
}
|
|
98490
|
-
}
|
|
98491
98852
|
_getComponentAttrs() {
|
|
98492
98853
|
const { rail, slider, innerPadding } = this._spec;
|
|
98493
98854
|
const attrs = {};
|
|
@@ -98844,7 +99205,7 @@ function xyLayout(data, startRelativeSeries, endRelativeSeries, relativeSeries,
|
|
|
98844
99205
|
const lines = [];
|
|
98845
99206
|
const dataPoints = data.latestData[0] && data.latestData[0].latestData ? data.latestData[0].latestData : data.latestData;
|
|
98846
99207
|
const xAxisHelper = relativeSeries.getXAxisHelper();
|
|
98847
|
-
const yAxisHelper = relativeSeries.
|
|
99208
|
+
const yAxisHelper = relativeSeries.getYAxisHelper();
|
|
98848
99209
|
const xDomain = xAxisHelper.getScale(0).domain();
|
|
98849
99210
|
const yDomain = yAxisHelper.getScale(0).domain();
|
|
98850
99211
|
const isXExpand = includeFullBand && !xAxisHelper.isContinuous && !!xAxisHelper.getBandwidth;
|
|
@@ -102623,17 +102984,13 @@ class Brush extends BaseComponent {
|
|
|
102623
102984
|
const axisRangeExpand = (_a = this._spec.axisRangeExpand) !== null && _a !== void 0 ? _a : 0;
|
|
102624
102985
|
const { x1, x2, y1, y2 } = operateMaskBounds;
|
|
102625
102986
|
const regionStartAttr = isHorizontal ? 'x' : 'y';
|
|
102987
|
+
const regionSizeAttr = isHorizontal ? 'width' : 'height';
|
|
102626
102988
|
const boundsStart = isHorizontal ? x1 : y1;
|
|
102627
102989
|
const boundsEnd = isHorizontal ? x2 : y2;
|
|
102628
102990
|
if (this._axisDataZoomMap[axis.id]) {
|
|
102629
102991
|
const dataZoom = this._axisDataZoomMap[axis.id];
|
|
102630
|
-
const
|
|
102631
|
-
const
|
|
102632
|
-
.getScale()
|
|
102633
|
-
.invert(boundsStart - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102634
|
-
const endValue = releatedAxis.getScale().invert(boundsEnd - region.getLayoutStartPoint()[regionStartAttr]);
|
|
102635
|
-
const startPercent = dataZoom.dataToStatePoint(startValue);
|
|
102636
|
-
const endPercent = dataZoom.dataToStatePoint(endValue);
|
|
102992
|
+
const startPercent = (boundsStart - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
|
|
102993
|
+
const endPercent = (boundsEnd - region.getLayoutStartPoint()[regionStartAttr]) / region.getLayoutRect()[regionSizeAttr];
|
|
102637
102994
|
const newStartPercent = this._stateClamp(startPercent - axisRangeExpand);
|
|
102638
102995
|
const newEndPercent = this._stateClamp(endPercent + axisRangeExpand);
|
|
102639
102996
|
dataZoom.setStartAndEnd(Math.min(newStartPercent, newEndPercent), Math.max(newStartPercent, newEndPercent), [
|
|
@@ -102644,8 +103001,8 @@ class Brush extends BaseComponent {
|
|
|
102644
103001
|
operateComponent: dataZoom,
|
|
102645
103002
|
start: newStartPercent,
|
|
102646
103003
|
end: newEndPercent,
|
|
102647
|
-
startValue: dataZoom.
|
|
102648
|
-
endValue: dataZoom.
|
|
103004
|
+
startValue: statePointToData(newStartPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal)),
|
|
103005
|
+
endValue: statePointToData(newEndPercent, dataZoom.stateScale, isReverse(dataZoom.relatedAxisComponent, dataZoom.isHorizontal))
|
|
102649
103006
|
});
|
|
102650
103007
|
}
|
|
102651
103008
|
else {
|
|
@@ -102785,10 +103142,10 @@ class CustomMark extends BaseComponent {
|
|
|
102785
103142
|
if (isValid$1(spec.dataId) || isValidNumber$1(spec.dataIndex)) {
|
|
102786
103143
|
const dataview = this.getChart().getSeriesData(spec.dataId, spec.dataIndex);
|
|
102787
103144
|
if (dataview) {
|
|
103145
|
+
mark.setDataView(dataview);
|
|
102788
103146
|
dataview.target.addListener('change', () => {
|
|
102789
103147
|
mark.getData().updateData();
|
|
102790
103148
|
});
|
|
102791
|
-
mark.setDataView(dataview);
|
|
102792
103149
|
}
|
|
102793
103150
|
}
|
|
102794
103151
|
}
|