Skip to content

Commit 504714f

Browse files
committed
fix: bar chart fix for stack bars
1 parent f33ecef commit 504714f

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

src/ui-chart/buffer/BarBuffer.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ export class BarBuffer extends AbstractBuffer<IBarDataSet> {
6464
} else {
6565
bottom = top + this.phaseY * (bottom - top);
6666
}
67-
if (left !== right && top !== bottom) {
68-
this.addBar(e, left, top, right, bottom);
69-
}
67+
// if (left !== right && top !== bottom) {
68+
this.addBar(e, left, top, right, bottom);
69+
// }
7070
} else {
7171
let posY = 0;
7272
let negY = -e.negativeSum;
@@ -109,9 +109,9 @@ export class BarBuffer extends AbstractBuffer<IBarDataSet> {
109109
bottom = top + this.phaseY * (bottom - top);
110110
}
111111

112-
if (left !== right && top !== bottom) {
113-
this.addBar(e, left, top, right, bottom);
114-
}
112+
// if (left !== right && top !== bottom) {
113+
this.addBar(e, left, top, right, bottom);
114+
// }
115115
}
116116
}
117117
}

src/ui-chart/renderer/BarChartRenderer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class BarChartRenderer extends BarLineScatterCandleBubbleRenderer {
161161
const top = buffer.buffer[j * 4 + 1];
162162
const right = buffer.buffer[j * 4 + 2];
163163
const bottom = buffer.buffer[j * 4 + 3];
164-
if (!this.mViewPortHandler.isInBoundsLeft(right)) {
164+
if (!this.mViewPortHandler.isInBoundsLeft(right) || (left === right && top === bottom)) {
165165
continue;
166166
}
167167

src/ui-chart/renderer/HorizontalBarChartRenderer.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ export class HorizontalBarChartRenderer extends BarChartRenderer {
107107
const top = buffer.buffer[j * 4 + 1];
108108
const right = buffer.buffer[j * 4 + 2];
109109
const bottom = buffer.buffer[j * 4 + 3];
110-
if (!this.mViewPortHandler.isInBoundsTop(bottom)) {
111-
break;
112-
}
113110

114-
if (!this.mViewPortHandler.isInBoundsBottom(top)) {
111+
if (!this.mViewPortHandler.isInBoundsBottom(top) || (left === right && top === bottom)) {
115112
continue;
116113
}
114+
115+
if (!this.mViewPortHandler.isInBoundsTop(bottom)) {
116+
break;
117+
}
117118
if (!isSingleColor) {
118119
// Set the color for the currently drawn value. If the index
119120
// is out of bounds, reuse colors.

0 commit comments

Comments
 (0)