# EET 2259 Unit 11 Charts and Graphs

Embed Size (px)

description

### Transcript of EET 2259 Unit 11 Charts and Graphs

EET 159 PowerPoint Slides

EET 2259 Unit 11Charts and GraphsRead Bishop, Chapter 7.

Lab #11 and Homework #11 due next week.Floyd, Digital Fundamentals, 10th edCharts and GraphsCharts and graphs are used to display data in graphical form.LabVIEW has many types of charts and graphs, found on the the Controls >> Modern >> Graph palette.The two most common types are the Waveform Chart and the Waveform Graph.(Bishop, pp. 348-349)Floyd, Digital Fundamentals, 10th ed2-Collecting large amounts of data is easy, but interpreting it is more difficult. Charts and graphs can help.-As example of 3D graph, go to example finder, search for 3D, and open 3D Graph Properties - Torus.viCharts versus GraphsCharts and graphs in LabVIEW are similar to each other, but theres an important difference:Charts display data on the fly as it becomes available. New data written to a chart is appended to previous data.Graphs display a set of data that has been previously generated and stored in an array. New data written to a graph replaces any previous data.(Bishop, p. 348)Floyd, Digital Fundamentals, 10th ed3Waveforms ChartsA waveform chart plots numeric data values on a chart.By default, the vertical axis automatically scales itself to have the best minimum and maximum for the data youre plotting.You can easily change the vertical or horizontal scale by double-clicking the minimum or maximum values.(Bishop, p. 349)Floyd, Digital Fundamentals, 10th ed4-Place a chart on front panel, change its X scale from 100 to 20 pts.-On block diagram, generate random numbers in a While Loop with a 0.1 s delay.-Then modify it to multiply the random values by 10, and run again; note that new data is appended to the old, and the vertical scale automatically changes.-Demo turning off autoscale and adding an X scrollbar.Clearing a ChartTo clear all plotted data, right-click on the chart and select Data Operations > Clear Chart. Floyd, Digital Fundamentals, 10th ed5Displaying Multiple Plots on a ChartTo display more than one plot on a waveform chart, bundle the data together using the Bundle function.(Bishop, p. 351)Floyd, Digital Fundamentals, 10th ed6-Demo by modifying existing VI to display random numbers and random numbers x 10.GraphsAs weve seen, charts display data on the fly as it becomes available. Graphs, on the other hand, display a set of data that has been previously generated and stored in an array.Well look at two kinds of graphs: waveform graphs and XY graphs.(Bishop, p. 357)Floyd, Digital Fundamentals, 10th ed7Waveform GraphsUse a waveform graph to plot data points that are evenly distributed on the x-axis.Example: Suppose youve got a set of voltage measurements that were made at one-second intervals, and you wish to make a plot of voltage (on the vertical axis) versus time (on the horizontal axis). Since the time interval is constant, you can use a waveform graph.(Bishop, p. 357)Floyd, Digital Fundamentals, 10th ed8-Create new VI with a waveform graph on front panel. Show that you get an error if you try to wire a random number to it.-Instead, place random number inside a For loop (with n=20), and then wire the output to waveform graph. Run it. Then clear the graph, and use execution highlighting to show how all 20 points are entered into array before any data passes to waveform graph.-Demo with WaveformGraphExample.vi on H drive. Then change function to sin(x/2).

