Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Application Not Responding on Cursor move...

I am having a scatter graph with multiple plots. Each plot has its own cursor. At one time only the cursor of the selected plot is displayed all other cursors are hidden. When the cursor is moved on the plot, all other cursors are moved according to its index. The values (x,y) of all the cursors are shown as label in my gui.

 

Following code shows the above description:

 

int _cursor = 0;

try
{
int index = scatterGraph.Cursors[selectedCursor].GetCurrentIndex();

for (; _cursor < scatterGraph.Cursors.Count; _cursor++)
{
if (_cursor != selectedCursor)
scatterGraph.Cursors[_cursor].MoveCursor(index);
}

for (int _plot = 0; _plot < scatterGraph.Plots.Count; _plot++)
{
pnl_Time.Controls[0].Text = Convert.ToDateTime(TimeSpan.FromSeconds(scatterGraph.Cursors[_plot].XPosition).ToString()).ToString("HH:mm:ss.fff");

Pnl_SelectedFields.Controls[_plot].Text = Math.Round(scatterGraph.Cursors[_plot].YPosition, 5);
}

catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
}

 

Initially I was having all the Y axes data with valid double values, which used to get plotted successfully and the cursor movement was fine as well.

Now I am having some null values in my Y data which is treated as special values (NaN) in the scatter graph and gets plotted. So I am having continuous (with all valid double values) as well as discrete graphs (data having some null values) plotted according to the data.

 

Lets say if I am rendering two plots. One plot gets rendered as continuous as all its y values are valid double values and the other gets rendered as discrete as its y values contains some double valid values with some null values as well. Both plots renders but when I move the cursor the application goes in Not Responding state :(.

 

I have tested this code with all valid Y data values for both the plots and all goes fine.

 

I think the MoveCursor(index) is causing some problem.

 

Please guide me whats going wrong, why the application hangs. Please provide me some solution its very urgent.

 

Thankyou and Regards,
Naureen.

0 Kudos
Message 1 of 2
(5,289 Views)

Hi Naureen,

 

Maybe the index in MoveCursor(index) doesn't get incremented when you have null values.You can try step throught the code, or use whatch windows to better understand what changes when you use null values versus when you don't. It could also be that MoveCursor(index) gets updated with wrong values. Take a look at this forum post.

 

Hope this gives an idea, let me know.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(5,250 Views)