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/18 05:12:09 UTC
[incubator-echarts] branch typescript updated: ts: bug fixes
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 b963718 ts: bug fixes
b963718 is described below
commit b96371800f2ff434b1241543945aab1a90751d4c
Author: pissang <bm...@gmail.com>
AuthorDate: Wed Mar 18 13:11:33 2020 +0800
ts: bug fixes
---
src/chart/boxplot/BoxplotSeries.ts | 4 +-
src/chart/boxplot/BoxplotView.ts | 2 +
src/chart/candlestick/CandlestickSeries.ts | 1 +
src/chart/graph/GraphSeries.ts | 2 +
src/chart/graph/simpleLayoutHelper.ts | 2 +-
src/chart/helper/LinePath.ts | 8 +--
src/chart/map/MapSeries.ts | 2 +
src/chart/map/MapView.ts | 2 +
src/component/polar.ts | 3 ++
src/component/timeline/SliderTimelineModel.ts | 5 +-
src/component/timeline/SliderTimelineView.ts | 3 +-
src/component/timeline/TimelineAxis.ts | 10 ++--
src/coord/cartesian/AxisModel.ts | 2 -
src/coord/cartesian/GridModel.ts | 2 -
src/coord/geo/GeoModel.ts | 1 -
src/coord/parallel/AxisModel.ts | 2 +-
src/coord/parallel/ParallelModel.ts | 3 +-
src/coord/polar/AxisModel.ts | 6 ++-
src/coord/single/AxisModel.ts | 2 +-
src/data/Graph.ts | 4 +-
src/preprocessor/helper/compatStyle.ts | 4 +-
src/scale/Ordinal.ts | 2 +-
src/scale/Time.ts | 2 +-
test/chord.html | 78 ---------------------------
24 files changed, 40 insertions(+), 112 deletions(-)
diff --git a/src/chart/boxplot/BoxplotSeries.ts b/src/chart/boxplot/BoxplotSeries.ts
index 04eef95..7afbdc1 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<BoxplotSeriesOption> {
static readonly type = 'series.boxplot'
+ readonly type = BoxplotSeriesModel.type
static readonly dependencies = ['xAxis', 'yAxis', 'grid']
@@ -133,6 +133,6 @@ interface BoxplotSeriesModel extends WhiskerBoxCommonMixin<BoxplotSeriesOption>
}
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 0bbaaae..bd7b488 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 862fbfd..671c56a 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<CandlestickSeriesOption> {
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 ad8a8cd..b06353d 100644
--- a/src/chart/graph/GraphSeries.ts
+++ b/src/chart/graph/GraphSeries.ts
@@ -472,4 +472,6 @@ class GraphSeriesModel extends SeriesModel<GraphSeriesOption> {
}
}
+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 58d5cae..fb699e7 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<GraphEdgeItemOption>().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 a6a414c..5f07b2d 100644
--- a/src/chart/helper/LinePath.ts
+++ b/src/chart/helper/LinePath.ts
@@ -66,19 +66,19 @@ class ECLinePath extends graphic.Path<ECLineProps> {
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 669e26c..7f5edbd 100644
--- a/src/chart/map/MapSeries.ts
+++ b/src/chart/map/MapSeries.ts
@@ -318,4 +318,6 @@ class MapSeries extends SeriesModel<MapSeriesOption> {
interface MapSeries extends DataSelectableMixin<MapSeriesOption> {}
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 3417e85..c5dc442 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 398015c..16743ed 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 baf4fa5..0673022 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 8bd3315..aae646c 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 bc55923..03fa5ec 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<LabelOption>;
+ return this.model.getModel('label') as Model<LabelOption>;
}
/**
* @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 454cf0e..9223f3e 100644
--- a/src/coord/cartesian/AxisModel.ts
+++ b/src/coord/cartesian/AxisModel.ts
@@ -68,8 +68,6 @@ class CartesianAxisModel extends ComponentModel<CartesianAxisOption>
}
}
-ComponentModel.registerClass(CartesianAxisModel);
-
interface CartesianAxisModel extends AxisModelCommonMixin<CartesianAxisOption>,
AxisModelExtendedInCreator<CartesianAxisOption> {}
diff --git a/src/coord/cartesian/GridModel.ts b/src/coord/cartesian/GridModel.ts
index e57ce5d..b4f96aa 100644
--- a/src/coord/cartesian/GridModel.ts
+++ b/src/coord/cartesian/GridModel.ts
@@ -65,6 +65,4 @@ class GridModel extends ComponentModel<GridOption> implements CoordinateSystemHo
}
}
-ComponentModel.registerClass(GridModel);
-
export default GridModel;
diff --git a/src/coord/geo/GeoModel.ts b/src/coord/geo/GeoModel.ts
index e11981a..5f3c228 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 c949253..6d1346d 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 f0105c4..aa2c8c9 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 d5714ee..77aa189 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<AngleAxisOption> {
+ static type = 'angleAxis'
+ type = AngleAxisModel.type
axis: AngleAxis
}
export class RadiusAxisModel extends PolarAxisModel<RadiusAxisOption> {
+ 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 5dd4edb..9706a7c 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<SingleAxisOption>
- implements AxisBaseModel<SingleAxisOption> {
+ implements AxisBaseModel<SingleAxisOption> {
static type = 'singleAxis'
type = SingleAxisModel.type
diff --git a/src/data/Graph.ts b/src/data/Graph.ts
index b978493..1ab114b 100644
--- a/src/data/Graph.ts
+++ b/src/data/Graph.ts
@@ -459,8 +459,8 @@ function createGraphDataProxyMixin<Host extends GraphEdge | GraphNode>(
interface GraphEdge extends ReturnType<typeof createGraphDataProxyMixin> {};
interface GraphNode extends ReturnType<typeof createGraphDataProxyMixin> {};
-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 2721a4a..dde1e32 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 51fdc07..e6cc3da 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 b34639a..ea6df16 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 0d4f5e3..0000000
--- a/test/chord.html
+++ /dev/null
@@ -1,78 +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.
--->
-
-<html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <script src="lib/esl.js"></script>
- <script src="lib/config.js"></script>
- <script src="lib/facePrint.js"></script>
- </head>
- <body>
- <style>
- html, body, #main {
- width: 100%;
- height: 100%;
- }
- </style>
- <div id="info"></div>
- <div id="main"></div>
- <script>
-
- require([
- 'echarts'
- // 'echarts/chart/chord',
- // 'echarts/component/legend',
- // 'echarts/component/grid',
- // 'echarts/component/tooltip'
- ], function (echarts) {
-
- var chart = echarts.init(document.getElementById('main'));
- chart.setOption({
- tooltip: {
- trigger: 'axis',
- axisPointer: {
- type: 'line'
- }
- },
- series: [{
- name: 'chord',
- type: 'chord',
- sort: 'descending',
- data : [
- {name : 'group1'},
- {name : 'group2'},
- {name : 'group3'},
- {name : 'group4'}
- ],
- matrix: [
- [11975, 5871, 8916, 2868],
- [ 1951, 10048, 2060, 6171],
- [ 8010, 16145, 8090, 8045],
- [ 1013, 990, 940, 6907]
- ]
- }]
- });
- })
-
- </script>
- </body>
-</html>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org