LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Plot colors mismatched with legend

Does any happen to know why colors on a graph would not match the colors indicated in the legend?

I am trying to use a property node to set the color and name for each set of data which is displayed. The colors and names are displayed properly in the legend, but the color of the plot itself does not follow.
Download All
0 Kudos
Message 1 of 8
(3,442 Views)
If you could repost your code in V6.0 format I'd be glad to look at it.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 8
(3,442 Views)
Is there some sort of conversion utility, or some guidelines i could follow to make this vi 6.0 compatible

thanks, bryan
0 Kudos
Message 3 of 8
(3,442 Views)
err... i just noticed save with options

here is the 6.0 format

it gave errors on saving some included vi's, such as the load spreadsheet one

those aren't necessary though, data should be in the format of the data.txt from my last file post...

the property node stuff on the right side of the for loop is maybe the cause

thanks a lot, bryan
0 Kudos
Message 4 of 8
(3,442 Views)
Here's your program back. I fixed the bug you were hsving trouble with. In any case, the problem is that you were always generating an array of 32 plots (16 from each file io function) instead of one element for each selected plot.

Also fixed the problem where it wouldn't properly display signal names from the comparison file; and the problem that names from the comparison file stayed in the list even after you turned off the comparison function; and the race condition in the code for setting the graph properties; also added a little initialization logic to get things started right every time.

If you have any questions on the changes I made give a hollar...

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 5 of 8
(3,442 Views)
thanks so much for the extra timely reply

-bryan
0 Kudos
Message 6 of 8
(3,442 Views)
oh man this is great!

a couple questions though. how does the for loop know how many iterations to go? does it go by the highest index of the arrays fed in?

also, on the same note, does feeding in arrays de-index them and make the for loop run that number of times automatically, or is there some other control involved that i'm missing?

thanks yet again, bryan
0 Kudos
Message 7 of 8
(3,442 Views)
The loop knows how many times to go due to a feature of LV called auto-indexing. If you pass in an array and let it autoindex on the boarder, the loop will automatically pull out the next value in the array with each iteration--AND set the number of time to loop before stopping. Compared to the hoops C makes you jump through to use arrays, this is indeed Very Cool...

Note that if you wire both the N terminal on a FOR loop, and autoindex an incoming array, the loop will iterate the smaller of the two sizes. For example, if you wire 5 to N and pass in an array with three elements, the loop will only go three times.

Finally, always remember that a FOR loop can iterate zero times. In that case any outputs coming directly from the loop will be
the default value for the datatype. Arrays will be empty, numbers will be zero'd and (this is a biggie) references numbers will be invalid(!).

In the case of your code, I modified the logic such that it generates an array of indexes that has one element for each signal selected. This array drives the loop that sets the plot properties. Note that if the operator selects more than 5 signals the higher-numbered plots will be undefined in terms of color and label because you only specify 5 colors in an array. (Input an array of 10 items and an array of 5 items and the loop only goes 5 times.)

Note that, although it's not used here, auto indexing also works with outputs. In that case though, the loop will automatically collect an array of the output values--one element per iteration.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 8
(3,442 Views)