kevinzhow / PNChart

A simple and beautiful chart lib used in Piner and CoinsMan for iOS
MIT License
9.71k stars 1.76k forks source link

Release 0.8.9 bug. #450

Open cywd opened 5 years ago

cywd commented 5 years ago

PNRadarChart can not change plotColor.

self.radarChart.plotColor = [UIColor yellowColor];

This is code in PNRadarChart.m (Release 0.8.9).

- (void)strokeChart {

    [self calculateChartPoints];
    [self setNeedsDisplay];
    [_detailLabel setHidden:YES];

    //Draw plot
    [_chartPlot removeAllAnimations];
    UIBezierPath *plotline = [UIBezierPath bezierPath];
    CGPoint beginPoint = [[_pointsToPlotArray objectAtIndex:0] CGPointValue];
    [plotline moveToPoint:CGPointMake(beginPoint.x, beginPoint.y)];
    for(NSValue *pointValue in _pointsToPlotArray){
        CGPoint point = [pointValue CGPointValue];
        [plotline addLineToPoint:CGPointMake(point.x ,point.y)];

    }
    [plotline setLineWidth:1];
    [plotline setLineCapStyle:kCGLineCapButt];

    _chartPlot.path = plotline.CGPath;

    [self addAnimationIfNeeded];
    [self showGraduation];
}

This is code in PNRadarChart.m (Now Master Souce Code).

- (void)strokeChart {

    [self calculateChartPoints];
    [self setNeedsDisplay];
    [_detailLabel setHidden:YES];

    //Draw plot
    [_chartPlot removeAllAnimations];
    UIBezierPath *plotline = [UIBezierPath bezierPath];
    CGPoint beginPoint = [[_pointsToPlotArray objectAtIndex:0] CGPointValue];
    [plotline moveToPoint:CGPointMake(beginPoint.x, beginPoint.y)];
    for(NSValue *pointValue in _pointsToPlotArray){
        CGPoint point = [pointValue CGPointValue];
        [plotline addLineToPoint:CGPointMake(point.x ,point.y)];

    }
    [plotline setLineWidth:1];
    [plotline setLineCapStyle:kCGLineCapButt];

    _chartPlot.path = plotline.CGPath;

    _chartPlot.fillColor = _plotColor.CGColor;

    [self addAnimationIfNeeded];
    [self showGraduation];

//    self.transform = CGAffineTransformMakeRotation(-M_PI_2);
}