Is there a way to make tick mark (major tick mark) to be UIImage (custom graphics) instead of text? I have values in one of the axis I need to present as icons. I do not see any delegate for this but maybe someone knows the trick?
Axis labels can have any CPTLayer
(which is a direct subclass of Core Animation's CALayer
) as its content. Set your image as the layer background and build a custom label using this layer. Several of the Core Plot example apps demonstrate custom labels, although they all use text labels.
You have two options for adding your custom labels to the graph:
Use the CPTAxisLabelingPolicyNone
labeling policy. Create a NSSet
containing your labels and set it to the axisLabels
property on the axis. If you use this, remember that you must provide the major and/or minor tick locations in addition to the custom labels.
Use any other labeling policy to generate the tick locations and implement the -axis:shouldUpdateAxisLabelsAtLocations:
axis delegate method. In your delegate, create new labels at the provided locations and return NO
to suppress the automatic labels.
Eric