提交 f4a11736 编写于 作者: K kener

x,y,widht,height支持百分比

上级 ae911eaf
......@@ -692,7 +692,7 @@ define(function (require) {
- dataRangeOption.borderWidth;
break;
default :
x = dataRangeOption.x - 0;
x = self.parsePercent(dataRangeOption.x, zrWidth);
x = isNaN(x) ? 0 : x;
break;
}
......@@ -714,7 +714,7 @@ define(function (require) {
y = Math.floor((zrHeight - totalHeight) / 2);
break;
default :
y = dataRangeOption.y - 0;
y = self.parsePercent(dataRangeOption.y, zrHeight)
y = isNaN(y) ? 0 : y;
break;
}
......
......@@ -45,25 +45,26 @@ define(function (require) {
option.grid = self.reformOption(option.grid);
var gridOption = option.grid;
_x = gridOption.x;
_y = gridOption.y;
var x2 = gridOption.x2;
var y2 = gridOption.y2;
_zrWidth = zr.getWidth();
_zrHeight = zr.getHeight();
_x = self.parsePercent(gridOption.x, _zrWidth);
_y = self.parsePercent(gridOption.y, _zrHeight);
var x2 = self.parsePercent(gridOption.x2, _zrWidth);
var y2 = self.parsePercent(gridOption.y2, _zrHeight);
if (typeof gridOption.width == 'undefined') {
_width = _zrWidth - _x - x2;
}
else {
_width = gridOption.width;
_width = self.parsePercent(gridOption.width, _zrWidth);
}
if (typeof gridOption.height == 'undefined') {
_height = _zrHeight - _y - y2;
}
else {
_height = gridOption.height;
_height = self.parsePercent(gridOption.height, _zrHeight);
}
_x = self.subPixelOptimize(_x, gridOption.borderWidth);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册