Unhandled exception in iOS charting

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
abuniz
Newbie
Newbie
Posts: 3
Joined: Tue Apr 24, 2012 12:00 am

Unhandled exception in iOS charting

Post by abuniz » Wed May 02, 2012 2:45 am

I am handling a Series click event and if I touch up outside and let go on a series, I get a fatal error (not in me code).


Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type.
at Steema.TeeChart.Chart.DoMouseDown (Boolean IsDoubleClick, MonoTouch.UIKit.UIGestureRecognizer e) [0x00000] in <filename unknown>:0
at Steema.TeeChart.TChart.OnMouseMove (MonoTouch.UIKit.UIGestureRecognizer e) [0x00000] in <filename unknown>:0
at Steema.TeeChart.TChart.PanGesture (MonoTouch.UIKit.UIPanGestureRecognizer e) [0x00000] in <filename unknown>:0
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) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at eLogic.Application.Main (System.String[] args) [0x00000] in /Users/ndiab/Projects/eLogic/eLogic/Main.cs:17
[ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidCastException: Cannot cast from source type to destination type.
at Steema.TeeChart.Chart.DoMouseDown (Boolean IsDoubleClick, MonoTouch.UIKit.UIGestureRecognizer e) [0x00000] in <filename unknown>:0
at Steema.TeeChart.TChart.OnMouseMove (MonoTouch.UIKit.UIGestureRecognizer e) [0x00000] in <filename unknown>:0
at Steema.TeeChart.TChart.PanGesture (MonoTouch.UIKit.UIPanGestureRecognizer e) [0x00000] in <filename unknown>:0
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) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at eLogic.Application.Main (System.String[] args) [0x00000] in /Users/ndiab/Projects/eLogic/eLogic/Main.cs:17

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

Re: Unhandled exception in iOS charting

Post by Pep » Wed May 09, 2012 9:53 am

Hello,

I've been doing some tests here, and using the following code it is wording fine :

Code: Select all

_controller.chart.ClickSeries += new Steema.TeeChart.TChart.SeriesEventHandler(series_clicked);

private void series_clicked(object sender, Steema.TeeChart.Styles.Series s, int valueIndex, UIGestureRecognizer e) 
{
	Console.WriteLine("Series clicked");
}	
You can try to add this code to the Features demo project.
Does the problem happens with both simulator and device ?
In the case you still having problems, would you be so kind to send us a simple test project with which we can reproduce the problem as is here ?

BobReck
Newbie
Newbie
Posts: 16
Joined: Tue Apr 24, 2012 12:00 am

Re: Unhandled exception in iOS charting

Post by BobReck » Wed May 09, 2012 2:14 pm

Pep,
Thanks for the response. I work with the originator of this article and we're both trying to determine the reason for this crash.

Your code example addresses tapping on a series. We have that working fine and can zoom into the series as we want. I did try implementing your code (successfully) but the crash still exists when you pan the chart. The problem is when we try to pan the chart by starting from a point where you tap on a series (bar, line, etc) and then swipe left or right and let go. This causes a crash. Please try try creating a bar chart, for example, and then pan it left or right. If you pan by touching above all the series, you're fine. If you pan by touching a series first, it crashes.

This is rather time sensitive and we purchased your product specifically for this project. Unfortunately, we are now thinking we may have to abandon your product because this is a serious issue and a show stopper. A quick turn around would be greatly appreciated.

Thanks very much!
Bob

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

Re: Unhandled exception in iOS charting

Post by Pep » Thu May 10, 2012 9:32 am

Hi Bob,

yes, you're correct, I'm able to reproduce the problem here.
I'm trying to fix it. I can advise and send the new assembly to you when it's fixed. Hope as soon as possible.

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Unhandled exception in iOS charting

Post by Yeray » Thu May 10, 2012 2:42 pm

Hi Bob,

I've just sent the fixed dll to the mail account you have registered in this forum.
Don't hesitate to let us know if you still find any problem with it.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

BobReck
Newbie
Newbie
Posts: 16
Joined: Tue Apr 24, 2012 12:00 am

Re: Unhandled exception in iOS charting

Post by BobReck » Thu May 10, 2012 3:35 pm

Yeray,

Thanks so much. I installed the new DLL and it's working. You rock! Thanks for the great support Steema!

Bob

BobReck
Newbie
Newbie
Posts: 16
Joined: Tue Apr 24, 2012 12:00 am

Re: Unhandled exception in iOS charting

Post by BobReck » Thu May 10, 2012 10:41 pm

Ok guys, the crash problem is corrected, but now I have something else going on related to this.

Now if I do a swipe to scroll the bar graph, the click/tap is registered right away. We have a click handler that "Zooms" in to the next level of data when you pick a series. This needs to only happen when the user taps and does not swipe. And likewise, when we swipe, we need it to move and not do the click event. Here's our click series handler. Any suggestions would be great.

Thanks,
Bob

void Handle_chartClickSeries (object sender, Steema.TeeChart.Styles.Series s, int valueIndex, UIGestureRecognizer e)
{
if (e.State == UIGestureRecognizerState.Cancelled ||
e.State == UIGestureRecognizerState.Failed ||
e.State == UIGestureRecognizerState.Possible)
return ;

if (valueIndex > s.XValues.Count)
return;

switch (_resolution)
{
case "Monthly":
_resolution = "Daily";
break;
case "Daily":
_resolution = "Hourly";
break;
case "Hourly":
default:
return;
}

_startDate = Steema.TeeChart.Utils.DateTime(s.XValues[valueIndex]);

DisplayPortraitData();
DisplayChartData();
}

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

Re: Unhandled exception in iOS charting

Post by Pep » Tue May 15, 2012 8:58 am

Hi Bob,

I think one woy could be checking what kind of UIGestureRecognizer is into the Handle_chartClickSeries method. You should be able to do something like:

Code: Select all

if (e is UISwipeGestureRecognizer)
{}

BobReck
Newbie
Newbie
Posts: 16
Joined: Tue Apr 24, 2012 12:00 am

Re: Unhandled exception in iOS charting

Post by BobReck » Tue May 15, 2012 2:50 pm

Thank you Josep! We got it working.

Bob

Post Reply