提交 5a6f8a36 编写于 作者: L lang

A bunch of tweaks

上级 c29f31a7
......@@ -24,6 +24,9 @@ define(function(require) {
return list;
}
function isStackable(axisType) {
return axisType !== 'category' && axisType !== 'time';
}
/**
* Creaters for each coord system.
* @return {Object} {dimensions, categoryAxisModel};
......@@ -46,7 +49,7 @@ define(function(require) {
name: 'y',
// If two category axes
type: isYAxisCategory ? 'ordinal' : 'float',
stackable: !isYAxisCategory
stackable: isStackable(yAxisType)
}];
categoryAxisModel = xAxisModel;
......@@ -57,7 +60,7 @@ define(function(require) {
type: 'ordinal'
}, {
name: 'x',
stackable: true
stackable: isStackable(xAxisType)
}];
categoryAxisModel = yAxisModel;
......@@ -93,7 +96,7 @@ define(function(require) {
name: 'radius',
// If two category axes
type: isRadiusAxisCategory ? 'ordinal' : 'float',
stackable: !isRadiusAxisCategory
stackable: isStackable(radiusAxisModel.get('type'))
}];
categoryAxisModel = angleAxisModel;
......@@ -104,7 +107,7 @@ define(function(require) {
type: 'ordinal'
}, {
name: 'angle',
stackable: true
stackable: isStackable(angleAxisModel.get('type'))
}];
categoryAxisModel = radiusAxisModel;
......
......@@ -68,8 +68,8 @@ define(function(require) {
// 拐点图形旋转控制
// symbolRotate: null,
// 显示 symbol, 只有在 tooltip hover 的时候显示
// notShowSymbol: false,
// 是否显示 symbol, 只有在 tooltip hover 的时候显示
showSymbol: true,
// 标志图形默认只有主轴显示(随主轴标签间隔隐藏策略)
// showAllSymbol: false
......
......@@ -192,7 +192,7 @@ define(function(require) {
var isAreaChart = !areaStyleModel.isEmpty();
var stackedOnPoints = getStackedOnPoints(coordSys, data);
var showSymbol = !seriesModel.get('notShowSymbol');
var showSymbol = seriesModel.get('showSymbol');
var isSymbolIgnore = showSymbol && !isCoordSysPolar && !seriesModel.get('showAllSymbol')
&& this._getSymbolIgnoreFunc(data, coordSys);
......@@ -206,7 +206,7 @@ define(function(require) {
}
});
// Remove previous created symbols if notShowSymbol changed to true
// Remove previous created symbols if showSymbol changed to false
if (!showSymbol) {
symbolDraw.remove();
}
......
......@@ -651,7 +651,7 @@
* @override
*/
remove: function () {
this._containerGroup.removeAll();
this._containerGroup && this._containerGroup.removeAll();
this._storage = createStorage();
this._state = 'ready';
this._breadcrumb && this._breadcrumb.remove();
......
......@@ -109,7 +109,8 @@ define(function (require) {
borderWidth: 2
}
// emphasis: {}
}
},
animationEasing: 'linear'
}
});
......
......@@ -104,7 +104,11 @@ define(function (require) {
}, defaultOption);
// FIXME
var timeAxis = zrUtil.merge({}, valueAxis);
var timeAxis = zrUtil.merge({
scale: true,
min: 'dataMin',
max: 'dataMax'
}, valueAxis);
var logAxis = zrUtil.merge({}, valueAxis);
logAxis.scale = true;
......
......@@ -24,19 +24,28 @@ define(function (require) {
*/
function getFormattedLabels () {
var labelFormatter = this.get('axisLabel.formatter');
var labels = this.axis.scale.getTicksLabels();
if (!labelFormatter) {
return labels;
}
else if (typeof labelFormatter === 'string') {
var axis = this.axis;
var scale = axis.scale;
var labels = scale.getTicksLabels();
var ticks = scale.getTicks();
if (typeof labelFormatter === 'string') {
labelFormatter = (function (tpl) {
return function (val) {
return tpl.replace('{value}', val);
};
})(labelFormatter);
return zrUtil.map(labels, labelFormatter);
}
else if (typeof labelFormatter === 'function') {
return zrUtil.map(ticks, function (tick) {
return labelFormatter(
axis.type === 'category' ? scale.getLabel(tick) : tick
);
}, this);
}
else {
return labels;
}
return zrUtil.map(labels, labelFormatter);
}
return {
......
......@@ -37,6 +37,7 @@ define(function(require) {
labels[i], font, 'center', 'top'
);
rect[isAxisHorizontal ? 'x' : 'y'] += tickCoord;
rect[isAxisHorizontal ? 'width' : 'height'] *= 1.5;
if (!textSpaceTakenRect) {
textSpaceTakenRect = rect.clone();
}
......
......@@ -8,7 +8,7 @@ define(function (require) {
];
function compatItemStyle(opt) {
var itemStyleOpt = opt.itemStyle;
var itemStyleOpt = opt && opt.itemStyle;
if (itemStyleOpt) {
zrUtil.each(POSSIBLE_STYLES, function (styleName) {
var normalItemStyleOpt = itemStyleOpt.normal;
......
......@@ -259,9 +259,15 @@ define(function(require) {
},
buildPath: function (ctx, shape) {
var proxySymbol = symbolBuildProxies[shape.symbolType];
if (proxySymbol) {
symbolShapeMakers[shape.symbolType](
var symbolType = shape.symbolType;
var proxySymbol = symbolBuildProxies[symbolType];
if (shape.symbolType !== 'none') {
if (!proxySymbol) {
// Default rect
symbolType = 'rect';
proxySymbol = symbolBuildProxies[symbolType];
}
symbolShapeMakers[symbolType](
shape.x, shape.y, shape.width, shape.height, proxySymbol.shape
);
proxySymbol.buildPath(ctx, proxySymbol.shape);
......@@ -322,10 +328,6 @@ define(function(require) {
symbolPath = graphic.makePath(symbolType.slice(7), {}, new BoundingRect(x, y, w, h));
}
else {
// Default rect
if (!symbolShapeMakers[symbolType]) {
symbolType = 'rect';
}
symbolPath = new Symbol({
shape: {
symbolType: symbolType,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册