IOS Core Plot Vertical Line with Draggable Feature

317 views Asked by At

Please help me to solve this problem:

  • I have a graph with X axis as last three months, Y axis as the amount spent.
  • I have used 2 scatter plots, 1 for drawing the variation on the amounts, 2nd a vertical line which moves on the finger drag on the screen.

I have implemented the feature where the vertical line moves on the drag.

I need to get the values where my vertical line and the Line graph meets and display the values in the bottom. Please let me know how to retrieve the value during dragging the line. I have implemented the vertical line reading the code from Github mentioned in below location.

http://blog.essencework.com/post/9413676170/put-some-touch-interactive-to-coreplot-on-ipad

1

There are 1 answers

0
Eric Skroch On

You obviously have the x-value since it is used to position the line. If it is on top of the one of the points from the main plot, you're done. If not, search the plot data and figure out which two points the selection is between. That's simple if the data is sorted in the x-direction. Do a linear interpolation between the two points to find the y-value of the selection.