Page 1 of 1

iOS Tapped Event on a Chart

Posted: Fri Feb 24, 2012 5:43 pm
by 17261689
I don't know if this posted in the correct forum - I don't see a forum for the new Mobile solution.

I have three charts on a view (similar to the demo code). I want the user to be able to tap on a chart and I get an event so I can take some action. I have tried many different ways but nothing works.

I would normally subclass the chart and override TouchesEnded - but this causes the app to crash with the following error:

System.Exception: Failed to find selector TapGesture on iosapp.viewGraphCoreSKU+ChartViewController
at MonoTouch.ObjCRuntime.Runtime.GetMethod (IntPtr klass, IntPtr selptr) [0x00000] in <filename unknown>:0
at (wrapper native-to-managed) MonoTouch.ObjCRuntime.Runtime:GetMethod (intptr,intptr)
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00000] in <filename unknown>:0
at MonoTouch.UIKit.UIApplication.Main (System.String[] args) [0x00000] in <filename unknown>:0
at iosapp.Application.Main (System.String[] args) [0x00000] in <filename unknown>:0


I just need a simple way to determine that the user tapped on a graph (not a series). In the future I may need to know where on a series they tapped so I can popup some additional information - but for now tapping anywhere on the graph should give me an event.

Sample code would be most appreciated.

Thanks!

Re: iOS Tapped Event on a Chart

Posted: Mon Feb 27, 2012 3:29 pm
by Pep
Hello,

ok, I'm going to prepare a code to do this and post it here.

Re: iOS Tapped Event on a Chart

Posted: Wed Feb 29, 2012 12:32 pm
by Pep
Hello,

just inform to you that I've uploaded a new TeeChart NET for iOS v2012.0.2.28 (Evaluation and Registered binary versions) on our web site.
This version includes some fixes, and the new ClickBackground event which is fired once the user taps into the Chart veiw.
Here and example code of use ( you can also find the same code into the TChartFeatures deno included into the installer).

Code: Select all

private bool chart_clickBackGround(UIGestureRecognizer recognizer, UITouch touch) 
{
	Console.WriteLine("BackGround clicked");
	return false;
}

chart.ClickBackground += new UITouchEventArgs(chart_clickBackGround);

Re: iOS Tapped Event on a Chart

Posted: Mon Mar 19, 2012 3:08 pm
by 17261689
Thanks for the update and the sample code. Working perfectly!

Charles