More secrets of the Visio Legend shape

I was going to do a full post on the special Legend shape in Visio that can automatically count instances of masters on a page, then I found that my good friend Chris Roth, aka VisGuy, had done one some years ago ( see…/legend-shapes). However, I have some extra information that will assist in getting the functionality to work consistently.

Basically, you can make any Master work with the Legend shape by adding the User.visLegendShape = 2 setting into a Master shape, but there are caveats.

  1. If the name of a Master is changed, then any existing shapes on the page must be re-placed
  2. The BaseID of each Master must be unique
  3. If the BaseID is changed (using NewBaseID), then any existing shapes on the page must be re-placed

To demonstrate this, I used the Good and Bad icon shapes from the Legend Shapes stencil.

This slideshow requires JavaScript.

I then created a new shape and dragged it onto the Legend shape. This action then makes a new Master in the document stencil and inserts the User.visLegendShape row with a value of 2. This new Master name is added to the count in the legend, but the name is incorrect. So, I then edited the name of the master, but the Legend still shows the old name. When I deleted the existing shape instances of the new master, and then re-added them, they then got shown correctly in the Legend shape, with the new name.

In the second test, I duplicated the Good master, which was then automatically named Good.9.

This slideshow requires JavaScript.

Simply adding instances of this to the page merely updated the count for the original Good icon, and no extra line was created. I renamed the Good.9 Master as Excellent (after making the smile bigger!), but the Legend shape did not update still (as expected after the first test). In this case, however, deleting any existing shape instances and replacing them still did not create a new Legend line.

I then checked the BaseID of the Good and Excellent Masters with the Immediate Window in the VBE, and saw that they were identical. I then request a new BaseID for the Excellent master with the NewBaseID property. Then I replaced the existing shapes, and everything worked fine.

This should solve some of the issues that users have found with the Legend shape.







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.


O365 and SharePoint

Simplify Tasks

Want to learn the simple way?

Paul Turley's SQL Server BI Blog

sharing my experiences with the Microsoft data platform, SQL Server BI, Data Modeling, SSAS Design, Power Pivot, Power BI, SSRS Advanced Design, Power BI, Dashboards & Visualization since 2009

John Goldsmith's visLog

be smart, be clear, be visual ...

Mo's blog

Personal views on Dynamics 365 for Operations and Technical Architecture.

Chris Webb's BI Blog

Microsoft Power BI, Analysis Services, MDX, DAX, M, Power Pivot and Power Query

Azure Solutions for Office 365, and more...

Rob Fahrni



Life with Visio and other Microsoft Toys!

Nilsandrey's Weblog

Just another weblog

Things that Should be Easy

Every so often (too often in the IT industry) I encounter things that should have been very easy to do but turned out to be far too complicated. My favorite topics include SharePoint, .Net development, and software architecture, especially distributed systems.

Visio Guy

Smart graphics for visual people

%d bloggers like this: