提交 ebaa950d 编写于 作者: L lang

Interval#niceExtent fix one data (extent span is 0) bug

上级 4b0f5f8d
......@@ -193,7 +193,8 @@ define(function(require) {
height = coord[1] - lastCoord;
if (Math.abs(height) < barMinHeight) {
height = (height < 0 ? -1 : 1) * barMinHeight;
// Include zero to has a positive bar
height = (height <= 0 ? -1 : 1) * barMinHeight;
}
lastStackCoords[stackId][idx][sign] += height;
}
......
......@@ -162,18 +162,7 @@ define(function (require) {
* @param {boolean} [fixMax=false]
*/
niceExtent: function (approxTickNum, fixMin, fixMax) {
this.niceTicks(approxTickNum, fixMin, fixMax);
var extent = this._extent;
var interval = this._interval;
if (!fixMin) {
extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval);
}
if (!fixMax) {
extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval);
}
// If extent start and end are same, expand them
if (extent[0] === extent[1]) {
// Expand extent
......@@ -187,6 +176,19 @@ define(function (require) {
extent[0] = -1;
this._niceExtent = [-1, 1];
this._interval = 0.5;
return;
}
this.niceTicks(approxTickNum, fixMin, fixMax);
// var extent = this._extent;
var interval = this._interval;
if (!fixMin) {
extent[0] = numberUtil.round(mathFloor(extent[0] / interval) * interval);
}
if (!fixMax) {
extent[1] = numberUtil.round(mathCeil(extent[1] / interval) * interval);
}
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册