提交 1ad70b97 编写于 作者: K Kener

legend location fixed #1146

上级 ece7e623
......@@ -340,36 +340,31 @@ define(function (require) {
for (var i = 0; i < dataLength; i++) {
if (this._getName(data[i]) === '') {
temp -= itemGap;
if (temp > zrWidth) {
totalWidth = zrWidth;
totalHeight += itemHeight + itemGap;
}
else {
totalWidth = Math.max(totalWidth, temp);
}
totalWidth = Math.max(totalWidth, temp);
totalHeight += itemHeight + itemGap;
temp = 0;
continue;
}
temp += itemWidth
+ zrArea.getTextWidth(
this._getFormatterNameFromData(data[i]),
data[i].textStyle
? this.getFont(zrUtil.merge(
data[i].textStyle || {},
textStyle
))
: font
)
+ itemGap;
}
totalHeight = Math.max(totalHeight, itemHeight);
temp -= itemGap; // 减去最后一个的itemGap
if (temp > zrWidth) {
totalWidth = zrWidth;
totalHeight += itemHeight + itemGap;
} else {
totalWidth = Math.max(totalWidth, temp);
var tempTextWidth = zrArea.getTextWidth(
this._getFormatterNameFromData(data[i]),
data[i].textStyle
? this.getFont(zrUtil.merge(
data[i].textStyle || {},
textStyle
))
: font
);
if (temp + itemWidth + tempTextWidth + itemGap > zrWidth) {
// new line
temp -= itemGap; // 减去最后一个的itemGap
totalWidth = Math.max(totalWidth, temp);
totalHeight += itemHeight + itemGap;
temp = 0;
}
else {
temp += itemWidth + tempTextWidth + itemGap;
totalWidth = Math.max(totalWidth, temp - itemGap);
}
}
}
else {
......@@ -392,27 +387,23 @@ define(function (require) {
totalWidth = maxWidth;
for (var i = 0; i < dataLength; i++) {
if (this._getName(data[i]) === '') {
temp -= itemGap;
if (temp > zrHeight) {
totalHeight = zrHeight;
totalWidth += maxWidth + itemGap;
}
else {
totalHeight = Math.max(totalHeight, temp);
}
totalWidth += maxWidth + itemGap;
temp -= itemGap; // 减去最后一个的itemGap
totalHeight = Math.max(totalHeight, temp);
temp = 0;
continue;
}
temp += itemHeight + itemGap;
}
totalWidth = Math.max(totalWidth, maxWidth);
temp -= itemGap; // 减去最后一个的itemGap
if (temp > zrHeight) {
totalHeight = zrHeight;
totalWidth += maxWidth + itemGap;
} else {
totalHeight = Math.max(totalHeight, temp);
if (temp + itemHeight + itemGap > zrHeight) {
// new line
totalWidth += maxWidth + itemGap;
temp -= itemGap; // 减去最后一个的itemGap
totalHeight = Math.max(totalHeight, temp);
temp = 0;
}
else {
temp += itemHeight + itemGap;
totalHeight = Math.max(totalHeight, temp - itemGap);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册