ArgumentException was unhandled during rotation

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

ArgumentException was unhandled during rotation

Post by BlueMonkey » Tue Aug 04, 2009 9:45 pm

I am porting a Delphi application to C#/WPF. I initially display a line chart in 2D, then enable 3D and rotation. The chart correctly appears in 3D, and rotates a little bit, then I get an "ArgumentException was unhandled" error "Width must be non-negative" and my application crashes without a traceback.

This same functionality works fine in my delphi version using the same charting data. Here is how I enable rotation and 3D:

FChartTimeSeries.ChartRotate = true;
FChartTimeSeries.ChartTranslate = false;
FChartTimeSeries.ChartZoom = false;
FChartTimeSeries.ChartThickness = false;
FChartTimeSeries.ChartDisplay.Zoom.Allow = false;
FChartTimeSeries.ChartDisplay.Aspect.View3D = true;

Here is how I apply rotation in the mouse move event handler:

FChartTimeSeries.ChartDisplay.Aspect.Orthogonal = false;
FChartTimeSeries.ChartDIsplay.Aspect.Rotation = FChartTimeSeries.ChartDisplay.Aspect.Rotation + deltaX;
FChartTimeSeries.ChartDIsplay.Aspect.Elevation = FChartTimeSeries.ChartDisplay.Aspect.Rotation - deltaX;

If I rotate exclusively or change elevation exclusively, it does not seem to happen. But if I have a combination of rotation and elevation change it crashes.

Can you give me any idea why this is happening? I can send my application code if necessary.

Thanks,
Kent

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

Re: ArgumentException was unhandled during rotation

Post by Yeray » Wed Aug 05, 2009 1:09 pm

Hi BlueMonkey,

Both the error message and the piece of code that you've posted, make me think that you could be trying set a negative elevation or rotation. I'm not sure if this should cause a crash, but you could try applying mod functions to prevent that. Something similar to the following for the rotation:

Code: Select all

FChartTimeSeries.ChartDIsplay.Aspect.Rotation = (FChartTimeSeries.ChartDisplay.Aspect.Rotation + deltaX) % 360;
And for the elevation there is another issue you should be careful with. Note that the scrollbar for the elevation in the editor is limited between 270 and 360 so if you want to show the aspect editor in your application, you should ensure that the elevation is into the correct range to avoid any error. Something like following:

Code: Select all

FChartTimeSeries.ChartDIsplay.Aspect.Elevation = ((FChartTimeSeries.ChartDisplay.Aspect.Rotation - deltaX) % 90) + 270;
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

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Wed Aug 05, 2009 5:32 pm

Hi Yeray,

I tried your suggestion, but it did not work. I examined the value of Rotation when I applied a delta of -1. The resulting value of rotation was 359 as intended, but I still got the crash with "height must be non-negative."

I do not have this code adjustment in my Delphi version, and I never get such a crash.

Any other ideas?

Thanks,
Kent

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ArgumentException was unhandled during rotation

Post by Sandra » Thu Aug 06, 2009 11:37 am

Hello BlueMonkey,

Please you could send a simple project us, because we can reproduce the problem here? You could attach the project directly in the Forums post.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Thu Aug 06, 2009 5:53 pm

I have attached a project and an input file. I had to remove pdb files and .exe file in order to make the project small enough to upload.
Although it is not a trival project, it isn't that big either. Just build it and run it.

To reproduce the problem do the following:

1. click the Browse... button and read the attached .txt file (unzipped). A chart will appear.
2. Click the rotate icon in the toolbar at the bottom of the screen (second from left). The chart will automatically change to 3D and activate mouse rotation.
3. Place the mouse in the chart area and drag with the left button held down.
4. Crash....

A second problem is that I cannot get the chart properties dialog window to appear. To reproduce, click the Tools icon (second from the right). The event handler is buttonEdit_Click().

Thanks,
Kent
Attachments
LDP_16Channels.zip
Input file
(1.4 KiB) Downloaded 561 times
WpfChartViewer_8_6.zip
Project files
(418.77 KiB) Downloaded 547 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ArgumentException was unhandled during rotation

Post by Sandra » Fri Aug 07, 2009 10:36 am

Hello BlueMonkey,

Please you could send again your .txt file, because I can not open this file in your application that you send.


Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Fri Aug 07, 2009 3:11 pm

