Color of Connector line changes according to Shape Data

Started by novski, April 17, 2014, 09:29:37 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

novski

hi
i have another question to shapesheet formulas...

I have just 7 Colors matching many different signal types.

The signal types i have are:
Prop.signaltyp=";SDI;HD-SDI;3G-SDI;4k-SDI;HDMI;DVI;DVI - HDMI;Display Port;VGA;Thunderbolt;Composite;Component;Y/C;RGBHV;LAN;iLO;USB1.1;USB2;USB3;PS/2;Serial;RS232;RS422;RS424;RS485;GPIO;GP-I;GP-O;Audio;AES;MADI-Coax;MADI-Opt.;AC3-Coax;AC3-opt.;Cobranet;Ethersound;Dante;AVB;A-Net;Livewire;Ravenna;Rocknet;ADAT;Fiber Singlemode;Fiber Multimode;"

so i read about the possability to change the color of the line acording a shape data and managed to do so like this:
=IF(STRSAME(Prop.signaltyp,"HDMI"),THEMEGUARD(RGB(255,0,0)),IF(STRSAME(Prop.signaltyp,"DVI"),THEMEGUARD(RGB(255,255,0)),0))

now to make my formula a little bit readable i think a OR() function wold be nice.

I tryed this:
=IF(OR
(STRSAME(Prop.signaltyp,"HDMI")),
(STRSAME(Prop.signaltyp,"DVI")),
THEMEGUARD(RGB(255,0,0))),
IF(OR
(STRSAME(Prop.signaltyp,"Composite"),
(STRSAME(Prop.signaltyp,"Component"),
THEMEGUARD(RGB(255,255,0)),
0)))

with no luck...

how is that to do?

thanks
novski

JohnGoldsmith

One approach would be to use an index and then test on the index.  If you look at the image below you'll see that I've shifted the signals list into a User cell and have added a new cell (User.SignalTypeIdx) to track the selected index in the list.

If you only have a couple of colors then you could use a series of IF statements to test on the index, but if there are more than a few and these might change you might find it easier to maintain by adding a colors list.  Once you've created this (User.LineColorsList) you can use it in combination with the SignalTypeIdx to retrieve the correct color.

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

novski

Hi John
Thanks for that Help.

I didn't understand your proposal until i made it work as you show in the PNG.
It works with a RGB value for every Signal.
Now its fact that i have alligned them to groupes. Like the first are all SDI singals so they all have the same color. Is it possible to generate a group RGB value? Like: Prop.SingalTyp: "1-10 [??are??] RGB(0,0,0)|11-18 [??are??] RGB(128.255.0) "

Just for more easy reading...

Thanks
novski


Jumpy

Instead of a colorlist, use a group list first, that fits your signaltyp list:
="0,0,0,0,0,1,1,1,1,1,1,2,2,2,2,2"

Instead of a color you now retrieve a group number from that list and use that number as index to retrieve the color  from a matching color list.

----

Or instead of an group list use some "Ifs" to determine a group number and use that again as an index against the colorlist.

novski

Hi
And how can i match the groupe to the RGB Color then?
I don't know with which code like "lookup()" or "index()" i can make the position of my signaltype to get the groupe number...

Sorry i don't have done much programming until now...
best regards
novski

JohnGoldsmith

Hi,

What Jumpy's suggesting is that you've got a couple of choices.  The first is to have an intermediate grouping list, where, rather than repeating the same RGB function for each index you just have a pointer to one of three colors.  For example:

User.LineColorsList = "RGB(135,42,175)|RGB(43,39,31)|RGB(114,209,193)"
User.GroupList = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2"
User.LineColor = INDEX(INDEX(User.SignalTypeIdx,User.GroupList,","),User.LineColorsList,"|")


This allows you to create a group list which holds an onward index to one of the three colors in User.LineColorsList.

Another option is to use an IF statement in much the same way you started with, in which case User.LineColor would look something like this:


IF(User.SignalTypeIdx>30,RGB(0,0,200),IF(User.SignalTypeIdx>10,RGB(0,200,0),RGB(200,0,0)))


This ignores the User.LineColorsList cell and make sense if you only have a limited choice of color.

Both of these are good options and get you to the same place.  The former might be a little more complex to read, but does allow you to have a non-contiguous index for your colors.  You could also do the same thing with a set of nested IF statements but the formula would quickly become more opaque than the list option as you grew the possible variations.

Best regards

John

PS - I've always thought that the INDEX And LOOKUP functions are curiously named.  The LOOKUP function returns an index in a list and the INDEX function returns an item in a list.  To my mind they should swap names.
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/

novski

Wow! so grateful!
Thank you very much for that exact explanation!
Now it works perfect with the Group Nr. and i think it will be also really easy to modify in future...
best regards
novski

Jumpy

Quote from: JohnGoldsmith on April 22, 2014, 09:01:24 AM
PS - I've always thought that the INDEX And LOOKUP functions are curiously named.  The LOOKUP function returns an index in a list and the INDEX function returns an item in a list.  To my mind they should swap names.

That's something I've always wondered about, too.

JohnGoldsmith

#8
Thought I'd add this post as it's relevant to this thread and also the tool I used to generate the lists below:

http://visualsignals.typepad.co.uk/vislog/2014/04/using-nimbletext-with-visio.html

Best regards

John
John Goldsmith - Visio MVP
http://visualsignals.typepad.co.uk/