Module-IV Plotting Data
Module-IV Plotting Data
MODULE-IV
PLOTTING DATA
INTRODUCTION
Graphical display of data is an important aspect of programming in LabVIEW.
A good knowledge of arrays and clusters is important for graphical operations. VIs with graph usually
collects the data in an array and then plots the data to the graph to obtain a waveform.
Two-dimensional X-Y displays are required in most situations. Charts and graphs let you display plots
of data in a graphical form. Charts interactively plot data, appending new data to old so that you can see the
current value in the context of previous data, as the new data become available. Graphs plot pre-generated
arrays of values in a more traditional fashion without retaining previously-generated data.
TYPES OF WAVEFORMS
LabVIEW includes the following types of graphs and charts:
● Waveform graphs and charts: Display data typically acquired at a constant rate.
● XY Graphs: Display data acquired at a non-constant rate and data for multivalued functions.
● Intensity graphs and charts: Display 3D data on a 2D plot by using color to display the values of
the third Dimension.
● Digital waveform graphs: Display data as pulses or groups of digital lines.
● Windows 3D Graphs: Display 3D data on a 3D plot in an ActiveX object on the front panel.
WAVEFORM GRAPHS
LabVIEW includes the waveform graph and chart to display data typically acquired at a constant rate.
The waveform graph displays one or more plots of evenly sampled measurements.
The waveform graph plots only single-valued functions, as in y = f (x), with points evenly distributed
along the x-axis, such as acquired time-varying waveforms.
Figure 7.1 shows an example of a waveform graph. The waveform graph can display plots containing
any number of points.
The graph also accepts several data types, which minimizes the extent to which you must manipulate
data before you display it
Prof. Bharateesh N.Fadanis Dept. of Computer Science & Engineering JCER, Belagavi
VIRTUAL INSTRUMENTATION
Use a plot array instead of a 2D array if the number of elements in each plot is different.
For example, when you sample data from several channels using different time amounts from
each channel, use this data structure instead of a 2D array because each row of a 2D array must
have the same number of elements.
Prof. Bharateesh N.Fadanis Dept. of Computer Science & Engineering JCER, Belagavi
VIRTUAL INSTRUMENTATION
The number of elements in the interior arrays of an array of clusters can vary. The
waveform graph accepts a cluster of an initial x value, a delta x value, and array that contains
clusters. Each cluster contains a 1D array that contains the y data.
You use the Bundle function to bundle the arrays into clusters and you use the Build
Array function to build the resulting clusters into an array. You also can use the Build Cluster
Array function which creates arrays of clusters that contain the inputs you specify.
The waveform graph accepts an array of clusters of an x value, a delta x value and an
array of y data. This is the most general of the multiple-plot waveform graph data types
because you can indicate a unique starting point and increment for the x-scale of each plot.
The waveform graph also accepts the dynamic data type, which is for use with Express
VIs. In addition to the data associated with a signal, the dynamic data type includes attributes
that provide information about the signal, such as the name of the signal or the date and time
the data was acquired.
Attributes specify how the signal appears on the waveform graph. When the dynamic
data type includes multiple channels, the graph displays a plot for each channel and
automatically formats the plot legend and x-scale time stamp
WAVEFORM CHARTS
The waveform chart is a special type of numeric indicator that displays one or more plots of data
typically acquired at a constant rate.
Waveform charts can display single or multiple plots. Figure 7.3 shows the elements of a multiplot
waveform chart.
Two plots are displayed: Raw Data and Running Avg. The waveform chart maintains a history of data
or buffer from previous updates.
To pass data for multiple plots to a waveform chart, you can bundle the data together into acluster of
scalar numeric values, where each numeric represents a single point for each of the plots.
If you want to pass multiple points per plot in a single update, wire an array of clusters of numeric
values to the chart. Each numeric represents a single y value point for each of the plots
. You can use the waveform data type to create multiple plots on a waveform chart. Use the Build
Waveform function to plot time on the x-axis of the chart and automatically use the correct interval between
markers on the x-scale of the chart.
A 1D array of waveforms that each specifies t0 and a single-element Y array is useful for plotting data
that is not evenly sampled because each data point has its own time stamp.
If you cannot determine the number of plots you want to display until run time, or you want to pass
multiple points for multiple plots in a single update, wire a 2D array of numeric values or waveforms to the
chart. By default, the waveform chart treats each column in the array as a single plot. Wire a 2D array data
type to the chart, right-click the chart, and select Transpose Array from the shortcut menu to treat each row in
the array as a single plot.
XY GRAPHS
The XY graph is a general-purpose, Cartesian graphing object that plots multivalued functions, such
as circular shapes or waveforms with a varying time base. It displays any set of points, evenly sampled or not.
You also can display Nyquist planes, Nichols planes, S planes and Z planes on the XY graph. Lines
and labels on these planes are the same colour as the Cartesian lines, and you cannot modify the plane label
font. Figure 7.6 shows an example of an XY graph.
The XY graph can display plots containing any number of points. It also accepts several data types,
which minimizes the extent to which you must manipulate data before you display it
Prof. Bharateesh N.Fadanis Dept. of Computer Science & Engineering JCER, Belagavi
VIRTUAL INSTRUMENTATION
Prof. Bharateesh N.Fadanis Dept. of Computer Science & Engineering JCER, Belagavi
VIRTUAL INSTRUMENTATION
The rows of the data pass into the display as new columns on the graph or chart. If you want rows to
appear as rows on the display, wire a 2D array data type to the graph or chart, right-click the graph or chart,
and select Transpose Array from the shortcut menu.
The array indexes correspond to the lower-left vertex of the block of color. The block of color has a
unit area which is the area between the two points, as defined by the array indexes. The intensity graph or
chart can display up to 256 discrete colors.
Intensity Charts
After you plot a block of data on an intensity chart, the origin of the Cartesian plane shifts to the right
of the last data block. When the chart processes new data, the new data values appear to the right of the old
data values.
When a chart display is full, the oldest data values scroll off the left side of the chart.
This behavior is similar to the behavior of a strip chart. Figure 7.8 shows an example of an intensity
chart. The intensity chart shares many of the optional parts of the waveform chart, including the scale legend
and graph palette, which you can show or hide by right-clicking the chart and selecting Visible Items from the
shortcut menu.
In addition, because the intensity chart includes color as a third dimension, a scale similar to a color
ramp control defines the range and mappings of values to colors. Like the waveform chart, the intensity chart
maintains a history of data, or buffer, from previous updates.
Right-click the chart and select Chart History Length from the shortcut menu to configure the buffer.
The default size for an intensity chart is 128 data points. The intensity chart display can be memory intensive.
Intensity Graphs
The intensity graph works the same as the intensity chart, except it does not retain previous data values
and does not include update modes. Each time new data values pass to an intensity graph; the new data values
replace old data values.
Like other graphs, the intensity graph can have cursors. Each cursor displays the x, y and z values for
a specified point on the graph.
exceeds a threshold value. You can set the color mapping interactively for the intensity graph and chart the
same way you define the colors for a color ramp numeric control.
You can set the color mapping for the intensity graph and chart programmatically by using the property
node in two ways. Typically, you specify the value-to-color mappings in the property node. For this method,
specify the Z scale: Marker Values property. This property consists of an array of clusters in which each
cluster contains a numeric limit value and the corresponding color to display for that value. When you specify
the color mapping in this manner, you can specify an upper out-of-range color using the Z scale: High Color
property and a lower out-of-range color using the Z scale: Low Color property.
The intensity graph and chart are limited to a total of 254 colors, with the lower and upper out-of-range
colors bringing the total to 256 colors. If you specify more than 254 colors, the intensity graph or chart creates
the 254-color table by interpolating among the specified colors. If you display a bitmap on the intensity graph,
you specify a color table using the Color Table property. With this method, you can specify an array of up to
256 colors.
Data passed to the chart are mapped to indexes in this color table based on the color scale of the
intensity chart. If the color scale ranges from 0 to 100, a value of 0 in the data is mapped to index 1, and a
value of 100 is mapped to index 254 with interior values interpolated between 1 and 254. Anything below 0
is mapped to the out-of-range below color (index 0), and anything above 100 is mapped to the out of-range
above color (index 255).
Prof. Bharateesh N.Fadanis Dept. of Computer Science & Engineering JCER, Belagavi