XY GraphsWhen you use a waveform graph, your data array just contains the y-coordinates of the data points, and LabVIEW assigns the x-coordinates. On the other hand, when you use an XY graph, you must provide the x-coordinate and y-coordinate for each data point.(Bishop, p. 365)Floyd, Digital Fundamentals, 10th ed9-Tell them to keep existing example using waveform graph so we can come back to it later.When to Use XY GraphsUse an XY graph to plot data points that are not evenly distributed on the x-axis.Example: Suppose youve got a set of voltage measurements that were made at irregular intervals, and you wish to make a plot of voltage (on the vertical axis) versus time (on the horizontal axis). Since the time interval is not constant, if you want your plot to accurately show the time relationship among the values, you cannot use a waveform graph; use an XY graph instead.(Bishop, p. 365)Floyd, Digital Fundamentals, 10th ed10-Demo with XYGraphExample.vi on H drive.-Reiterate that for waveform graphs and waveform charts the data points will be evenly distributed on the x-axis.When to Use XY Graphs (Cont.)Also use an XY graph if the plot contains more than one data point for the same x-coordinate.Example: Suppose you want to plot a circle. For each x-coordinate in the plot, a circle contains two points (with different y-coordinates). You cannot plot these points using a waveform graph; use an XY graph instead.(Bishop, p. 365)Floyd, Digital Fundamentals, 10th ed11Customizing Charts & GraphsLabVIEW has many features that let you customize charts and graphs.Most of these features can be accessed through the Properties dialog box. To open this dialog box, right-click on the chart or graph and select Properties.(Bishop, pp. 368-382)Floyd, Digital Fundamentals, 10th ed12-Before going into this, review the difference between waveform charts, waveform graphs, and xy graphs.-Place a waveform chart & a waveform chart. Look quickly at Properties of each, noting absence of Cursors tab on chart. Delete the chart, and write code to send 20 random numbers to the graph.Chart/Graph PropertiesThe Properties dialog box has the following tabs:AppearanceDisplay FormatPlotsScalesCursors (for Graphs only)DocumentationFloyd, Digital Fundamentals, 10th ed13-Demo with the waveform graph.Plots TabThe Plots tab lets you control many aspects of the line used to plot data:Solid, dashed, or dottedThicknessShow or hide data-point markersSmooth or jaggedColorFillFloyd, Digital Fundamentals, 10th ed14Scales TabThe Scales tab lets you control many aspects of the scales on the x-axis and y-axis, including:Scales shown or hiddenMinimum and maximum valuesColors of scale markers and textColors of grid linesAutoscaling enabled or disabledFloyd, Digital Fundamentals, 10th ed15-DemoDisplay Format TabThe Display Format tab lets you control aspects of the values shown on the scales:Floating point notation, scientific notation, or engineering (SI) notationNumber of digits displayedFloyd, Digital Fundamentals, 10th ed16Cursors TabThe Cursors tab (for graphs only) lets you add one or more cursors to your graph and lets you control many aspects of the cursor:Line style and thicknessColorWhether cursors can be moved freely or are locked to a particular plotFloyd, Digital Fundamentals, 10th ed17-Demo on a waveform graph (doesnt seem to work on xy graph).-Youll probably want to turn on the cursors legend if youre using a cursor.Appearance TabThe Appearance tab lets you reveal or hide items such as:LabelCaptionGraph PalettePlot legendScrollbarScale legendDigital display (for Charts only)Cursor legend (for Graphs only)Floyd, Digital Fundamentals, 10th ed18Plot LegendThe plot legend shows the name and appearance of each plot. Right-clicking on the plot legend gives you easy access to many of the same features that you can access from the Plots tab in the Properties dialog box.(Bishop, p. 372)

Floyd, Digital Fundamentals, 10th ed19-DemoGraph PaletteThe graph palette (which is available on both graphs and charts) lets you zoom in on part of the displayed data and lets you scroll forward or backward through the displayed data.(Bishop, p. 374)

Floyd, Digital Fundamentals, 10th ed20-Demo the hand tool -Demo the zoom in and zoom out tools (last two tools under the magnifying glass icon).Scale LegendThe scale legend gives you easy access to many of the same features that you can access from the Scales tab and the Format and Precision tab in the Properties dialog box. (Bishop, p. 374)

Floyd, Digital Fundamentals, 10th ed21Cursor LegendThe cursor legend (for graphs only) shows you the x and y coordinates of the cursor. It also gives you easy access to many of the same features that you can access from the Cursors tab in the Properties dialog box. (Bishop, p. 377)

Floyd, Digital Fundamentals, 10th ed22Chart History LengthBy default, a chart remembers the last 1024 data points that it has plotted, and you cant scroll back to view earlier data points. To increase this number of data points, right-click on the chart and select Chart History Length.

Floyd, Digital Fundamentals, 10th ed23