Chart and Graph Components


Graphs and charts have many powerful features that you can use to customize your plots. This section covers how to configure these options.

1 Plot legend

4 Minor-grid mark

7 Cursor legend

10 Y-scale

2 Cursor

5 Graph palette

8 Scale legend

11 Label

3 Grid mark

6 Cursor mover

9 X-scale

 


Figure 8.31. Graph elements


Playing with the Scales

Charts and graphs can automatically adjust their horizontal and vertical scales to reflect the points plotted on them; that is, the scales adjust themselves to show all points on the graph at the greatest resolution. You can turn this autoscaling feature on or off using the AutoScale X and AutoScale Y options from the X Scale menu, or the Y Scale menu of the object's pop-up menu. You can also control these autoscaling features from the scale legend (which we'll get to in a minute). LabVIEW defaults to autoscaling on for graphs and off for charts. However, using autoscaling may cause the chart or graph to update more slowly, depending upon the computer and video system you use, because new scales must be calculated with each plot.

If you don't want to autoscale, you can change the horizontal or vertical scale directly using the Operating or Labeling tool to type in a new number, just as you can with any other LabVIEW control or indicator, and turn autoscaling off.

X and Y Scale Menus

The X and Y scales each have a submenu of options, as shown in Figure 8.32.

Figure 8.32. X Scale and Y Scale graph pop-up submenu options


Use AutoScale to turn the autoscaling option on or off.

Normally, the scales are set to the exact range of the data when you perform an autoscale operation. You can use the Loose Fit option if you want LabVIEW to round the scale to "nicer" numbers. With a loose fit, the numbers are rounded to a multiple of the increment used for the scale. For example, if the markers increment by five, then the minimum and maximum values are set to a multiple of five instead of the exact range of the data.

The Formatting . . . option brings up a Graph Properties dialog box with the Format and Precision tab active, as shown in Figure 8.33. From here, you can configure the numeric formatting of the scale.

Figure 8.33. Format and Precision tab of the Graph Properties dialog


From the Scales tab of the Graph Properties dialog box, as shown in Figure 8.34, you can configure the following items:

  • Name is the axis label.

  • The Show scale label checkbox allows you to show (checked) or hide (unchecked) the axis label.

  • The Log checkbox lets you to select either a linear (unchecked) or logarithmic (checked) scale for the data display.

  • The Inverted checkbox allows you to define whether the axis minimum and maximum values on the scale are reversed (checked) or not (unchecked).

  • Use AutoScale to turn the autoscaling option on or off. If Autoscale is off, then you can use Minimum and Maximum to set the scale range.

  • The Scale Style and Colors menu lets you select major and minor tick marks for the scale, or none at all. Click on this icon to see your choices. A major tick mark corresponds to a scale label, while a minor tick mark denotes an interior point between labels. This menu also lets you select the markers for a given axis as either visible or invisible.

  • The Grid Style and Colors lets you choose between no grid lines only at major tick mark locations, or grid lines at both major and minor tick marks. You can also change the color of the grid lines here. Click on the grid buttons to see a pullout menu of your options.

  • You can set Offset, the X value you want to start at, and Multiplier, the increment between X values (same as delta X), in the Scaling Factors section.

Figure 8.34. Scales tab of the Graph Properties dialog


The Scale Legend

The scale legend lets you create labels for the X and Y scale (or for multiple XY scales, if you have more than one), and have easy pop-up access to their configuration. The scale legend gives you buttons for scaling the X or Y axis, changing the display format, and autoscaling.

Popping up on the graph or chart and choosing Visible Items>>Scale Legend will give you a box like the one shown in Figure 8.35.

Figure 8.35. Scale legend


In the scale legend, you can type the names of your scales in the textbox. This text will show up on the graph or chart's box X or Y axis.

You can click on the buttons to configure the same options as in the X|Y Scale Formatting pop-up window just described (see Figure 8.36). It's just a more convenient way to access this information for some people.

Figure 8.36. Scale legend buttons pop-up menu options


Scale Lock Button

Use the Operating tool to click on the Scale Lock button to toggle autoscaling for each scale, the visibility of scales, and so on.

You can resize the scale legend with the Positioning tool, just like an array, to create, show, or hide additional scales on your chart or graph.


The Plot Legend

Charts and graphs use a default style for each plot unless you have created a custom plot style for it. The plot legend lets you label, color, select line style, and choose point style for each plot. Show or hide the legend using the Visible Items>>Plot Legend option of the chart or graph pop-up menu. You can also specify a name for each plot in the legend. An example of a legend is shown in Figure 8.37.

Figure 8.37. Plot Legend


When you select Plot Legend, only one plot shows in the box that appears. You can show more plots by dragging down a corner of the legend with the Positioning tool. After you set plot characteristics in the Plot Legend, the plot retains those settings, regardless of whether the legend is visible. If the chart or graph receives more plots than are defined in the legend, LabVIEW draws the extra plots in default style.

When you move the chart or graph body, the legend moves with it. You can change the position of the legend relative to the graph by dragging only the legend to a new location. Resize the legend on the left to give labels more room in the window or on the right to give plot samples more room.

By default, the plot legend of a graph or chart will automatically resize to the width of the longest plot name visible in the legend. This behavior can be disabled by popping up on the graph or chart and selecting Autosize Legend from the shortcut menu to remove the checkmark.


By default, each plot is labeled with a number, beginning with zero. You can modify this label the same way you modify other LabVIEW labelsjust start typing with the Labeling tool. Each plot sample has its own menu to change the plot, line, color, and point styles of the plot. You can also access this menu by clicking on the legend with the Operating tool.

  • The Common Plots option lets you easily configure a plot to use any of six popular plot styles, including a scatter plot, a bar plot, and a fill to zero plot (see Figure 8.38). Options in this subpalette configure the point, line, and fill styles of the graph in one step (instead of setting these options individually, as listed next). Look at Activity 8-6 for an example of a bar graph.

    Figure 8.38. Set the appearance of a plot by choosing from one of the Common Plots in the plot legend

  • The Color option displays the Color palette so that you can select the plot color. You can also color the plots on the legend with the Color tool. You can change the plot colors while running the VI.

  • The Line Style and Line Width offer different types of patterns and widths for the lines to plot.

  • The Anti-Aliased option makes line plots appear smoother and nicer overall, but be aware that anti-aliased line drawing can be computationally intensive and slow performance.

  • The Bar Plots option lets you create bar plots of 100%, 75%, or 1% width, either horizontally or vertically. The Fill Baseline option controls the baseline of the bars; plots can have no fill or they can fill to zero, negative infinity, or infinity. (With multi-plots, it is possible to fill to the value of another plot.)

  • The Interpolation option determines how LabVIEW draws lines between data points (see Figure 8.39). The first option does not draw any lines, making it suitable for a scatter plot (in other words, you get points only). The option at the bottom left draws a straight line between points. The four stepped options link points with a right-angled elbow, which is useful for histograms.

    Figure 8.39. Choosing an Interpolation option to define how lines will connect a plot's data points

  • The Point Style options display different point styles (none, round, square, hollow, filled, etc.) you can choose from.

  • The X Scale and Y scale are useful for specifying which plot corresponds to which X and Y scale, when you have multiple scales on your chart or graph.




LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net