tvcharts 0.8.80 → 0.8.82
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.js +111 -32
- package/dist/echarts.js.map +2 -2
- package/lib/component/dataZoom/AxisProxy.js +7 -2
- package/lib/component/dataZoom/roams.js +2 -2
- package/lib/component/helper/RoamController.js +3 -1
- package/lib/core/echarts.js +38 -0
- package/lib/model/Model.js +80 -8
- package/package.json +1 -1
- package/types/dist/echarts.d.ts +9 -1
- package/types/dist/shared.d.ts +9 -1
- package/types/src/component/helper/RoamController.d.ts +1 -0
- package/types/src/core/echarts.d.ts +1 -0
- package/types/src/model/Model.d.ts +7 -1
- package/types/src/util/types.d.ts +1 -0
package/dist/echarts.js
CHANGED
|
@@ -14633,6 +14633,7 @@ var ItemStyleMixin = class {
|
|
|
14633
14633
|
// src/model/Model.ts
|
|
14634
14634
|
var Model = class {
|
|
14635
14635
|
constructor(option, parentModel, ecModel) {
|
|
14636
|
+
this._pathCache = new Map();
|
|
14636
14637
|
this.parentModel = parentModel;
|
|
14637
14638
|
this.ecModel = ecModel;
|
|
14638
14639
|
this.option = option;
|
|
@@ -14646,7 +14647,72 @@ var Model = class {
|
|
|
14646
14647
|
if (path == null) {
|
|
14647
14648
|
return this.option;
|
|
14648
14649
|
}
|
|
14649
|
-
|
|
14650
|
+
const pathArr = this.parsePath(path);
|
|
14651
|
+
return this._doGetOptimized(pathArr, !ignoreParent && this.parentModel);
|
|
14652
|
+
}
|
|
14653
|
+
parsePath(path) {
|
|
14654
|
+
if (typeof path === "string") {
|
|
14655
|
+
let cached = this._pathCache.get(path);
|
|
14656
|
+
if (!cached) {
|
|
14657
|
+
cached = path.split(".");
|
|
14658
|
+
this._pathCache.set(path, cached);
|
|
14659
|
+
}
|
|
14660
|
+
return cached;
|
|
14661
|
+
}
|
|
14662
|
+
return path;
|
|
14663
|
+
}
|
|
14664
|
+
_doGetOptimized(pathArr, parentModel) {
|
|
14665
|
+
const length2 = pathArr.length;
|
|
14666
|
+
switch (length2) {
|
|
14667
|
+
case 0:
|
|
14668
|
+
return this.option;
|
|
14669
|
+
case 1:
|
|
14670
|
+
return this._getSingle(pathArr[0], parentModel);
|
|
14671
|
+
case 2:
|
|
14672
|
+
return this._getDouble(pathArr[0], pathArr[1], parentModel);
|
|
14673
|
+
case 3:
|
|
14674
|
+
return this._getTriple(pathArr[0], pathArr[1], pathArr[2], parentModel);
|
|
14675
|
+
default:
|
|
14676
|
+
return this._getDeep(pathArr, parentModel);
|
|
14677
|
+
}
|
|
14678
|
+
}
|
|
14679
|
+
_getSingle(key, parentModel) {
|
|
14680
|
+
let value = this.option?.[key];
|
|
14681
|
+
if (value == null && parentModel) {
|
|
14682
|
+
value = parentModel.get(key, false);
|
|
14683
|
+
}
|
|
14684
|
+
return value;
|
|
14685
|
+
}
|
|
14686
|
+
_getDouble(key1, key2, parentModel) {
|
|
14687
|
+
const obj = this.option?.[key1];
|
|
14688
|
+
let value = obj?.[key2];
|
|
14689
|
+
if (value == null && parentModel) {
|
|
14690
|
+
value = parentModel.get([key1, key2], false);
|
|
14691
|
+
}
|
|
14692
|
+
return value;
|
|
14693
|
+
}
|
|
14694
|
+
_getTriple(key1, key2, key3, parentModel) {
|
|
14695
|
+
let value = this.option?.[key1]?.[key2]?.[key3];
|
|
14696
|
+
if (!value && parentModel) {
|
|
14697
|
+
value = parentModel.get([key1, key2, key3], false);
|
|
14698
|
+
}
|
|
14699
|
+
return value;
|
|
14700
|
+
}
|
|
14701
|
+
_getDeep(pathArr, parentModel) {
|
|
14702
|
+
let obj = this.option;
|
|
14703
|
+
const length2 = pathArr.length;
|
|
14704
|
+
for (let i = 0; i < length2; i++) {
|
|
14705
|
+
const segment = pathArr[i];
|
|
14706
|
+
if (!segment)
|
|
14707
|
+
continue;
|
|
14708
|
+
obj = obj?.[segment];
|
|
14709
|
+
if (obj == null)
|
|
14710
|
+
break;
|
|
14711
|
+
}
|
|
14712
|
+
if (obj == null && parentModel) {
|
|
14713
|
+
obj = parentModel.get(pathArr, false);
|
|
14714
|
+
}
|
|
14715
|
+
return obj;
|
|
14650
14716
|
}
|
|
14651
14717
|
getShallow(key, ignoreParent) {
|
|
14652
14718
|
const option = this.option;
|
|
@@ -14662,7 +14728,7 @@ var Model = class {
|
|
|
14662
14728
|
getModel(path, parentModel) {
|
|
14663
14729
|
const hasPath = path != null;
|
|
14664
14730
|
const pathFinal = hasPath ? this.parsePath(path) : null;
|
|
14665
|
-
const obj = hasPath ? this.
|
|
14731
|
+
const obj = hasPath ? this._doGetOptimized(pathFinal) : this.option;
|
|
14666
14732
|
parentModel = parentModel || this.parentModel && this.parentModel.getModel(this.resolveParentPath(pathFinal));
|
|
14667
14733
|
return new Model(obj, parentModel, this.ecModel);
|
|
14668
14734
|
}
|
|
@@ -14675,12 +14741,6 @@ var Model = class {
|
|
|
14675
14741
|
const Ctor = this.constructor;
|
|
14676
14742
|
return new Ctor(clone(this.option));
|
|
14677
14743
|
}
|
|
14678
|
-
parsePath(path) {
|
|
14679
|
-
if (typeof path === "string") {
|
|
14680
|
-
return path.split(".");
|
|
14681
|
-
}
|
|
14682
|
-
return path;
|
|
14683
|
-
}
|
|
14684
14744
|
resolveParentPath(path) {
|
|
14685
14745
|
return path;
|
|
14686
14746
|
}
|
|
@@ -14693,25 +14753,6 @@ var Model = class {
|
|
|
14693
14753
|
}
|
|
14694
14754
|
}
|
|
14695
14755
|
}
|
|
14696
|
-
_doGet(pathArr, parentModel) {
|
|
14697
|
-
let obj = this.option;
|
|
14698
|
-
if (!pathArr) {
|
|
14699
|
-
return obj;
|
|
14700
|
-
}
|
|
14701
|
-
for (let i = 0; i < pathArr.length; i++) {
|
|
14702
|
-
if (!pathArr[i]) {
|
|
14703
|
-
continue;
|
|
14704
|
-
}
|
|
14705
|
-
obj = obj && typeof obj === "object" ? obj[pathArr[i]] : null;
|
|
14706
|
-
if (obj == null) {
|
|
14707
|
-
break;
|
|
14708
|
-
}
|
|
14709
|
-
}
|
|
14710
|
-
if (obj == null && parentModel) {
|
|
14711
|
-
obj = parentModel._doGet(this.resolveParentPath(pathArr), parentModel.parentModel);
|
|
14712
|
-
}
|
|
14713
|
-
return obj;
|
|
14714
|
-
}
|
|
14715
14756
|
};
|
|
14716
14757
|
enableClassExtend(Model);
|
|
14717
14758
|
enableClassCheck(Model);
|
|
@@ -25317,6 +25358,39 @@ var ECharts = class extends Eventful_default {
|
|
|
25317
25358
|
this.scrollToDataIndex(dataIndex, animationDuration);
|
|
25318
25359
|
}
|
|
25319
25360
|
}
|
|
25361
|
+
scrollToRange(startTime, endTime, expectCount = 0) {
|
|
25362
|
+
if (this._disposed) {
|
|
25363
|
+
disposedWarning(this.id);
|
|
25364
|
+
return;
|
|
25365
|
+
}
|
|
25366
|
+
const xAxisModal = this._model.getComponent("xAxis", 0);
|
|
25367
|
+
const scale4 = xAxisModal.axis.scale;
|
|
25368
|
+
const categories = scale4.getOrdinalMeta().getCategories();
|
|
25369
|
+
const dataCount = categories.length;
|
|
25370
|
+
const [startIndex, endIndex] = getIndexRange(categories, startTime, endTime);
|
|
25371
|
+
const axisLength = xAxisModal.axis.getExtent()[1];
|
|
25372
|
+
let barCount = Math.max(endIndex - startIndex + 1, 2);
|
|
25373
|
+
let barSpace = Math.max(1, axisLength / barCount);
|
|
25374
|
+
let lastBarRightSideDiffBarCount = endIndex - dataCount + 0.5;
|
|
25375
|
+
const maxRightOffsetBarCount = axisLength / barSpace - Math.min(2, dataCount);
|
|
25376
|
+
if (lastBarRightSideDiffBarCount > maxRightOffsetBarCount) {
|
|
25377
|
+
lastBarRightSideDiffBarCount = maxRightOffsetBarCount;
|
|
25378
|
+
}
|
|
25379
|
+
const minRightOffsetBarCount = -dataCount + Math.min(2, dataCount);
|
|
25380
|
+
if (lastBarRightSideDiffBarCount < minRightOffsetBarCount) {
|
|
25381
|
+
lastBarRightSideDiffBarCount = minRightOffsetBarCount;
|
|
25382
|
+
if (expectCount && expectCount !== dataCount) {
|
|
25383
|
+
barSpace = Math.max(1, axisLength / expectCount);
|
|
25384
|
+
}
|
|
25385
|
+
}
|
|
25386
|
+
const payload = {
|
|
25387
|
+
type: "dataZoom",
|
|
25388
|
+
dataZoomIndex: 0,
|
|
25389
|
+
barSpace,
|
|
25390
|
+
lastBarRightSideDiffBarCount
|
|
25391
|
+
};
|
|
25392
|
+
doDispatchAction.call(this, payload, false);
|
|
25393
|
+
}
|
|
25320
25394
|
setMarkLabel(seriesName, data) {
|
|
25321
25395
|
const seriesModal = this._model.getSeriesByName(seriesName)[0];
|
|
25322
25396
|
if (seriesModal) {
|
|
@@ -42167,6 +42241,8 @@ var RoamController = class extends Eventful_default {
|
|
|
42167
42241
|
this._startY = y;
|
|
42168
42242
|
this._dragging = true;
|
|
42169
42243
|
if (this.kineticScroll) {
|
|
42244
|
+
this.kineticScrollId && cancelAnimationFrame(this.kineticScrollId);
|
|
42245
|
+
this.kineticScrollId = null;
|
|
42170
42246
|
this.kineticScroll = null;
|
|
42171
42247
|
}
|
|
42172
42248
|
}
|
|
@@ -42275,7 +42351,7 @@ var RoamController = class extends Eventful_default {
|
|
|
42275
42351
|
isAvailableBehavior: null,
|
|
42276
42352
|
lastBarRightSideDiffBarCount: Math.round(newPos / this.minScrollUnit) * this.minScrollUnit
|
|
42277
42353
|
});
|
|
42278
|
-
requestAnimationFrame_default(() => this._kineticScroll());
|
|
42354
|
+
this.kineticScrollId = requestAnimationFrame_default(() => this._kineticScroll());
|
|
42279
42355
|
} else {
|
|
42280
42356
|
trigger(this, "dragEnd", "moveOnMouseMove", {}, {isAvailableBehavior: null});
|
|
42281
42357
|
}
|
|
@@ -60598,9 +60674,9 @@ var LabelsView2 = class extends Chart_default {
|
|
|
60598
60674
|
const data = seriesModel.getData();
|
|
60599
60675
|
this.seriesModel = seriesModel;
|
|
60600
60676
|
this.api = api2;
|
|
60677
|
+
this._renderTooltipSymbol(data, seriesModel);
|
|
60601
60678
|
this._renderSymbol(data, seriesModel);
|
|
60602
60679
|
this._renderText(data, seriesModel);
|
|
60603
|
-
this._renderTooltipSymbol(data, seriesModel);
|
|
60604
60680
|
toggleHoverEmphasis(this.group, null, null, false);
|
|
60605
60681
|
const groupId = seriesModel.get("groupId");
|
|
60606
60682
|
getECData(this.group).groupId = groupId;
|
|
@@ -60616,6 +60692,7 @@ var LabelsView2 = class extends Chart_default {
|
|
|
60616
60692
|
const textGroup = this._textGroup;
|
|
60617
60693
|
const textList = data.getLayout("textList");
|
|
60618
60694
|
const emphasisState = seriesModel.get("emphasis").emphasisState;
|
|
60695
|
+
const isShape = seriesModel.get("isShape");
|
|
60619
60696
|
each(textList, function(item) {
|
|
60620
60697
|
const {
|
|
60621
60698
|
text,
|
|
@@ -60643,7 +60720,8 @@ var LabelsView2 = class extends Chart_default {
|
|
|
60643
60720
|
y: point[1] + offset[1],
|
|
60644
60721
|
fontStyle,
|
|
60645
60722
|
fontWeight
|
|
60646
|
-
}
|
|
60723
|
+
},
|
|
60724
|
+
silent: !isShape
|
|
60647
60725
|
});
|
|
60648
60726
|
el.states.emphasis = emphasisState;
|
|
60649
60727
|
textGroup.add(el);
|
|
@@ -69999,8 +70077,8 @@ var AxisProxy = class {
|
|
|
69999
70077
|
if (from < 0 && !dataZoomModel.isDragging) {
|
|
70000
70078
|
api2.trigger("loadmore", [from, to]);
|
|
70001
70079
|
}
|
|
70002
|
-
const visibleFrom = Math.max(0, Math.
|
|
70003
|
-
const visibleTo = Math.min(
|
|
70080
|
+
const visibleFrom = Math.max(0, Math.round(to - barCount));
|
|
70081
|
+
const visibleTo = Math.min(Math.round(lastBarRightSideDiffBarCount + dataCount - 0.5), dataCount - 1);
|
|
70004
70082
|
const messageCenter = dataZoomModel.ecModel.scheduler.ecInstance.getMessageCenter();
|
|
70005
70083
|
this._throttleVisibleChanged(messageCenter, {
|
|
70006
70084
|
from,
|
|
@@ -80534,6 +80612,7 @@ function installDataZoomRoamProcessor(registers) {
|
|
|
80534
80612
|
const controllerParams = mergeControllerParams(dataZoomInfoMap);
|
|
80535
80613
|
controller.enable(controllerParams.controlType, controllerParams.opt);
|
|
80536
80614
|
controller.setPointerChecker(coordSysRecord.containsPoint);
|
|
80615
|
+
createOrUpdate(coordSysRecord, "dispatchAction", 16, "fixRate");
|
|
80537
80616
|
});
|
|
80538
80617
|
});
|
|
80539
80618
|
}
|