SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, and now iOS Charting & Android Chart Components

Answered
1
0

Hi,

Is there any possible way to get axis value for a point in chart view? I use pan gesture to get the touch location and convert it to its context point but cannot find the value for that CGPoint.

Thanks,
Irmak

Version
1.2.0.8
  • You must to post comments
Best Answer
2
0

Good day

Need more information to be more specific
But here is example how to write to console X and Y data values at pan gesture location on surface:

//create custom modifier
class CoordToConsole : SCIGestureModifier {
    override func onPanGesture(gesture: UIPanGestureRecognizer!, at view: UIView!) -> Bool {
        let xCalc : SCICoordinateCalculator = self.xAxis().getCurrentCoordinateCalculator()
        let yCalc : SCICoordinateCalculator = self.yAxis().getCurrentCoordinateCalculator()

        let location : CGPoint = gesture.locationInView(view)

        NSLog( "X: %.2f Y: %.2f",
               xCalc.getDataValueFrom( Double(location.x) ),
               yCalc.getDataValueFrom( Double(location.y) ))

        return true
    }
}

And

// create instance and attach it to surface
    let coordLog = CoordToConsole()
    let groupModifier = SCIModifierGroup(childModifiers: [otherModifier1, otherModifier2, coordLog])
    chartSurface.chartModifier = groupModifier // where chartSurface is SCIChartSurface

Best regards
Andrii
SciChart iOS developer

  • Irmak Can Ozsut
    Hi Andrii,Thank you for your quick reply. That’s what I was looking for!But I have one more issue regarding to SCIAxisMarkerAnnotation that I could not find. Can I customise the look of it or should I implement my own axis marker? And lastly, can I add another pan gesture to annotation pin to change the axis annotation location by the user?Thanks, Irmak
  • Andrew
    Hi Irmak – it’s worth asking a separate question for each of these, as the Q&A format of the forum is not suited to long conversations. Can you do this please? I will also ask the team for their input. Best regards, Andrew
  • Irmak Can Ozsut
    Sure, thank you.
  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.