From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Gradient Color Ramp (Scrolling) 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

These VI demonstrate algorithms to generate color tables for LabVIEW color ramps.

 

Description
Use this Vi to create some color ramp. By using the rotate 1D array you could create some awesome gradient scrolling action. 

In the first step the application creates colors shades and then creates movement by an array rotation .

 

Requirements

  • LabVIEW 2012 (or compatible)

 
Steps to Implement or Execute Code

1. Open Scrolling Gradient Color Ramp LV2012 NI Verified

2. Set colors in color array
3. Run VI
4. Change speed
5. Try another colors combination

 

Additional Information or References

Top level VI Block Diagram

Scrolling Gradient Color Ramp LV2012 NI verified.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.

Comments
josborne
Active Participant
Active Participant
on

Thanks!  Great code.  Just used it to add some fancy effects to my GUI.

Kudos!

http://www.medicollector.com
David_L
Active Participant
Active Participant
on

Awesome! I'm glad someone found it useful!

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

Very neat thanks for sharing.  I had a need to generate a 2D picture with a gradient, so I took your output of an array of color boxes, and used the Draw Multiple Lines function, to draw a horizontal line for each color.  There was some room for improvement, using the newer concatenating tunnel function, and removing the build array in Create Gradient Array.vi and just use the normal indexing tunnel.

David_L
Active Participant
Active Participant
on

Brian Hoover wrote:


There was some room for improvement.


                   

Considering that I was a 1-year LabVIEW user when I posted this, I'm sure there is quite a lot of room for improvement :-).  Either way, I'm glad it was useful. 

Hooovahh
Proven Zealot Proven Zealot
Proven Zealot
on

1 year or not, you accomplished what I was looking for with pretty minimal effort.  I didn't have to write the code, I just did a search and this was the first complete result I found.  That being said I did develop my own using .Net and a gradient brush but I like the G solution in this case.

TScholtens
Member
Member
on

I was looking for a way to color multiple lines in my XY graph in a gradient manner and found your tool very helpful, thanks!