CPTAxisLabel background color in Coreplot

82 views Asked by At

I want to set background color for x-axis and y-axis label. How to set the background color of CPTAxisLabel.

1

There are 1 answers

0
Eric Skroch On

Create custom axis labels. The CPTTextLayer class commonly used to create text labels is a subclass of CPTBorderedLayer so you can give it a border and/or background fill, too. Use the layer padding to adjust the margin space around the text inside the border.

Either use the CPTAxisLabelingPolicyNone labeling policy or use an axis delegate and implement the -axis:shouldUpdateAxisLabelsAtLocations: method. In the delegate method, create labels for each tick location and return NO to tell the axis that the delegate took care of updating the labels.