使用三方库PNChart存在的问题

折线图X轴数据定位显示不准

修改源代码PNLineChart.m类 196行代码

 NSInteger x = (index * _xLabelWidth + _chartMarginLeft + _xLabelWidth / 2.0);

修改成

NSInteger x = (index * _xLabelWidth + _chartMarginLeft);

折线图设置代理点击折线上的点崩溃

修改源代码PNLineChart.m类 267行代码

[_delegate userClickedOnLinePoint:touchPoint lineIndex:[_chartPath indexOfObject:path]];

修改成

if (self.delegate && [self.delegate respondsToSelector:@selector(userClickedOnLinePoint:lineIndex:)]) {
                            [self.delegate userClickedOnLinePoint:touchPoint lineIndex:[_chartPath indexOfObject:path]];
                        }

修改源代码PNLineChart.m类 297行代码

[_delegate userClickedOnLineKeyPoint:touchPoint
                                           lineIndex:p
                                          pointIndex:(distance == distanceToP2 ? i + 1 : i)];

修改成

if (self.delegate && [self.delegate respondsToSelector:@selector(userClickedOnLineKeyPoint:lineIndex:pointIndex:)]) {
                    [self.delegate userClickedOnLineKeyPoint:touchPoint lineIndex:p pointIndex:(distance == distanceToP2 ? i + 1 : i)];
                }

你可能感兴趣的:(使用三方库PNChart存在的问题)