Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Adjust plot data

In my windows application using Measurement Studio I retrieve different signals which are inserted in a scattergraph using PlotXYAppend().

What possibilities do I have to adjust the data within the plot, i.e. the data retrievable by GetYData() and GetXData(), for presentation?

What I would like is to scale all points and or adding an offset, etc.

 

I can see two options:

1. For every signal use two plots, one (hidden) original/raw data plot and one (displayed) and adjusted plot. Every time I modify scale/offset I need to dispose the adjusted plot and create a new one based on the original data.

2. Is is possible to override the Paint-function used to draw a plot? To adjust the data just before it is drawn on the screen?

 

Any comments?

Best regards, Björn Nilsson

0 Kudos
Message 1 of 2
(3,301 Views)

Hi there,

 

Option1

The DefaultOffset and DefaultStart properties of WaveformPlot might be what you are looking for.

 

Option2

You can customize drawing plot in different ways, by hooking onto WaveformPlot.BeforeDraw or by hooking onto WaveformGraph.BeforeDrawPlot, or by deriving from WaveformPlot and overriding OnBeforeDraw event.

 

Inside the event handlers (or the overriden method if you choose to write a subclass of WaveformPlot), you can map the data points to the coordinates in pixels by using WaveformPlot.MapDataPoints(....) method.

This method will return an array of points that you can use to manipulate/draw.

Once you are done drawing, you can cancel the default drawing by setting BeforeDrawXYPlotEventArgs.Cancel to true.

 

The second option (i.e. customizing drawing) involves a bit of coding, but with option2 you can customize the graph to look the way you want.

 

Reply if you need more help.

Hope this helps,

 

Vijet Patankar,

National Instruments

Message 2 of 2
(3,271 Views)