Programmatically Change Multiple Line Colors on a Chart or Graph

Updated May 21, 2024

Environment

Software

  • LabVIEW Full
  • LabVIEW Professional
  • LabVIEW Base

I have a Waveform Graph or Waveform Chart with multiple plot lines. I can change the color of the first line with a Plot.Color Property Node, but that doesn't change the other plot colors. How can I do this?

  1. Create a Property Node from the graph/chart. On the Block Diagram, right-click on the graph/chart and choose Create»Property Node.
  2. Select the Active Plot property.
  3. Drag the Property Node handle down so that two properties are visible. For the second property, select Plot Color.
  4. Right click on the Property Node and select Change All To Write.
  5. The Active Plot property is zero-indexed and selects which plot line color to change. The Plot Color property will then set the color of the plot that you set as active. You can place the Property Node in a loop and iterate through each plot and set the color.

The following VI snippet shows one way to approach changing the color for two different plot lines and the resulting XY Graph.