02-17-2019 11:01 PM - edited 02-17-2019 11:05 PM
Hi Everyone,
I am struggling to program chart legends and I am hoping to get some help. My code is simulating a NI9205 with NIMAX and DAQmx. I am trying to programmatically update the legends by the user specifying the channel names.
I am having two problems
ANY INFORMATION WOULD BE APPRECIATED!
Thanks
02-18-2019 01:24 AM
Hi Kurtz,
I can’t get the first channel name to be displayed on the legend. … I don’t know what I am doing wrong.
You did wrong at the chart's property node:
first you set the plot name, then you set the active plot. You need to do that the other way around: first define the active plot, then change it's properties!
02-18-2019 03:34 PM
Wow... well that did the trick. It works now thank you very much.
Do you have any idea how to remove the unused plots in the legend?
02-18-2019 04:52 PM - edited 02-18-2019 04:53 PM
To force remove plots, use Legend:Plot Minimum property. It should be used after resizing legend, because changing size of legend increases number of active plots.
I would not use legend height.
Instead (N = number of names):
1) Remove "Autosize plot legend" checkmark.
2) Put a decoration box at full graph height. Optional, but empty array elements do not look nice, I could not make them completely invisible.
3) Set Num of rows to minimum of graph height (13) and N.
4) Set Legend: Plot Minimum to N
5) If N less or equal to 13, set legend scrollbar Visibility to false.
Also:
Remove names array build, transpose and local variable. Autoindexing works for single dimension arrays.
Properties that apply to all legend (size, visibility) should be written once, not in a loop. Only Active plot and Name should be in the loop.
02-20-2019 09:04 PM
Hi Alexander!
All of those tips worked very well. I am pretty sure I implemented everything you mentioned. However, I may have messed up the legend height. Thanks for the help though.
02-20-2019 09:45 PM
It turns out that the legend height has become a problem, because it is showing inactive plots. I tried implementing your suggestions, but I must have read them wrong. Any idea what I am doing wrong?