Question

Can we set the number of labels per axis when using core-plot? I'm trying to plot 19 data points with the help of core-plot, but since my chart is small, the labels overlap.

coreplot

So can I say that the y-axis should only display 3 labels? I don't want to set the labels manually. I want to use scaleToFitPlots and say "Display only 3 labels on the y-axis".

Was it helpful?

Solution

When you create your axis set the labelling policy to CPTAxisLabelingPolicyAutomatic. For example,

CPTXYAxis *x = [[CPTXYAxis alloc] init];
x.coordinate                  = CPTCoordinateX;
x.labelingPolicy              = CPTAxisLabelingPolicyAutomatic;
// ...

This will automatically determine a sensible number and location for your axis labels.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top