ArgumentException was unhandled during rotation

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
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 » Tue Sep 01, 2009 2:36 pm

Hi Kent,

Ok, I have finally been able to isolate the problem comparing your application with the WPF example project shipped with TeeChart. The problem occurs when rotating a chart with visible axes titles. You can also reproduce the probem using the WPF demo project adding lines below to InitializeChart() method in Window1.xaml.cs.

Code: Select all

 tChart1.Axes.Left.Title.Text = "left axis title";
 tChart1.Axes.Bottom.Title.Text = "bottom axis title";
I've added this defect to the bug list (TW16014377) to be fixed for next releases.

Find attached PageChart.xaml.cs with changes I made. Also worth mentioning that I modified your project to use a Rotate tool instead of implementing rotation manually. For now a workaround is hiding axes titles for rotating, for example:

Code: Select all

        private void buttonRotate_Click(object sender, RoutedEventArgs e)
        {
            const string ROTATE_MSG = "   Drag Chart to Rotate";

            System.Diagnostics.Debug.Assert(FChartTimeSeries.EventData != null,"EventData is null");

            labelHelp.Content = ROTATE_MSG;
						//FChartTimeSeries.ChartRotate = true;
						//FChartTimeSeries.ChartTranslate = false;
						//FChartTimeSeries.ChartZoom = false;
						//FChartTimeSeries.ChartThickness = false;
						//FChartTimeSeries.ChartDisplay.Zoom.Allow = false;
						//if(!FChartTimeSeries.EventData.InputSettings.Chart3D) 
						//{
						//    button3D_Click(sender,e);
						//}

						FChartTimeSeries.ChartDisplay.Axes.Left.Title.Visible = false;
						FChartTimeSeries.ChartDisplay.Axes.Bottom.Title.Visible = false;

						Steema.TeeChart.WPF.Tools.Rotate rotate1 = new Steema.TeeChart.WPF.Tools.Rotate(FChartTimeSeries.ChartDisplay.Chart);
        }
Attachments
PageChart.xaml.zip
Change extension from .zip to .cs as with the file you posted.
(67.17 KiB) Downloaded 478 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 » Wed Sep 09, 2009 4:23 pm

Hi,

Using the Rotate "tool" instead of "manual" control of rotation is inconsistent with the other chart manipulation functions that my application supports. If I am going to use the Rotate tool, I would expect to find similar tools for Depth, Translation and Zoom, but there do not appear to be such tools under the Steema.TeeChart.WPF.Tools class. Am I looking in the wrong place?

Is there some reason that I should not use the manual methods? Do you not support them for dotNET? They work fine using the Delphi TeeChart library.

Thanks,
Kent

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 Sep 10, 2009 9:02 am

Hi Kent,
Using the Rotate "tool" instead of "manual" control of rotation is inconsistent with the other chart manipulation functions that my application supports.
Which is the inconsistency you find with it? Also, have you checked the last file I sent you? Notice that I made some changes to manual rotation code too as in several places you were not using correct mouse coordinates. You were using window coordinates instead of chart's. If you wish to use manual rotation please revise that code with the changes I made.
If I am going to use the Rotate tool, I would expect to find similar tools for Depth, Translation and Zoom, but there do not appear to be such tools under the Steema.TeeChart.WPF.Tools class. Am I looking in the wrong place?
No, such tools don't exist.
Is there some reason that I should not use the manual methods? Do you not support them for dotNET? They work fine using the Delphi TeeChart library.
No, but it's much easier using existing features than having to reimplement them.
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 » Fri Sep 11, 2009 12:33 am

Narcis,

I replaced my source file with the one that you modified, so I think I should have gotten all of your changes. My comment about consistency lies with the fact that I am using your "tool" for rotation, but not for the other operations. Translation, thickness and zoom would still be manual. The way it is currently implemented using the Rotate tool, as soon as I activate rotation, it stays in rotation and I cannot get it out of that mode. For example if I switch to zoom, it will simultaneously rotate and zoom. Setting .ChartRotate = False does not seem to disable the rotation tool, so I am not sure how to deactivate it.

In any case, with your version of the file PageChart.xaml.cs, none of the operations work "manually" because of the change I was told to make that uses the screen width and height (ChartDisplay.Width, ChartDisplay.Height) to scale the mouse movement deltas. (see tmpX,tmpY in ChartHMICBEMA_MouseMove). Because those members are undefined, tmpX and tmpY are NAN, and this breaks the dynamic operations.

If I go back to my original code and just put in the workaround to suppress titles, everything works fine except that rotation has some discontinuous behavior. I assume that this is related to the scaling and rounding issues that were supposed to be correctly by the tmpX,tmpY changes.

So... it seems that the best alternative is to stick with manual operations, but implement a solution for the rotation problem that corrects the discontinuous rotation using the Math.Round(90.0 * (newX - oldX) / chart.width) expression. I just need to know how to get the chart width and height. Is the fact that these members are not initialized a bug in the WPF version of TeeChart?

Thanks,
Kent

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 » Mon Sep 14, 2009 10:03 am

Hi Kent,

In that case I think the easiest option is deactivating Rotate tool when using other functionality and enabling it when required, for example:

Code: Select all

rotate1.Active = false;
Hope this helps!
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 » Mon Sep 14, 2009 4:20 pm

Setting the rotate tool Active property to false does not work. I tried making the rotate tool a class member so that it would be available to all the dynamic operation click methods. When I try to switch from Rotate to Translate, the rotate tool object is nil.

I still think there is something wrong with the WPF Teechart width and height members because they are undefined, and therefore cannot be used to scale the x/y delta values. I believe this must be a bug in the WPF Teechart.

I have subsequently disabled the rotate tool and returned to my original manual methods and now most things are working as expected if I disable label rotation as previously suggested as a workaround. I removed the limits imposed on rotation and elevation, and it performs ok. I do not see any reason to limit the range of rotation or elevation.

I have attached the latest versions of two source files so that you may see that the manual methods are working and to investigate the remaining problems related to the window width/height and the rotate tool active method (if you wish).

Thanks for your help,
Kent
Attachments
FormChartTimeSeries.cs.zip
Just rename file to remove .zip extension
(174.82 KiB) Downloaded 637 times
PageChart.xaml.cs.zip
Just rename file to remove .zip extension
(68.42 KiB) Downloaded 494 times

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 » Tue Sep 15, 2009 9:04 am

Hi Kent,

I'm glad to hear you could solve your problems. I checked with the WPFDemo project that TChart.Width and TChart.Height don't have a valid value. However, TChart.Chart.Width and TChart.Chart.Height have valid values. Anyway, I'll add this issue to the bug list to be investigated.
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

Post Reply