# LabVIEW

cancel
Showing results for
Did you mean:

## How to plot area between two cursor in waveform graph

In waveform, I want to know the area between the cursor and the signal which is showing between the cursor.

Message 1 of 4
(1,179 Views)

## Re: How to plot area between two cursor in waveform graph

If you know the index locations of those cursors, I would create another waveform with data only at locations between the cursors and the rest of the data changed to NaN (this tells the graph not to plot).

Now this second waveform you created can be configured to use a filled plot.

Next, about the area under the curve, I believe you can use the math library to extract the area.

Santhosh
Soliton Technologies

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 4
(1,150 Views)

## Re: How to plot area between two cursor in waveform graph

Your question is too ambiguous to give a precise answer, because a picture alone is not sufficient.

• Is this a waveform graph or and xy graph, or something else?
• What is the datatype (dynamic, waveform, 1D array, complex array, etc.)
• What are the units of the x axis?
• What do you mean by "area"? The integral under the curve? What are the units of the integral?
• Is the data always positive?

Assuming it is a simple waveform graph and 1D DBL array, use the cursor index property (make sure the cursors are locked to the plot!) and integrate the subset between. To graph the data, duplicate the data and make a 2D array, but replace all data outside the cursors with NaN and set the plot style to "fill baseline to zero".

Message 3 of 4
(1,140 Views)

## Re: How to plot area between two cursor in waveform graph

@altenbach wrote:

Assuming it is a simple waveform graph and 1D DBL array, use the cursor index property (make sure the cursors are locked to the plot!) and integrate the subset between. To graph the data, duplicate the data and make a 2D array, but replace all data outside the cursors with NaN and set the plot style to "fill baseline to zero".

Here's how that could look like:

You also need to decide to include or exclude the cursor positions for the area calculations, so modify as needed (i.e. define "between" exactly). Of course things only need to be recalculated when the data or cursor positions change, so use an event structure. You can use a cursor move or cursor release event to get the "CursIdx" of the moved cursor from an event data node. (Not shown)

Message 4 of 4
(1,133 Views)