提交 b9637180 编写于 作者: P pissang

ts: bug fixes

上级 fe09d9f3
......@@ -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;
......@@ -199,4 +199,6 @@ function transInit(points: number[][], dim: number, itemLayout: BoxplotItemLayou
});
}
ChartView.registerClass(BoxplotView);
export default BoxplotView;
......@@ -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']
......
......@@ -472,4 +472,6 @@ class GraphSeriesModel extends SeriesModel<GraphSeriesOption> {
}
}
SeriesModel.registerClass(GraphSeriesModel);
export default GraphSeriesModel;
\ No newline at end of file
......@@ -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());
......
......@@ -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);
}
}
......
......@@ -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
......@@ -266,4 +266,6 @@ function enterRegionHighDown(highDownRecord: HighDownRecord, toHighOrDown: boole
}
}
ChartView.registerClass(MapView);
export default MapView;
......@@ -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';
......
......@@ -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: []
}
})
}
......
......@@ -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;
}
......
......@@ -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';
}
}
......
......@@ -68,8 +68,6 @@ class CartesianAxisModel extends ComponentModel<CartesianAxisOption>
}
}
ComponentModel.registerClass(CartesianAxisModel);
interface CartesianAxisModel extends AxisModelCommonMixin<CartesianAxisOption>,
AxisModelExtendedInCreator<CartesianAxisOption> {}
......
......@@ -65,6 +65,4 @@ class GridModel extends ComponentModel<GridOption> implements CoordinateSystemHo
}
}
ComponentModel.registerClass(GridModel);
export default GridModel;
......@@ -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';
......
......@@ -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';
......
......@@ -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';
......
......@@ -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,
......
......@@ -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
......
......@@ -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;
......
......@@ -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
......@@ -35,7 +35,7 @@ import { AxisBaseOption } from '../coord/axisCommonTypes';
class OrdinalScale extends Scale {
type: 'ordinal';
readonly type = 'ordinal'
private _ordinalMeta: OrdinalMeta;
......
......@@ -73,7 +73,7 @@ var bisect = function (
class TimeScale extends IntervalScale {
type = 'time';
readonly type = 'time';
private _stepLvl: [string, number];
......
<!--
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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册