August, 2007

Visio Insights
The official blog of the Microsoft Visio product team

August, 2007

  • Visio Insights

    Automatic Behaviors in Visio


    Several people have posted in the newsgroups about Visio moving shapes around unexpectedly - particularly when documents are opened or saved.  This random behavior can be infuriating to users.  Perhaps more frustrating is that Visio may continue moving shapes around after the user has "fixed up" their diagram again.  This post looks at automatic behaviors and tries to shine some light on the issues.


    Connector Routing

    Perhaps the most common automatic activity in Visio is connector routing.  Visio ensures that connectors stay glued to shapes when those shapes are moved around the page.  Visio also finds the optimum route for connectors that will avoid other shapes along the path.  Finally line jumps are added to connectors that cross over other connectors.  Historically, crazy connector routing has been a frequent complaint, but routing logic has gotten significantly better over time.  Recent versions of Visio do a pretty good job with routing.  While users may object to the routes chosen, there are very few reports of routes randomly changing in the diagram.




    If you are encountering routing issues in your diagram, you might find this earlier post helpful.  You can also reduce the number of situations where connector routes are changed.  Go to Format > Behavior and then the Connector tab and adjust the Reroute property.  Reroute = Never means that Visio will maintain glue but never recompute the route to optimize it.


    Solution Behaviors

    The second type of automatic behaviors involve Visio solutions.  In this case we are referring to the Visio add-ons that provide extra capabilities for individual diagram types.  For example, the Organization Chart solution is responsible for providing features such as dropping subordinates on top of managers, generating a diagram using the Organization Chart Wizard or synchronizing organizations across pages.  You may not think of these capabilities as add-ons because Visio tries to make the functionality seem as integrated as possible with the core diagramming features.

    Most frequently we hear about random shape movement with the Organizational Chart and Cross-functional diagram types.  However, users have reported issues with a number of diagrams such as Gantt Charts and Timelines too.  The root cause for random shape movement is that a diagram has solution managing the position of shapes, and something is triggering that solution to make it move shapes around the page.  These solutions get in trouble when they fail to realize that a shape’s current position has been designated by the user and is no longer under the complete control of the solution.

    Visio’s solutions that manage the position of shapes on the page can tolerate varying degrees of customization by the user.  Sometimes it is okay for a shape to be in a different location than what the solution wants, and sometimes the solution is not capable of leaving a shape in a different location.  Many problems arise when the user takes additional steps to prevent automatic behavior such as grouping shapes, replacing connectors with regular lines or disconnecting connectors.  This increases the likelihood that the “proper shape arrangement” according to the solution is not at all what the user intends.


    Remedies for Automatic Solution Behaviors

    There are two basic approaches to correcting a diagram that is “misbehaving”.  You can try to make the solution understand the diagram again.  This typically involves removing non-standard shapes and using the ones provided in the template.  It also means restoring connections between shapes using connectors and not lines.  The other approach is to disable the “intelligent” behavior of the solution and work with the diagram using core Visio capabilities only.  Depending on the drawing type and level of complexity in the diagram you may want the second option, although this is a more drastic measure.

    For Organization Charts, the typical cleanup is to delete the connections between shapes and then drop each subordinate on top of their manager again.  For Cross-functional Flowcharts, the typical cleanup is to drag each process shape outside the swimlanes and then drag them back in.  Unfortunately, none of these remedies is guaranteed.  There may be no way for a user to correct some situations.

    To disable a solution, you need to disable the Persisted Events that get stored in the document and trigger the solution whenever the document is opened in Visio.  Persisted Events can only be managed programmatically or through Visio’s XML file formats.  The Persisted Events tool in the Visio SDK is a great way to modify Persisted Events.  For those looking for something simpler, try pasting the VBA macros below into your document.  Run DisablePersistedEvents to turn off solution behavior for the document.  Run EnablePersistedEvents to turn solution behavior back on.


    Public Sub DisablePersistedEvents()


        Dim vsoEvent As Visio.Event


        For Each vsoEvent In ThisDocument.EventList


            If vsoEvent.Persistent = True Then

                vsoEvent.Enabled = False

            End If




    End Sub


    Public Sub EnablePersistedEvents()


        Dim vsoEvent As Visio.Event


        For Each vsoEvent In ThisDocument.EventList


            If vsoEvent.Persistent = True Then

                vsoEvent.Enabled = True

            End If




    End Sub



    Visio provides automatic behaviors to make diagrams much easier to create and manage.  When the automatic behavior matches your expectations, Visio feels like a very powerful tool.  When Visio seems to have a mind of its own, it becomes a frustrating application to work with.  The Visio Product Team is definitely interested in your experiences good or bad with the automatic behaviors in the application.  Your feedback helps us understand where we need to improve.


  • Visio Insights

    Data Graphics Tips


      One final post about Data Graphics before turning to other topics for a while.  We've gotten some great feedback from customers about their usage of Data Graphics.  Based on comments and observations of users, there are a few points of confusion that people are encountering.  This post explains the most common issues with the Data Graphics feature.



      I modified the data graphic on one shape and all my shapes changed

      Users encounter this when the same data graphic is applied to multiple shapes.  They select one shape and edit its data graphic only to find that the data graphic was updated on the other shapes as well.  When you edit the data graphic on a shape using the Edit Data Graphic command, you are actually changing the definition of the data graphic used everywhere.


      If you really want to change the data graphic on some of the shapes, you need to assign a different data graphic to those shapes so that they act independent of the rest.  Go to Data > Display Data on Shapes to open the Data Graphics task pane.  Right-click on the data graphic currently applied and click Duplicate.  Then select the shapes you want in the drawing and click on the duplicate data graphic to apply it.  You can continue to modify the new data graphic and only affect the shapes you chose to apply it to.




      How do I switch between Text Callouts and Data Bars?

      With Data Graphics you can display information using Text Callouts, Data Bars, Icon Sets or Color by Value.  These are the choices when adding new items in the Edit Data Graphics dialog.  Unfortunately, once you choose the type of graphic for an item, you cannot switch to one of the other types.  This is a limitation of the feature.  You will have to delete the item you have and add a new one with the type you want.




      Sometimes I can't select the data graphic in the diagram

      Visio adds data graphics to shape in the diagram by inserting them as sub-shapes of the target shape.  The ability to select the callout sub-shapes is then dependent on whether the target shape allows it.  Go to Format > Behavior and look at the Selection property.  "Group only" means that sub-shapes cannot be selected.  Change this to "Group first" or "Members first" to all selection.  A common reason to select callout sub-shapes is to apply local formatting to them.




      My Data Bar doesn't show the correct percentage value

      The default Minimum and Maximum values for a Data Bar are 0 and 100.  This makes it seem like the Data Bar naturally displays percentage values with 100 being the largest data value and 0 being the smallest data value.  However, that is not how Data Bars work.  The Min and Max properties are actual values.  If your data field has values in a different range, you need to update the Min and Max properties to match your data range.




      How do I reset the position control handle?

      Visio adds a control handle to target shapes for easy repositioning of the data graphic.  This allows you to customize the location of the data graphic on a shape-by-shape basis.  Changes to the position property in the data graphic definition do not override the custom position you designate. 


      If you would like to reset the position control handle so that it uses the data graphic position property, you must remove the data graphic and reapply it.  Go to Data > Display Data on Shapes to open the Data Graphics task pane.  Select your shape and choose the None data graphic.  Then click on the previous data graphic to reapply it.




      Data graphics don't appear when I apply them to pictures or images in my diagram

      Data graphics cannot be applied directly to pictures or embedded objects.  Visio is unable to convert these shape types to groups so that callouts can be inserted.  The typical workaround in this case is to group the picture or object and then apply the data graphic to the group.  You also have to move your data to the group shape.  There is a KB article explaining the procedure:



      Want to know more about Data Graphics and visualizing information?

      If you have mastered the basics and want to go further with Data Graphics, there's a new book available for Visio 2007.  The book is Visualizing Information with Microsoft Office Visio 2007 by Visio MVP David Parker.  You can read a review of the book on Chris Roth's Visio Guy blog.


Page 1 of 1 (2 items)