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/03/11 14:07:09 UTC

[incubator-echarts] branch typescript updated: refact: use inner to store ec data on elements.

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 b64c643  refact: use inner to store ec data on elements.
b64c643 is described below

commit b64c6438b2738322ff9ccc9e7c83b2cb180b3071
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Mar 11 22:06:12 2020 +0800

    refact: use inner to store ec data on elements.
---
 src/chart/bar/BarView.ts                  | 58 +++++++++++++++----------------
 src/chart/bar/PictorialBarView.ts         |  6 ++--
 src/chart/chord.ts                        | 31 -----------------
 src/chart/sunburst/SunburstPiece.ts       |  6 ++--
 src/component/helper/MapDraw.ts           |  5 ++-
 src/component/title.ts                    |  5 ++-
 src/component/tooltip/TooltipView.ts      | 11 +++---
 src/component/visualMap/ContinuousView.ts | 12 ++++---
 src/data/List.ts                          | 18 ++++++----
 src/echarts.ts                            | 15 ++++----
 src/model/Model.ts                        |  7 ----
 src/util/graphic.ts                       | 21 +++++++++--
 src/util/types.ts                         |  5 ---
 tsconfig.json                             |  4 ++-
 14 files changed, 92 insertions(+), 112 deletions(-)

diff --git a/src/chart/bar/BarView.ts b/src/chart/bar/BarView.ts
index 7baa1a1..08e5ea7 100644
--- a/src/chart/bar/BarView.ts
+++ b/src/chart/bar/BarView.ts
@@ -19,7 +19,7 @@
 
 import {__DEV__} from '../../config';
 import * as zrUtil from 'zrender/src/core/util';
-import * as graphic from '../../util/graphic';
+import {Rect, Sector, getECData, updateProps, initProps, setHoverStyle} from '../../util/graphic';
 import {setLabel} from './helper';
 import {getBarItemStyle} from './barItemStyle';
 import Path, { PathProps } from 'zrender/src/graphic/Path';
@@ -31,7 +31,7 @@ import ChartView from '../../view/Chart';
 import List from '../../data/List';
 import GlobalModel from '../../model/Global';
 import ExtensionAPI from '../../ExtensionAPI';
-import { StageHandlerProgressParams, ECElement, ZRElementEvent } from '../../util/types';
+import { StageHandlerProgressParams, ZRElementEvent } from '../../util/types';
 import BarSeriesModel, { BarSeriesOption, BarDataItemOption } from './BarSeries';
 import type Axis2D from '../../coord/cartesian/Axis2D';
 import type Cartesian2D from '../../coord/cartesian/Cartesian2D';
@@ -45,13 +45,13 @@ const mathMax = Math.max;
 const mathMin = Math.min;
 
 type CoordSysOfBar = BarSeriesModel['coordinateSystem'];
-type RectShape = graphic.Rect['shape']
-type SectorShape = graphic.Sector['shape']
+type RectShape = Rect['shape']
+type SectorShape = Sector['shape']
 
 type SectorLayout = SectorShape;
 type RectLayout = RectShape;
 
