You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by sh...@apache.org on 2020/02/21 06:07:49 UTC
[incubator-echarts] branch typescript updated: ts: use generic for
List#hostModel
This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch typescript
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/typescript by this push:
new 04e3a6a ts: use generic for List#hostModel
04e3a6a is described below
commit 04e3a6a14fd08392c818f2c2e53eb81bd4bdba98
Author: pissang <bm...@gmail.com>
AuthorDate: Fri Feb 21 14:07:31 2020 +0800
ts: use generic for List#hostModel
---
src/data/List.ts | 9 ++++-----
src/model/Series.ts | 2 +-
src/processor/dataStack.ts | 2 +-
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/data/List.ts b/src/data/List.ts
index c803568..7f008a8 100644
--- a/src/data/List.ts
+++ b/src/data/List.ts
@@ -40,7 +40,6 @@ import {
} from '../util/types';
import {parseDate} from '../util/number';
import {isDataItemOption} from '../util/model';
-import SeriesModel from '../model/Series';
var isObject = zrUtil.isObject;
@@ -123,7 +122,7 @@ var CLONE_PROPERTIES = [
-class List {
+class List <HostModel extends Model = Model> {
readonly type = 'list';
@@ -132,7 +131,7 @@ class List {
// Infomation of each data dimension, like data type.
private _dimensionInfos: {[dimName: string]: DataDimensionInfo};
- readonly hostModel: SeriesModel;
+ readonly hostModel: HostModel;
readonly dataType: string;
@@ -226,7 +225,7 @@ class List {
* For example, ['someDimName', {name: 'someDimName', type: 'someDimType'}, ...].
* Dimensions should be concrete names like x, y, z, lng, lat, angle, radius
*/
- constructor(dimensions: Array<string | object | DataDimensionInfo>, hostModel: SeriesModel) {
+ constructor(dimensions: Array<string | object | DataDimensionInfo>, hostModel: HostModel) {
dimensions = dimensions || ['x', 'y'];
var dimensionInfos: Dictionary<DataDimensionInfo> = {};
@@ -1757,7 +1756,7 @@ class List {
* Shallow clone a new list except visual and layout properties, and graph elements.
* New list only change the indices.
*/
- cloneShallow(list?: List): List {
+ cloneShallow(list?: List<HostModel>): List<HostModel> {
if (!list) {
var dimensionInfoList = zrUtil.map(this.dimensions, this.getDimensionInfo, this);
list = new List(dimensionInfoList, this.hostModel);
diff --git a/src/model/Series.ts b/src/model/Series.ts
index eeaaf21..bfe9f8f 100644
--- a/src/model/Series.ts
+++ b/src/model/Series.ts
@@ -240,7 +240,7 @@ class SeriesModel<Opt extends SeriesOption = SeriesOption> extends ComponentMode
* data in the stream procedure. So we fetch data from upstream
* each time `task.perform` called.
*/
- getData(dataType?: string): List {
+ getData(dataType?: string): List<SeriesModel<Opt>> {
var task = getCurrentTask(this);
if (task) {
var data = task.context.data;
diff --git a/src/processor/dataStack.ts b/src/processor/dataStack.ts
index b616b97..6d79a86 100644
--- a/src/processor/dataStack.ts
+++ b/src/processor/dataStack.ts
@@ -138,7 +138,7 @@ function calculateStack(stackInfoList: StackInfo[]) {
return resultVal;
});
- targetData.hostModel.setData(newData);
+ (targetData.hostModel as SeriesModel).setData(newData);
// Update for consequent calculation
targetStackInfo.data = newData;
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org