03-23-2011 05:12 AM
Hello,
I'm using Microsoft Visual Studio 2010 together with NI Measurement Studio 2010 to create a "simple" graph plotting application.
To make the matter not too simple I am using WPF with the WindowsFormsHost element to host a NationalInstruments.UI.WindowsForms.ScatterGraph control.
So far, this pretty much works as expected.
At first I only noticed that once in a while the application would just hang. I debugged a lot and noticed that the problem is found somewhere in the interoperability between WPF and WinForms. Although I started to doubt the use of WPF, I further noticed that the WPF window messaging handler was waiting for something. That something turned out to be the ScatterGraph control... !?
I further narrowed the problem to the scaling functionality of the ScatterGraph control. The hang would only happen if I set the Mode property of the x and y axes to AxisMode.AutoScaleLoose and then change the ScaleType of those axes to ScaleType.Logarithmic. Of course I called PlotXY() on the Plot that is attached to that ScatterGraph. "Unfortunately" the problem only occurs with specific data that gets plotted...
While debugging I monitored the xAxis.Range.Minimum and yAxis.Range.Minimum values and both remained 0 after setting the Mode property to AutoScaleLoose. If I used AutoScaleExact instead the problem would not occur because both range minimum values became greater than zero afterwards. The problem also would not occur if I set the Mode property to Fixed, specified a custom scale range with both x minimum and y minimum set to 1 (other values below 1 also won't work...) and then changed the ScaleType to Logarithmic.
I would appreciate any help to solve this problem because I almost spent a whole week of my job to find a solution.
Thanks in advance.
Hagen
03-23-2011 06:49 AM - edited 03-23-2011 06:49 AM
It took me a while to construct a test case to demonstrate the problem. Here it is at last.
You will need Visual Studio 2010 and Measurement Studio 2010.
03-23-2011 07:44 AM
Further investigation led me to the creation of a WinForms application that reproduces the issue. So I can now definetly eliminate WPF to be the source of the problem. And so the problem seems to solely lie in the ScatterGraph control.
Any comments on this?
Best regards
Hagen
03-23-2011 10:25 AM
Hello Hagen -
This appears to be a bug. I've filed a bug report with ID 290486 for further investigation. In the meantime, it appears that ensuring that the lower bound of the X Axis remains above .1000 is the best workaround.
I'm sorry for any inconvenience -
NickB
National Instruments
03-23-2011 10:37 AM
Thank you Nick.
The workaround you suggested is exactly what I did to avoid the issue. Furthermore I completely avoid the automatic scaling feature and handle scaling myself, for I know the lower and upper boundaries of the data and can therefore "fix" the lower boundary of the x axis if it falls on 0.1 or below.
So for now I guess that is the best that can be done.