-type BarPossiblePath = graphic.Sector | graphic.Rect | Sausage
+type BarPossiblePath = Sector | Rect | Sausage
 
 function isCartesian2D(coord: CoordSysOfBar): coord is Cartesian2D {
     return coord.type === 'cartesian2d';
@@ -89,9 +89,9 @@ class BarView extends ChartView {
 
     _isLargeDraw: boolean
 
-    _backgroundGroup: graphic.Group
+    _backgroundGroup: Group
 
-    _backgroundEls: (graphic.Rect | graphic.Sector)[]
+    _backgroundEls: (Rect | Sector)[]
 
     render(seriesModel: BarSeriesModel, ecModel: GlobalModel, api: ExtensionAPI) {
         this._updateDrawMode(seriesModel);
@@ -212,8 +212,8 @@ class BarView extends ChartView {
                     bgEls[newIndex] = bgEl;
 
                     var shape = createBackgroundShape(isHorizontalOrRadial, layout, coord);
-                    graphic.updateProps(
-                        bgEl as graphic.Path, { shape: shape }, animationModel, newIndex
+                    updateProps(
+                        bgEl as Path, { shape: shape }, animationModel, newIndex
                     );
                 }
 
@@ -232,7 +232,7 @@ class BarView extends ChartView {
                 }
 
                 if (el) {
-                    graphic.updateProps(el as graphic.Path, {
+                    updateProps(el as Path, {
                         shape: layout
                     }, animationModel, newIndex);
                 }
@@ -254,10 +254,10 @@ class BarView extends ChartView {
             .remove(function (dataIndex) {
                 var el = oldData.getItemGraphicEl(dataIndex);
                 if (coord.type === 'cartesian2d') {
-                    el && removeRect(dataIndex, animationModel, el as graphic.Rect);
+                    el && removeRect(dataIndex, animationModel, el as Rect);
                 }
                 else {
-                    el && removeSector(dataIndex, animationModel, el as graphic.Sector);
+                    el && removeSector(dataIndex, animationModel, el as Sector);
                 }
             })
             .execute();
@@ -306,12 +306,12 @@ class BarView extends ChartView {
             this._removeBackground();
             this._backgroundEls = [];
 
-            data.eachItemGraphicEl(function (el: ECElement & (graphic.Sector | graphic.Rect)) {
+            data.eachItemGraphicEl(function (el: Sector | Rect) {
                 if (el.type === 'sector') {
-                    removeSector(el.dataIndex, ecModel, el as (graphic.Sector));
+                    removeSector(getECData(el).dataIndex, ecModel, el as (Sector));
                 }
                 else {
-                    removeRect(el.dataIndex, ecModel, el as (graphic.Rect));
+                    removeRect(getECData(el).dataIndex, ecModel, el as (Rect));
                 }
             });
         }
@@ -333,7 +333,7 @@ interface Clipper {
 var clip: {
     [key in 'cartesian2d' | 'polar']: Clipper
 } = {
-    cartesian2d(coordSysBoundingRect: RectLike, layout: graphic.Rect['shape']) {
+    cartesian2d(coordSysBoundingRect: RectLike, layout: Rect['shape']) {
         var signWidth = layout.width < 0 ? -1 : 1;
         var signHeight = layout.height < 0 ? -1 : 1;
         // Needs positive width and height
@@ -391,7 +391,7 @@ var elementCreator: {
         dataIndex, layout: RectLayout, isHorizontal,
         animationModel, isUpdate
     ) {
-        var rect = new graphic.Rect({
+        var rect = new Rect({
             shape: zrUtil.extend({}, layout),
             z2: 1
         });
@@ -405,7 +405,7 @@ var elementCreator: {
             var animateTarget = {} as RectShape;
             rectShape[animateProperty] = 0;
             animateTarget[animateProperty] = layout[animateProperty];
-            graphic[isUpdate ? 'updateProps' : 'initProps'](rect, {
+            (isUpdate ? updateProps : initProps)(rect, {
                 shape: animateTarget
             }, animationModel, dataIndex);
         }
@@ -423,7 +423,7 @@ var elementCreator: {
         // or less than startAngle.
         var clockwise = layout.startAngle < layout.endAngle;
 
-        var ShapeClass = (!isRadial && roundCap) ? Sausage : graphic.Sector;
+        var ShapeClass = (!isRadial && roundCap) ? Sausage : Sector;
 
         var sector = new ShapeClass({
             shape: zrUtil.defaults({clockwise: clockwise}, layout),
@@ -439,7 +439,7 @@ var elementCreator: {
             var animateTarget = {} as SectorShape;
             sectorShape[animateProperty] = isRadial ? 0 : layout.startAngle;
             animateTarget[animateProperty] = layout[animateProperty];
-            graphic[isUpdate ? 'updateProps' : 'initProps'](sector, {
+            (isUpdate ? updateProps : initProps)(sector, {
                 shape: animateTarget
             }, animationModel, dataIndex);
         }
@@ -451,11 +451,11 @@ var elementCreator: {
 function removeRect(
     dataIndex: number,
     animationModel: BarSeriesModel | GlobalModel,
-    el: graphic.Rect
+    el: Rect
 ) {
     // Not show text when animating
     el.style.text = null;
-    graphic.updateProps(el, {
+    updateProps(el, {
         shape: {
             width: 0
         }
@@ -467,11 +467,11 @@ function removeRect(
 function removeSector(
     dataIndex: number,
     animationModel: BarSeriesModel | GlobalModel,
-    el: graphic.Sector
+    el: Sector
 ) {
     // Not show text when animating
     el.style.text = null;
-    graphic.updateProps(el, {
+    updateProps(el, {
         shape: {
             r: el.shape.r0
         }
@@ -564,7 +564,7 @@ function updateStyle(
     if (isZeroOnPolar(layout as SectorLayout)) {
         hoverStyle.fill = hoverStyle.stroke = 'none';
     }
-    graphic.setHoverStyle(el, hoverStyle);
+    setHoverStyle(el, hoverStyle);
 }
 
 // In case width or height are too small.
@@ -662,7 +662,7 @@ function createLarge(
     setLargeStyle(el, seriesModel, data);
 
     // Enable tooltip and user mouse/touch event handlers.
-    (el as ECElement).seriesIndex = seriesModel.seriesIndex;
+    getECData(el).seriesIndex = seriesModel.seriesIndex;
 
     if (!seriesModel.get('silent')) {
         el.on('mousedown', largePathUpdateDataIndex);
@@ -674,7 +674,7 @@ function createLarge(
 var largePathUpdateDataIndex = throttle(function (this: LargePath, event: ZRElementEvent) {
     var largePath = this;
     var dataIndex = largePathFindDataIndex(largePath, event.offsetX, event.offsetY);
-    (largePath as ECElement).dataIndex = dataIndex >= 0 ? dataIndex : null;
+    getECData(largePath).dataIndex = dataIndex >= 0 ? dataIndex : null;
 }, 30, false);
 
 function largePathFindDataIndex(largePath: LargePath, x: number, y: number) {
@@ -772,8 +772,8 @@ function createBackgroundEl(
     coord: CoordSysOfBar,
     isHorizontalOrRadial: boolean,
     layout: SectorLayout | RectLayout
-): graphic.Rect | graphic.Sector {
-    var ElementClz = coord.type === 'polar' ? graphic.Sector : graphic.Rect;
+): Rect | Sector {
+    var ElementClz = coord.type === 'polar' ? Sector : Rect;
     return new ElementClz({
         shape: createBackgroundShape(isHorizontalOrRadial, layout, coord) as any,
         silent: true,
diff --git a/src/chart/bar/PictorialBarView.ts b/src/chart/bar/PictorialBarView.ts
index 71f695f..19ceb2b 100644
--- a/src/chart/bar/PictorialBarView.ts
+++ b/src/chart/bar/PictorialBarView.ts
@@ -29,7 +29,7 @@ import ExtensionAPI from '../../ExtensionAPI';
 import List from '../../data/List';
 import GlobalModel from '../../model/Global';
 import Model from '../../model/Model';
-import { ColorString, ECElement, AnimationOptionMixin } from '../../util/types';
+import { ColorString, AnimationOptionMixin } from '../../util/types';
 import type Cartesian2D from '../../coord/cartesian/Cartesian2D';
 import type Displayable from 'zrender/src/graphic/Displayable';
 import type Axis2D from '../../coord/cartesian/Axis2D';
@@ -221,8 +221,8 @@ class PictorialBarView extends ChartView {
         var data = this._data;
         if (ecModel.get('animation')) {
             if (data) {
-                data.eachItemGraphicEl(function (bar: PictorialBarElement & ECElement) {
-                    removeBar(data, bar.dataIndex, ecModel, bar);
+                data.eachItemGraphicEl(function (bar: PictorialBarElement) {
+                    removeBar(data, graphic.getECData(bar).dataIndex, ecModel, bar);
                 });
             }
         }
diff --git a/src/chart/chord.ts b/src/chart/chord.ts
deleted file mode 100644
index 91cf60a..0000000
--- a/src/chart/chord.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*   http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-
-import * as echarts from '../echarts';
-
-import './chord/ChordSeries';
-import './chord/ChordView';
-
-import chordCircularLayout from './chord/chordCircularLayout';
-import dataColor from '../visual/dataColor';
-import dataFilter from '../processor/dataFilter';
-
-echarts.registerLayout(chordCircularLayout);
-echarts.registerVisual(dataColor('chord'));
-echarts.registerProcessor(dataFilter('pie'));
\ No newline at end of file
diff --git a/src/chart/sunburst/SunburstPiece.ts b/src/chart/sunburst/SunburstPiece.ts
index 1033a0a..ab1e034 100644
--- a/src/chart/sunburst/SunburstPiece.ts
+++ b/src/chart/sunburst/SunburstPiece.ts
@@ -19,7 +19,7 @@
 
 import * as zrUtil from 'zrender/src/core/util';
 import * as graphic from '../../util/graphic';
-import { ECElement, ZRColor, ColorString } from '../../util/types';
+import { ZRColor, ColorString } from '../../util/types';
 import { TreeNode } from '../../data/Tree';
 import SunburstSeriesModel, { SunburstSeriesNodeOption, SunburstSeriesOption } from './SunburstSeries';
 import GlobalModel from '../../model/Global';
@@ -54,7 +54,7 @@ class SunburstPiece extends graphic.Group {
         var sector = new graphic.Sector({
             z2: DEFAULT_SECTOR_Z
         });
-        (sector as ECElement).seriesIndex = seriesModel.seriesIndex;
+        graphic.getECData(sector).seriesIndex = seriesModel.seriesIndex;
 
         var text = new graphic.Text({
             z2: DEFAULT_TEXT_Z,
@@ -93,7 +93,7 @@ class SunburstPiece extends graphic.Group {
         ecModel = ecModel || this._ecModel;
 
         var sector = this.childAt(0) as graphic.Sector;
-        (sector as ECElement).dataIndex = node.dataIndex;
+        graphic.getECData(sector).dataIndex = node.dataIndex;
 
         var itemModel = node.getModel<SunburstSeriesNodeOption>();
         var layout = node.getLayout();
diff --git a/src/component/helper/MapDraw.ts b/src/component/helper/MapDraw.ts
index 5a104d2..505b747 100644
--- a/src/component/helper/MapDraw.ts
+++ b/src/component/helper/MapDraw.ts
@@ -28,11 +28,10 @@ import ExtensionAPI from '../../ExtensionAPI';
 import GeoModel, { GeoCommonOptionMixin, GeoItemStyleOption } from '../../coord/geo/GeoModel';
 import MapSeries from '../../chart/map/MapSeries';
 import GlobalModel from '../../model/Global';
-import { Payload, ECElement } from '../../util/types';
+import { Payload } from '../../util/types';
 import GeoView from '../geo/GeoView';
 import MapView from '../../chart/map/MapView';
 import Region from '../../coord/geo/Region';
-import Element from 'zrender/src/Element';
 import Geo from '../../coord/geo/Geo';
 import Model from '../../model/Model';
 
@@ -295,7 +294,7 @@ class MapDraw {
             else {
                 const regionModel = mapOrGeoModel.getRegionModel(region.name);
                 // Package custom mouse event for geo component
-                (compoundPath as Element as ECElement).eventData = {
+                graphic.getECData(compoundPath).eventData = {
                     componentType: 'geo',
                     componentIndex: mapOrGeoModel.componentIndex,
                     geoIndex: mapOrGeoModel.componentIndex,
diff --git a/src/component/title.ts b/src/component/title.ts
index 99ae5a9..d9850be 100644
--- a/src/component/title.ts
+++ b/src/component/title.ts
@@ -28,8 +28,7 @@ import {
     ZRTextVerticalAlign,
     ZRColor,
     BorderOptionMixin,
-    LabelOption,
-    ECElement
+    LabelOption
 } from '../util/types';
 import ComponentView from '../view/Component';
 import GlobalModel from '../model/Global';
@@ -189,7 +188,7 @@ class TitleView extends ComponentView {
             });
         }
 
-        (textEl as ECElement).eventData = (subTextEl as ECElement).eventData = triggerEvent
+        graphic.getECData(textEl).eventData = graphic.getECData(subTextEl).eventData = triggerEvent
             ? {
                 componentType: 'title',
                 componentIndex: titleModel.componentIndex
diff --git a/src/component/tooltip/TooltipView.ts b/src/component/tooltip/TooltipView.ts
index 3e4c537..fc8ebcd 100644
--- a/src/component/tooltip/TooltipView.ts
+++ b/src/component/tooltip/TooltipView.ts
@@ -444,7 +444,7 @@ class TooltipView extends ComponentView {
             this._showAxisTooltip(dataByCoordSys, e);
         }
         // Always show item tooltip if mouse is on the element with dataIndex
-        else if (el && el.dataIndex != null) {
+        else if (el && graphic.getECData(el).dataIndex != null) {
             this._lastDataByCoordSys = null;
             this._showSeriesItemTooltip(e, el, dispatchAction);
         }
@@ -604,16 +604,17 @@ class TooltipView extends ComponentView {
         dispatchAction: ExtensionAPI['dispatchAction']
     ) {
         var ecModel = this._ecModel;
+        var ecData = graphic.getECData(el);
         // Use dataModel in element if possible
         // Used when mouseover on a element like markPoint or edge
         // In which case, the data is not main data in series.
-        var seriesIndex = el.seriesIndex;
+        var seriesIndex = ecData.seriesIndex;
         var seriesModel = ecModel.getSeriesByIndex(seriesIndex);
 
         // For example, graph link.
-        var dataModel = el.dataModel || seriesModel;
-        var dataIndex = el.dataIndex;
-        var dataType = el.dataType;
+        var dataModel = ecData.dataModel || seriesModel;
+        var dataIndex = ecData.dataIndex;
+        var dataType = ecData.dataType;
         var data = dataModel.getData();
 
         var tooltipModel = buildTooltipModel([
diff --git a/src/component/visualMap/ContinuousView.ts b/src/component/visualMap/ContinuousView.ts
index 1fbba1a..1400c18 100644
--- a/src/component/visualMap/ContinuousView.ts
+++ b/src/component/visualMap/ContinuousView.ts
@@ -33,12 +33,13 @@ import GlobalModel from '../../model/Global';
 import ExtensionAPI from '../../ExtensionAPI';
 import Element, { ElementEvent } from 'zrender/src/Element';
 import { TextVerticalAlign, TextAlign } from 'zrender/src/core/types';
-import { ColorString, Payload, ECElement } from '../../util/types';
+import { ColorString, Payload } from '../../util/types';
 
 var linearMap = numberUtil.linearMap;
 var each = zrUtil.each;
 var mathMin = Math.min;
 var mathMax = Math.max;
+var getECData = graphic.getECData;
 
 // Arbitrary value
 var HOVER_LINK_SIZE = 12;
@@ -702,18 +703,19 @@ class ContinuousView extends VisualMapView {
         var el = e.target;
         var visualMapModel = this.visualMapModel;
 
-        if (!el || (el as ECElement).dataIndex == null) {
+        if (!el || getECData(el).dataIndex == null) {
             return;
         }
+        var ecData = getECData(el);
 
-        var dataModel = this.ecModel.getSeriesByIndex((el as ECElement).seriesIndex);
+        var dataModel = this.ecModel.getSeriesByIndex(ecData.seriesIndex);
 
         if (!visualMapModel.isTargetSeries(dataModel)) {
             return;
         }
 
-        var data = dataModel.getData((el as ECElement).dataType);
-        var value = data.get(visualMapModel.getDataDimension(data), (el as ECElement).dataIndex) as number;
+        var data = dataModel.getData(ecData.dataType);
+        var value = data.get(visualMapModel.getDataDimension(data), ecData.dataIndex) as number;
 
         if (!isNaN(value)) {
             this._showIndicator(value, value);
diff --git a/src/data/List.ts b/src/data/List.ts
index 0057432..bdf2994 100644
--- a/src/data/List.ts
+++ b/src/data/List.ts
@@ -34,13 +34,14 @@ import DataDimensionInfo from './DataDimensionInfo';
 import {ArrayLike, Dictionary, FunctionPropertyNames} from 'zrender/src/core/types';
 import Element from 'zrender/src/Element';
 import {
-    DimensionIndex, DimensionName, ECElement, DimensionLoose, OptionDataItem,
+    DimensionIndex, DimensionName, DimensionLoose, OptionDataItem,
     ParsedValue, ParsedValueNumeric, OrdinalNumber, DimensionUserOuput, ModelOption
 } from '../util/types';
 import {parseDate} from '../util/number';
 import {isDataItemOption} from '../util/model';
 import type Graph from './Graph';
 import type Tree from './Tree';
+import { getECData } from '../util/graphic';
 
 
 var isObject = zrUtil.isObject;
@@ -1738,11 +1739,12 @@ class List<HostModel extends Model = Model> {
         var hostModel = this.hostModel;
 
         if (el) {
+            var ecData = getECData(el);
             // Add data index and series index for indexing the data by element
             // Useful in tooltip
-            (el as ECElement).dataIndex = idx;
-            (el as ECElement).dataType = this.dataType;
-            (el as ECElement).seriesIndex = hostModel && (hostModel as any).seriesIndex;
+            ecData.dataIndex = idx;
+            ecData.dataType = this.dataType;
+            ecData.seriesIndex = hostModel && (hostModel as any).seriesIndex;
             if (el.type === 'group') {
                 el.traverse(setItemDataAndSeriesIndex, el);
             }
@@ -2084,9 +2086,11 @@ class List<HostModel extends Model = Model> {
         };
 
         setItemDataAndSeriesIndex = function (this: Element, child: Element): void {
-            (child as ECElement).seriesIndex = (this as ECElement).seriesIndex;
-            (child as ECElement).dataIndex = (this as ECElement).dataIndex;
-            (child as ECElement).dataType = (this as ECElement).dataType;
+            var childECData = getECData(child);
+            var thisECData = getECData(this);
+            childECData.seriesIndex = thisECData.seriesIndex;
+            childECData.dataIndex = thisECData.dataIndex;
+            childECData.dataType = thisECData.dataType;
         };
 
         transferProperties = function (target: List, source: List): void {
diff --git a/src/echarts.ts b/src/echarts.ts
index 0c97527..b953714 100644
--- a/src/echarts.ts
+++ b/src/echarts.ts
@@ -765,24 +765,23 @@ class ECharts {
         each(MOUSE_EVENT_NAMES, function (eveName) {
             const handler = (e: ElementEvent) => {
                 var ecModel = this.getModel();
-                var targetEl = e.target;
-                var el = targetEl as ECElement;
+                var el = e.target;
                 var params: ECEvent;
                 var isGlobalOut = eveName === 'globalout';
-
+                var ecData = el && graphic.getECData(el);
                 // no e.target when 'globalout'.
                 if (isGlobalOut) {
                     params = {} as ECEvent;
                 }
-                else if (el && el.dataIndex != null) {
-                    var dataModel = el.dataModel || ecModel.getSeriesByIndex(el.seriesIndex);
+                else if (ecData && ecData.dataIndex != null) {
+                    var dataModel = ecData.dataModel || ecModel.getSeriesByIndex(ecData.seriesIndex);
                     params = (
-                        dataModel && dataModel.getDataParams(el.dataIndex, el.dataType, targetEl) || {}
+                        dataModel && dataModel.getDataParams(ecData.dataIndex, ecData.dataType, targetEl) || {}
                     ) as ECEvent;
                 }
                 // If element has custom eventData of components
-                else if (el && el.eventData) {
-                    params = zrUtil.extend({}, el.eventData) as ECEvent;
+                else if (el && ecData.eventData) {
+                    params = zrUtil.extend({}, ecData.eventData) as ECEvent;
                 }
 
                 // Contract: if params prepared in mouse event,
diff --git a/src/model/Model.ts b/src/model/Model.ts
index 6cf80f3..86763ac 100644
--- a/src/model/Model.ts
+++ b/src/model/Model.ts
@@ -46,13 +46,6 @@ type Value<Opt, R> = Opt extends Dictionary<any>
     ? (R extends keyof Opt ? Opt[R] : ModelOption)
     : ModelOption;
 
-/**
- * @alias module:echarts/model/Model
- * @constructor
- * @param {Object} [option]
- * @param {module:echarts/model/Model} [parentModel]
- * @param {module:echarts/model/Global} [ecModel]
- */
 class Model<Opt extends ModelOption = ModelOption> {    // TODO: TYPE use unkown insteadof any?
 
     // [Caution]: for compat the previous "class extend"
diff --git a/src/util/graphic.ts b/src/util/graphic.ts
index c5b1a30..9a391d8 100644
--- a/src/util/graphic.ts
+++ b/src/util/graphic.ts
@@ -57,9 +57,12 @@ import {
     DisplayState,
     ECElement,
     ZRRectLike,
-    ColorString
+    ColorString,
+    DataModel,
+    ECEventData
 } from './types';
 import GlobalModel from '../model/Global';
+import { makeInner } from './model';
 
 
 const mathMax = Math.max;
@@ -1386,7 +1389,7 @@ export function groupTransition(
             if (oldEl) {
                 var newProp = getAnimatableProps(el);
                 el.attr(getAnimatableProps(oldEl));
-                updateProps(el, newProp, animatableModel, (el as ECElement).dataIndex);
+                updateProps(el, newProp, animatableModel, getECData(el).dataIndex);
             }
         }
     });
@@ -1525,6 +1528,20 @@ function nearZero(val: number) {
     return val <= (1e-6) && val >= -(1e-6);
 }
 
+
+/**
+ * ECData stored on graphic element
+ */
+export interface ECData {
+    dataIndex?: number;
+    dataModel?: DataModel;
+    eventData?: ECEventData;
+    seriesIndex?: number;
+    dataType?: string;
+}
+
+export const getECData = makeInner<ECData>();
+
 // Register built-in shapes. These shapes might be overwirtten
 // by users, although we do not recommend that.
 registerShape('circle', Circle);
diff --git a/src/util/types.ts b/src/util/types.ts
index d05010d..fe0d20d 100644
--- a/src/util/types.ts
+++ b/src/util/types.ts
@@ -95,11 +95,6 @@ export interface ComponentTypeInfo {
 
 export interface ECElement extends Element {
     useHoverLayer?: boolean;
-    dataIndex?: number;
-    dataModel?: DataModel;
-    eventData?: ECEventData;
-    seriesIndex?: number;
-    dataType?: string;
     tooltip?: CommonTooltipOption<unknown> & {
         content?: string;
         formatterParams?: unknown;
diff --git a/tsconfig.json b/tsconfig.json
index 5457b91..aa178b5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -16,7 +16,9 @@
 
         "importHelpers": true,
 
-        "pretty": true
+        "pretty": true,
+
+        "outDir": "lib"
     },
     "include": [
         "src/**/*.ts",


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org