Z-order for annotation and selection


#1

Hi,

here is the problem I am trying to solve. 
Look at the pic attached, I select point and added vertical line as annotation.
Is there a way to draw line under that yellow (selected) point but above the chart?

Thanks,
Nick

#2

Hi Nick,

Unfortunately this is not possible due to the series and points being rendered using OpenGL on the same view.

However, there are a couple of solutions that I can think of:

  1. Create a custom annotation and override v erticalLineAtPosition:withXAxis:andYAxis:withWidth:withColor: and then draw a circle on top of this, perhaps using a subview.

  • You could create two separate lines using your own UIView instances (or perhaps more elegantly a view that draws the lines using a CAShapeLayer), that are then added as subviews of SChartCanvasOverlay.

  • The two lines could then be drawn from the top and bottom of your chart to the datapoint, minus the point’s radius.

Hopefully one of the above solutions points you in the right direction - please get back in touch if you require further assistance!

Sam