@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
|
@@ -4,15 +4,15 @@ import { BaseComponent } from "../base/base-component";
|
|
|
4
4
|
|
|
5
5
|
import { ComponentTypeEnum } from "../interface";
|
|
6
6
|
|
|
7
|
-
import { dataFilterComputeDomain, dataFilterWithNewDomain, lockStatisticsFilter } from "./util";
|
|
7
|
+
import { dataFilterComputeDomain, dataFilterWithNewDomain, dataToStatePoint, getAxisBandSize, isReverse, lockStatisticsFilter, modeCheck, parseDomainFromStateAndValue, parseDomainFromState, statePointToData } from "./util";
|
|
8
8
|
|
|
9
9
|
import { registerDataSetInstanceParser, registerDataSetInstanceTransform } from "../../data/register";
|
|
10
10
|
|
|
11
|
-
import { BandScale, isContinuous, isDiscrete } from "@visactor/vscale";
|
|
11
|
+
import { BandScale, isContinuous, isDiscrete, LinearScale } from "@visactor/vscale";
|
|
12
12
|
|
|
13
13
|
import { getDirectionByOrient, getOrient } from "../axis/cartesian/util/common";
|
|
14
14
|
|
|
15
|
-
import { mixin,
|
|
15
|
+
import { mixin, isNil, isEqual, isValid, array, minInArray, maxInArray, last, isValidNumber } from "@visactor/vutils";
|
|
16
16
|
|
|
17
17
|
import { dataViewParser, DataView } from "@visactor/vdataset";
|
|
18
18
|
|
|
@@ -24,47 +24,49 @@ import { TransformLevel } from "../../data/initialize";
|
|
|
24
24
|
|
|
25
25
|
import { AttributeLevel } from "../../constant/attribute";
|
|
26
26
|
|
|
27
|
+
import { DataFilterEvent } from "./data-filter-event";
|
|
28
|
+
|
|
29
|
+
import { ChartEvent } from "../../constant/event";
|
|
30
|
+
|
|
27
31
|
export class DataFilterBaseComponent extends BaseComponent {
|
|
32
|
+
get isHorizontal() {
|
|
33
|
+
return this._isHorizontal;
|
|
34
|
+
}
|
|
35
|
+
get stateScale() {
|
|
36
|
+
return this._stateScale;
|
|
37
|
+
}
|
|
28
38
|
get relatedAxisComponent() {
|
|
29
39
|
return this._relatedAxisComponent;
|
|
30
40
|
}
|
|
31
41
|
setStartAndEnd(start, end, rangeMode = [ "percent", "percent" ]) {
|
|
32
|
-
const [startMode = "percent", endMode = "percent"] = rangeMode, startPercent = "percent" === startMode ? start :
|
|
42
|
+
const [startMode = "percent", endMode = "percent"] = rangeMode, startPercent = "percent" === startMode ? start : dataToStatePoint(start, this._stateScale, this._isHorizontal), endPercent = "percent" === endMode ? end : dataToStatePoint(end, this._stateScale, this._isHorizontal);
|
|
33
43
|
this._handleChange(startPercent, endPercent, !0);
|
|
34
44
|
}
|
|
35
45
|
enableInteraction() {
|
|
36
|
-
this.
|
|
46
|
+
this._dataFilterEvent.enableInteraction();
|
|
37
47
|
}
|
|
38
48
|
disableInteraction() {
|
|
39
|
-
this.
|
|
49
|
+
this._dataFilterEvent.disableInteraction();
|
|
40
50
|
}
|
|
41
51
|
zoomIn(location) {
|
|
42
|
-
this.
|
|
43
|
-
zoomDelta: 1.2,
|
|
44
|
-
zoomX: null == location ? void 0 : location.x,
|
|
45
|
-
zoomY: null == location ? void 0 : location.y
|
|
46
|
-
});
|
|
52
|
+
this._dataFilterEvent.zoomIn(location);
|
|
47
53
|
}
|
|
48
54
|
zoomOut(location) {
|
|
49
|
-
this.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
})
|
|
55
|
+
this._dataFilterEvent.zoomOut(location);
|
|
56
|
+
}
|
|
57
|
+
_initEvent() {
|
|
58
|
+
var _a;
|
|
59
|
+
this._dataFilterEvent.initZoomEvent(), null === (_a = this._relatedAxisComponent) || void 0 === _a || _a.event.on(ChartEvent.scaleRawDomainUpdate, (({model: model}) => {
|
|
60
|
+
console.log("scaleRawDomainUpdate", model.getRawDomain());
|
|
61
|
+
}));
|
|
54
62
|
}
|
|
55
63
|
_handleChange(start, end, updateComponent) {
|
|
56
64
|
var _a, _b;
|
|
57
65
|
null !== (_b = null === (_a = this._spec) || void 0 === _a ? void 0 : _a.zoomLock) && void 0 !== _b && _b || end - start !== this._spanCache && (end - start < this._minSpan || end - start > this._maxSpan) ? this._shouldChange = !1 : (this._shouldChange = !0,
|
|
58
66
|
this._spanCache = end - start);
|
|
59
67
|
}
|
|
60
|
-
_isReverse() {
|
|
61
|
-
const axis = this._relatedAxisComponent;
|
|
62
|
-
if (!axis) return !1;
|
|
63
|
-
const axisScale = axis.getScale();
|
|
64
|
-
return axisScale.range()[0] > axisScale.range()[1] && (!axis.getInverse() || this._isHorizontal);
|
|
65
|
-
}
|
|
66
68
|
_updateRangeFactor(tag) {
|
|
67
|
-
const axis = this._relatedAxisComponent, axisScale = axis.getScale(), reverse = this.
|
|
69
|
+
const axis = this._relatedAxisComponent, axisScale = axis.getScale(), reverse = isReverse(axis, this._isHorizontal), newRangeFactor = reverse ? [ 1 - this._end, 1 - this._start ] : [ this._start, this._end ];
|
|
68
70
|
if (reverse) switch (tag) {
|
|
69
71
|
case "startHandler":
|
|
70
72
|
axis.scaleRangeFactorEnd(newRangeFactor[1]);
|
|
@@ -97,26 +99,19 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
97
99
|
}
|
|
98
100
|
constructor(spec, options) {
|
|
99
101
|
super(spec, options), this.layoutType = "none", this._orient = "left", this._cacheVisibility = void 0,
|
|
100
|
-
this._dataUpdating = !1, this.
|
|
101
|
-
this.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
enable: !0,
|
|
107
|
-
rate: 1,
|
|
108
|
-
reverse: !0
|
|
109
|
-
}, this._scrollAttr = {
|
|
110
|
-
enable: !0,
|
|
111
|
-
rate: 1,
|
|
112
|
-
reverse: !0
|
|
102
|
+
this._dataUpdating = !1, this._hasInitStateScale = !1, this._shouldChange = !0,
|
|
103
|
+
this._stateField = "x", this._handleStateChange = (startValue, endValue, tag) => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
return this._startValue = startValue, this._endValue = endValue, this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale),
|
|
106
|
+
null === (_b = (_a = this.effect).onZoomChange) || void 0 === _b || _b.call(_a, tag),
|
|
107
|
+
!0;
|
|
113
108
|
}, this.effect = {
|
|
114
109
|
onZoomChange: tag => {
|
|
115
110
|
var _a, _b;
|
|
116
111
|
const axis = this._relatedAxisComponent;
|
|
117
112
|
if (axis && "axis" === this._filterMode) {
|
|
118
113
|
const axisScale = axis.getScale(), axisSpec = axis.getSpec();
|
|
119
|
-
this._auto &&
|
|
114
|
+
this._auto && getAxisBandSize(axisSpec) && this._spec.ignoreBandSize && (axisScale.bandwidth("auto"),
|
|
120
115
|
axisScale.maxBandwidth("auto"), axisScale.minBandwidth("auto")), this._updateRangeFactor(tag),
|
|
121
116
|
this._auto && (null === (_b = null === (_a = this._component) || void 0 === _a ? void 0 : _a.setStartAndEnd) || void 0 === _b || _b.call(_a, this._start, this._end)),
|
|
122
117
|
axis.effect.scaleUpdate({
|
|
@@ -135,53 +130,11 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
135
130
|
specIndex: this._seriesIndex
|
|
136
131
|
});
|
|
137
132
|
}
|
|
138
|
-
}, this._visible = !0, this.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}, this._handleChartZoom = (params, e) => {
|
|
144
|
-
var _a, _b;
|
|
145
|
-
if (!this._activeRoam || this._zoomAttr.filter && !this._zoomAttr.filter(params, e)) return;
|
|
146
|
-
const {zoomDelta: zoomDelta, zoomX: zoomX, zoomY: zoomY} = params, {x: x, y: y} = this._regions[0].getLayoutStartPoint(), {width: width, height: height} = this._regions[0].getLayoutRect(), delta = Math.abs(this._start - this._end), zoomRate = null !== (_b = null === (_a = this._spec.roamZoom) || void 0 === _a ? void 0 : _a.rate) && void 0 !== _b ? _b : 1;
|
|
147
|
-
if (delta >= 1 && zoomDelta < 1) return;
|
|
148
|
-
if (delta <= .01 && zoomDelta > 1) return;
|
|
149
|
-
const focusLoc = this._isHorizontal ? zoomX : zoomY, totalValue = delta * (zoomDelta - 1) * zoomRate;
|
|
150
|
-
let startValue = totalValue / 2, endValue = totalValue / 2;
|
|
151
|
-
if (focusLoc) {
|
|
152
|
-
const startLoc = this._isHorizontal ? x : y, endLoc = this._isHorizontal ? width : height;
|
|
153
|
-
startValue = Math.abs(startLoc - focusLoc) / Math.abs(endLoc - startLoc) * totalValue,
|
|
154
|
-
endValue = Math.abs(endLoc - focusLoc) / Math.abs(endLoc - startLoc) * totalValue;
|
|
155
|
-
}
|
|
156
|
-
const start = clamp(this._start + startValue, 0, 1), end = clamp(this._end - endValue, 0, 1);
|
|
157
|
-
this._handleChange(Math.min(start, end), Math.max(start, end), !0);
|
|
158
|
-
}, this._handleChartScroll = (params, e) => {
|
|
159
|
-
var _a;
|
|
160
|
-
if (!this._activeRoam || this._scrollAttr.filter && !this._scrollAttr.filter(params, e)) return !1;
|
|
161
|
-
const {scrollX: scrollX, scrollY: scrollY} = params;
|
|
162
|
-
let value = this._isHorizontal ? scrollX : scrollY;
|
|
163
|
-
const active = this._isHorizontal ? abs(scrollX / scrollY) >= .5 : abs(scrollY / scrollX) >= .5;
|
|
164
|
-
this._scrollAttr.reverse || (value = -value), active && this._handleChartMove(value, null !== (_a = this._scrollAttr.rate) && void 0 !== _a ? _a : 1);
|
|
165
|
-
const hasChange = 0 !== this._start && 1 !== this._end;
|
|
166
|
-
return active && hasChange;
|
|
167
|
-
}, this._handleChartDrag = (delta, e) => {
|
|
168
|
-
var _a, _b;
|
|
169
|
-
if (!this._activeRoam || this._dragAttr.filter && !this._dragAttr.filter(delta, e)) return;
|
|
170
|
-
(null === (_a = this._spec.roamDrag) || void 0 === _a ? void 0 : _a.autoVisible) && this.show();
|
|
171
|
-
const [dx, dy] = delta;
|
|
172
|
-
let value = this._isHorizontal ? dx : dy;
|
|
173
|
-
this._dragAttr.reverse && (value = -value), this._handleChartMove(value, null !== (_b = this._dragAttr.rate) && void 0 !== _b ? _b : 1);
|
|
174
|
-
}, this._handleChartMove = (value, rate) => {
|
|
175
|
-
const totalValue = this._isHorizontal ? this.getLayoutRect().width : this.getLayoutRect().height;
|
|
176
|
-
if (Math.abs(value) >= 1e-6) if (value > 0 && this._end < 1) {
|
|
177
|
-
const moveDelta = Math.min(1 - this._end, value / totalValue) * rate;
|
|
178
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, !0);
|
|
179
|
-
} else if (value < 0 && this._start > 0) {
|
|
180
|
-
const moveDelta = Math.max(-this._start, value / totalValue) * rate;
|
|
181
|
-
this._handleChange(this._start + moveDelta, this._end + moveDelta, !0);
|
|
182
|
-
}
|
|
183
|
-
return !1;
|
|
184
|
-
}, this._orient = getOrient(spec), this._isHorizontal = "horizontal" === getDirectionByOrient(this._orient);
|
|
133
|
+
}, this._visible = !0, this._orient = getOrient(spec), this._isHorizontal = "horizontal" === getDirectionByOrient(this._orient),
|
|
134
|
+
this._dataFilterEvent = new DataFilterEvent(this.type, this._spec, this._handleChange.bind(this), this.getLayoutRect.bind(this), (() => ({
|
|
135
|
+
start: this._start,
|
|
136
|
+
end: this._end
|
|
137
|
+
})), (() => this._regions), (() => this._option).bind(this), (() => this.event));
|
|
185
138
|
}
|
|
186
139
|
created() {
|
|
187
140
|
super.created(), this._setAxisFromSpec(), this._setRegionsFromSpec(), this._initEvent(),
|
|
@@ -190,10 +143,61 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
190
143
|
initLayout() {
|
|
191
144
|
super.initLayout(), this._layout && (this._layout.layoutOrient = this._orient);
|
|
192
145
|
}
|
|
146
|
+
init(option) {
|
|
147
|
+
super.init(option), this._addTransformToSeries(), 0 === this._start && 1 === this._end || this.effect.onZoomChange();
|
|
148
|
+
}
|
|
149
|
+
_compareSpec(spec, prevSpec) {
|
|
150
|
+
const result = super._compareSpec(spec, prevSpec);
|
|
151
|
+
return result.reMake || isEqual(prevSpec, spec) || (result.reRender = !0, result.reMake = !0),
|
|
152
|
+
result;
|
|
153
|
+
}
|
|
154
|
+
reInit(spec) {
|
|
155
|
+
super.reInit(spec), this._marks.forEach((g => {
|
|
156
|
+
g.getMarks().forEach((m => {
|
|
157
|
+
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
158
|
+
}));
|
|
159
|
+
}));
|
|
160
|
+
}
|
|
161
|
+
onLayoutStart(layoutRect, viewRect) {
|
|
162
|
+
super.onLayoutStart(layoutRect, viewRect);
|
|
163
|
+
const isShown = this._autoUpdate(layoutRect);
|
|
164
|
+
this._autoVisible(isShown), this._dataUpdating = !1;
|
|
165
|
+
}
|
|
166
|
+
updateLayoutAttribute() {
|
|
167
|
+
this._visible && this._createOrUpdateComponent(), this._hasInitStateScale || (0 === this._start && 1 === this._end || (this._newDomain = parseDomainFromStateAndValue(this._spec.start, this._startValue, this._spec.end, this._endValue, this._stateScale),
|
|
168
|
+
this.effect.onZoomChange()), this._hasInitStateScale = !0);
|
|
169
|
+
}
|
|
170
|
+
_initAfterLayout() {
|
|
171
|
+
this._stateScale = null, this._initStateScale(), this._updateScaleRange(), this._setStateFromAxis();
|
|
172
|
+
}
|
|
173
|
+
_beforeLayoutEnd() {
|
|
174
|
+
this._hasInitStateScale ? this._updateScaleRange() : this._initAfterLayout();
|
|
175
|
+
}
|
|
176
|
+
onLayoutEnd() {
|
|
177
|
+
var _a;
|
|
178
|
+
this._beforeLayoutEnd();
|
|
179
|
+
const isShown = !(0 === this._start && 1 === this._end);
|
|
180
|
+
this._autoVisible(isShown), super.onLayoutEnd(), null === (_a = this._relatedAxisComponent) || void 0 === _a || _a.updateScaleRange();
|
|
181
|
+
}
|
|
182
|
+
getBoundsInRect(rect) {
|
|
183
|
+
const result = {
|
|
184
|
+
x1: this.getLayoutStartPoint().x,
|
|
185
|
+
y1: this.getLayoutStartPoint().y,
|
|
186
|
+
x2: 0,
|
|
187
|
+
y2: 0
|
|
188
|
+
};
|
|
189
|
+
return this._isHorizontal ? (result.y2 = result.y1 + this._height, result.x2 = result.x1 + rect.width) : (result.x2 = result.x1 + this._width,
|
|
190
|
+
result.y2 = result.y1 + rect.height), result;
|
|
191
|
+
}
|
|
192
|
+
setAttrFromSpec() {
|
|
193
|
+
var _a;
|
|
194
|
+
super.setAttrFromSpec(), this._dataFilterEvent.setEventAttrFromSpec(), this._field = this._spec.field,
|
|
195
|
+
this._width = this._computeWidth(), this._height = this._computeHeight(), this._visible = null === (_a = this._spec.visible) || void 0 === _a || _a;
|
|
196
|
+
}
|
|
193
197
|
_setAxisFromSpec() {
|
|
194
198
|
if (isValid(this._spec.axisId) ? this._relatedAxisComponent = this._option.getComponentByUserId(this._spec.axisId) : isValid(this._spec.axisIndex) && (this._relatedAxisComponent = this._option.getComponentByIndex("axes", this._spec.axisIndex)),
|
|
195
199
|
isNil(this._spec.field) && !this._relatedAxisComponent) {
|
|
196
|
-
const axes = this._option.getComponentsByKey("axes"), sameOrientAxis = axes.find((cm => cm._orient === this._orient));
|
|
200
|
+
const axes = this._option.getComponentsByKey("axes"), sameOrientAxis = axes.find((cm => getDirectionByOrient(cm._orient) === getDirectionByOrient(this._orient)));
|
|
197
201
|
if (sameOrientAxis) this._relatedAxisComponent = sameOrientAxis; else {
|
|
198
202
|
const bandAxis = axes.find((cm => !isContinuous(cm.getScale().type)));
|
|
199
203
|
this._relatedAxisComponent = bandAxis;
|
|
@@ -223,27 +227,8 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
223
227
|
this._regions = ids.length ? this._regions.filter((r => ids.includes(r.id))) : [];
|
|
224
228
|
} else ;
|
|
225
229
|
}
|
|
226
|
-
onDataUpdate() {
|
|
227
|
-
var _a;
|
|
228
|
-
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
229
|
-
this._stateScale.domain(domain, !1), this._handleChange(this._start, this._end, !0),
|
|
230
|
-
this._spec.auto && !isEqual(this._domainCache, domain) && (this._domainCache = domain,
|
|
231
|
-
this._dataUpdating = !0, null === (_a = this.getChart()) || void 0 === _a || _a.setLayoutTag(!0, null, !1));
|
|
232
|
-
}
|
|
233
|
-
_computeDomainOfStateScale(isContinuous) {
|
|
234
|
-
if (this._spec.customDomain) return this._spec.customDomain;
|
|
235
|
-
const domain = this._data.getLatestData().map((d => d[this._stateField]));
|
|
236
|
-
if (isContinuous) {
|
|
237
|
-
const domainNum = domain.map((n => 1 * n));
|
|
238
|
-
return domain.length ? [ minInArray(domainNum), maxInArray(domainNum) ] : [ -1 / 0, 1 / 0 ];
|
|
239
|
-
}
|
|
240
|
-
return domain;
|
|
241
|
-
}
|
|
242
|
-
_initEvent() {
|
|
243
|
-
this._initCommonEvent();
|
|
244
|
-
}
|
|
245
230
|
_initData() {
|
|
246
|
-
const dataCollection = [], stateFields = [], valueFields = [];
|
|
231
|
+
const dataCollection = [], seriesCollection = [], stateFields = [], valueFields = [];
|
|
247
232
|
let isCategoryState;
|
|
248
233
|
if (this._relatedAxisComponent) {
|
|
249
234
|
const originalStateFields = {};
|
|
@@ -251,21 +236,22 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
251
236
|
var _a, _b;
|
|
252
237
|
const xAxisHelper = "cartesian" === s.coordinate ? s.getXAxisHelper() : "polar" === s.coordinate ? s.angleAxisHelper : null, yAxisHelper = "cartesian" === s.coordinate ? s.getYAxisHelper() : "polar" === s.coordinate ? s.radiusAxisHelper : null;
|
|
253
238
|
if (!xAxisHelper || !yAxisHelper) return;
|
|
254
|
-
const stateAxisHelper = xAxisHelper.getAxisId() === this._relatedAxisComponent.id ? xAxisHelper : yAxisHelper.getAxisId() === this._relatedAxisComponent.id ? yAxisHelper : this._isHorizontal ? xAxisHelper : yAxisHelper, valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper;
|
|
239
|
+
const stateAxisHelper = xAxisHelper.getAxisId() === this._relatedAxisComponent.id ? xAxisHelper : yAxisHelper.getAxisId() === this._relatedAxisComponent.id ? yAxisHelper : this._isHorizontal ? xAxisHelper : yAxisHelper, valueAxisHelper = stateAxisHelper === xAxisHelper ? yAxisHelper : xAxisHelper, isValidateValueAxis = isContinuous(valueAxisHelper.getScale(0).type), isValidateStateAxis = isContinuous(stateAxisHelper.getScale(0).type);
|
|
255
240
|
dataCollection.push(s.getRawData());
|
|
256
241
|
const seriesSpec = s.getSpec(), xField = "cartesian" === s.coordinate ? array(seriesSpec.xField) : array(null !== (_a = seriesSpec.angleField) && void 0 !== _a ? _a : seriesSpec.categoryField), yField = "cartesian" === s.coordinate ? array(seriesSpec.yField) : array(null !== (_b = seriesSpec.radiusField) && void 0 !== _b ? _b : seriesSpec.valueField);
|
|
257
242
|
if (originalStateFields[s.id] = "link" === s.type ? [ "from_xField" ] : stateAxisHelper === xAxisHelper ? xField : yField,
|
|
258
|
-
|
|
259
|
-
this._valueField) {
|
|
243
|
+
isValidateStateAxis ? (isCategoryState = !1, stateFields.push(originalStateFields[s.id])) : (isCategoryState = !0,
|
|
244
|
+
stateFields.push(originalStateFields[s.id][0])), this._valueField) {
|
|
260
245
|
const valueField = "link" === s.type ? [ "from_yField" ] : valueAxisHelper === xAxisHelper ? xField : yField;
|
|
261
|
-
|
|
246
|
+
isValidateValueAxis && valueFields.push(...valueField);
|
|
262
247
|
}
|
|
263
248
|
}), {
|
|
264
249
|
userId: this._seriesUserId,
|
|
265
250
|
specIndex: this._seriesIndex
|
|
266
251
|
}), this._originalStateFields = originalStateFields;
|
|
267
252
|
} else eachSeries(this._regions, (s => {
|
|
268
|
-
dataCollection.push(s.getRawData()),
|
|
253
|
+
dataCollection.push(s.getRawData()), seriesCollection.push(s), stateFields.push(this._field),
|
|
254
|
+
this._valueField && valueFields.push(this._spec.valueField);
|
|
269
255
|
}), {
|
|
270
256
|
userId: this._seriesUserId,
|
|
271
257
|
specIndex: this._seriesIndex
|
|
@@ -280,6 +266,7 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
280
266
|
options: {
|
|
281
267
|
input: {
|
|
282
268
|
dataCollection: dataCollection,
|
|
269
|
+
seriesCollection: seriesCollection,
|
|
283
270
|
stateFields: stateFields,
|
|
284
271
|
valueFields: valueFields,
|
|
285
272
|
isCategoryState: isCategoryState
|
|
@@ -292,64 +279,6 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
292
279
|
}, !1), this._data = new CompilableData(this._option, data), data.reRunAllTransform(),
|
|
293
280
|
dataSet.multipleDataViewAddListener(dataCollection, "change", this._handleDataCollectionChange.bind(this));
|
|
294
281
|
}
|
|
295
|
-
setAttrFromSpec() {
|
|
296
|
-
var _a;
|
|
297
|
-
super.setAttrFromSpec(), !0 === this._spec.roamZoom || this._spec.roamZoom ? this._zoomAttr = merge({}, this._zoomAttr, this._spec.roamZoom) : this._zoomAttr.enable = !1,
|
|
298
|
-
!0 === this._spec.roamDrag || this._spec.roamDrag ? this._dragAttr = merge({}, this._dragAttr, this._spec.roamDrag) : this._dragAttr.enable = !1,
|
|
299
|
-
!0 === this._spec.roamScroll || this._spec.roamScroll ? this._scrollAttr = merge({}, this._scrollAttr, this._spec.roamScroll) : this._scrollAttr.enable = !1,
|
|
300
|
-
this._field = this._spec.field, this._width = this._computeWidth(), this._height = this._computeHeight(),
|
|
301
|
-
this._visible = null === (_a = this._spec.visible) || void 0 === _a || _a;
|
|
302
|
-
}
|
|
303
|
-
statePointToData(state) {
|
|
304
|
-
const scale = this._stateScale, domain = scale.domain();
|
|
305
|
-
if (isContinuous(scale.type)) return this._isReverse() ? domain[0] + (last(domain) - domain[0]) * (1 - state) : domain[0] + (last(domain) - domain[0]) * state;
|
|
306
|
-
let range = scale.range();
|
|
307
|
-
this._isReverse() && (range = range.slice().reverse());
|
|
308
|
-
const posInRange = range[0] + (last(range) - range[0]) * state;
|
|
309
|
-
return scale.invert(posInRange);
|
|
310
|
-
}
|
|
311
|
-
dataToStatePoint(data) {
|
|
312
|
-
const scale = this._stateScale, pos = scale.scale(data);
|
|
313
|
-
let range = scale.range();
|
|
314
|
-
return !this._isHorizontal && isContinuous(scale.type) && (range = range.slice().reverse()),
|
|
315
|
-
(pos - range[0]) / (last(range) - range[0]);
|
|
316
|
-
}
|
|
317
|
-
_modeCheck(statePoint, mode) {
|
|
318
|
-
return "start" === statePoint ? "percent" === mode && isValid(this._spec.start) || "value" === mode && isValid(this._spec.startValue) : "percent" === mode && isValid(this._spec.end) || "value" === mode && isValid(this._spec.endValue);
|
|
319
|
-
}
|
|
320
|
-
_setStateFromSpec() {
|
|
321
|
-
var _a, _b;
|
|
322
|
-
let start, end;
|
|
323
|
-
if (this._auto = !!this._spec.auto, this._spec.rangeMode) {
|
|
324
|
-
const [startMode, endMode] = this._spec.rangeMode;
|
|
325
|
-
this._modeCheck("start", startMode) && this._modeCheck("end", endMode) && (start = "percent" === startMode ? this._spec.start : this.dataToStatePoint(this._spec.startValue),
|
|
326
|
-
end = "percent" === endMode ? this._spec.end : this.dataToStatePoint(this._spec.endValue));
|
|
327
|
-
} else start = this._spec.start ? this._spec.start : this._spec.startValue ? this.dataToStatePoint(this._spec.startValue) : 0,
|
|
328
|
-
end = this._spec.end ? this._spec.end : this._spec.endValue ? this.dataToStatePoint(this._spec.endValue) : 1;
|
|
329
|
-
this._startValue = this.statePointToData(start), this._endValue = this.statePointToData(end),
|
|
330
|
-
this._start = start, this._end = end, this._minSpan = null !== (_a = this._spec.minSpan) && void 0 !== _a ? _a : 0,
|
|
331
|
-
this._maxSpan = null !== (_b = this._spec.maxSpan) && void 0 !== _b ? _b : 1, isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain()) && (this._spec.minValueSpan && (this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0])),
|
|
332
|
-
this._spec.maxValueSpan && (this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]))),
|
|
333
|
-
this._minSpan = Math.max(0, this._minSpan), this._maxSpan = Math.min(this._maxSpan, 1),
|
|
334
|
-
this._relatedAxisComponent && "axis" === this._filterMode || 0 === this._start && 1 === this._end || (this._newDomain = this._parseDomainFromState(this._startValue, this._endValue));
|
|
335
|
-
}
|
|
336
|
-
_parseFieldOfSeries(s) {
|
|
337
|
-
var _a;
|
|
338
|
-
return null === (_a = this._originalStateFields) || void 0 === _a ? void 0 : _a[s.id];
|
|
339
|
-
}
|
|
340
|
-
_initStateScale() {
|
|
341
|
-
const defaultRange = [ 0, 1 ];
|
|
342
|
-
if (this._relatedAxisComponent) {
|
|
343
|
-
const scale = this._relatedAxisComponent.getScale(), isContinuousScale = isContinuous(scale.type), domain = this._computeDomainOfStateScale(isContinuousScale);
|
|
344
|
-
if (this._stateScale = scale.clone(), isContinuousScale) {
|
|
345
|
-
const domainNum = domain.map((n => 1 * n));
|
|
346
|
-
this._stateScale.domain(domain.length ? [ minInArray(domainNum), maxInArray(domainNum) ] : [ 0, 1 ], !0).range(defaultRange);
|
|
347
|
-
} else this._stateScale.domain(domain, !0).range(defaultRange);
|
|
348
|
-
} else this._stateScale = new BandScale, this._stateScale.domain(this._computeDomainOfStateScale(), !0).range(defaultRange);
|
|
349
|
-
}
|
|
350
|
-
init(option) {
|
|
351
|
-
super.init(option), this._addTransformToSeries(), 0 === this._start && 1 === this._end || this.effect.onZoomChange();
|
|
352
|
-
}
|
|
353
282
|
_addTransformToSeries() {
|
|
354
283
|
this._relatedAxisComponent && "axis" === this._filterMode || (registerDataSetInstanceTransform(this._option.dataSet, "dataFilterWithNewDomain", dataFilterWithNewDomain),
|
|
355
284
|
registerDataSetInstanceTransform(this._option.dataSet, "lockStatisticsFilter", lockStatisticsFilter),
|
|
@@ -383,43 +312,67 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
383
312
|
specIndex: this._seriesIndex
|
|
384
313
|
}));
|
|
385
314
|
}
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
315
|
+
onDataUpdate() {
|
|
316
|
+
var _a;
|
|
317
|
+
const domain = this._computeDomainOfStateScale(isContinuous(this._stateScale.type));
|
|
318
|
+
this._stateScale.domain(domain, !1), this._handleChange(this._start, this._end, !0),
|
|
319
|
+
this._spec.auto && !isEqual(this._domainCache, domain) && (this._domainCache = domain,
|
|
320
|
+
this._dataUpdating = !0, null === (_a = this.getChart()) || void 0 === _a || _a.setLayoutTag(!0, null, !1));
|
|
390
321
|
}
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
this.initMarkStyleWithSpec(m, this._spec[m.name]);
|
|
395
|
-
}));
|
|
396
|
-
}));
|
|
322
|
+
_parseFieldOfSeries(s) {
|
|
323
|
+
var _a;
|
|
324
|
+
return null === (_a = this._originalStateFields) || void 0 === _a ? void 0 : _a[s.id];
|
|
397
325
|
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
this.
|
|
413
|
-
this.
|
|
414
|
-
null
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
326
|
+
_setStateFromSpec() {
|
|
327
|
+
let start, end;
|
|
328
|
+
if (this._auto = !!this._spec.auto, this._spec.rangeMode) {
|
|
329
|
+
const [startMode, endMode] = this._spec.rangeMode;
|
|
330
|
+
modeCheck("start", startMode, this._spec) && modeCheck("end", endMode, this._spec) && (start = "percent" === startMode ? this._spec.start : dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal),
|
|
331
|
+
end = "percent" === endMode ? this._spec.end : dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal));
|
|
332
|
+
} else start = this._spec.start ? this._spec.start : this._spec.startValue ? dataToStatePoint(this._spec.startValue, this._stateScale, this._isHorizontal) : 0,
|
|
333
|
+
end = this._spec.end ? this._spec.end : this._spec.endValue ? dataToStatePoint(this._spec.endValue, this._stateScale, this._isHorizontal) : 1;
|
|
334
|
+
this._start = Math.max(0, Math.min(1, start)), this._end = Math.max(0, Math.min(1, end));
|
|
335
|
+
}
|
|
336
|
+
_setStateFromAxis() {
|
|
337
|
+
var _a, _b;
|
|
338
|
+
this._setStateFromSpec();
|
|
339
|
+
const axis = this._relatedAxisComponent;
|
|
340
|
+
this._startValue = statePointToData(this._start, this._stateScale, isReverse(axis, this._isHorizontal)),
|
|
341
|
+
this._endValue = statePointToData(this._end, this._stateScale, isReverse(axis, this._isHorizontal)),
|
|
342
|
+
this._minSpan = null !== (_a = this._spec.minSpan) && void 0 !== _a ? _a : 0, this._maxSpan = null !== (_b = this._spec.maxSpan) && void 0 !== _b ? _b : 1,
|
|
343
|
+
isContinuous(this._stateScale.type) && this._stateScale.domain()[0] !== last(this._stateScale.domain()) && (this._spec.minValueSpan && (this._minSpan = this._spec.minValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0])),
|
|
344
|
+
this._spec.maxValueSpan && (this._maxSpan = this._spec.maxValueSpan / (last(this._stateScale.domain()) - this._stateScale.domain()[0]))),
|
|
345
|
+
this._minSpan = Math.max(0, this._minSpan), this._maxSpan = Math.min(this._maxSpan, 1),
|
|
346
|
+
axis && (axis && "axis" === this._filterMode || 0 === this._start && 1 === this._end || (this._newDomain = parseDomainFromState(this._startValue, this._endValue, this._stateScale)));
|
|
347
|
+
}
|
|
348
|
+
_initStateScale() {
|
|
349
|
+
var _a, _b, _c, _d, _e, _f;
|
|
350
|
+
const defaultRange = [ 0, 1 ];
|
|
351
|
+
if (this._relatedAxisComponent) {
|
|
352
|
+
const scale = this._relatedAxisComponent.getScale().clone();
|
|
353
|
+
this._stateScale = scale, null === (_b = (_a = scale).maxBandwidth) || void 0 === _b || _b.call(_a, "auto", !0),
|
|
354
|
+
null === (_d = (_c = scale).minBandwidth) || void 0 === _d || _d.call(_c, "auto", !0),
|
|
355
|
+
null === (_f = (_e = scale).bandwidth) || void 0 === _f || _f.call(_e, "auto", !0),
|
|
356
|
+
scale.rangeFactor(defaultRange, !0).range(defaultRange);
|
|
357
|
+
} else {
|
|
358
|
+
let fieldLinear = !0;
|
|
359
|
+
this._field && eachSeries(this._regions, (s => {
|
|
360
|
+
const stats = s.getRawDataStatisticsByField(this._field);
|
|
361
|
+
isValidNumber(null == stats ? void 0 : stats.min) && isValidNumber(null == stats ? void 0 : stats.max) || (fieldLinear = !1);
|
|
362
|
+
}), {
|
|
363
|
+
userId: this._seriesUserId,
|
|
364
|
+
specIndex: this._seriesIndex
|
|
365
|
+
}), this._stateScale = fieldLinear ? new LinearScale : new BandScale, this._stateScale.domain(this._computeDomainOfStateScale(fieldLinear), !0).range(defaultRange);
|
|
419
366
|
}
|
|
420
367
|
}
|
|
421
|
-
|
|
422
|
-
this.
|
|
368
|
+
_computeDomainOfStateScale(isContinuous) {
|
|
369
|
+
if (this._spec.customDomain) return this._spec.customDomain;
|
|
370
|
+
const domain = this._data.getLatestData().map((d => d[this._stateField]));
|
|
371
|
+
if (isContinuous) {
|
|
372
|
+
const domainNum = domain.map((n => 1 * n));
|
|
373
|
+
return domain.length ? [ minInArray(domainNum), maxInArray(domainNum) ] : [ -1 / 0, 1 / 0 ];
|
|
374
|
+
}
|
|
375
|
+
return domain;
|
|
423
376
|
}
|
|
424
377
|
_autoVisible(isShown) {
|
|
425
378
|
if (!this._auto) return;
|
|
@@ -431,25 +384,6 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
431
384
|
[sizeKey]: AttributeLevel.Built_In
|
|
432
385
|
});
|
|
433
386
|
}
|
|
434
|
-
onLayoutStart(layoutRect, viewRect) {
|
|
435
|
-
super.onLayoutStart(layoutRect, viewRect);
|
|
436
|
-
const isShown = this._autoUpdate(layoutRect);
|
|
437
|
-
this._autoVisible(isShown), this._dataUpdating = !1;
|
|
438
|
-
}
|
|
439
|
-
onLayoutEnd() {
|
|
440
|
-
const isShown = !(0 === this._start && 1 === this._end);
|
|
441
|
-
this._autoVisible(isShown), super.onLayoutEnd();
|
|
442
|
-
}
|
|
443
|
-
getBoundsInRect(rect) {
|
|
444
|
-
const result = {
|
|
445
|
-
x1: this.getLayoutStartPoint().x,
|
|
446
|
-
y1: this.getLayoutStartPoint().y,
|
|
447
|
-
x2: 0,
|
|
448
|
-
y2: 0
|
|
449
|
-
};
|
|
450
|
-
return this._isHorizontal ? (result.y2 = result.y1 + this._height, result.x2 = result.x1 + rect.width) : (result.x2 = result.x1 + this._width,
|
|
451
|
-
result.y2 = result.y1 + rect.height), result;
|
|
452
|
-
}
|
|
453
387
|
hide() {
|
|
454
388
|
var _a;
|
|
455
389
|
null === (_a = this._component) || void 0 === _a || _a.hideAll();
|
|
@@ -458,18 +392,10 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
458
392
|
var _a;
|
|
459
393
|
null === (_a = this._component) || void 0 === _a || _a.showAll();
|
|
460
394
|
}
|
|
461
|
-
_getAxisBandSize(axisSpec) {
|
|
462
|
-
const bandSize = null == axisSpec ? void 0 : axisSpec.bandSize, maxBandSize = null == axisSpec ? void 0 : axisSpec.maxBandSize, minBandSize = null == axisSpec ? void 0 : axisSpec.minBandSize;
|
|
463
|
-
if (bandSize || minBandSize || maxBandSize) return {
|
|
464
|
-
bandSize: bandSize,
|
|
465
|
-
maxBandSize: maxBandSize,
|
|
466
|
-
minBandSize: minBandSize
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
395
|
_autoUpdate(rect) {
|
|
470
396
|
var _a, _b, _c, _d, _e, _f;
|
|
471
397
|
if (!this._auto) return this._cacheVisibility = void 0, !0;
|
|
472
|
-
const axis = this._relatedAxisComponent, axisSpec = null == axis ? void 0 : axis.getSpec(), axisScale = null == axis ? void 0 : axis.getScale(), bandSizeResult =
|
|
398
|
+
const axis = this._relatedAxisComponent, axisSpec = null == axis ? void 0 : axis.getSpec(), axisScale = null == axis ? void 0 : axis.getScale(), bandSizeResult = getAxisBandSize(axisSpec);
|
|
473
399
|
if (!this._dataUpdating && isDiscrete(axisScale.type) && (null == rect ? void 0 : rect.height) === (null === (_a = this._cacheRect) || void 0 === _a ? void 0 : _a.height) && (null == rect ? void 0 : rect.width) === (null === (_b = this._cacheRect) || void 0 === _b ? void 0 : _b.width) && this._fixedBandSize === (null == bandSizeResult ? void 0 : bandSizeResult.bandSize)) return this._cacheVisibility;
|
|
474
400
|
let isShown = !0;
|
|
475
401
|
if (this._isHorizontal && (null == rect ? void 0 : rect.width) !== (null === (_c = this._cacheRect) || void 0 === _c ? void 0 : _c.width) ? axisScale.range(axis.getInverse() ? [ rect.width, 0 ] : [ 0, rect.width ]) : (null == rect ? void 0 : rect.height) !== (null === (_d = this._cacheRect) || void 0 === _d ? void 0 : _d.height) && axisScale.range(axis.getInverse() ? [ 0, rect.height ] : [ rect.height, 0 ]),
|
|
@@ -492,9 +418,6 @@ export class DataFilterBaseComponent extends BaseComponent {
|
|
|
492
418
|
_getNeedClearVRenderComponents() {
|
|
493
419
|
return [ this._component ];
|
|
494
420
|
}
|
|
495
|
-
clear() {
|
|
496
|
-
this._throttledHide = null;
|
|
497
|
-
}
|
|
498
421
|
}
|
|
499
422
|
|
|
500
423
|
mixin(DataFilterBaseComponent, Zoomable);
|