[SOLVED] Change line color depending on value in ShapeSheet

Started by siric, April 19, 2012, 09:07:51 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

siric

Hello,


I have a value in my shapesheet which defines the capacity of a data link - 1 (Red), 10 (Blue), 155 (Green) etc.  What I want to do is to change the color of the line depending on the value.  The shape property is Prop._VisDM_Capacity, so I am using this formula, but the line stays black

="IF(Prop._VisDM_Capacity=1,THEMEGUARD(RGB(255,0,0)), IF(Prop._VisDM_Capacity=10,THEMEGUARD(RGB(51,102,255)), IF(Prop._VisDM_Capacity=155,THEMEGUARD(RGB(51,153,102)))))"

I have also tried it as

="IF(Prop._VisDM_Capacity=1,RGB(255,0,0), IF(Prop._VisDM_Capacity=10, RGB(51,102,255), IF(Prop._VisDM_Capacity=155,RGB(51,153,102))))"

but no difference.

Any assistance would be appreciated.


Thanks






JohnGoldsmith

Hi,

You're just missing the final part of your IF statement.  I find the 'Edit formula' dialog useful for longer formulae as you can add line breaks and whitespace, which are then ignored as you accept the formula back again.  For example if you break up your first formula (see attached image) it becomes easier to see where the problem is (missing final false part).

If you just add a zero (black) as your final 'false' parameter then this will be the default value if none of the other conditions are met:

=IF(Prop._VisDM_Capacity=1,THEMEGUARD(RGB(255,0,0)),IF(Prop._VisDM_Capacity=10,THEMEGUARD(RGB(51,102,255)),IF(Prop._VisDM_Capacity=155,THEMEGUARD(RGB(51,153,102)),0)))

Best regards

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


dasadler

A follow on question if I may. I know this dealt with a line (connector) but I expect the same principle would apply to a shape.  I wonder, though, how would you do it if the value in question was text?




JohnGoldsmith

If you mean how could I set the text color, then you can just use a similar formula in the Color cell of the Character ShapeSheet section. 

If you mean how can I change shape text based on some other logic, then you can use an inserted field (see the Insert tab on the ribbon).  If you have a specific scenario, why not flesh out the details in a new thread and we can solve it there.

All the best

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

Jumpy

And if you mean, how to change the color depending on a textvalue, not a number value, you have to use the STRSAME-Function, so instead of:

=IF(Prop._VisDM_Capacity=1,THEMEGUARD(RGB(255,0,0)).....

=IF(STRSAME(Prop._VisDM_Capacity,"Text_123"),THEMEGUARD(RGB(255,0,0))....

hth Jumpy