Section 2: Labeling Shapes from Shape Data (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 1: Creating Linked Data (Visualizing Information with Microsoft Office Visio 2007)

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

Contents

  • Overview

  • Using Data Graphics to Update Labels

  • Label Shapes Add-In

  • Custom Callouts

  • Manually Editing Associated Text Blocks

  • Additional Resources

  • About the Author

Overview

You can label shapes that contain shape data using several methods. Some may be more suitable than others for your type of diagrams. The main principle is to have labels that are automatically updated whenever the data changes. This removes the possibility of error in data entry.

Using Data Graphics to Update Labels

Microsoft Office Visio 2007 introduces a new, and superior, method for labeling shapes that have shape data. Among its capabilities, Data Graphics can be used to label shapes quite effectively. The labels can include both the shape data row names and values.

Data Graphics label

This is done by editing an existing Data Graphic or by creating a new Data Graphic from the Data Graphics panel, which is opened with the Data | Display Data on Shapes menu item.

Data Graphics panel

The Edit Data Graphics dialog enables you to create and edit four types of Data Graphics, with Text being the first. You learn about the others in the section “Enhancing Shapes with Color, Icons, and Data Bars”. You can add as many Text items as you require, by simply creating a new Text item and selecting a shape data field, or by selecting any other cell from the Field dialog that is opened by More Fields… at the end of the pull-down list of fields.

Edit Text dialog box

The Edit Text dialog provides you with the capability to select a type of Callout, specify its position relative to the shape, and to change the Details.

Edit Data Graphic dialog box

You have great flexibility in the definition of the detail of each label. See the following table.

The resultant Data Graphics from these simple changes, such as selecting Heading 3 (a simple colored bar with white text), rather than Text Callout, can add much greater clarity.

Data Graphic Callouts Detail

Detail

Comment

Show Value

True or False

Value Format

Enter a valid

Label Position

Select the position of the label (Left, Right, Above, Below), or no label at all

Label

[Default] or any alternative text you would like

Border Type

None, Bottom, or Top

Fill Type

None or Filled

Callout Offset

None, Left, or Right

When you apply any of the Data Graphics, a new grouped shape is added to the target shape and, if the target shape is not already a group, then it will be automatically turned into one. The smart thing is that the new subshapes are linked to a Master in the document stencil and, if the target shape is an instance of a Master, then the link is preserved.

Grouped shape

If you do not need any compatibility with versions earlier than 2007 of Visio, then Data Graphics is the way to go. You can still view the Data Graphics in Microsoft Office Visio 2003, but you cannot create them.

Label Shapes Add-In

Visio Professional 2007 provides you with the Label Shapes Add-In available from Tools | Add-Ons | Maps and Floor Plans. This is not part of the new Data Graphics in Visio 2007, but rather it exists in both Visio 2003 and 2007.

Label Shapes add-in

This is limited to a maximum of four shape data rows and you cannot include the name of the shape data row. However, it can be applied to any selected shape and can be reapplied multiple times.

This creates a new User-defined cell named visCustomLabel at the bottom of the User-defined Cells section in the ShapeSheet, and then references this in the Value cell of the first row in the Text Fields section.

User-defined Cells section in the ShapeSheet

The formula in User.visCustomLabel includes multiple IF statements that test if there is an entry in each desired shape data row.

If you need to be able to create or update labels easily in Visio 2003, then the Label Shapes Add-in is probably the way to go.

Custom Callouts

Three Custom Callouts are on the Visio Extras | Callouts stencil that you can use to label shapes with their data. Again, these are not part of the new Data Graphics in Visio 2007, but they exist in both Visio 2003 and 2007.

The only difference among these callouts is their appearance. Each of them has the capability to automatically display selected shape data, with or without the name along with the value.

Custom callouts

The callouts can be duplicated and linked to other shapes and, thus, they will display the selected shape data. The display changes whenever the shape data changes. These callouts could be used to highlight particular shapes in conjunction with the other methods of labeling.

Manually Editing Associated Text Blocks

Every shape in Visio has the capability of displaying text and the text can be multiple lines, and can optionally include references to ShapeSheet cells. Paragraphs, sentences, lines, words, or individual characters can be formatted to suit.

In the Network–Computers example we have been constructing, the PC shape already has an associated text block, complete with a control handle (the yellow diamond) to reposition it. Simply select a PC shape, select Insert | Field, then select Shape Data, and then Serial Number.

Editing text blocks

You can format the value, if required, according to the type of data.

The result is that the selected shape data cell reference is inserted into the Text Fields section in the ShapeSheet, and these Text Fields are embedded within the paragraph you write. So, this is the great flexibility of this method. You have the freedom to embed shape data cell references, as well as any other cell reference while you are at it.

The disadvantage of this method is that it is more suited to labeling individual shapes or prelabeling Masters before they are used in a document. In the latter case, it can be used effectively in grouped shapes where you need automatic labels in different areas.

For example, drag the Title Block Corporate 2 Master from the Visio Extras | Borders and Titles stencil on to a drawing page, and then delete it. This copies the Master into the document, so open the Drawing Explorer window and expand the Master's node. Edit the Master Properties and ensure that Match master by name on drop is checked.

Master Properties dialog box

Now, select Edit Master Shape and select the Company Name shape within the main shape. Select Insert | Field to open the Field dialog, and then select the Category Document Info and the field name Company.

Field dialog box

Close the Master Edit window. Now, you can drag the Master from the stencil on to multiple pages within the document. If you edit the File Properties | Company value, it will now automatically be displayed in all instances of the Master in all pages in the document.

Editing Master properties

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 3: Enhancing Shapes with Color, Icons, and Data Bars (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)