Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Graph with several plots, one cursor programmatically jumps from plot to tlot

Solved!
Go to solution

Hi, 

I am using MS 2013 with Vstudio 2010

I have a graph with 3 plots, and one cursor which in design time is attached to plot 0.

I need to reattach this cursor to plots 1 or 2, based on the index of my choise.

I guess one way would be to delete the existing gursor and re-create a new one, attached to a different plot.

But can it be done using already existing cursor?  I could not find a way to do it .

I need something like:

 

private void comboBoxCursor_SelectedIndexChanged(object sender, EventArgs e)
{
   var selected_plot = comboBoxCursor.SelectedIndex;
   var cur_indx = waveformGraphScope.Cursors.IndexOf(xyCursorScope);
   waveformGraphScope.Cursors. ????????.Plot[selected_plot ]
}

Thanks,

Igor

0 Kudos
Message 1 of 4
(4,853 Views)

Igor,

 

You could definitely do the delete-and-recreate approach, but you may also be able to use some of the events associated with MS cursors--such as BeforeDraw() to--switch the draw functionality to a new graph.

 

Some of our custom cursor documentation can be found here: http://www.ni.com/example/10151/en/

Kirk L. | Applications Engineer | National Instruments
0 Kudos
Message 2 of 4
(4,770 Views)
Solution
Accepted by IgorKord

Actually, it is simple:

if "selected_ch" is a plot number, then this will attach cursor to a particular plot:

 

waveformGraph.Cursors[0].Plot = waveformGraph.Plots[selected_ch];

 

Igor

0 Kudos
Message 3 of 4
(4,761 Views)

Igor,

 

That's interesting; I'm glad you got that to work.

Kirk L. | Applications Engineer | National Instruments
0 Kudos
Message 4 of 4
(4,733 Views)