Position tag on CPTBarPlot (Core-Plot)

I am trying to change the default position of labels in a chart using Core-Plot. I am using this method:

-(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx;

And I come back:

return textLayer = [[CPTTextLayer alloc] initWithText:@"2222" style:textStyle];

I get this result:

enter image description here

But I want to look like this:

enter image description here

Any idea? I tried to find the answer to the documentation, but I was not possible.

+4
source share
1 answer

Use negative labelOffsetto plot strokes. The default value is +10, which places labels 10 pixels above the bars. This property is inherited from CPTPlot, so it works for all types of plots, although the default values โ€‹โ€‹and behavior are slightly different.

+9
source

All Articles