I have a chart with two y-axes, one on each side. The titles for both y-axes show up on the left side of the axis - this makes sense for the left axis, but not the right one, since it puts the title on the inside of the chart.
How can I move the location of the title on the right-side y-axis to the right of the labels (outside the chart)?
Hi,
Looks like the public property to set the title location is missing from the chart. We'll add that in.In the meantime you can do this:
NSObject *internalAxis = [y2Axis performSelector:NSSelectorFromString(@"getAxisRef")];
NSObject *titleSettings = [internalAxis performSelector:NSSelectorFromString(@"titleSettings")];
[titleSettings setValue:[NSNumber numberWithInt:2] forKey:@"position"]; //2 is the enum value for Right
Thanks, that worked.
Swift answer:
guard let internalAxis = y2Axis.perform(NSSelectorFromString("getAxisRef")).takeUnretainedValue() as? NSObject else {
return
}
guard let titleSettings = internalAxis.perform(NSSelectorFromString("titleSettings")).takeUnretainedValue() as? NSObject else {
titleSettings.setValue(2, forKey: "position")