Visio Insights
The official blog of the Microsoft Visio product team

Customizing Data Graphics

Customizing Data Graphics

  • Comments 13
 

    One of the new features in Visio 2007 Professional is Data Graphics - the ability to display data on shapes in rich, visual ways.  Many of you have already experimented with this feature and are looking for ways to create custom visualizations.  There is an MSDN article that covers the full spectrum of customizations possible for Data Graphics.  In this post we'll work through a specific example - changing the text size in callouts.

     

     

    In the flowchart above, a data graphic is applied to the three process steps.  The data graphic has two text callouts displaying the Cost and Duration shape data fields.  The default text size for the flowchart shapes and the text callouts is 8 points.  What happens if we do a Select All and change the text size to 12 points?

     

     

    The flowchart shape text has increased in size, but the callout text has not.  Normally when you apply formatting to a group shape, Visio automatically pushes that formatting to all sub-shapes as well.  However, Data Graphics callouts are designed to prevent this automatic propagation.  There are many scenarios where it is desirable to maintain separate formatting for the shapes and the callouts.  Visio 2007 introduces a new protection on shapes to prevent group formatting from propagating to sub-shapes.

     

     

    Group formatting protection does not prevent all formatting changes on a shape - just those pushed from groups.  You can directly select (or sub-select) a shape and still format it.  Data Graphics callout work this way.  Not all Visio shapes allow selection of sub-shapes.  This is controlled by the group selection behavior property found in the Format > Behavior dialog.  If the selection property is set to Group Only, you will have to go to Edit > Open Group to make any formatting changes.

     

    Thus it is possible to customize the formatting on individual data graphic callouts, but what about making a global change to the data graphic?  The MSDN article explains more about the way that data graphics are structured, but essentially the callouts used in a data graphic derive from Visio callout masters.  By editing the callout master, all the data graphic callouts can be changed.  You may be accustomed to opening the Document Stencil to edit masters, but Data Graphic callouts are hidden masters.  Go to View > Drawing Explorer to find them.

     

     

    In the Drawing Explorer, you will find masters for the flowchart shapes in the diagram.  There are also masters for the data graphics and the callouts used in the data graphics.  For our example, we want to edit the Text callout master to update the text font size.  You can right click on the master name, choose Edit Master Shape and make the desired formatting changes.    Once you close the edit window and save the changes, all the data graphics in the diagram are updated. 

     

     

    It is a good idea to rename this callout master.  Because this version of the text callout master is different from the built-in one, Visio will offer both in the Edit Data Graphic dialog.  Assigning a new name will allow you to distinguish between the two.

     

     

    You may want to make your custom data graphic callout available in all your documents.  Visio 2007 does not offer a central storage location, so the recommended practice is to put the data graphic and callout masters into a template that you can use as you start each new diagram.  You can use the custom callout in a data graphic on a shape in the diagram.  Then copy that shape to another document.  Visio will copy over all necessary data graphic and callout masters.  We're interested to find out what types of custom data graphics you create to visualize information.  Be sure to let us know how you use the feature.

     

     

