Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to overlay graphs in C# .Net using NI Measurement Studio.

Hello,

 

I have to make an overlay graph having multiple Y axes attributes with a single X axis "Time" attribute. Can you please guide me is it possible to achieve in C# .Net using NI Measurement Studio. A sample code would be greatly appreciated.

 

Regards,

Naureen.

0 Kudos
Message 1 of 8
(7,487 Views)

Hi Naureen,

 

Take a look at this NI commnuity example. It shows how you can have multiple y-axes and a single x-axis on a waveform graph.

Hope this helps.

Rohama K.
0 Kudos
Message 2 of 8
(7,478 Views)

Hi,

 

Thanks for your help. Why the graph does not zoom (in/out) when I zoom it in the sample code. Same is the case with panning.

 

Regards,

Naureen.

0 Kudos
Message 3 of 8
(7,464 Views)

Hi Naureen,

 

What do you mean you by can't zoom or pan? Are you having trouble doing this programatically? If you are trying to zoom and pan programatically, take a look at this example.

Rohama K.
0 Kudos
Message 4 of 8
(7,456 Views)

Hello,

 

Actually what I mean is that, by doing zooming or panning with the mouse I do not see the effects of these operations. I am not doing it programmatically, assuming that the default properties of the waveform graph should work.

 

Regards,

Naureen.

0 Kudos
Message 5 of 8
(7,445 Views)

Zooming and panning functionality is available using a mouse or keyboard. Take a look at this help document for more information about zooming and this help document for panning.

What you will need to do is first make sure the InteractiveMode property for the graph is set correctly. Once that is set, you can hold the <Shift> key or the <Ctrl> key to zoom or pan the graph using the mouse, respectively. Details on what to set the InteractiveMode property to and how to use a mouse to zoom and pan are in the documents I linked above.

Rohama K.
0 Kudos
Message 6 of 8
(7,436 Views)

Hi,

 

Nice example. I have implemented this by plotting multiple Y axis along single X axis(Time). When I plot my data, I get the graph but the problem is the X axis does not make any effect i.e: the time array that I provide, it does not plot rather the X axis starts from zero always. Also when I dont give the data for X axis the graph still renders the same.

 

Like if I have

 

YData1 = {2,5,7,8,9}

YData2 = {22,45,67,77.83}

XData = {10,20,30,40,50}

 

When I plot the above data YData1 and YData2 renders correctly but the XData does not. And when I place the cursor on a first point I get (0,2) instead of (10,2) on the YData1 plot.

 

Please tell me why the X-Axis does not render according to the data provided. Its the time data.

 

Regards,

Naureen

0 Kudos
Message 7 of 8
(7,181 Views)

Hello there,

 

Change label format on xaxis:

 

//xAxis1.MajorDivisions.LabelFormat
xAxis1.MajorDivisions.LabelFormat = new NationalInstruments.UI.FormatString(NationalInstruments.UI.FormatStringMode.DateTime, "g");

Scaling the data value:

 

  • WaveformPlot.DefaultStart
  • WaveformPlot.DefaultIncrement

Controlling the label values on an XAxis (YAxis is also similar):

 

  • XAxis.MajorDivisions and its sub properties
  • XAxis.MinorDivisions and its sub properties
  • XAxis.CustomDivisions and its sub properties

Regards,

 

Vijet Patankar

National Instruments

0 Kudos
Message 8 of 8
(7,176 Views)