This is an automated email from the ASF dual-hosted git repository.
shenyi pushed a commit to branch release
in repository https://gitbox.apache.org/repos/asf/incubator-echarts.git
The following commit(s) were added to refs/heads/release by this push:
new c5eba3c fix(bar): expand clipping area on the boundaryGap axis or
value axis.
c5eba3c is described below
commit c5eba3c096437337a3d79b70cf77858c22d400a1
Author: pissang <[email protected]>
AuthorDate: Thu Sep 26 23:08:06 2019 +0800
fix(bar): expand clipping area on the boundaryGap axis or value axis.
---
src/chart/bar/BarView.js | 27 ++++++++++++++++++++++++---
src/layout/barGrid.js | 2 ++
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/src/chart/bar/BarView.js b/src/chart/bar/BarView.js
index 310ddff..146ebdc 100644
--- a/src/chart/bar/BarView.js
+++ b/src/chart/bar/BarView.js
@@ -35,6 +35,29 @@ var _eventPos = [0, 0];
// Just for compatible with ec2.
zrUtil.extend(Model.prototype, barItemStyle);
+function getClipArea(coord, data) {
+ var coordSysClipArea = coord.getArea && coord.getArea();
+ if (coord.type === 'cartesian2d') {
+ var baseAxis = coord.getBaseAxis();
+ // When boundaryGap is false or using time axis. bar may exceed the
grid.
+ // We should not clip this part.
+ // See test/bar2.html
+ if (baseAxis.type !== 'category' || !baseAxis.onBand) {
+ var expandWidth = data.getLayout('bandWidth');
+ if (baseAxis.isHorizontal()) {
+ coordSysClipArea.x -= expandWidth;
+ coordSysClipArea.width += expandWidth * 2;
+ }
+ else {
+ coordSysClipArea.y -= expandWidth;
+ coordSysClipArea.height += expandWidth * 2;
+ }
+ }
+ }
+
+ return coordSysClipArea;
+}
+
export default echarts.extendChartView({
type: 'bar',
@@ -94,10 +117,8 @@ export default echarts.extendChartView({
var animationModel = seriesModel.isAnimationEnabled() ? seriesModel :
null;
- var coordSysClipArea = coord.getArea && coord.getArea();
-
var needsClip = seriesModel.get('clip', true);
-
+ var coordSysClipArea = getClipArea(coord, data);
// If there is clipPath created in large mode. Remove it.
group.removeClipPath();
// We don't use clipPath in normal mode because we needs a perfect
animation
diff --git a/src/layout/barGrid.js b/src/layout/barGrid.js
index 5d211d8..b5c998b 100644
--- a/src/layout/barGrid.js
+++ b/src/layout/barGrid.js
@@ -223,6 +223,7 @@ function doCalBarWidthAndOffset(seriesInfoList) {
var offset = -widthSum / 2;
zrUtil.each(stacks, function (column, stackId) {
result[coordSysName][stackId] = result[coordSysName][stackId] || {
+ bandWidth: bandWidth,
offset: offset,
width: column.width
};
@@ -280,6 +281,7 @@ export function layout(seriesType, ecModel) {
lastStackCoordsOrigin[stackId] = lastStackCoordsOrigin[stackId] || [];
// Fix #4243
data.setLayout({
+ bandWidth: columnLayoutInfo.bandWidth,
offset: columnOffset,
size: columnWidth
});
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]