0
votes

I want to add a label to a core plot scatter chart. It should be at a specific y value at the left edge of the chart, like that:

a graph with a label

I tried doing it using annotation but I have a problem with dragging. When I drag the chart the annotation is also being dragged, and I would like it to always stay at the left edge.

1
What kind of annotation did you use? A layer annotation is anchored to a fixed spot within the host layer. It only moves when the whole layer moves or resizes. - Eric Skroch
Thank you Eric for your response I did use layer (CPTextLayer to be precise) The label should get its Y position from the graph data (as shown value of 8.7 in approximate) and should get its X position from the physical graph location (as shown, the left of the graph) and has no connection to specific x value When the graph moves the label should remain in the left of the graph but to move up/down if necessary and remain above the same Y point (8.7 in this example) - user1746700

1 Answers

1
votes

Create your label as a plot space annotation. Use a plot space delegate to monitor changes to the xRange and update the x-value of the anchor point as needed. You can use the plot space to convert the desired x-position to the corresponding data value for the anchor point.