Question

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.

Était-ce utile?

La solution

Add "alpha" (transparency) to the color:

CPTColor *color = [[CPTColor redColor] colorWithAlphaComponent:0.1];
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top