cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

line color/width/style picker as in graph legend

Highlighted

line color/width/style picker as in graph legend

I am looking for a control similar to what is shown in the legend of a graph and which is used to set the line thickness, color and type. Does anybody know if this graph control is available as a sort of custom control so that I can use it in other parts of my code apart from the legend ?

 

Thanks in advance

Martien

Message 1 of 10
(1,271 Views)

Re: line color/width/style picker as in graph legend

Here's how you do that (or at least how I figured out how to do this).  Make a Waveform Chart (or graph), and set the Plot Legend as you want (I made mine a thick dashed red line).  On the Block Diagram, right-click the Chart and choose Create Property Node.  Look at the Properties, and wire some of them to indicators (I chose Plot.LineWidth, Plot.Color, and Plot.LineStyle.  Run the VI and look at the indicators.  For the Color, go to the Graphics & Sound Palette, Picture Functions, and put a Color Box (constant) on your Block Diagram.  Right-click it and change it to Indicator.  Now your Front Panel indicator will be a box that "turns red".

 

Once you figure out which Properties you want to Set, simply change the Property Node to "Write All" and wire in Controls.

 

Plot Controls.png

Bob Schor

0 Kudos
Message 2 of 10
(1,251 Views)

Re: line color/width/style picker as in graph legend

Thanks Bob,

 

I was aware of the property nodes you listed, and I am also aware that I can build controls which can be used to fill in these properties. Following your message, I actually need three controls, one being the color box control, one for the line width (which is an integer value) and one fo the line style (again an integer). I was also that far.

 

What I am actually looking for is a single control which I can use to set all these properties, which is the same control as shown on the legend, i.e. a box with a colored line inside of a certain thickness and line style.  So the question is how to make such control or where to find it (as it apparently already exist in Labview) ?

 

Thanks again for the reply

 

Martien

0 Kudos
Message 3 of 10
(1,218 Views)

Re: line color/width/style picker as in graph legend

There's something called an X Control (or may X-Control) that (trust me) is pretty complicated, but may well be what you are trying to find.  If I were doing it, I'd go with three simple controls, but if you are going to want to use this in many places and can devote the time to learning how to do this, see if X-Controls are your answer.

 

BS

0 Kudos
Message 4 of 10
(1,209 Views)

Re: line color/width/style picker as in graph legend

You might try a radio control with the buttons replaced by classic flat square buttons and customize the button decals to show images of the various line widths and so on.  This will take some work but could be made to look similar to the legend menu items.

 

Lynn

0 Kudos
Message 5 of 10
(1,198 Views)

Re: line color/width/style picker as in graph legend


@Bob_Schor wrote:

There's something called an X Control (or may X-Control) ...


Nope, it's actually XControl!

 

It's the first thing that I thought of as well because you can do exactly what you are asking with an XControl, but if you cannot find one already made, then I would not recommend it due to the complexity-vs.-value tradeoff probably being far out of your favor in this case.



0 Kudos
Message 6 of 10
(1,188 Views)

Re: line color/width/style picker as in graph legend

Dear All,

 

Many thanks for all the comments. I had a look into the XControl option as mentioned and I admit that I have to agree to the comments made, quite complex to get something like this programmed. I think I have to go for the option to use three controls for the various properties which I would like to set.  Possibly the suggestion to use the radio controls and play with the butttons  could be an option. The issue is however, that I would like to use only a small amount of space for controls as I have to copy these many times on a front panel.

 

I remain curious to whether the control which I am looking for, which evidently exists as it is used in the legend, is not exposed to the outside world (or could be exposed in some way) so that Labview programmers could access it.

 

Thanks again for all the support,

 

Martien

0 Kudos
Message 7 of 10
(1,136 Views)

Re: line color/width/style picker as in graph legend

Martien,

 

I understand your frustration and have requested (for years) that NI share (i.e add to palettes) these and many other controls.

The simplest part of your question to answer is for color selection, just use the Color Box control.

 

Framed Color Box.png

 

 

I have created several custom controls (picture rings) I use for setting other plot/cursor properties.

The images are transparent for flexibility in use, but you can color the control background if needed for visibility.

 

If they are useful, I work for Kudos!    Smiley Happy

 

Regards,

 

James

Systems Engineering
LabVIEW 5.0 - 2016
Message 8 of 10
(993 Views)

Re: line color/width/style picker as in graph legend

I was about to replicate this exactly, but you've saved me the trouble.  Many thanks James for the beautiful controls!

0 Kudos
Message 9 of 10
(278 Views)

Re: line color/width/style picker as in graph legend


@ataranta

Kudos to James

compiling executables with LabView 2017

0 Kudos
Message 10 of 10
(259 Views)