Skip to content

Commit

Permalink
Fix a bug when all values in bar chart is zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
xhacker committed Dec 21, 2014
1 parent 49fabc1 commit 42b6f7d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TEAChart/TEABarChart.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ - (void)drawRect:(CGRect)rect

for (NSInteger i = 0; i < numberOfBars; i += 1)
{
CGFloat barHeight = barMaxHeight * [self.data[i] floatValue] / max;
CGFloat barHeight = (max == 0 ? 0 : barMaxHeight * [self.data[i] floatValue] / max);
if (barHeight > barMaxHeight) {
barHeight = barMaxHeight;
}
Expand Down

0 comments on commit 42b6f7d

Please sign in to comment.