Main plot: grid background color

I want to be able to set the background color in the spaces between the grid lines of the y axis. Can this be achieved with a basic schedule? If so, how?

Any help and / or sample code would be appreciated.

Thanks,

Peter

+4
source share
1 answer

You can use the alternatingBandFills property to set the fill between consecutive main ticks. Here is an example with two different colors:

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

An array can contain any combination of CPTFill , CPTColor , CPTGradient and / or CPTImage . Empty (transparent) stripes can be created using [NSNull null] instead of some CPTFill objects. You can use as many different fillings as you want; the axis will go through all of them, and then repeat the pattern until all spaces are filled.

The axes also support what Core Plot calls "limit lanes." This is a way to fill out a section in a specific plot range. They do not repeat automatically as they fill the strip.

The Axis Demo sample application in the Graphic Gallery application shows both functions.

+7
source

Source: https://habr.com/ru/post/1397588/


All Articles