iOS Tapped Event on a Chart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Tech44
Newbie
Newbie
Posts: 7
Joined: Wed Feb 22, 2012 12:00 am

iOS Tapped Event on a Chart

Post by Tech44 » Fri Feb 24, 2012 5:43 pm

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!

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: iOS Tapped Event on a Chart

Post by Pep » Mon Feb 27, 2012 3:29 pm

Hello,

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

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: iOS Tapped Event on a Chart

Post by Pep » Wed Feb 29, 2012 12:32 pm

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);

Tech44
Newbie
Newbie
Posts: 7
Joined: Wed Feb 22, 2012 12:00 am

Re: iOS Tapped Event on a Chart

Post by Tech44 » Mon Mar 19, 2012 3:08 pm

Thanks for the update and the sample code. Working perfectly!

Charles

Post Reply