Automatically Setting Shape Color By Data Values In Visio Diagrams


Visio has a way to let you automatically color shapes by the values in the shape’s custom properties. Consider the case of an organization chart. By default, there are a number of custom properties on an organization chart shape, such as Name, Title, Email.

 

You can view custom properties on a shape by right-clicking a shape and selecting Shape and then Custom Properties. Alternatively, you can use the Custom Properties window which you can pull up by going to the View menu and selecting the Custom Properties Window option.

 

Let’s say that you want to color-code the organization chart by the titles. First, create your org chart, remembering to fill out the custom properties on the shape. I’m using Visio 2003, so the next few steps will be specific to my version.

 

Go to the Tools menu, select the Addons entry, then Building Plan, and finally Color By Values. (No, this add-on is not Building Plan solution-specific; it's just where the add-on entry point is stored. It can be used with Building Plans or any other type of diagram that has custom properties in it.) You will see a dialog that lets you select the custom property field by which you want to set color. In my example, I want to set the color-coding by Title. I select Title from the drop-down list, which contains all the custom property fields for the shapes on the page. I want this to apply to all shapes, so I leave the default Shape Types entry to <all shapes>. Alternatively, I can apply my color coding to shapes that were created from a master shape on a stencil – like a Manager shape or a Employee shape for org charts.

 

By default, the color coding uses primary colors and is too bright for me. I select from the drop-down icon above the color bar on the dialog and choose one of the more pastel color patterns. Then click OK and see what happens. My diagram looks this:

 

 

 

 

The Color By Value add-on also gives you a nice legend to go with your diagram. This add-on is useful for process flowcharts, organization charts, and other diagrams where you want to emphasize shapes that share common values (like “Late” for a Status custom property).

 

Some things to keep in mind when using the Color By Values add-on:

  • Draw your diagram first. The add-on will not apply the color by value formatting to shapes that you drop on the page AFTER you run the add-on.
  • You can change what color is assigned to what value. For example, if you want the “Late” value in a Status custom property field to color the shape red as opposed to blue, you can set that through the dialog.
  • Be very careful how you type your values in the fields. If you add a space or have a typo, the add-on treats it as a unique value – “  Manager” will be listed as a separate value as “manager” or “Manager”.
  • You can run the add-on multiple times. Manually delete the Legand shape in the bottom right corner of your page before re-running the add-on. Every time the add-on is run, it will drop a new Legend shape in the same place, regardless if a legend (or any other shape) already lives there.
  • You can customize colors in a limited way. You can pick the beginning and end colors on the color bar by selecting More Colors… on the color flyout menu.

 -- Mai-lan

 

This posting is provided "AS IS" with no warranties, and confers no rights