简体   繁体   English

GridBackground图表Swift3

[英]GridBackground Charts Swift3

I hope one of you is champion in pods "Charts". 我希望你们中的一位在“图表”播客中获得冠军。 I have problem that i need to have 3 colors in gridBackground at the same time in LineChart. 我有一个问题,我需要同时在LineChart中的gridBackground中具有3种颜色。 I guess its is impossible without any draw modification. 我想如果不进行任何抽奖修改就不可能。 Did any of you fight this problem? 你们有没有解决这个问题? I will be grateful for any help. 我将不胜感激。 I think this will be useful also for others 我认为这对其他人也有用

Try this out 试试看

  NSArray *gradientColors = @[
                                (id)[ChartColorTemplates colorFromString:@"#00ff0000"].CGColor,
                                (id)[ChartColorTemplates colorFromString:@"#ffff0000"].CGColor
                                ];
    CGGradientRef gradient = CGGradientCreateWithColors(nil, (CFArrayRef)gradientColors, nil);

    set1.fillAlpha = 1.f;
    set1.fill = [ChartFill fillWithLinearGradient:gradient angle:90.f];
    set1.drawFilledEnabled = YES;

    CGGradientRelease(gradient);

 NSMutableArray *dataSets = [[NSMutableArray alloc] init];
 [dataSets addObject:set1];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM