March, 2007

Visio Insights
The official blog of the Microsoft Visio product team

March, 2007

  • Visio Insights

    Where's my text control handle?

    • 9 Comments

    A Visio user posted a question in the newsgroups about the yellow text control handle on connector shapes.  Some connectors have a yellow handle and some don't.  What's going on?

    Starting in Visio 2003, the built-in connector shape used by the Connector Tool was modified to include a text control handle.  If you start a blank drawing and click on the Connector Tool you should get this version of the shape.  Note that you must enter text on the shape before you see the text control handle.  This shape is named the Dynamic Connector. 

    There are also a number of Visio stencils with a Dynamic Connector shape such as the one in the Basic Flowchart Shapes.  Unfortunately, many of these shapes were not updated with the new text control handle.  Diagrams created in previous versions of Visio would have connectors that did not have the text control handle either.  Furthermore, once you have any shape named Dynamic Connector in the document, Visio will use that shape for the Connector Tool.

    All is not lost!  The text control handle behavior is relatively simple and can be added to any existing shape or master.  Here are the steps.  Go to File > Shapes > Show Document Stencil and double-click on the Dynamic Connector master shape.  Select the connector in the edit window and go to Window > Show Shapesheet.  Then go to Insert > Section and choose the Controls and Text Transform sections if they are enabled.  Click OK.  Now enter formulas in the cells as shown in the screenshot.  The downside of this is that connectors already on the page won't pick up all the behavior because they have some local formulas.

    But there is an even better solution.  Download the attached Visio document to get a macro that will fix up your masters and shapes automatically.  The macro is designed to work on the active document.  Load the macro document, enable macros if you get a security warning, then switch back to your document and go to Tools > Macro > TextControlHandle > ThisDocument > AddTextControlHandle.  The macro looks for connectors that do not yet have a text control handle and sets one up.  The macro doesn't quite fix everything.  It doesn't dive into groups looking for connectors to fix.  You should now be able to draw with the Connector Tool and get text control handles.  Note that dragging out a Dynamic Connector shape from a stencil will give you the old connector not the new connector, so stick with the Connector Tool.

    Thanks for the great newsgroup question!

     

     

  • Visio Insights

    Custom Formulas in Data Graphics

    • 1 Comments

    Judging from the page view statistics on the blog, Data Graphics is a topic of interest to a number of people.  For those interest in the previous post on building custom data graphics, look here.  In this post we’ll look at another way to get more out of the data graphics you create.  Our example will focus on the sales data for a fictitious furniture company.  Our goal is to use Data Graphics to show financial data about each product.

    We have data for the Product Name, Revenue and Expenses associated with a number of furniture products.  A first attempt at a data graphic might look like this:

     

    The Product Name is shown as a text callout.  Revenue and Expenses are shown using data bars.  It would be really helpful to see our profit for each product.  That value isn’t part of the data, but we can easily calculate it.  Data Graphics supports a wide variety of custom formulas for situations where the data value is not explicitly stored in a Shape Data field.  Let’s create a new text callout to show Profit and see how to specify a custom formula.

     

    In the Data field dropdown, pick the More Fields option at the end of the list.  Then in the Field dialog choose Custom Formula in the Category list.  Enter the expression ={Revenue}-{Expenses} in the formula box.

     

    The profit is calculated by subtracting the Expenses from the Revenue.  To use other fields in the custom formula, wrap the field names in curly braces.  (Technically, the field name corresponds to the Label cell of a Shape Data row for that field.)  When Visio applies the data graphic, it figures out what Shape Data fields to use in the custom formula and creates the proper Shapesheet formulas in the callout.  You can enter almost any valid Shapesheet expression in the Custom formula box.

    One the field is selected, it is useful to set the value format and label properties of the text callout.  The final property values are shown below.

     

    There’s one more thing to make this a great-looking diagram.  If you notice in the original image, the data graphic is too close to each shape.  Our furniture shapes spill outside their bounding box a bit, making the diagram look cluttered.  There is a User-defined cell (User.msvDGCalloutGap) in the Pagesheet that controls the spacing between shapes and data graphics.  By making this value larger, we increase the spacing.

     

    Here is the final result with our custom formula and custom spacing:

     

    Please post your comments and questions about Data Graphics in Visio 2007.  If you have a suggestion for another blog post on the subject, just let us know.

     

Page 1 of 1 (2 items)