Using charts and graphs in labview with example: tutorial 6

In the tutorial we will focus on using charts, graphs fill slides and thermometers. First is the introduction and uses of graphs and charts then in the example we focused on, is about the conversion of temperature from Fahrenheit scale to Celsius scale using the formula of conversion we have been studying from elementary classes. The example program is explained point by point and the reference figures are added wherever required. At the end of the tutorial you are provided with an exercise which you are supposed to do on your own and in the upcoming tutorials I assume that you have done that example correctly and I am not going to explain the concepts regarding that exercise.

About charts and graphs in labview

Someone said, “A picture is worth a thousand words”. What about graphs and charts??? Graphs and charts are always been helpful in data analysis and to see the variation of data with time. One can easily see the variation of data with time or any other independent variable when it is stored in the form of graphs or charts. There are various types of graphs and chart. Reading off information about the number of a particular thing in a category can also be done using charts or graphs without going back to the data table (which is quite a hideous task to perform). A graph can also be defined as a pictorial representation of data. The basic purpose of this tutorial is to familiarize the reader with the concepts of drawing graphs and charts in LabView programming.

In the previous tutorials we have learned about the introductions of LabView and learned to write a labview simple basic program to do string and numerical operations. In this tutorial we will use the built in graph and charts functionality blocks to plot various data points and plot the graphs.

labview Programs including graphs and charts

  • Create a new Blank VI as explained in the 1st tutorial and save it for future use as we have done in previous tutorials or press <Ctrl+S>
  • After saving, come to the plotting part. Let’s begin with the introduction of simple functionality blocks.
  • In the example below I am going to show you how charts and graphs work in LabView. I am going to design a simple LabView program that will convert temperature from Fahrenheit to Celsius scale; at the end of the conversion the VI will display the temperature variations on charts (colored scales).
  • Right click on the front panel and from the control palette select numeric and then select Vertical slide bar. Name every block properly, this block will provide the temperature in Fahrenheit to be converted in Celsius.Vertical fill slide graphs in labview

Figure 1: Vertical slide fill

  • Using the formula for the conversion of temperature from one scale into other as given in the equation below:

 Tc = 5/9(Tf – 32)

  • To fulfill the conditions in the above equation we need division subtraction and multiplications block. Connect the output of the Temperature slider to in upper input of the subtraction block which is available in the function palette in numeric section, and at the other side of the subtraction block connect a numeric constant and set its value to 32.
  • This task is accomplished in order to cover the portion (  of the equation defined above. From the same section select the division block and at the upper end of it connect a numeric constant of value 5 whereas at the lower input connect a numeric constant of value 9.
  • Now, place a multiplier block from the same section at the input of which connect the output from the subtraction block and the division block we have just installed The resulting block diagram will look like the one shown in the figure below.Equation solution block

Figure 2: Equation solution block diagram

  • The output of the multiply block will give the temperature value in Celsius. Now, right click on the front panel and from control palette select numeric and then select thermometer as shown in the figure below.Thermometer in labview

Figure 3: Thermometer

  • Connect the associated block of this thermometer with the output of the multiply block and name all the blocks properly. The resulting block diagram is shown in the figure below.Complete block diagram for scale conversion

Figure 4: Complete diagram for scale conversion

  • Also attach a numeric indicator at the temperature in both scales i.e. at the input temperature and at the temperature block after conversion, using the knowledge from the previous tutorials.After indicators graphs in labview

Figure 5: Diagram after indicators

  • You can see that the scale of the vertical slide fill is just from 0 to 10. If we want to change the scale of the fill, right click on the vertical slide fill and select properties and from properties block select scale and set its maximum value to the desired value of your choice. Refer to the figure below.Changing uper limit of vertical slide fill in labview

Figure 6: Changing upper limit of the vertical slide fill

  • Now run the program by clicking run button or press <Ctrl+R>. If you want to change the value of the slide fill during runtime, simply press run continuously button on the block diagram (next to run button).Running the program graphs in labview

Figure 7: After running the VI

  • This was the just bar graphs, now come to the charts and graphs portion. From control palette select graphs and then select Waveform charts.Waveform charts in labview

Figure 8: Waveform charts

  • Connect the associated block of it in the block diagram window with the output of the multiply block. Now run the VI continuously, and change the value of the input temperature (F) from the slide fill. You will see the variation of data in the chart when you vary the temperature. See the figure belowCharts output in labview

Figure 9: Output of the waveform chart

Graphs in labview

  • Now, let’s come to the graphs portion. In order to see a graph of a data we have to have a data set of any type over some period of time. For that purpose we will use a ‘for’ loop set its number of iteration to a desired value and also place a wait block inside the loop, and place all of these blocks already present on the block diagram window inside the loop. From the output of the multiply block connect a wire to the edge of the ‘for’ loop, this will allow you to connect a block outside the loop. From the control palette select graphs and then select waveform graphs as shown below.Waveform graphs in labview

Figure 10: Waveform graphs block

  • Connect the associated block of graphs to the edge of the loop as shown in the figure below.Graphs block diagram

Figure 11: Graph block diagram

  • Run the program and change the temperature from the slide fill continuously. You will see the variation of temperature on the chart but nothing is displayed on the graphs. As soon as you stop the program or the number of iterations is complete you will see all the data of the variations you have performed will be displayed on the graph. See the figure graphs and charts output in labview

Figure 12: Final graph and chart output

From the above example we can conclude that the waveform charts in LabView gives us point to point information about the data with respect to time, whereas, the graphs gives us the information about the data variation on a defined period of time.


  • Do the above example, and try to convert temperature from Celsius to Fahrenheit scale.

<<Previous tutorial                                               Next tutorial>> 

Add Comment