Conditional format Simple Square or Circle

Started by neilmac, April 21, 2010, 02:07:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

neilmac

Good afternoon everyone, and thank you for such a great forum.

I am making a visio diagram of a Cisco Switch network, and I would like to colour code the VLANS on each switch port. I don't think it's possible within the Cisco shape, so I thought I would create a simple circle or square to go over each port on the switch.

I will enter the values of 1,2,3,4,5 etc for each port according to the VLAN membership.

Please would anyone tell me how I can get the shape fill colour to change based on the number I place in the shape ? For example, number 1 makes the shape fill red, number 2 fills blue and so on.

Any suggestions gratefully appreciated.

Many thanks,

NSM

vojo

first your answer

1. layout all the boxes where you want them on the circle
2. group them
3. add custom props to your group shape.....props.vlan1....props.vlan2....props.vlan3...etc
    set group shape eventdblclk = docmd(1312)
4. in each box (subshape of the group), set fillforegnd = if(sheet.x!props.vlanv<vlan of interest> = <num of interest>, RGB (R,G,B), RGB (100,100,100)
    (R,G,B are the red green blue elements of the color you desire....gives you better control than just say 0 or 1 or 5...they work, just no control to tune it).
    You can nest these or use a user cell to help with the nesting....I.e. if (x=y, if (a=b, if (q=r, ans1,ans2), ans3), if(m=n, ans4, ans5))
    can also use the lookup function if you want to get fancy
5. Now done...so try it out....double click the group....set the vlans as appropriate...voila subshape squares change color

Now the next thing you will want to think about
- probably want some connection points on those squares so that if you move the group around...lines follow
- since cisco stuff is usually iso or 2.5 iso...may want to start with that shape and put your boxes over top....viso cafe has usual cast of characters in visio format
  (can get cisco shapes from cisco directly)...using cisco shapes would also allow you to have additional info already coded...location of switch, SN, etc

Good luck

neilmac

Thanks, Vojo, that's pretty detailed.

I will have a go, just want to check a couple of things - I need this to work per port not as a group.

I will only enter values 1,2,3,4 etc, not VLAN1, VLAN2.

Can I make one, then copy and paste and it retains the formatting ?

Thanks,

NSM

vojo

yes....all your requirements met....I do that all the time

neilmac

Vojo,

Thanks again.

I hate to ask, however I am really struggling with this, I wonder if you wouldn't mind sending me an example that I can open up and amend, to understand a bit better what's involved ?

Would that be ok ?

NSM


neilmac

Thanks for that, however not quite what I meant - I am sorry for not explaining better. In excel for example, I can apply conditional formatting to a cell, input a number in the cell and the colour will change accordingly.

For Visio, I just need a single simple shape, either a circle or a square.

If I put a 1 in the square (or circle) it goes red, 2, it goes blue, etc.

If I change the numbers in the sample you sent, the colours don't change.

I do appreciate the help, and again I am sorry for not explaining better.

Is there a simpler option ?

Thanks again,

NSM

wapperdude

Strange...the colors changed for me. 

Select the group shape, don't select the subshape.  Then right click > Data > Shape Data.  Brings up a form with three entries.  Each entry has a drop-down menu to select a number.  Change the number and the corresponding circle color changes.

Were you wanting to enter the number directly into the subshape rather than via a data form?

Wapperdude
Visio 2019 Pro

neilmac

Ahh, got you....

Yeah, I was hoping just to enter a number and the format would go automatically as it does in Excel.


vojo

it does....double click the shape....type what number in appropriate VLAN entry....color changes automatically.

you are going to want to do it this way.

you could use just text but with a group of shapes its going to get pretty unusable
(need to tie specific text to shape, if number in the little circles then hard to read, need to use if(strsame(thetext, "<value>"), color, default)  kind of construct, etc.)

More over as I said...you quite likely to want additional info...and custom props is where that is best placed
(can export more easily to DB or excell, can generate reports, etc).

But fill free to poke at this all you want

wapperdude

#10
A quick and dirty solution is attached.  You can incorporate some of Vojo's features, e.g., using index function, etc.  The key to this solution is using "shapetext(TheText)" to read what is typed in.  Set the character transparency to 100% if you don't want to see any text.

Vojo's solution is much more elegant.

HTH
Wapperdude
Visio 2019 Pro

neilmac

Thanks, Wapperdude.

That's exactly it, I am trying to get into it to edit it and play with it. I have been looking for more than an hour and can't find where to amend the FillForegnd attribute, would you mind giving me a pointer ?

Thanks,

NSM

Aeon

#12
in addition to wapperdude: or just set hidetext (under miscellaneous) to true

@neil: if you want just send the drawing and i'll look at it, got time on my hands atm anyways

if you can tell me what cisco shapes you are using i could try to adapt them so you can colour each port.
i managed to colour a UPS from the default visio drawings so i don't see why it wouldn't work here

wapperdude

Hi NSM --

In the shapesheet (menu bar > Window > Show Shapesheet), scroll down to the Fill Section.  It is almost always present.  If not, you can right click in the shapesheet to pop up a menu.  Either choose Insert Section or View Sections and click the Fill Section to see it.  As for the text transparency, that can also be set from the shapesheet -- since you're there.  It's in the Char Section.

Note:  you can also toggle the format of the shapesheet to see either the values in each of the cell blocks, or the formulas.  Again right click and check either values or formulas.

Nice shapesheet reference is here:  http://msdn.microsoft.com/en-us/library/ms427024(v=office.12).aspx

and VisioGuy has a host of articles on shapesheet related topics.  You might want to start here:  http://www.visguy.com/category/development/shapesheet/page/2/

HTH
Wapperdude
Visio 2019 Pro

neilmac

Quote from: Aeon on April 22, 2010, 09:32:38 AM
in addition to wapperdude: or just set hidetext (under miscellaneous) to true

@neil: if you want just send the drawing and i'll look at it, got time on my hands atm anyways

if you can tell me what cisco shapes you are using i could try to adapt them so you can colour each port.
i managed to colour a UPS from the default visio drawings so i don't see why it wouldn't work here

Thanks again to you all, Aeon - if you're still up for a challenge...

I have a number of switches, all WS-3750E, some 24 port (PD and TD) , some 48 ports (PD and PDF). I have a number of VLANS, and it may change, see attached graphic for colours. The shut port is represented by an "x" (that would be the text entry). The 4+1 port is the IP phone where the phone is on VLAN for and the nativeis on VLAN 1. Don't worry if you don't know about the vlans, it's just that the text entry changes.

All as I would like is to be able to easily change the colours on the ports on the visio of the switch. I like the original idea where you can open a master property sheet, but I haven't been able to replicate it.

Any thoughts ?