diff --git a/src/chart/boxplot/BoxplotSeries.ts b/src/chart/boxplot/BoxplotSeries.ts index 04eef95d8f05087176c57a4c2c602f477048d2b6..7afbdc19e98b7b84b421bb32042981401b394861 100644 --- a/src/chart/boxplot/BoxplotSeries.ts +++ b/src/chart/boxplot/BoxplotSeries.ts @@ -28,7 +28,6 @@ import { LabelOption, OptionDataValueNumeric } from '../../util/types'; -import ComponentModel from '../../model/Component'; import type Axis2D from '../../coord/cartesian/Axis2D'; import Cartesian2D from '../../coord/cartesian/Cartesian2D'; @@ -74,6 +73,7 @@ export interface BoxplotSeriesOption extends SeriesOption, SeriesOnCartesianOpti class BoxplotSeriesModel extends SeriesModel { static readonly type = 'series.boxplot' + readonly type = BoxplotSeriesModel.type static readonly dependencies = ['xAxis', 'yAxis', 'grid'] @@ -133,6 +133,6 @@ interface BoxplotSeriesModel extends WhiskerBoxCommonMixin } zrUtil.mixin(BoxplotSeriesModel, WhiskerBoxCommonMixin, true); -ComponentModel.registerClass(BoxplotSeriesModel); +SeriesModel.registerClass(BoxplotSeriesModel); export default BoxplotSeriesModel; diff --git a/src/chart/boxplot/BoxplotView.ts b/src/chart/boxplot/BoxplotView.ts index 0bbaaaeb18a5f8df15a43f3f956fbab927fdbfe2..bd7b488e2e72162e33b671b04d07b69951a41f20 100644 --- a/src/chart/boxplot/BoxplotView.ts +++ b/src/chart/boxplot/BoxplotView.ts @@ -199,4 +199,6 @@ function transInit(points: number[][], dim: number, itemLayout: BoxplotItemLayou }); } +ChartView.registerClass(BoxplotView); + export default BoxplotView; diff --git a/src/chart/candlestick/CandlestickSeries.ts b/src/chart/candlestick/CandlestickSeries.ts index 862fbfdec2720cc51c3836b1cde501c57d3f03a9..671c56a9ba6053e0026002fe8157d93f46cb2e96 100644 --- a/src/chart/candlestick/CandlestickSeries.ts +++ b/src/chart/candlestick/CandlestickSeries.ts @@ -82,6 +82,7 @@ export interface CandlestickSeriesOption extends SeriesOption, SeriesOnCartesian class CandlestickSeriesModel extends SeriesModel { static readonly type = 'series.candlestick' + readonly type = CandlestickSeriesModel.type static readonly dependencies = ['xAxis', 'yAxis', 'grid'] diff --git a/src/chart/graph/GraphSeries.ts b/src/chart/graph/GraphSeries.ts index ad8a8cd12b6a2281857b4d81049d5cdd6caee5db..b06353da1b4b7cd5a0e9cbd705ac2af2cd385fca 100644 --- a/src/chart/graph/GraphSeries.ts +++ b/src/chart/graph/GraphSeries.ts @@ -472,4 +472,6 @@ class GraphSeriesModel extends SeriesModel { } } +SeriesModel.registerClass(GraphSeriesModel); + export default GraphSeriesModel; \ No newline at end of file diff --git a/src/chart/graph/simpleLayoutHelper.ts b/src/chart/graph/simpleLayoutHelper.ts index 58d5cae426d677896fd9c8aab4c9bd69a78df4d8..fb699e76799276d4fe4fc1c0da6c61b0268eec14 100644 --- a/src/chart/graph/simpleLayoutHelper.ts +++ b/src/chart/graph/simpleLayoutHelper.ts @@ -37,7 +37,7 @@ export function simpleLayout(seriesModel: GraphSeriesModel) { } export function simpleLayoutEdge(graph: Graph) { - graph.eachEdge(function (edge) { + graph.eachEdge(function (edge, idx) { var curveness = edge.getModel().get(['lineStyle', 'curveness']) || 0; var p1 = vec2.clone(edge.node1.getLayout()); var p2 = vec2.clone(edge.node2.getLayout()); diff --git a/src/chart/helper/LinePath.ts b/src/chart/helper/LinePath.ts index a6a414cb225ce4066d4999d5fb59b7d2a91bdd58..5f07b2dcc556287a73d9651f828cd5eabae73606 100644 --- a/src/chart/helper/LinePath.ts +++ b/src/chart/helper/LinePath.ts @@ -66,19 +66,19 @@ class ECLinePath extends graphic.Path { buildPath(ctx: CanvasRenderingContext2D, shape: StraightLineShape | CurveShape) { if (isStraightLine(shape)) { - straightLineProto.buildPath(ctx, shape); + straightLineProto.buildPath.call(this, ctx, shape); } else { - bezierCurveProto.buildPath(ctx, shape); + bezierCurveProto.buildPath.call(this, ctx, shape); } } pointAt(t: number) { if (isStraightLine(this.shape)) { - return straightLineProto.pointAt(t); + return straightLineProto.pointAt.call(this, t); } else { - return bezierCurveProto.pointAt(t); + return bezierCurveProto.pointAt.call(this, t); } } diff --git a/src/chart/map/MapSeries.ts b/src/chart/map/MapSeries.ts index 669e26c74f168c2af8f39dc1ee9b388193eed25d..7f5edbd0b7c344b33ac3bd2aba21cb6d232dc19f 100644 --- a/src/chart/map/MapSeries.ts +++ b/src/chart/map/MapSeries.ts @@ -318,4 +318,6 @@ class MapSeries extends SeriesModel { interface MapSeries extends DataSelectableMixin {} zrUtil.mixin(MapSeries, DataSelectableMixin); +SeriesModel.registerClass(MapSeries); + export default MapSeries; \ No newline at end of file diff --git a/src/chart/map/MapView.ts b/src/chart/map/MapView.ts index 3417e854bcf8b1b617c65962211f2a3d9a227565..c5dc44221df818c82806b4dd4f6b003ed68611c0 100644 --- a/src/chart/map/MapView.ts +++ b/src/chart/map/MapView.ts @@ -266,4 +266,6 @@ function enterRegionHighDown(highDownRecord: HighDownRecord, toHighOrDown: boole } } +ChartView.registerClass(MapView); + export default MapView; diff --git a/src/component/polar.ts b/src/component/polar.ts index 398015c9c8820a96e6e912e3cc9eacb8a13c7942..16743ed9b4c29f971cf2f15d43c46843d525dac8 100644 --- a/src/component/polar.ts +++ b/src/component/polar.ts @@ -21,6 +21,9 @@ import * as echarts from '../echarts'; import * as zrUtil from 'zrender/src/core/util'; import barPolar from '../layout/barPolar'; +// Import self registered models. +import '../coord/polar/PolarModel'; +import '../coord/polar/AxisModel'; import '../coord/polar/polarCreator'; import './angleAxis'; import './radiusAxis'; diff --git a/src/component/timeline/SliderTimelineModel.ts b/src/component/timeline/SliderTimelineModel.ts index baf4fa53ba6dd22a529ab2c9822010b183ee0350..0673022fa425ea045764f66b24e57722a3ae7f09 100644 --- a/src/component/timeline/SliderTimelineModel.ts +++ b/src/component/timeline/SliderTimelineModel.ts @@ -22,6 +22,7 @@ import DataFormatMixin from '../../model/mixin/dataFormat'; import ComponentModel from '../../model/Component'; import { mixin } from 'zrender/src/core/util'; import List from '../../data/List'; +import { inheritDefaultOption } from '../../util/component'; interface SliderTimelineOption extends TimelineOption { } @@ -34,7 +35,7 @@ class SliderTimelineModel extends TimelineModel { /** * @protected */ - static defaultOption: SliderTimelineOption = { + static defaultOption: SliderTimelineOption = inheritDefaultOption(TimelineModel.defaultOption, { backgroundColor: 'rgba(0,0,0,0)', // 时间轴背景颜色 borderColor: '#ccc', // 时间轴边框颜色 @@ -119,7 +120,7 @@ class SliderTimelineModel extends TimelineModel { } }, data: [] - } + }) } diff --git a/src/component/timeline/SliderTimelineView.ts b/src/component/timeline/SliderTimelineView.ts index 8bd3315d45f9ac03a302f2b8092fe101ed6d37cc..aae646c7e8c8b4d455ac0db0ff96a3196bdfcbd3 100644 --- a/src/component/timeline/SliderTimelineView.ts +++ b/src/component/timeline/SliderTimelineView.ts @@ -24,7 +24,6 @@ import * as layout from '../../util/layout'; import TimelineView from './TimelineView'; import TimelineAxis from './TimelineAxis'; import {createSymbol} from '../../util/symbol'; -import * as axisHelper from '../../coord/axisHelper'; import * as numberUtil from '../../util/number'; import {encodeHTML} from '../../util/format'; import GlobalModel from '../../model/Global'; @@ -342,7 +341,7 @@ class SliderTimelineView extends TimelineView { scale.niceTicks(); var axis = new TimelineAxis('value', scale, layoutInfo.axisExtent as [number, number], axisType); - axis.timelineModel = timelineModel; + axis.model = timelineModel; return axis; } diff --git a/src/component/timeline/TimelineAxis.ts b/src/component/timeline/TimelineAxis.ts index bc559233e1da702107c37af81314efbac6fa4e5f..03fa5ec351cd97fa70dc21dc2d670327d0b3421b 100644 --- a/src/component/timeline/TimelineAxis.ts +++ b/src/component/timeline/TimelineAxis.ts @@ -30,10 +30,8 @@ class TimelineAxis extends Axis { type: 'category' | 'time' | 'value' - // Not using the model. - model: never - - timelineModel: TimelineModel + // @ts-ignore + model: TimelineModel constructor(dim: string, scale: Scale, coordExtent: [number, number], axisType: 'category' | 'time' | 'value') { super(dim, scale, coordExtent); @@ -45,14 +43,14 @@ class TimelineAxis extends Axis { */ getLabelModel() { // Force override - return this.timelineModel.getModel('label') as Model; + return this.model.getModel('label') as Model; } /** * @override */ isHorizontal() { - return this.timelineModel.get('orient') === 'horizontal'; + return this.model.get('orient') === 'horizontal'; } } diff --git a/src/coord/cartesian/AxisModel.ts b/src/coord/cartesian/AxisModel.ts index 454cf0ea9b91bc6967c99f234949f51f1653c105..9223f3e9143a262bdcf1527a47c5efdefbc99358 100644 --- a/src/coord/cartesian/AxisModel.ts +++ b/src/coord/cartesian/AxisModel.ts @@ -68,8 +68,6 @@ class CartesianAxisModel extends ComponentModel } } -ComponentModel.registerClass(CartesianAxisModel); - interface CartesianAxisModel extends AxisModelCommonMixin, AxisModelExtendedInCreator {} diff --git a/src/coord/cartesian/GridModel.ts b/src/coord/cartesian/GridModel.ts index e57ce5d3bc1009749680b198c792c82819ce5967..b4f96aa87088ee32b840e634c2f320d9f402201c 100644 --- a/src/coord/cartesian/GridModel.ts +++ b/src/coord/cartesian/GridModel.ts @@ -65,6 +65,4 @@ class GridModel extends ComponentModel implements CoordinateSystemHo } } -ComponentModel.registerClass(GridModel); - export default GridModel; diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts index e11981a6f34a760856595aa486a77866537bb280..5f3c228488679228d0f53fc83b1795ac9602dc9b 100644 --- a/src/coord/geo/GeoModel.ts +++ b/src/coord/geo/GeoModel.ts @@ -34,7 +34,6 @@ import { DisplayState, RoamOptionMixin } from '../../util/types'; -import { RoamType } from '../../component/helper/RoamController'; import { NameMap } from './geoTypes'; import GlobalModel from '../../model/Global'; diff --git a/src/coord/parallel/AxisModel.ts b/src/coord/parallel/AxisModel.ts index c949253622ab63ce20cfe3f2f87579e5e4996df9..6d1346d66e3fc5c276905fcf382cc0302ff3ed34 100644 --- a/src/coord/parallel/AxisModel.ts +++ b/src/coord/parallel/AxisModel.ts @@ -25,7 +25,7 @@ import axisModelCreator, { AxisModelExtendedInCreator } from '../axisModelCreato import * as numberUtil from '../../util/number'; import {AxisModelCommonMixin} from '../axisModelCommonMixin'; import ParallelAxis from './ParallelAxis'; -import { ComponentOption, ZRColor, ParsedValue } from '../../util/types'; +import { ZRColor, ParsedValue } from '../../util/types'; import { AxisBaseOption } from '../axisCommonTypes'; import { StyleProps } from 'zrender/src/graphic/Style'; import Parallel from './Parallel'; diff --git a/src/coord/parallel/ParallelModel.ts b/src/coord/parallel/ParallelModel.ts index f0105c461eb3ec320a9c0128887c054295801795..aa2c8c9a9f9e84e6e78da187e931c7c773d0aa2b 100644 --- a/src/coord/parallel/ParallelModel.ts +++ b/src/coord/parallel/ParallelModel.ts @@ -20,9 +20,8 @@ import * as zrUtil from 'zrender/src/core/util'; import ComponentModel from '../../model/Component'; -import './AxisModel'; import Parallel from './Parallel'; -import { DimensionName, ComponentOption, BoxLayoutOptionMixin, Dictionary } from '../../util/types'; +import { DimensionName, ComponentOption, BoxLayoutOptionMixin } from '../../util/types'; import ParallelAxisModel, { ParallelAxisOption } from './AxisModel'; import GlobalModel from '../../model/Global'; import ParallelSeries from '../../chart/parallel/ParallelSeries'; diff --git a/src/coord/polar/AxisModel.ts b/src/coord/polar/AxisModel.ts index d5714ee6c571f3863ca27ca040d5642e8fe041c0..77aa18996d92bc0fc5923f96537f334aa7b97fbd 100644 --- a/src/coord/polar/AxisModel.ts +++ b/src/coord/polar/AxisModel.ts @@ -82,14 +82,16 @@ zrUtil.mixin(PolarAxisModel, AxisModelCommonMixin); export {PolarAxisModel}; export class AngleAxisModel extends PolarAxisModel { + static type = 'angleAxis' + type = AngleAxisModel.type axis: AngleAxis } export class RadiusAxisModel extends PolarAxisModel { + static type = 'radiusAxis' + type = RadiusAxisModel.type axis: RadiusAxis } -ComponentModel.registerClass(PolarAxisModel); - const angleAxisExtraOption: AngleAxisOption = { startAngle: 90, diff --git a/src/coord/single/AxisModel.ts b/src/coord/single/AxisModel.ts index 5dd4edb0050aa6d3290454f7d47aad88c5d7acb8..9706a7c27d14df9ca658ccb1b5632a0c8d96f80e 100644 --- a/src/coord/single/AxisModel.ts +++ b/src/coord/single/AxisModel.ts @@ -35,7 +35,7 @@ export interface SingleAxisOption extends AxisBaseOption, BoxLayoutOptionMixin { } class SingleAxisModel extends ComponentModel - implements AxisBaseModel { + implements AxisBaseModel { static type = 'singleAxis' type = SingleAxisModel.type diff --git a/src/data/Graph.ts b/src/data/Graph.ts index b9784932d4dd4fd43ee1c3ba80d71cde6cc34197..1ab114b7365d9853c298efe047eeee397e9e94b2 100644 --- a/src/data/Graph.ts +++ b/src/data/Graph.ts @@ -459,8 +459,8 @@ function createGraphDataProxyMixin( interface GraphEdge extends ReturnType {}; interface GraphNode extends ReturnType {}; -zrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'data')); -zrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'edgeData')); +zrUtil.mixin(GraphNode, createGraphDataProxyMixin('hostGraph', 'data')); +zrUtil.mixin(GraphEdge, createGraphDataProxyMixin('hostGraph', 'edgeData')); export default Graph; diff --git a/src/preprocessor/helper/compatStyle.ts b/src/preprocessor/helper/compatStyle.ts index 2721a4aa3ba70a2f8f92dd50555b46003b6920ce..dde1e3255e25264493b3596af57125f17a0464a0 100644 --- a/src/preprocessor/helper/compatStyle.ts +++ b/src/preprocessor/helper/compatStyle.ts @@ -37,7 +37,7 @@ function deprecateLog(str: string) { } if (typeof console !== 'undefined' && console.warn) { storedLogs[str] = true; - console.warn('DEPRECATED: ' + str); + console.warn('[ECharts] DEPRECATED: ' + str); } } @@ -343,5 +343,5 @@ export default function (option: any, isTheme?: boolean) { compatTextStyle(toObj(option.tooltip).axisPointer, 'label'); // Clean logs - storedLogs = {}; + // storedLogs = {}; } \ No newline at end of file diff --git a/src/scale/Ordinal.ts b/src/scale/Ordinal.ts index 51fdc07ad9ed35b0efdeb02bf365b6ba6b65b960..e6cc3daf6e3410b04be7f405425d702b6420e51b 100644 --- a/src/scale/Ordinal.ts +++ b/src/scale/Ordinal.ts @@ -35,7 +35,7 @@ import { AxisBaseOption } from '../coord/axisCommonTypes'; class OrdinalScale extends Scale { - type: 'ordinal'; + readonly type = 'ordinal' private _ordinalMeta: OrdinalMeta; diff --git a/src/scale/Time.ts b/src/scale/Time.ts index b34639a4cc8642e4cefd5c52a1568cde6fb35d83..ea6df168183de8ae0bc9a3e4496962d859d1648d 100644 --- a/src/scale/Time.ts +++ b/src/scale/Time.ts @@ -73,7 +73,7 @@ var bisect = function ( class TimeScale extends IntervalScale { - type = 'time'; + readonly type = 'time'; private _stepLvl: [string, number]; diff --git a/test/chord.html b/test/chord.html deleted file mode 100644 index 0d4f5e3a8e2c8ac4f347ad8c94f10f014d4419fb..0000000000000000000000000000000000000000 --- a/test/chord.html +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - - - - - -
-
- - - \ No newline at end of file