Share via


Section 3: Enhancing Shapes with Color, Icons, and Data Bars (Visualizing Information with Microsoft Office Visio 2007)

This article is an excerpt from Visualizing Information with Microsoft Office Visio 2007 by David J. Parker from McGraw-Hill (ISBN 13: 9780071482615 copyright McGraw-Hill Companies 2007, all rights reserved) with permission from McGraw-Hill Professional. No part of this chapter may be reproduced, stored in a retrieval system, or transmitted in any form or by any means—electronic, electrostatic, mechanical, photocopying, recording, or otherwise—without the prior written permission of the publisher, except in the case of brief quotations embodied in critical articles or reviews.

Previous part: Section 2: Labeling Shapes from Shape Data (Visualizing Information with Microsoft Office Visio 2007)

Contents

  • Overview

  • Setting Color to Shape Data Values

  • Predefining Fills in a Database

  • Space Plan—Color By Value

  • Data Graphics—Color By Value

  • Data Graphic Icons Sets

  • Data Graphic Data Bars

  • Additional Resources

  • About the Author

Overview

Coloring shapes according to data values can be an effective way to communicate information quickly, and now you can also add icons and data bars.

Setting Color to Shape Data Values

You can set formulas to change the display color of different elements within a shape to reflect different data values. In the previous chapter, we changed the line color to reflect the different Priority Status for a Process shape. The same principle can be applied to the foreground fill, the background fill, or the shadow color. In fact, you can have subshapes within your shapes that reflect different shape data values.

In the following example of a risk model, the Capacity and Operational Risk rectangles on the right of each shape reflect their status.

Using color to denote status in a risk model

The next example is a variance on risk, which displays the details of an application on a server, and the associated business continuity management level, the criticality, the status, and the IT ownership is the fill color of main body of the shape.

Using color to denote the status of an application

This shape was designed prior to Microsoft Office Visio 2007, thus, the color fill does not use Data Graphics. All the colors apart from the IT ownership are from a fixed list, similar to the Priority Status example, but the IT ownership fill color is read from a database.

Predefining Fills in a Database

You can use Visio to update a database with the settings for color fills and patterns. This can make your diagrams consistently use the same graphics for the same entity, such as Department, in a variety of diagram types. We examine this in more detail when we use the Database Wizard in Chapter 6.

Space Plan—Color By Value

The Space Plan Add-in—Color By Value—can be used in any type of diagram, if you have Microsoft Office Visio 2003 Professional, or later. Color By Value also creates a legend automatically that displays the color, count of shapes in the page, and the value. This is not part of the new Data Graphics, but it can be updated by Visio 2003 users.

Color by Value dialog box

The right mouse menu for the legend shape provides the capability to Edit Legend or Refresh Legend. You can also decide whether or not to display the count.

The colors will not automatically refresh as you add more relevant shapes to the drawing page. You need to do this manually, using the right mouse menu of the legend, unlike in the new Data Graphics, where colors can be automatically applied as the shapes are dropped.

Data Graphics—Color By Value

The new Data Graphics also has the capability to color shapes by value, but it does not create a legend automatically. This is an omission that needs to be overcome for serious business use, so we will take some time to examine how this can be done.

Edit Color by Value dialog box

These Color By Value Data Graphics allow the suggested colors for each data value to be overridden by custom colors.

Creating Data Graphic Color By Value Legends

The color formulas are stored in a User-defined cell in the Data Graphic Master shape. Consequently, any code that needs to read or update the colors associated with any values must first determine which Data Graphic Masters are used for Color By Value, and then interpret the shape data row (or other formula) being used for coloring. Then, the shapes in the page must be examined to see how many there are for each color and value.

Finally, the results need to be displayed on the page, so any viewer can understand what the colors represent. The Space Plan Color By Value Add-in presents a reasonable legend, so this is used as a model.

The Color By Value part of Data Graphics can understand if the shape data type is text or numbers by checking the Prop.MyData.Type cell. Thus, it is able to provide the capability to display colors for discrete values...

Displaying colors for discrete values

...or, for numbers, you can enter ranges of values.

Displaying colors for number ranges

Using more than one Color By Value set in a page would be extremely confusing, so I have put a check in the code that aborts if you have multiple Color By Value sets.

The VBA code for this is too long to list here, but it is available from the companion website: Visualizing Information with Microsoft Office Visio 2007.

Data Graphic Icons Sets

You can use multiple Data Graphic Icon Sets in the same page and, indeed, you can have multiple sets per shape. This is because you have a variety of icon sets to choose from, and you can create your own. Icon sets can be used in conjunction with Color By Value to enhance the display even further. However, there is no built-in capability to create legends for Icon Sets either, so I extended the sample VBA legend code to include Icon Sets.

Legends for icon sets

Icon Sets can have a maximum of five different icons, so you need to provide criteria for no more than this number, but you do not have to use them all.

Edit Icon Set dialog box

Later, in Chapter 7, you learn how to create your own Icon Sets.

Creating Data Graphic Icon Set Legends

The essential concept here is to recognize that a Master for each Icon Set exists in the document, and the shapes that use the Icon Sets have a shape inserted into them. A user-defined cell, called msvCalloutIconNumber, is in the subshape, which stores the currently displayed icon number.

Thus, the code iterates through each of the shapes in the page to check if an Icon Set Master is incorporated as a subshape. If it exists, then the count for that icon is incremented.

The code handles multiple Icon Sets being used to represent different shape data values, but it does not handle the same Icon Set being used to represent different shape data, as that would be too confusing. Consequently, multiple Icon Set Legends can be created on the same page, which the user must manually arrange.

The VBA code for this is too long to list here, but it is also available from the companion website: Visualizing Information with Microsoft Office Visio 2007.

Data Graphic Data Bars

Data Graphic Data Bars are another way to display numeric data in a shape. They can also be used with the other types of Data Graphics, as in the following example:

Data Graphic Data Bars

A variety of Data Bars are provided, including some that allow the data from multiple fields to be combined into, say, a bar chart.

Edit Data Bar dialog box

You have great flexibility in the definition of the detail of each Data Bar. See the table below.

So, you now have a variety of methods to display information within your Visio 2007 shapes, and I hope you will use them to clarify, rather than confuse.

Data Graphic Data Bars Details

Detail

Comment

Minimum Value

Default 0, but you can edit to any number

Maximum Value

Default 100, but you can edit to any number

Value Position

Not Shown, Left, Right, Top, Bottom, or Interior

Value Format

Either enter valid format codes or open the Data Form dialog

Label Position

Not Shown, Left, Right, Top, Bottom, or Interior

Label

[Default] or any alternative text you would like

Callout Offset

None, Left, or Right

Additional Resources

For additional excerpts from this chapter, see the following topics:

Section 1: Creating Linked Data (Visualizing Information with Microsoft Office Visio 2007)

Section 2: Labeling Shapes from Shape Data (Visualizing Information with Microsoft Office Visio 2007)

About the Author

David J. Parker is a Microsoft Visio MVP and the director of bVisual, a Microsoft Certified Partner that provides visual software solutions to a wide range of business sectors and situations.

See Also

Concepts

Book chapter landing page: Chapter 3: Linking Data to Shapes (Visualizing Information with Microsoft Office Visio 2007)