Example Code

Multiple Color Chart Plot Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example shows a quick way plot the single plot on a chart contains multiple colors.


Description
Currently in LabVIEW it is not possible to have a single plot on a chart that contains multiple colors.  However if you manipulate the data just right it is possible to use multiple plots to give the effect of a single plot with multiple colors.

The following code takes data and splits the data up into up to four separate plots that are overlaid in order to give the effect of a single plot.  The secret to make it work is to write "NaN" to all other plots that are not being currently written to.  This will ensure that no data is written except to the plot you currently want.  Also you want to make sure to write to all of the plots at the boundaries in order to ensure no gaps in the line. 

In this example the color changes every few points (determined by '# of points') but this can be changed to specify the color by any method desired. 


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  • Run the program

 

Additional Information or References
VI Snippet

2-271.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.