Leave a Comment
  • Please add 5 and 6 and type the answer here:
  • Post
  • Hi,

    I am using the Dell PowerEdge server stencil to create a Visio file for our server consolidation project. When I place one of the server objects on the page and then link data to it the data graphic will not display. I grabbed a plain server graphic from one of the standard visio stencils and had no problem getting the data graphic to display. Any idea why it wont display using Dell's stencil?

  • Hi Brett,

    One possibility is that the data graphic you applied has fields that are not found on the Dell server shape.  Try right-clicking on the server to choose Data > Remove Data Graphic.  Then choose Data > Edit Data Graphic and see if you can select new fields.

    Visio Team

  • How do you set the Global Options for data graphics? I am building a Q&D floorplan for my building the cubicles are at a different angles. I have linked a Excel sheet to label all the cubicles. The Data Graphics are oreinted to the angle of the cubicle and not the page. <B>Is there a way to rotate a group of data graphics to the same oreintation? </B>

    I am a ArcGIS User I know in that program you would change the orientation to the global axis.

  • Hi Leif,

    I am not aware of a way to accomplish this.  Data Graphics are considered part of the shapes they are applied to.  Therefore, they match the angle of the parent shape.  You might be able to design your own custom data graphic to do this, but it would be challenging to create.

    Mark Nelson

  • Is there a way to access the shapesheet of a data graphic? I want to tweak some attributes of a DG and have those attributes apply to all future uses of the DG.

    Simple example: the BaseWidth of the Triangle text callout adjusts dynamically based on the width of displayed text. I want to set a MAX() formula so it is never smaller than a certain value. Works fine for an instance of the DG.

    But if I apply the DG to a different instance of the shape, naturally I get the "master" set of values for the DG and not my modified version. Consequently, I want to edit the "master" set. Where is it???

  • Scott, check out the MSDN article linked at the top of the post.  You just need to use the callout you want to modify once so that Visio will put a copy of it in your document.  Then you can customize this master as you like.

    Mark Nelson

  • Great info in this blog post! I've modified some of the router shapes to include callouts that show info about the installed interfaces (Name, IP, Mask, etc).

    The problem I ran into is when you resize the shape the callouts get wider. I figure out how to tie that down and sort of got a single callout to resize to the text (it still ends up on two lines sometimes).

    Where I've failed is when trying to get all callouts in that "block" to auto-resize to the largest one. Any tips on that?

    Apologies if that didn't make sense; I'm not a Visio developer and mostly just hack at it until something works. :p

    -Brent

  • Good question, Brent.  I'm not aware of a way to do this.  Callouts are not aware of each other.  Be sure to check out the article on auto-sizing with text: http://blogs.msdn.com/visio/archive/2006/08/11/694681.aspx

    One of the best practices in the article is to use a CEILING function to round up.  You could go with a fairly large rounding value to increase the chance that callouts will align.  If you don't find a solution, I suggest you pick a single maximum size for your callouts.  You should be able to predict the size of data like IP addresses.  Place the name at the top of the stack and let it wrap.

    Mark Nelson

  • Thanks Mark!

    I did get it to work (sort of) by having the width of each field check the textwidth of the other callouts. This could be a performance problem though if there end up being a lot of callouts.

    I've opted for the fixed width solution. You are correct, I can judge what the max width will be (assuming 8pt font). I've run into one issue with this though. When I drop the shape on my page the callouts end up very very small. (we don't use the default 1:1 scale on our drawing templates).

    Somehow I need that fixed width to work even though my scale isn't 1:1. Any magical formulas for that? Here's what I've tried so far:

    Width = 1.65 * DropOnPageScale

    Width = 1.65 in

    Worst case I can could make a few copies of the shape for the scales we use most.

    -Brent

  • Hi Brent,

    DropOnPageScale should work here.  We use that on the built-in callouts to handle scale.  One caveat is that everything must key off the setting of the topmost shape in the callout.  By definition, any subshape within your callout has a DropOnPageScale equal to 100% because there is no change in scale within the shape.

    Mark Nelson

  • Mark,

    Thanks for referring me back to the MSDN article. I had read it previously and had even created a custom icon set. However, I had overlooked the info on getting new callouts into the document stencil.

    One followup question: the article refers to setting the Hidden property for callout masters via code -- is there a way to do it from the Visio UI?

    Scott

  • Hi Scott,

    The Hidden property of a master is only accessible through the Visio API.

    Mark Nelson

  • I have the same problem as Brett B: "Using the Dell PowerEdge server stencil. When I place one of the server objects on the page and then link data to it the data graphic will not display. I grabbed a plain server graphic from one of the standard visio stencils and had no problem getting the data graphic to display. Any idea why it wont display using Dell's stencil?"

    And I try the removing and apply the Data graphic.

Page 1 of 1 (13 items)