Here is a new input file. It is a .csv instead of .txt.
Attachments
LDP_16Channels.zip
input file
(1.4 KiB) Downloaded 494 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ArgumentException was unhandled during rotation

Post by Sandra » Mon Aug 10, 2009 9:24 am

Hello BlueMonkey,

We couldn't reproduce your project, because not appears chart and appears message that said: "File does not contains valid data". Please you could send a more simple project us we could reproduce your issue here?.


Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Mon Aug 17, 2009 5:25 pm

I have updated my project and uploaded the new project files and a sample data file. I removed the pdb files and the Teechart.WPF.dll in order to make the zip file small enough to upload. All you have to do is paste the latest Teechart.WPF.dll into the /bin/Debug folder of the project folder and rebuild the application (I am using 4.0.2009.21358). I have tested the zipped files and was able to build the project and reproduce the problems.

There are two ways to import data into the application: 1) click the "Browse..." button to import the supplied .CSV file or 2) open the CSV file in Notepad, select all, copy and paste into the text area of the NotePad tab at the top of the WPF application window, then click the Chart button. NOTE: all controls now have tooltips to explain their function. NOTE also, it is possible that you can get an "Invalid data" error if your regional settings are not set up for US-English. If this happens, please change your Regional and Language options in the Control Panel to English (United States). This is probably what caused the problems with the sample application that I sent previously.

Here are the problems that I am having and an explanation of how to reproduce each:

- Copy to clipboard does not work (crash)
1. Import the supplied data file as described above
2. click the copy icon in the bottom toolbar (rightmost icon)

- Showing the editor window (Teechart property editor window) does not work (nothing happens)
1. Click the tools "Edit chart properties" icon in the bottom toolbar ( icon second from right)

- The Teechart GetNextAxisLabel() method is never called.
1. Import the supplied data file. The method should be called automatically, but it is not.

- Crash during 3D rotation
1. Import the supplied data file
2. Click the "Enable Chart Rotation" icon in the bottom toolbar (second from left)
3. Drag the mouse over the chart with the left button pressed to attempt rotation.

- Cursor over chart to query data values does not work
1. Import the supplied data file
2. Click the "Enable chart data feedback at cursor location" icon in bottom toolbar (6th icon from right).
3. Hover the mouse pointer over the chart. The event handler for MouseMove (ChartHMICBEMA_MouseMove calls DisplayMouseQueryFeedback()) does not produce a "Match" condition. (See line 3601 of FormChartTimeSeries.cs)


Thanks alot for your help,

Kent
Attachments
LDP_16Channels.zip
sample data file
(1.4 KiB) Downloaded 516 times
WpfChartViewerDemo.zip
updated project files
(456.18 KiB) Downloaded 561 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ArgumentException was unhandled during rotation

Post by Sandra » Mon Aug 24, 2009 9:44 am

Hello Kent,
- Copy to clipboard does not work (crash)
1. Import the supplied data file as described above
2. click the copy icon in the bottom toolbar (rightmost icon)
As I commented in this post. I have added back to list of Bug Report with number [TW16014356].
- Showing the editor window (Teechart property editor window) does not work (nothing happens)
1. Click the tools "Edit chart properties" icon in the bottom toolbar ( icon second from right)
At the moment, can not possible using editor but there is a feature Request with number [TW16014180] to regards in features versions of TeeChartFor .Net.
- The Teechart GetNextAxisLabel() method is never called.
1. Import the supplied data file. The method should be called automatically, but it is not.
There are a bug, when you use GetNextAxisLabel() simultaneous with GetAxisLabel() event there is a conflict and don't GetAxisNextLabel don't works. This already is in the list with number[TF02014336].we will try to fix it for next versions of TeeChart .NET.
- Crash during 3D rotation
1. Import the supplied data file
2. Click the "Enable Chart Rotation" icon in the bottom toolbar (second from left)
3. Drag the mouse over the chart with the left button pressed to attempt rotation.
Please, send a simple project with only reproduce this problem and we could reproduce here. You could attach your project directly in the post.
Cursor over chart to query data values does not work
1. Import the supplied data file
2. Click the "Enable chart data feedback at cursor location" icon in bottom toolbar (6th icon from right).
3. Hover the mouse pointer over the chart. The event handler for MouseMove (ChartHMICBEMA_MouseMove calls DisplayMouseQueryFeedback()) does not produce a "Match" condition. (See line 3601 of FormChartTimeSeries.cs)
I couldn't reproduce your problem here, using last version of TeeChartFor.Net. Please, you could make a simple project that reproduce this issue. You could attach your example directly in the post.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Mon Aug 24, 2009 5:06 pm

