提交 704c1d11 编写于 作者: P pissang

ts: bug fixes

上级 7577caae
......@@ -101,10 +101,10 @@ class SliderZoomModel extends DataZoomModel<SliderDataZoomOption> {
show: true,
// deault value can only be drived in view stage.
right: 'auto', // Default align to grid rect.
top: 'auto', // Default align to grid rect.
width: 'auto', // Default align to grid rect.
height: 'auto', // Default align to grid rect.
right: 'ph', // Default align to grid rect.
top: 'ph', // Default align to grid rect.
width: 'ph', // Default align to grid rect.
height: 'ph', // Default align to grid rect.
left: null, // Default align to grid rect.
bottom: null, // Default align to grid rect.
......
......@@ -206,7 +206,7 @@ class SliderZoomView extends DataZoomView {
// Replace the placeholder value.
each(['right', 'top', 'width', 'height'] as const, function (name) {
if (layoutParams[name] === 'auto') {
if (layoutParams[name] === 'ph') {
layoutParams[name] = positionInfo[name];
}
});
......
......@@ -96,7 +96,7 @@ export interface CalendarCellRect {
class Calendar implements CoordinateSystem, CoordinateSystemMaster {
static readonly dimensions = ['time', 'value'];
static getDimensionInfo() {
static getDimensionsInfo() {
return [{
name: 'time', type: 'time'
}, 'value'];
......@@ -124,7 +124,7 @@ class Calendar implements CoordinateSystem, CoordinateSystemMaster {
this._model = calendarModel;
}
// Required in createListFromData
getDimensionsInfo = Calendar.getDimensionInfo
getDimensionsInfo = Calendar.getDimensionsInfo
getRangeInfo() {
return this._rangeInfo;
......
......@@ -27,6 +27,7 @@ var roundNumber = numberUtil.round;
class IntervalScale extends Scale {
static type = 'interval';
type = 'interval';
// Step is calculated in adjustExtent.
......
......@@ -41,7 +41,7 @@ var mathPow = Math.pow;
var mathLog = Math.log;
class LogScale extends Scale {
static type = 'log';
readonly type = 'log';
base = 10;
......@@ -201,4 +201,7 @@ function fixRoundingError(val: number, originalVal: number): number {
return roundingErrorFix(val, getPrecisionSafe(originalVal));
}
Scale.registerClass(LogScale);
export default LogScale;
......@@ -24,17 +24,18 @@
// FIXME only one data
import * as zrUtil from 'zrender/src/core/util';
import Scale from './Scale';
import OrdinalMeta from '../data/OrdinalMeta';
import List from '../data/List';
import * as scaleHelper from './helper';
import { OrdinalRawValue, OrdinalNumber, DimensionLoose } from '../util/types';
import { AxisBaseOption } from '../coord/axisCommonTypes';
import { isArray } from 'zrender/src/core/util';
class OrdinalScale extends Scale {
static type = 'ordinal'
readonly type = 'ordinal'
private _ordinalMeta: OrdinalMeta;
......@@ -49,7 +50,7 @@ class OrdinalScale extends Scale {
var ordinalMeta = this.getSetting('ordinalMeta');
// Caution: Should not use instanceof, consider ec-extensions using
// import approach to get OrdinalMeta class.
if (!ordinalMeta || zrUtil.isArray(ordinalMeta)) {
if (!ordinalMeta || isArray(ordinalMeta)) {
ordinalMeta = new OrdinalMeta({categories: ordinalMeta});
}
this._ordinalMeta = ordinalMeta;
......@@ -103,8 +104,10 @@ class OrdinalScale extends Scale {
*/
getLabel(n: OrdinalNumber): string {
if (!this.isBlank()) {
const cateogry = this._ordinalMeta.categories[n];
// Note that if no data, ordinalMeta.categories is an empty array.
return this._ordinalMeta.categories[n] + '';
// Return empty if it's not exist.
return cateogry == null ? '' : cateogry + '';
}
}
......
......@@ -42,6 +42,7 @@ import * as numberUtil from '../util/number';
import * as formatUtil from '../util/format';
import * as scaleHelper from './helper';
import IntervalScale from './Interval';
import Scale from './Scale';
var mathCeil = Math.ceil;
......@@ -73,6 +74,7 @@ var bisect = function (
class TimeScale extends IntervalScale {
static type = 'time';
readonly type = 'time';
private _stepLvl: [string, number];
......@@ -231,5 +233,6 @@ var scaleLevels = [
['year', ONE_DAY * 380] // 1Y
] as [string, number][];
Scale.registerClass(TimeScale);
export default TimeScale;
......@@ -1444,12 +1444,12 @@ export function createIcon(
? (
(style as ZImageStyleProps).image = iconStr.slice(8),
zrUtil.defaults(style, rect),
new ZImage(opt)
new ZImage(innerOpts)
)
: (
makePath(
iconStr.replace('path://', ''),
opt,
innerOpts,
rect,
'center'
)
......
......@@ -77,8 +77,8 @@ function boxLayout(
var rect = child.getBoundingRect();
var nextChild = group.childAt(idx + 1);
var nextChildRect = nextChild && nextChild.getBoundingRect();
var nextX;
var nextY;
var nextX: number;
var nextY: number;
if (orient === 'horizontal') {
var moveX = rect.width + (nextChildRect ? (-nextChildRect.x + rect.x) : 0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册