The ability to add structure to Visio diagrams using containers
is one of my favorite features in Visio 2010. In this article I’ll describe a mashup of containers and lists that meet a real-world need.
Prior to reading this article, it would help to read my previous articles on containers
My goal is to create a seating chart for an auditorium or theater. I would like the diagram to be sufficiently flexible that I can move seats and rows around to reconfigure the auditorium or to represent a different theater. But more than that, when I move seats and rows, I want Visio to do all of the work of numbering and renumbering the seats and rows.
Prior to Visio 2010, it would have required writing a program to number and renumber something as complex as the collection of seats and rows in a theater. However, with Visio 2010, we can build a complete solution using three elements: containers and lists, shape data, and a handful of ShapeSheet formulas.
Solution Component 1: Containers and Lists
The key to building our solution is to remember that a list is a special type of container that maintains its members in a specific sequence. This property is the perfect basis for creating numbered rows and seats in a theater. Consequently, it seems that all we should need to do is to create two lists:
The first list will represent a section of theater seats and will contain multiple rows (a “list of rows”, if you will).
The second list will represent a row and will contain multiple seats (a “list of seats”).
Unfortunately, it’s not quite that simple because a Visio 2010 list cannot contain another list
. It can contain shapes and containers, but it cannot contain other lists. Therefore, to create our seating solution we need a workaround.
The workaround comes in the form of a container. While lists can’t contain other lists, it turns out that containers can contain anything. Consequently, we will package each seat list in a container. Then we can drop multiple copies of this container into the list representing a section of the theater. In effect, we put a list inside a container inside a list.
The resulting structure is summarized in the following graphic.
The figure below shows the Visio building blocks:
On the left is a section list labeled Orchestra Left.
In the center is a row consisting of a list (white) inside a container (pink).
On the right is a seat shape.
Solution Component 2: Shape Data
Shape data is a critical part of fulfilling my goal of completely automatic numbering. Shape data fields on the theater section lists allow me to set different numbering and lettering options for different parts of the theater. The shape data dialog below shows that I can customize:
The list of available row letters (some theaters don’t use the letter “I”, for example);
The letter to be assigned to the first row in the section;
Whether seats are numbered from left to right or right to left;
The number to be assigned to the first seat in rows in this section;
Whether seat numbers increment by one or two in this section.
Solution Component 3: ShapeSheet Formulas
Each of the four shape types shown in the first illustration above contains several formulas. Most of the formulas read values from the section list’s shape data fields and pass it to contained shapes. In some cases, the formulas transform the data. For example, the row container includes formulas that convert an ordinal position in the section list to a row letter, e.g., converting “3” to “C”.
Two of the four shapes – the row container and the seat – contain formulas that calculate their position within their respective lists.
The seat shape also contains formulas that determine whether the seat is currently in a row and whether the row is in a section. If both conditions are true, the seat displays its seat number and the letter of the containing row as shown below. If both conditions are not true, the seat displays nothing, as illustrated by the single seat in the image earlier in this article.
The Seating Chart
The figure below employs the list-container-list-seat structure for a hypothetical theater. This example takes full advantage of the shape data contained in each section to show the following variations:
Seats in Orchestra Center are numbered sequentially from right to left, starting with 101.
Seats in Orchestra Left contain only even numbers starting with 2 and are numbered from right to left.
Seats in Orchestra Right contain only odd numbers starting with 1 and are numbered from left to right.
In all three sections described above, the first row is letter A.
The first row in the Balcony is AA and seats are numbered from right to left beginning with 201.
The best part of this example is that we’ve met our goal: all of the row lettering and seat numbering is handled automatically – there is no programming required. If you add or delete a row or a seat, everything around it will resequence automatically. In the graphic on the left below, for example, a new row is being dropped into the Orchestra Left
section between two existing rows. (Note the orange feedback lines that are characteristic of a Visio 2010 list
.) The result is shown on the right below.
Download This Example
If you would like to experiment with the list and container mashup described in this article, you can download a Visio diagram containing the theater seating chart
example. The first page contains more detailed instructions for using the various shapes.
The theater seating chart demonstrates that Visio 2010 lists enable complex, dynamic numbering without requiring any programming. I hope these examples stimulate your imagination about ways that you might use lists and containers.
If you have questions or want to describe great uses you’ve invented for structured diagrams in Visio 2010, please post them below.
For more information about containers, lists and callouts in Visio 2010, refer to Chapter 11 in my book, Visio 2010 Step by Step
You will also find container details in several articles on the truly excellent Visio Insights
blog written by the Visio development team:
Other Articles in this Series
If you liked this article
and want to see more from this author, please click here
If you found this article helpful
, please click the Yes
button near “Was this article helpful?” below.
To learn more about Visio 2010
, please visit the Visio 2010 Step by Step