1
votes

I'm using CorePlot and I'm trying to use my number formatter, but the labels on the axes are clearly not using my formatter. This is the code I'm using:

CPTXYGraph *xygraph = [[CPTXYGraph alloc] initWithFrame:fullFrame];
self.graph = xygraph;
self.graph.title = @"Plot of Statistical Data Points";
self.graph.titleDisplacement = CGPointMake(0, -10);

hostingView.hostedGraph = self.graph;

CPTAxisSet *axisSet = xygraph.axisSet;
for (CPTAxis *axis in axisSet.axes) {
    NSLog(@"setting axis (%@) label formatter=%@ -> %@", axis, axis.labelFormatter, self.formatter.completedValueFormatter);
    axis.labelFormatter = self.formatter.completedValueFormatter;
}

I have verified that self.formatter.completedValueFormatter is a good NSNumberFormatter, but the labels on the axes are not using my formatter. What am I doing wrong?

1
Is the labelTextStyle set to a style that will show up against the graph background? Both a formatter and text style are required. - Eric Skroch
I can see the numbers being rendered, they just aren't being rendered using MY formatter. - Kenny Wyland
I tested this in the Plot Gallery example app and changing the label formatter seems to work correctly in the latest code. Can you test your formatter in one of the example apps just to make sure it's performing the way you expect? - Eric Skroch
Hm, I think the problem may have been some cached code. I did a clean build today and reinstalled and it seems to be working now without any changes. Eric, if you post your response as an Answer, saying that the code does work, then I'll accept your answer. Please include a reference to a clean build, etc. - Kenny Wyland

1 Answers

1
votes

I tested your code in the Plot Gallery example app and changing the label formatter seems to work correctly in the latest code.