Graphs Steps PDF
Graphs Steps PDF
Graphs and charts differ in the way they display and update data. VIs with a graph usually collect the data in an
array and then plot the data to the graph. When the data is plotted, the graph discards the previously plotted
data and displays only the new data. You typically use a graph with fast processes that acquire sets of data
continuously.
In contrast, a chart appends new data points to those points already in the display to create a history. On a
chart, you can see the current reading or measurement in context with data previously acquired. When more
data points are added than can be displayed on the chart, the chart scrolls so that new points are added to the
right side of the chart while old points disappear to the left. You typically use a chart with slow processes in
which only a few data points per second are added to the plot.
Follow this procedure to create an example to help understand how charts and graphs function in LabVIEW.
Before starting this procedure, you need to complete the exercise in the Taking a Measurement module.
1. Create a numeric slider control for the Fahrenheit temperature control
a. Right-click the front panel and select Modern >> Numeric >> Vertical Pointer Slide
d. Right-click the control and select Visible items >> Digital Display to display the digital value
a. Right-click the front panel and select Modern >> Graph >> Waveform Graph
c. Right-click the front panel and select Modern >> Graph >> Waveform Chart
a. Right-click the front panel and select Modern >> Numeric >> Thermometer
d. Right-click the control and select Visible items >> Digital Display to display the digital value
ii. Right-click the bottom input and select Create >> Constant and enter 32 for the value
i. Right-click the top input, select Create >> Constant, and enter 5 for the value
ii. Right-click the bottom input, select Create >> Constant, and enter 9 for the value
ni.com/students/learnlabview
d. Place a Multiply function by right-clicking the block diagram and selecting Programming >>
Numeric >> Multiply and left-clicking to place it to the right of the Subtract and Divide functions
i. Wire the divide output to the top input terminal of the Multiply function
ii. Wire the subtract output to the bottom input terminal of the Multiply function
e. Wire the output of the Multiply function to the input of the waveform chart and the input to the
Temp (C) thermometer numeric indicator
f. Attempt to wire the output from the Multiply function to the input of the waveform graph
i. Note that this causes a broken wire because it requires an array input
5. Place a While Loop around the code to create an array and allow the VI to run continuously
a. Move the waveform graph to the right of the rest of the code on the block diagram
b. Right-click the block diagram and select Programming >> Structures >> While Loop
c. Left-click and drag this around the code, excluding the waveform graph
d. Right-click the conditional terminal and select Create >> Control to create a Stop button on the
front panel
6. Create an auto-indexing tunnel to output an array when the While Loop is exited
a. Wire the output from the Multiply function to the input of the waveform graph indicator that is outside
the While Loop
b. This automatically creates a non-auto-indexing tunnel, and the wire is broken because the graph
indicator requires an array
c. Right-click the tunnel and select Enable Indexing to output an array of values
a. Right-click the block diagram and select Programming >> Timing >> Wait (ms)
c. Right-click the input and select Create >> Control and enter 100 for the value
a. Note that the waveform chart updates with every iteration of the While Loop
b. Note that the waveform graph does not update until you press the Stop button
2011 National Instruments. All rights reserved. LabVIEW, National Instruments, NI, and ni.com are trademarks of National Instruments.
Other product and company names listed are trademarks or trade names of their respective companies.
ni.com/students/learnlabview