原因:
CGFloat scale = _axisHeight / (maxBound - minBound);
当最大值与最小值相等时, (maxBound - minBound) = 0 ,零能当分母 ? scale结果不是一个数值,当然会报错.
解决方法,修改- (void)strokeChart
加一个判断
CGFloat scale = 0;
if ((maxBound - minBound) != 0) {
scale = _axisHeight / (maxBound - minBound);
}
网友评论