Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Core-Plot DataLabel Z-Ordering

I try to add data labels to a bar graph in Core-Plot (on iOS). The user selects individual plots and then the values are shown.

The main problem is shown in the image, the other plots overdraw the data labels.

Image showing the problem

Is it possible to have the labels always at the top?

As the user sets the ordering of the bars, I cannot reorder the bars. (Also if I did, the user experience would be terrible as the whole graph appearance would change on selection.)

Other possibility: Can I reorder the plots for Z-ordering but have the positions remain unchanged?

Any other ideas? I also tried CPTPlotSpaceAnnotations, but I cannot align them on the bar precise enough (see the "1037" label at the year (x-axis) 1980).

like image 989
user3436516 Avatar asked Mar 18 '26 20:03

user3436516


1 Answers

I came up with a solution by myself: I just remove the plot and add it back. In that way the plot is raised in the z-Hierarchy.

[self.graph removePlot:plot];
[self.graph addPlot:plot];
like image 175
user3436516 Avatar answered Mar 21 '26 09:03

user3436516



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!