example of using gradient for fills
dam13n opened this issue · 2 comments
dam13n commented
The demo app included doesn't seem to have any example of this, and I've been having trouble getting it working. Any example apps or code of using gradient fills for line/area charts?
Also, it would be nice to have vertical gradients vs. left-to-right!
terryworona commented
Please refer to the customization readme or header documentation.
Implement:
- (JBLineChartViewLineStyle)lineChartView:(JBLineChartView *)lineChartView fillColorStyleForLineAtLineIndex:(NSUInteger)lineIndex
{
return JBLineChartViewColorStyleGradient;
}
And supply a left to right gradient:
- (CAGradientLayer *)lineChartView:(JBLineChartView *)lineChartView fillGradientForLineAtLineIndex:(NSUInteger)lineIndex
{
CAGradientLayer *gradient = [CAGradientLayer new];
gradient.startPoint = CGPointMake(0.0, 0.5);
gradient.endPoint = CGPointMake(1.0, 0.5);
gradient.colors = @[(id)[UIColor redColor].CGColor, (id)[UIColor greenColor].CGColor];
return gradient;
}
Hope this helps.
dam13n commented
So fast, thanks! I was missing that / didn't catch it in the readme for customization. : )