Skip to content

Commit 42b6f7d

Browse files
committed
Fix a bug when all values in bar chart is zero.
1 parent 49fabc1 commit 42b6f7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

TEAChart/TEABarChart.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ - (void)drawRect:(CGRect)rect
7474

7575
for (NSInteger i = 0; i < numberOfBars; i += 1)
7676
{
77-
CGFloat barHeight = barMaxHeight * [self.data[i] floatValue] / max;
77+
CGFloat barHeight = (max == 0 ? 0 : barMaxHeight * [self.data[i] floatValue] / max);
7878
if (barHeight > barMaxHeight) {
7979
barHeight = barMaxHeight;
8080
}

0 commit comments

Comments
 (0)