提交 2ca85360 编写于 作者: S SHUANG SU 提交者: sushuang

fix: fix the last commit: tweak code and fix remainWidth when barWidth is given.

上级 adf659ae
......@@ -283,13 +283,13 @@ function doCalBarWidthAndOffset(seriesInfoList) {
autoWidth = Math.max(autoWidth, 0);
// Find if any auto calculated bar exceeded maxBarWidth
zrUtil.each(stacks, function (column, stack) {
zrUtil.each(stacks, function (column) {
var maxWidth = column.maxWidth;
var minWidth = column.minWidth;
if (!column.width) {
var finalWidth = autoWidth;
if (maxWidth && maxWidth < finalWidth) {
finalWidth = Math.min(finalWidth, maxWidth, remainedWidth);
finalWidth = Math.min(maxWidth, remainedWidth);
}
// `minWidth` has higher priority. `minWidth` decide that wheter the
// bar is able to be visible. So `minWidth` should not be restricted
......@@ -297,7 +297,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
// the extreme cases for `value` axis, bars are allowed to overlap
// with each other if `minWidth` specified.
if (minWidth && minWidth > finalWidth) {
finalWidth = Math.max(finalWidth, minWidth);
finalWidth = minWidth;
}
if (finalWidth !== autoWidth) {
column.width = finalWidth;
......@@ -318,6 +318,8 @@ function doCalBarWidthAndOffset(seriesInfoList) {
finalWidth = Math.max(finalWidth, minWidth);
}
column.width = finalWidth;
remainedWidth -= finalWidth;
autoWidthCount--;
}
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册