Boris-Em / BEMSimpleLineGraph

Elegant Line Graphs for iOS. (Charting library)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to customize the Gradient layer?

GopiK14 opened this issue · comments

I need to draw a gradient like the one in the screenshot. Is this possible?

I tried to add extra points in the bottom points array but it doesn't work:

- (NSArray *)bottomPointsArray {
    CGPoint bottomPointZero = CGPointMake(0, self.frame.size.height);
    CGPoint bottomPointZeroRev = CGPointMake(self.frame.size.height,0 );
    CGPoint bottomPointFull = CGPointMake(self.frame.size.width, self.frame.size.height);
    NSMutableArray *bottomPoints = [NSMutableArray arrayWithArray:self.points];
    [bottomPoints insertObject:[NSValue valueWithCGPoint:bottomPointZero] atIndex:0];
    [bottomPoints addObject:[NSValue valueWithCGPoint:bottomPointFull]];
    return bottomPoints;
}

screen shot 2017-08-02 at 11 29 02 pm

Hmm... the screenshot you posted does not have a gradient in it. Maybe I'm missing something?

If you're trying to draw a gradient below the line, set the gradientBottom a CGGradientRef) property on your graph object. Likewise, you can also apply gradients to the top of the graph and to the main graph line with gradientTop and gradientLine.

As per our Contributing Guidelines, in the future, please refer to Stack Overflow and use the BEMSimpleLineGraph tag to ask questions like this. I am now closing this issue. Should there be further discussion or questions related to this issue, it can be reopened. Thank you.