So I have a graph with x axis that goes from 0-5. I need to have 0-3 background colors in red and then 3-5 in green. I am trying to do this by using:

axisSet.xAxis.alternatingBandFills = [NSArray arrayWithObjects:[CPTColor redColor], 
                                                               [CPTColor redColor], 
                                                               [CPTColor redColor], 
                                                               [CPTColor greenColor], 
                                                               [CPTColor greenColor], 
                                                               nil];

It does work but color is very bright, I am trying to make the opacity very lower so you can barely see the colors but able to tell what the colors are. The solid red and green is too much.

有帮助吗?

解决方案

Add "alpha" (transparency) to the color:

CPTColor *color = [[CPTColor redColor] colorWithAlphaComponent:0.1];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top