iOS/OC: FSLineChart所有Y值相等时报错

原因:

CGFloat scale = _axisHeight / (maxBound - minBound);
当最大值与最小值相等时, (maxBound - minBound) = 0 ,零能当分母 ? scale结果不是一个数值,当然会报错.

解决方法,修改- (void)strokeChart
加一个判断

CGFloat scale = 0;
    
    if ((maxBound - minBound) != 0) {
        
        scale = _axisHeight / (maxBound - minBound);
    }

你可能感兴趣的:(iOS/OC: FSLineChart所有Y值相等时报错)