tvcharts 0.5.71 → 0.5.73
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/dist/echarts.common.js +191 -132
- package/dist/echarts.common.js.map +1 -1
- package/dist/echarts.common.min.js +2 -2
- package/dist/echarts.js +17 -40
- package/dist/echarts.js.map +2 -2
- package/dist/echarts.min.js +1 -1
- package/dist/echarts.simple.js +81 -4
- package/dist/echarts.simple.js.map +1 -1
- package/dist/echarts.simple.min.js +1 -1
- package/lib/component/axisPointer/viewHelper.js +1 -0
- package/lib/component/graphic/GraphicView.js +52 -47
- package/lib/coord/Axis.js +1 -1
- package/package.json +1 -1
package/dist/echarts.common.js
CHANGED
|
@@ -2936,15 +2936,15 @@
|
|
|
2936
2936
|
return Storage;
|
|
2937
2937
|
}());
|
|
2938
2938
|
|
|
2939
|
-
var requestAnimationFrame;
|
|
2940
|
-
requestAnimationFrame = (env.hasGlobalWindow
|
|
2939
|
+
var requestAnimationFrame$1;
|
|
2940
|
+
requestAnimationFrame$1 = (env.hasGlobalWindow
|
|
2941
2941
|
&& ((window.requestAnimationFrame && window.requestAnimationFrame.bind(window))
|
|
2942
2942
|
|| (window.msRequestAnimationFrame && window.msRequestAnimationFrame.bind(window))
|
|
2943
2943
|
|| window.mozRequestAnimationFrame
|
|
2944
2944
|
|| window.webkitRequestAnimationFrame)) || function (func) {
|
|
2945
2945
|
return setTimeout(func, 16);
|
|
2946
2946
|
};
|
|
2947
|
-
var requestAnimationFrame$
|
|
2947
|
+
var requestAnimationFrame$2 = requestAnimationFrame$1;
|
|
2948
2948
|
|
|
2949
2949
|
var easingFuncs = {
|
|
2950
2950
|
linear: function (k) {
|
|
@@ -5082,11 +5082,11 @@
|
|
|
5082
5082
|
this._running = true;
|
|
5083
5083
|
function step() {
|
|
5084
5084
|
if (self._running) {
|
|
5085
|
-
requestAnimationFrame$
|
|
5085
|
+
requestAnimationFrame$2(step);
|
|
5086
5086
|
!self._paused && self.update();
|
|
5087
5087
|
}
|
|
5088
5088
|
}
|
|
5089
|
-
requestAnimationFrame$
|
|
5089
|
+
requestAnimationFrame$2(step);
|
|
5090
5090
|
};
|
|
5091
5091
|
Animation.prototype.start = function () {
|
|
5092
5092
|
if (this._running) {
|
|
@@ -26322,6 +26322,66 @@
|
|
|
26322
26322
|
triggerUpdatedEvent.call(this, silent);
|
|
26323
26323
|
}
|
|
26324
26324
|
};
|
|
26325
|
+
// 新增一个方法用于更新图表的配置(在不影响其他组件的情况下)
|
|
26326
|
+
ECharts.prototype.updateComOption = function (option, opt) {
|
|
26327
|
+
var _this = this;
|
|
26328
|
+
if (this[IN_MAIN_PROCESS_KEY]) {
|
|
26329
|
+
if ("development" !== 'production') {
|
|
26330
|
+
error('`updateComOption` should not be called during main process.');
|
|
26331
|
+
}
|
|
26332
|
+
return;
|
|
26333
|
+
}
|
|
26334
|
+
if (this._disposed) {
|
|
26335
|
+
disposedWarning(this.id);
|
|
26336
|
+
return;
|
|
26337
|
+
}
|
|
26338
|
+
if (!isObject(opt)) {
|
|
26339
|
+
opt = {
|
|
26340
|
+
silent: !!opt
|
|
26341
|
+
};
|
|
26342
|
+
}
|
|
26343
|
+
var replaceMerge;
|
|
26344
|
+
this[IN_MAIN_PROCESS_KEY] = true;
|
|
26345
|
+
var mainTypes = Object.keys(option);
|
|
26346
|
+
if (!this._model) {
|
|
26347
|
+
error('图表尚未初始化');
|
|
26348
|
+
return;
|
|
26349
|
+
}
|
|
26350
|
+
this._model.setOption(option, {
|
|
26351
|
+
replaceMerge: replaceMerge
|
|
26352
|
+
}, optionPreprocessorFuncs);
|
|
26353
|
+
this._model.eachComponent(function (type, modal) {
|
|
26354
|
+
if (mainTypes.includes(type)) {
|
|
26355
|
+
var view = _this._componentsMap[modal.__viewId];
|
|
26356
|
+
if (view) {
|
|
26357
|
+
view.render(modal, _this._model, _this._api, {
|
|
26358
|
+
type: 'updateComOption'
|
|
26359
|
+
});
|
|
26360
|
+
}
|
|
26361
|
+
}
|
|
26362
|
+
});
|
|
26363
|
+
// // May dispatchAction in rendering procedure
|
|
26364
|
+
// if (this[IN_MAIN_PROCESS_KEY]) {
|
|
26365
|
+
// this._pendingActions.push(payload);
|
|
26366
|
+
// return;
|
|
26367
|
+
// }
|
|
26368
|
+
var silent = opt.silent;
|
|
26369
|
+
// doDispatchAction.call(this, payload, silent);
|
|
26370
|
+
var flush = opt.flush;
|
|
26371
|
+
if (flush) {
|
|
26372
|
+
this._zr.flush();
|
|
26373
|
+
} else if (flush !== false && env.browser.weChat) {
|
|
26374
|
+
// In WeChat embedded browser, `requestAnimationFrame` and `setInterval`
|
|
26375
|
+
// hang when sliding page (on touch event), which cause that zr does not
|
|
26376
|
+
// refresh until user interaction finished, which is not expected.
|
|
26377
|
+
// But `dispatchAction` may be called too frequently when pan on touch
|
|
26378
|
+
// screen, which impacts performance if do not throttle them.
|
|
26379
|
+
this._throttledZrFlush();
|
|
26380
|
+
}
|
|
26381
|
+
this[IN_MAIN_PROCESS_KEY] = false;
|
|
26382
|
+
flushPendingActions.call(this, silent);
|
|
26383
|
+
// triggerUpdatedEvent.call(this, silent);
|
|
26384
|
+
};
|
|
26325
26385
|
/**
|
|
26326
26386
|
* @deprecated
|
|
26327
26387
|
*/
|
|
@@ -27244,6 +27304,7 @@
|
|
|
27244
27304
|
var cptTypeTmp = (actionInfo.update || 'update').split(':');
|
|
27245
27305
|
var updateMethod = cptTypeTmp.pop();
|
|
27246
27306
|
var cptType = cptTypeTmp[0] != null && parseClassType(cptTypeTmp[0]);
|
|
27307
|
+
// console.log('%c [ cptType ]-1960', 'font-size:13px; background:pink; color:#bf2c9f;', cptType)
|
|
27247
27308
|
this[IN_MAIN_PROCESS_KEY] = true;
|
|
27248
27309
|
var payloads = [payload];
|
|
27249
27310
|
var batched = false;
|
|
@@ -30819,7 +30880,7 @@
|
|
|
30819
30880
|
};
|
|
30820
30881
|
OrdinalScale.prototype.contain = function (rank) {
|
|
30821
30882
|
rank = this.parse(rank);
|
|
30822
|
-
return contain$1(rank, this._extent) && (this._ordinalMeta.categories[rank] != null || this._ordinalMeta.extraCategory[rank -
|
|
30883
|
+
return contain$1(rank, this._extent) && (this._ordinalMeta.categories[rank] != null || this._ordinalMeta.extraCategory[rank - this._ordinalMeta.categories.length] != null);
|
|
30823
30884
|
};
|
|
30824
30885
|
/**
|
|
30825
30886
|
* Normalize given rank or name to linear [0, 1]
|
|
@@ -30916,7 +30977,7 @@
|
|
|
30916
30977
|
OrdinalScale.prototype.getLabel = function (tick) {
|
|
30917
30978
|
if (!this.isBlank()) {
|
|
30918
30979
|
var ordinalNumber = this.getRawOrdinalNumber(tick.value);
|
|
30919
|
-
var cateogry = this._ordinalMeta.categories[ordinalNumber] || this._ordinalMeta.extraCategory[ordinalNumber -
|
|
30980
|
+
var cateogry = this._ordinalMeta.categories[ordinalNumber] || this._ordinalMeta.extraCategory[ordinalNumber - this._ordinalMeta.categories.length];
|
|
30920
30981
|
// Note that if no data, ordinalMeta.categories is an empty array.
|
|
30921
30982
|
// Return empty if it's not exist.
|
|
30922
30983
|
return cateogry == null ? '' : cateogry + '';
|
|
@@ -33312,6 +33373,7 @@
|
|
|
33312
33373
|
}
|
|
33313
33374
|
|
|
33314
33375
|
var inner$5 = makeInner();
|
|
33376
|
+
var dataTimeInner = makeInner();
|
|
33315
33377
|
function createAxisLabels(axis) {
|
|
33316
33378
|
// Only ordinal scale support tick interval
|
|
33317
33379
|
return axis.type === 'category' ? makeCategoryLabels(axis) : makeRealNumberLabels(axis);
|
|
@@ -33598,6 +33660,11 @@
|
|
|
33598
33660
|
marks: masks
|
|
33599
33661
|
};
|
|
33600
33662
|
}
|
|
33663
|
+
var ecModal = axis.model.ecModel;
|
|
33664
|
+
if (!dataTimeInner(ecModal).dataTimeCatch) {
|
|
33665
|
+
dataTimeInner(ecModal).dataTimeCatch = {};
|
|
33666
|
+
}
|
|
33667
|
+
var dataTimeCatch_1 = dataTimeInner(ecModal).dataTimeCatch;
|
|
33601
33668
|
masks.forEach(function (item) {
|
|
33602
33669
|
var visible = item.index >= ordinalExtent[0] && item.index <= ordinalExtent[1];
|
|
33603
33670
|
if (visible) {
|
|
@@ -33605,8 +33672,18 @@
|
|
|
33605
33672
|
value: item.index
|
|
33606
33673
|
};
|
|
33607
33674
|
var weightType = weightToTickMarkType(item.weight, true, true);
|
|
33675
|
+
var locale = 'zh-CN';
|
|
33676
|
+
var key = item.originalTime + locale;
|
|
33677
|
+
// console.log('%c [ axis ]-409', 'font-size:13px; background:pink; color:#bf2c9f;', ecModal);
|
|
33678
|
+
var formattedLabel = dataTimeCatch_1[key];
|
|
33679
|
+
if (!formattedLabel) {
|
|
33680
|
+
formattedLabel = defaultTickMarkFormatter(item, weightType, locale);
|
|
33681
|
+
dataTimeCatch_1[key] = formattedLabel;
|
|
33682
|
+
// dataTimeInner(ecModal).dataTimeCatch = dataTimeCatch;
|
|
33683
|
+
}
|
|
33684
|
+
|
|
33608
33685
|
result.push({
|
|
33609
|
-
formattedLabel:
|
|
33686
|
+
formattedLabel: formattedLabel,
|
|
33610
33687
|
rawLabel: ordinalScale.getLabel(tickObj),
|
|
33611
33688
|
tickValue: item.index
|
|
33612
33689
|
});
|
|
@@ -33729,7 +33806,7 @@
|
|
|
33729
33806
|
var dataIndex = data;
|
|
33730
33807
|
var dataCount = this.scale.getAxisDataLen();
|
|
33731
33808
|
var deltaFromRight = dataCount + scale.lastBarRightSideDiffBarCount - dataIndex;
|
|
33732
|
-
return Math.floor(this._extent[1] - deltaFromRight * scale.barSpace);
|
|
33809
|
+
return Math.floor(this._extent[1] - (deltaFromRight - 0.5) * scale.barSpace) - 0.5;
|
|
33733
33810
|
}
|
|
33734
33811
|
if (this.onBand && scale.type === 'ordinal') {
|
|
33735
33812
|
extent = extent.slice();
|
|
@@ -36503,7 +36580,7 @@
|
|
|
36503
36580
|
}
|
|
36504
36581
|
if (!finished) {
|
|
36505
36582
|
var self_1 = this;
|
|
36506
|
-
requestAnimationFrame$
|
|
36583
|
+
requestAnimationFrame$2(function () {
|
|
36507
36584
|
self_1._paintList(list, prevList, paintAll, redrawId);
|
|
36508
36585
|
});
|
|
36509
36586
|
}
|
|
@@ -45052,6 +45129,7 @@
|
|
|
45052
45129
|
padding: paddings,
|
|
45053
45130
|
backgroundColor: bgColor
|
|
45054
45131
|
}),
|
|
45132
|
+
// z: labelModel.get('z'),
|
|
45055
45133
|
// Label should be over axisPointer.
|
|
45056
45134
|
z2: 10
|
|
45057
45135
|
};
|
|
@@ -47010,6 +47088,7 @@
|
|
|
47010
47088
|
});
|
|
47011
47089
|
var width = api.getWidth();
|
|
47012
47090
|
var seriesLabels = this._seriesLabels;
|
|
47091
|
+
var backgroundColor = ecModel.get('backgroundColor');
|
|
47013
47092
|
// const showLabelElIndex: {[index: number]: boolean } = {}
|
|
47014
47093
|
ecModel.eachSeries(function (seriesModel, index) {
|
|
47015
47094
|
// const seriesData = seriesModel.getData();
|
|
@@ -47031,7 +47110,7 @@
|
|
|
47031
47110
|
var yAxisModel = coordSys.getAxis('y');
|
|
47032
47111
|
var yValue = Array.isArray(data) ? data[2] : data;
|
|
47033
47112
|
var y = coordSys.dataToPoint([0, yValue])[1] - 9;
|
|
47034
|
-
var x = yAxisModel.position === 'right' ? width - 65 : 0;
|
|
47113
|
+
var x = (yAxisModel.position === 'right' ? width - 65 : 0) + 1;
|
|
47035
47114
|
var fill = '#26A69A';
|
|
47036
47115
|
var text = yValue.toFixed(4);
|
|
47037
47116
|
if (seriesModel.subType === 'candlestick') {
|
|
@@ -47057,23 +47136,27 @@
|
|
|
47057
47136
|
el.x = x;
|
|
47058
47137
|
el.y = y;
|
|
47059
47138
|
el.ignore = false;
|
|
47060
|
-
el.
|
|
47061
|
-
|
|
47062
|
-
|
|
47063
|
-
|
|
47064
|
-
text: text
|
|
47065
|
-
});
|
|
47066
|
-
} else {
|
|
47067
|
-
el.style.stroke = fill;
|
|
47068
|
-
}
|
|
47139
|
+
el.attr('style', {
|
|
47140
|
+
fill: fill,
|
|
47141
|
+
text: text,
|
|
47142
|
+
borderColor: fill
|
|
47069
47143
|
});
|
|
47144
|
+
// el.traverse(function (el: any) {
|
|
47145
|
+
// if (el.type === 'text') {
|
|
47146
|
+
// el.attr('style', { fill, text });
|
|
47147
|
+
// }
|
|
47148
|
+
// else {
|
|
47149
|
+
// el.style.stroke = fill;
|
|
47150
|
+
// }
|
|
47151
|
+
// });
|
|
47070
47152
|
// elLabelGroupEls.push(el);
|
|
47071
47153
|
} else {
|
|
47072
47154
|
el = getTipsGraphic({
|
|
47073
47155
|
x: x,
|
|
47074
47156
|
y: y,
|
|
47075
47157
|
text: text,
|
|
47076
|
-
fill: fill
|
|
47158
|
+
fill: fill,
|
|
47159
|
+
backgroundColor: backgroundColor
|
|
47077
47160
|
});
|
|
47078
47161
|
rootGroup.add(el);
|
|
47079
47162
|
seriesLabels[index] = el;
|
|
@@ -47352,52 +47435,52 @@
|
|
|
47352
47435
|
eventData.info = elOption.info;
|
|
47353
47436
|
}
|
|
47354
47437
|
}
|
|
47355
|
-
function getWidthFromBytes(
|
|
47356
|
-
|
|
47357
|
-
|
|
47358
|
-
|
|
47359
|
-
|
|
47360
|
-
|
|
47361
|
-
|
|
47362
|
-
}
|
|
47438
|
+
// function getWidthFromBytes(
|
|
47439
|
+
// text: string,
|
|
47440
|
+
// averageWidthInPixels: number = 8
|
|
47441
|
+
// ): number {
|
|
47442
|
+
// const byteCount: number = new TextEncoder().encode(text).length;
|
|
47443
|
+
// const width: number = byteCount * averageWidthInPixels;
|
|
47444
|
+
// return width;
|
|
47445
|
+
// }
|
|
47363
47446
|
var getTipsGraphic = function (_a) {
|
|
47447
|
+
// const width = getWidthFromBytes(text as string);
|
|
47448
|
+
// const group = new graphicUtil.Group({ x, y });
|
|
47449
|
+
// const rect = new graphicUtil.Rect({
|
|
47450
|
+
// shape: {
|
|
47451
|
+
// width: width + 10,
|
|
47452
|
+
// height: 18
|
|
47453
|
+
// },
|
|
47454
|
+
// style: {
|
|
47455
|
+
// stroke: fill,
|
|
47456
|
+
// lineWidth: 1
|
|
47457
|
+
// },
|
|
47458
|
+
// z: 100,
|
|
47459
|
+
// zlevel: 2
|
|
47460
|
+
// });
|
|
47364
47461
|
var x = _a.x,
|
|
47365
47462
|
y = _a.y,
|
|
47366
47463
|
text = _a.text,
|
|
47367
47464
|
_b = _a.fill,
|
|
47368
|
-
fill = _b === void 0 ? '#26A69A' : _b
|
|
47369
|
-
|
|
47370
|
-
var group = new Group({
|
|
47371
|
-
x: x,
|
|
47372
|
-
y: y
|
|
47373
|
-
});
|
|
47374
|
-
var rect = new Rect({
|
|
47375
|
-
shape: {
|
|
47376
|
-
width: width + 10,
|
|
47377
|
-
height: 18
|
|
47378
|
-
},
|
|
47379
|
-
style: {
|
|
47380
|
-
stroke: fill,
|
|
47381
|
-
lineWidth: 1
|
|
47382
|
-
},
|
|
47383
|
-
z: 100,
|
|
47384
|
-
zlevel: 2
|
|
47385
|
-
});
|
|
47465
|
+
fill = _b === void 0 ? '#26A69A' : _b,
|
|
47466
|
+
backgroundColor = _a.backgroundColor;
|
|
47386
47467
|
var textEl = new ZRText({
|
|
47468
|
+
z: 100,
|
|
47469
|
+
x: x,
|
|
47470
|
+
y: y,
|
|
47387
47471
|
style: {
|
|
47388
47472
|
fill: fill,
|
|
47389
|
-
|
|
47390
|
-
|
|
47391
|
-
text: text
|
|
47473
|
+
backgroundColor: backgroundColor,
|
|
47474
|
+
padding: [3, 5, 1, 7],
|
|
47475
|
+
text: text,
|
|
47476
|
+
borderColor: fill,
|
|
47477
|
+
borderWidth: 1
|
|
47392
47478
|
},
|
|
47393
|
-
zlevel: 2
|
|
47394
|
-
z: 100,
|
|
47395
|
-
x: 4,
|
|
47396
|
-
y: 4
|
|
47479
|
+
zlevel: 2
|
|
47397
47480
|
});
|
|
47398
|
-
group.add(rect);
|
|
47399
|
-
group.add(textEl);
|
|
47400
|
-
return
|
|
47481
|
+
// group.add(rect);
|
|
47482
|
+
// group.add(textEl);
|
|
47483
|
+
return textEl;
|
|
47401
47484
|
};
|
|
47402
47485
|
|
|
47403
47486
|
function install$9(registers) {
|
|
@@ -47549,6 +47632,17 @@
|
|
|
47549
47632
|
});
|
|
47550
47633
|
return coordSysInfoWrap;
|
|
47551
47634
|
}
|
|
47635
|
+
function barSpaceLimit(barSpace, maxWidth) {
|
|
47636
|
+
if (maxWidth === void 0) {
|
|
47637
|
+
maxWidth = 200;
|
|
47638
|
+
}
|
|
47639
|
+
if (barSpace < 1) {
|
|
47640
|
+
return 1;
|
|
47641
|
+
} else if (barSpace > maxWidth) {
|
|
47642
|
+
return maxWidth;
|
|
47643
|
+
}
|
|
47644
|
+
return barSpace;
|
|
47645
|
+
}
|
|
47552
47646
|
|
|
47553
47647
|
var DataZoomAxisInfo = /** @class */function () {
|
|
47554
47648
|
function DataZoomAxisInfo() {
|
|
@@ -48107,6 +48201,8 @@
|
|
|
48107
48201
|
|
|
48108
48202
|
var each$4 = each;
|
|
48109
48203
|
var asc$1 = asc;
|
|
48204
|
+
var leftMinVisibleBarCount = 2;
|
|
48205
|
+
var rightMinVisibleBarCount = 2;
|
|
48110
48206
|
/**
|
|
48111
48207
|
* Operate single axis.
|
|
48112
48208
|
* One axis can only operated by one axis operator.
|
|
@@ -48171,7 +48267,6 @@
|
|
|
48171
48267
|
* Only calculate by given range and this._dataExtent, do not change anything.
|
|
48172
48268
|
*/
|
|
48173
48269
|
AxisProxy.prototype.calculateDataWindow = function (opt) {
|
|
48174
|
-
var _a, _b;
|
|
48175
48270
|
var dataExtent = this._dataExtent;
|
|
48176
48271
|
var axisModel = this.getAxisModel();
|
|
48177
48272
|
var scale = axisModel.axis.scale;
|
|
@@ -48180,7 +48275,6 @@
|
|
|
48180
48275
|
var percentWindow = [];
|
|
48181
48276
|
var valueWindow = [];
|
|
48182
48277
|
var hasPropModeValue;
|
|
48183
|
-
var isXAxis = axisModel.mainType === 'xAxis';
|
|
48184
48278
|
each$4(['start', 'end'], function (prop, idx) {
|
|
48185
48279
|
var boundPercent = opt[prop];
|
|
48186
48280
|
var boundValue = opt[prop + 'Value'];
|
|
@@ -48217,10 +48311,6 @@
|
|
|
48217
48311
|
});
|
|
48218
48312
|
asc$1(valueWindow);
|
|
48219
48313
|
asc$1(percentWindow);
|
|
48220
|
-
if (isXAxis) {
|
|
48221
|
-
percentWindow[2] = (_a = opt.startOffset) !== null && _a !== void 0 ? _a : 0;
|
|
48222
|
-
percentWindow[3] = (_b = opt.endOffset) !== null && _b !== void 0 ? _b : 0;
|
|
48223
|
-
}
|
|
48224
48314
|
// The windows from user calling of `dispatchAction` might be out of the extent,
|
|
48225
48315
|
// or do not obey the `min/maxSpan`, `min/maxValueSpan`. But we don't restrict window
|
|
48226
48316
|
// by `zoomLock` here, because we see `zoomLock` just as a interaction constraint,
|
|
@@ -48261,7 +48351,7 @@
|
|
|
48261
48351
|
}
|
|
48262
48352
|
var axisModel = this.getAxisModel();
|
|
48263
48353
|
var isDistanceMode = axisModel.axis.getIsDistanceMode();
|
|
48264
|
-
|
|
48354
|
+
// const isXAxis = axisModel.mainType === 'xAxis';
|
|
48265
48355
|
// `calculateDataWindow` uses min/maxSpan.
|
|
48266
48356
|
this._updateMinMaxSpan();
|
|
48267
48357
|
if (isDistanceMode) {
|
|
@@ -48269,8 +48359,6 @@
|
|
|
48269
48359
|
var scale = axisModel.axis.scale;
|
|
48270
48360
|
var dataCount = scale.getAxisDataLen();
|
|
48271
48361
|
var barCount = axisModel.axis.getExtent()[1] / barSpace;
|
|
48272
|
-
var leftMinVisibleBarCount = 1;
|
|
48273
|
-
var rightMinVisibleBarCount = 1;
|
|
48274
48362
|
var lastBarRightSideDiffBarCount = dataZoomModel.option.lastBarRightSideDiffBarCount;
|
|
48275
48363
|
var maxRightOffsetBarCount = barCount - Math.min(leftMinVisibleBarCount, dataCount);
|
|
48276
48364
|
if (lastBarRightSideDiffBarCount > maxRightOffsetBarCount) {
|
|
@@ -48299,13 +48387,6 @@
|
|
|
48299
48387
|
dataZoomModel.option.lastBarRightSideDiffBarCount = lastBarRightSideDiffBarCount;
|
|
48300
48388
|
} else {
|
|
48301
48389
|
var dataWindow = this.calculateDataWindow(dataZoomModel.settledOption);
|
|
48302
|
-
if (isXAxis && dataWindow.percentWindow[1] === 100 && (dataWindow.percentWindow[2] || dataWindow.percentWindow[3])) {
|
|
48303
|
-
var startValueCount = Math.ceil((this._rawDataExtent[1] - this._rawDataExtent[0]) * dataWindow.percentWindow[2] / 100);
|
|
48304
|
-
var endValueCount = Math.ceil((this._rawDataExtent[1] - this._rawDataExtent[0]) * dataWindow.percentWindow[3] / 100);
|
|
48305
|
-
// todo 数量过多时百分比会有误差 所以这里还得锁定最大值
|
|
48306
|
-
dataWindow.valueWindow[0] = Math.min(dataWindow.valueWindow[0] + startValueCount, this._rawDataExtent[1] - 1);
|
|
48307
|
-
dataWindow.valueWindow[1] = dataWindow.valueWindow[1] + endValueCount;
|
|
48308
|
-
}
|
|
48309
48390
|
this._valueWindow = dataWindow.valueWindow;
|
|
48310
48391
|
this._percentWindow = dataWindow.percentWindow;
|
|
48311
48392
|
// Update axis setting then.
|
|
@@ -48563,9 +48644,10 @@
|
|
|
48563
48644
|
if (axisProxy) {
|
|
48564
48645
|
var percentRange = axisProxy.getDataPercentWindow();
|
|
48565
48646
|
var isDistanceMode = axisProxy.getAxisModel().axis.getIsDistanceMode();
|
|
48647
|
+
var maxWidth = ecModel.scheduler.api.getWidth() / 2;
|
|
48566
48648
|
if (isDistanceMode) {
|
|
48567
48649
|
dataZoomModel.setCalculatedRange({
|
|
48568
|
-
barSpace: percentRange[0],
|
|
48650
|
+
barSpace: barSpaceLimit(percentRange[0], maxWidth),
|
|
48569
48651
|
lastBarRightSideDiffBarCount: percentRange[1]
|
|
48570
48652
|
});
|
|
48571
48653
|
} else {
|
|
@@ -48586,6 +48668,7 @@
|
|
|
48586
48668
|
registers.registerAction('dataZoom', function (payload, ecModel) {
|
|
48587
48669
|
var effectedModels = findEffectedDataZooms(ecModel, payload);
|
|
48588
48670
|
each(effectedModels, function (dataZoomModel) {
|
|
48671
|
+
var isLocalDataZoom = payload.uid === dataZoomModel.uid;
|
|
48589
48672
|
dataZoomModel.setRawRange({
|
|
48590
48673
|
start: payload.start,
|
|
48591
48674
|
end: payload.end,
|
|
@@ -48593,8 +48676,8 @@
|
|
|
48593
48676
|
// endOffset: payload.endOffset,
|
|
48594
48677
|
startValue: payload.startValue,
|
|
48595
48678
|
endValue: payload.endValue,
|
|
48596
|
-
lastBarRightSideDiffBarCount: payload.lastBarRightSideDiffBarCount,
|
|
48597
|
-
barSpace: payload.barSpace
|
|
48679
|
+
lastBarRightSideDiffBarCount: isLocalDataZoom ? void 0 : payload.lastBarRightSideDiffBarCount,
|
|
48680
|
+
barSpace: isLocalDataZoom ? void 0 : payload.barSpace
|
|
48598
48681
|
});
|
|
48599
48682
|
});
|
|
48600
48683
|
});
|
|
@@ -51738,6 +51821,10 @@
|
|
|
51738
51821
|
this._tooltipModel = tooltipModel;
|
|
51739
51822
|
this._ecModel = ecModel;
|
|
51740
51823
|
this._api = api;
|
|
51824
|
+
// todo tooltip都没有了也就不需要渲染了
|
|
51825
|
+
if (!tooltipModel.get('showContent')) {
|
|
51826
|
+
return;
|
|
51827
|
+
}
|
|
51741
51828
|
var tooltipContent = this._tooltipContent;
|
|
51742
51829
|
tooltipContent.update(tooltipModel);
|
|
51743
51830
|
tooltipContent.setEnterable(tooltipModel.get('enterable'));
|
|
@@ -56077,16 +56164,16 @@
|
|
|
56077
56164
|
var isDistanceMode = axisModal.axis.getIsDistanceMode();
|
|
56078
56165
|
if (isDistanceMode) {
|
|
56079
56166
|
// // todo 这里为什么要赋值 为了防止防抖导致有些数据更新不及时
|
|
56080
|
-
|
|
56081
|
-
|
|
56082
|
-
|
|
56083
|
-
|
|
56167
|
+
dzInfo.model.setRawRange({
|
|
56168
|
+
barSpace: range[0],
|
|
56169
|
+
lastBarRightSideDiffBarCount: range[1]
|
|
56170
|
+
});
|
|
56084
56171
|
axisProxy.setDataPercentWindow([range[0], range[1]]);
|
|
56085
|
-
|
|
56172
|
+
axisModal.axis.scale.setSpace(range[0], range[1]);
|
|
56086
56173
|
}
|
|
56087
|
-
|
|
56088
56174
|
batch.push(isDistanceMode ? {
|
|
56089
56175
|
dataZoomId: dzInfo.model.id,
|
|
56176
|
+
uid: dzInfo.model.uid,
|
|
56090
56177
|
barSpace: range[0],
|
|
56091
56178
|
lastBarRightSideDiffBarCount: range[1],
|
|
56092
56179
|
event: event
|
|
@@ -56108,13 +56195,25 @@
|
|
|
56108
56195
|
*/
|
|
56109
56196
|
function dispatchAction(api, batch) {
|
|
56110
56197
|
if (!api.isDisposed()) {
|
|
56111
|
-
api.dispatchAction({
|
|
56112
|
-
|
|
56113
|
-
|
|
56114
|
-
|
|
56115
|
-
|
|
56116
|
-
|
|
56117
|
-
|
|
56198
|
+
// api.dispatchAction({
|
|
56199
|
+
// type: 'dataZoom',
|
|
56200
|
+
// animation: {
|
|
56201
|
+
// easing: 'cubicOut',
|
|
56202
|
+
// duration: 100
|
|
56203
|
+
// },
|
|
56204
|
+
// batch: batch
|
|
56205
|
+
// });
|
|
56206
|
+
// todo 这里不加requestAnimationFrame会导致多屏拖拽卡顿
|
|
56207
|
+
// eslint-disable-next-line no-undef
|
|
56208
|
+
requestAnimationFrame(function () {
|
|
56209
|
+
api.dispatchAction({
|
|
56210
|
+
type: 'dataZoom',
|
|
56211
|
+
animation: {
|
|
56212
|
+
easing: 'cubicOut',
|
|
56213
|
+
duration: 100
|
|
56214
|
+
},
|
|
56215
|
+
batch: batch
|
|
56216
|
+
});
|
|
56118
56217
|
});
|
|
56119
56218
|
}
|
|
56120
56219
|
}
|
|
@@ -56258,7 +56357,8 @@
|
|
|
56258
56357
|
var scale = Math.max(1 / e.scale, 0);
|
|
56259
56358
|
var isDistanceMode = axisModel.axis.getIsDistanceMode();
|
|
56260
56359
|
if (isDistanceMode) {
|
|
56261
|
-
|
|
56360
|
+
var maxWidth = axisModel.ecModel.scheduler.api.getWidth() / 2;
|
|
56361
|
+
range[0] = barSpaceLimit(lastRange[0] * e.scale, maxWidth);
|
|
56262
56362
|
this.range = range;
|
|
56263
56363
|
if (lastRange[0] !== range[0] || lastRange[1] !== range[1]) {
|
|
56264
56364
|
return range;
|
|
@@ -56267,39 +56367,6 @@
|
|
|
56267
56367
|
}
|
|
56268
56368
|
range[0] = (range[0] - percentPoint) * scale + percentPoint;
|
|
56269
56369
|
range[1] = (range[1] - percentPoint) * scale + percentPoint;
|
|
56270
|
-
// // todo 交互与tradingview保持一致缩放左边(tradingView的实现方式应该为修改barwidth)
|
|
56271
|
-
// if (!isXAxis) {
|
|
56272
|
-
// }
|
|
56273
|
-
// else {
|
|
56274
|
-
// const dataExtent = this.dataZoomModel.findRepresentativeAxisProxy().getRawDataExtent();
|
|
56275
|
-
// const maxOffset = 100 - 2 / (dataExtent[1] - dataExtent[0]);
|
|
56276
|
-
// // 如果有开始偏移量
|
|
56277
|
-
// if (range[2]) {
|
|
56278
|
-
// // 如果开始进度小于0 则修改开始偏移量
|
|
56279
|
-
// if (range[0] <= 0) {
|
|
56280
|
-
// range[2] = range[2] + range[0];
|
|
56281
|
-
// }
|
|
56282
|
-
// // 如果开始进度与偏移量大于最大起始偏移量
|
|
56283
|
-
// else if (range[0] + range[2] > maxOffset) {
|
|
56284
|
-
// const offsetDiff = range[0] + range[2] - maxOffset;
|
|
56285
|
-
// range[2] = range[2] - offsetDiff;
|
|
56286
|
-
// range[0] = Math.max(maxOffset - range[2], 0);
|
|
56287
|
-
// }
|
|
56288
|
-
// }
|
|
56289
|
-
// // 当开始偏移量为0 且拥有结束偏移量时
|
|
56290
|
-
// if (range[3] && range[2] <= 0 && range[0] <= 0) {
|
|
56291
|
-
// range[3] = Math.max((range[3] - percentPoint) * scale + percentPoint, 0);
|
|
56292
|
-
// }
|
|
56293
|
-
// // 当开始偏移量已经达到最大值时 且拥有结束偏移量时
|
|
56294
|
-
// else if (range[3] && range[0] + range[2] >= maxOffset) {
|
|
56295
|
-
// const offsetDiff = range[0] + range[2] - maxOffset;
|
|
56296
|
-
// range[3] = Math.max(range[2] - offsetDiff, 0);
|
|
56297
|
-
// }
|
|
56298
|
-
// range[0] = Math.min(range[0], maxOffset);
|
|
56299
|
-
// if (range[2]) {
|
|
56300
|
-
// range[2] = Math.max(range[2], 0);
|
|
56301
|
-
// }
|
|
56302
|
-
// }
|
|
56303
56370
|
// Restrict range.
|
|
56304
56371
|
var minMaxSpan = this.dataZoomModel.findRepresentativeAxisProxy().getMinMaxSpan();
|
|
56305
56372
|
sliderMove(0, range, [0, 100], 0, minMaxSpan.minSpan, minMaxSpan.maxSpan);
|
|
@@ -56317,14 +56384,6 @@
|
|
|
56317
56384
|
return directionInfo.signal * (range[1] - range[0]) * e.scrollDelta;
|
|
56318
56385
|
})
|
|
56319
56386
|
};
|
|
56320
|
-
function barSpaceLimit(barSpace) {
|
|
56321
|
-
if (barSpace < 1) {
|
|
56322
|
-
return 1;
|
|
56323
|
-
} else if (barSpace > 200) {
|
|
56324
|
-
return 200;
|
|
56325
|
-
}
|
|
56326
|
-
return barSpace;
|
|
56327
|
-
}
|
|
56328
56387
|
function makeMover(getPercentDelta) {
|
|
56329
56388
|
return function (coordSysInfo, coordSysMainType, controller, e) {
|
|
56330
56389
|
var _a, _b, _c;
|
|
@@ -56342,7 +56401,7 @@
|
|
|
56342
56401
|
var startLastBarRightSideDiffBarCount = (_c = lastRange[1]) !== null && _c !== void 0 ? _c : this.dataZoomModel.get('lastBarRightSideDiffBarCount');
|
|
56343
56402
|
var distanceBarCount = distance / barSpace;
|
|
56344
56403
|
var lastBarRightSideDiffBarCount = startLastBarRightSideDiffBarCount - distanceBarCount;
|
|
56345
|
-
range[0] =
|
|
56404
|
+
range[0] = barSpace;
|
|
56346
56405
|
range[1] = lastBarRightSideDiffBarCount;
|
|
56347
56406
|
this.range = range;
|
|
56348
56407
|
if (lastRange[0] !== range[0] || lastRange[1] !== range[1]) {
|