I don't understand why you need a simpler example. The one I sent to you reproduces the problems very easily. I may not be able to reproduce the problem with a trivial example.

Are you telling me that you tried to reproduce the problems with my example, and they worked as expected?

Thanks,
Kent

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: ArgumentException was unhandled during rotation

Post by Sandra » Tue Aug 25, 2009 10:06 am

Hello BlueMonkey,
Are you telling me that you tried to reproduce the problems with my example, and they worked as expected?
I have not expressed correctly, When I said that you send a simple project I want refered that if you could send a small project that only reproduce for example your rotation problem or Cursor over chart to query data values. Because, your project is very complex there we are dedicated much time to debug right to know where the problem that solved this. We would be very grateful if you could send us a project where reproduce only your problem of rotation and other project where only reproduce the problem of Cursor over chart to query data values there so we can try to solve your problem easier.

Thanks,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Wed Aug 26, 2009 12:26 am

I would still like to know whether you even tried to reproduce the problems with my sample. In the case of the rotation problem, it crashes immediately in TeeChart code. You do not even need to look into my code.

In the case of the cursor tool problem, I have isolated the location of the problem in my code so that you can simply debug in the vicinity of a few lines of my code to determine why the technique I am using is not working. If I were to isolate the problem to a smaller example, the code in the vicinity of the problem would not be different.

In my opinion, making my sample project smaller is not going make your job any easier. It is definitely going to be more work for me, and I don't have alot of spare time either.

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: ArgumentException was unhandled during rotation

Post by Narcís » Thu Aug 27, 2009 11:28 am

Hi Kent,

I'm taking over this issue as Sandra is on holidays now. Regarding the issues that are still open:
- Crash during 3D rotation
1. Import the supplied data file
2. Click the "Enable Chart Rotation" icon in the bottom toolbar (second from left)
3. Drag the mouse over the chart with the left button pressed to attempt rotation.
You should better try using a Steema.TeeChart.WPF.Tools.Rotate tool or implement rotation as in this post or may be more precise in the attached code.
- Cursor over chart to query data values does not work
1. Import the supplied data file
2. Click the "Enable chart data feedback at cursor location" icon in bottom toolbar (6th icon from right).
3. Hover the mouse pointer over the chart. The event handler for MouseMove (ChartHMICBEMA_MouseMove calls DisplayMouseQueryFeedback()) does not produce a "Match" condition. (See line 3601 of FormChartTimeSeries.cs)
This is most likely because you are using screen or window coordinates instead of chart coordinates. At point P in DisplayMouseQueryFeedback you should substract chart's left coordinate from its X coordinate and chart's top coordinate from its Y coordinate. Actually assigning it as shown below does the job.

Code: Select all

								P = e.GetPosition(FChartTimeSeries.ChartDisplay);
Hope this helps!
Attachments
Form1.zip
(1.75 KiB) Downloaded 554 times
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

BlueMonkey
Newbie
Newbie
Posts: 20
Joined: Mon Feb 14, 2005 5:00 am
Location: Eastern Washington, US

Re: ArgumentException was unhandled during rotation

Post by BlueMonkey » Tue Sep 01, 2009 2:49 am

The example code that you sent to me that illustrates the technique for rotation was written for WinForms, not WPF. I tried to implement your technique in WPF, but the Height and Width members of the TChart component are not initialized, so the technique does not work. I have attached the revised version of one of my source files that you can plug into my original application to reproduce the behavior that I am experiencing. Please test the WPF implementation. It does not help to do this in WinForms, because your WPF implementation is not the same.

Please examine function ChartHMICBEMA_MouseMove in PageChart.xaml.cs.

NOTE: I attached the file as PageChart.xaml.zip, but it is not zipped. Just rename the file.

Thanks,
Kent
Attachments
PageChart.xaml.zip
replacement source file (not zipped)
(66.73 KiB) Downloaded 528 times

Post Reply