![]() |
|
Spaces home bVisualPhotosProfileFriendsMore ![]() | ![]() |
bVisualbe smart, be clear, be visual!
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
July 25 Hyperlinks to SharePoint Lists from Visio ShapesMy previous post showed how to link Visio Timelines to a SharePoint Calendar ( http://bvisual.spaces.live.com/blog/cns!3350D61BC93733A9!552.entry ), and I glibbly mentioned how you can create hyperlinks automatically on the shapes from the SharePoint list. Well, that was true, but the example shown goes to a SharePoint page, and it didn’t work. So, I feel I need to demonstrate a fix for it. The ShapeSheet formula in the hyperlink address cell is: =SETATREF(Prop._VisDM_Encoded_Absolute_URL) This translates to the URL: http://www.wssdemo.com/Lists/Calendar/1_.000 Well, this does not actually work from Visio, but, navigating to the entry in the SharePoint calendar shows that the actual URL is: … and this can be reduced to: http://www.wssdemo.com/Lists/Calendar/DispForm.aspx?ID=3 So, how can we correct the URL for the Visio shapes? We will need to write a little bit of code to change the formula in the hyperlink Address cell to : =REPLACE(Prop._VisDM_Encoded_Absolute_URL,LEN(Prop._VisDM_Encoded_Absolute_URL)-4-LEN(FORMAT(Prop._VisDM_ID,"#")),LEN(FORMAT(Prop._VisDM_ID,"#"))+5,"DispForm.aspx?ID="&FORMAT(Prop._VisDM_ID,"#"))
This will change the URL to actually open the SharePoint page, like this: I will write the code when I can get my Office programs working again…. July 24 Using SharePoint Calendars with Visio TimelinesI was recently asked if it is possible to use SharePoint calendars with Visio Timeline Shapes automatically. My first reaction was “not without code”, but a closer inspection reveals that you can use Visio 2007 Professional Link Data to Shapes quite easily…. Firstly, I found the WSS Demo site http://www.wssdemo.com/application/default.aspx to be useful. In Visio 2007 Professional, you can use Data / Link Data to Shapes … to get data from Microsoft Windows SharePoint Services: Then enter http://www.WSSDemo.com (or your own) as the Site. And login of course, in this case the password is pass@word1. Then select the Calendar list: Now, you need to rename the Title, Start Time and End Time columns by selecting Column Settings … on the right mouse menu of the External Data window… .. to Task Name, Start and Finish . This is important, because this will be used to match the values from the calendar to the shape properties. Drag and drop a Timeline shape, and set the Start and Finish to your requirements…. Then, select an Interval shape in the stencil, and drag a row from the External Data window, and drop it on the page (not over the Timeline itself). The Configure Interval dialogue will popup, which you can just OK. In addition to the three columns that we previously mapped, all of the other columns will be automatically added as extra Shape Data rows on each shape. Of course, you can use Milestones or Intervals…. Q.E.D. Post script: The sample data happens to include hyperlinks as text, but you can ensure that Visio interprets them as real hyperlinks by checking the Hyperlink box on the Types and Units dialogue opened from the Data Type… button on the Column Settings dialogue. You will then get hyperlinks on your shapes! And you can have multiple ones per shape! Ye gads … Visio is cool! July 13 Flags of the WorldI was recently asked how to add a country flag to Visio Org Chart shapes automatically. Well, as I am currently working with world data at the moment, I have taken up the challenge. Firstly, the CIA have an excellent source of information, called the World Factbook ( https://www.cia.gov/library/publications/the-world-factbook/ ). You can find all sorts of information about every country in the world, including, of course, their flags. There are over 240 countries at the moment, and there are various codes used by different systems to identify them. Even the name may not be the same, for example, do I live in UK, United Kingdom, Great Britain, United Kingdom of Great Britain and Northern Ireland or just plain old England? Answers on a post card, please, addressed to …..? Alternatively, a country can be identified accurately with a code, but you need to know which system is being used. United Kingdom can be identified by GB in the Iso 2 character system, or 826 in the Iso numeric system, or UK in the FIPS 10 system. The CIA World Factbook utilises the FIPS 10 code, so consequently, all of the country related web pages and images are coded with this system. I have already created an Access database with all this information, so I decided to use this knowledge to create a Flags of the World Visio Master. I wrote some VBA to download the gif files from CIA website, and imported them into a specially prepared group shape. Each image shape was automatically named with the FIPS 10 code, and the Width and Height formulae were written to be 0 if the parent group shape does not represent relevant country. The ShapeSheet of the parent shape was loaded with semi-colon separated lists of country related data, mainly pulled from the CIA website. The Prop.Country Shape Data row is a fixed list so that the user can select a country by its name. The other Shape Data rows are all guarded because their values are pulled via the Index of selected country name, from the User defined cells. ShapeSheet of the GB sub-shape, below, showing that the Width and Height is 0, if the shape Name is not equal to the Prop.Fips10 value in the parent shape. Notice that the Width and Height formulae maintain the original aspect ratio of the flag image. This provides a Flags of the World Master, but I also created a Flags of the World Small Master because the first one uses the large flag images from the CIA website, but the second one uses the small image files, and thus uses less file size. I have also added context sensitive hyperlinks to the CIA website, Maps Live, Google Maps and Google Earth, and one to bVisual’s website…. OK, now we are halfway there … we actually want to apply the map icon to any shape that has a Shape Data value that is a country name, but we don’t know the name of this Shape Data row in advance…. Visio 2007 Professional Data Graphics has Icon Sets, but you can only have a maximum of 5 icons in each set … certainly not enough for over 240 countries. So, why not use an Icon Set as a placeholder for a country flag, then replace the Icon Set image with the flag for the country whose value is in the Shape Data row specified by the Icon Set Graphic Item? That is exactly what I did in the screen-shot below: I duplicated an existing Icon Set (Trend Arrow 1) in the Drawing Explorer, renamed it as FlagPlaceholder, then amended it to have one image sub-shape, called Flag.
Thus the Icon Set becomes available in the Data Graphics editor, and you can select the Shape Data row that contains the name of the country. You only need to have one qualifying value, so I entered does not contain * , because I assume that there is no country in the world with that character in its name. The attached stencil, FlagsOfTheWorld.vss http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/FlagsOfTheWorld.zip , includes the macro UpdateFlags, which will then change the flag for each selected shape. So, when the macro is run, the test shapes now show the flags for each country…. Option Explicit Public Sub UpdateFlags() On Error Resume Next Private Function getLookup(ByVal value As String, ByVal aryIn As Variant) As Integer Note : The following web site was invaluable for helping me download the flag image files from the CIA web-site : http://www.vb-helper.com/howto_download_url_to_file.html Interesting related blog: http://dbwhisperer.blogspot.com/2008/07/getting-geography-data-from-visio.html Download files : http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/FlagsOfTheWorld.zip June 19 Enhancing Visio Data Graphics Text CalloutsVisio 2007 Professional introduced the wonderful Data Graphics feature to display Shape Data in a clear visual way, but it is not clear how you may, for example, change the font of even the simplest Graphic Item type, Text Callouts. In this blog, I’ll show you one method that I employ to vary the appearance of Text Callouts. The same technique can be used for other Graphic Item types, Icon Sets and Data Bars. I am using the the sample IT Asset Management drawing to demonstrate throughout, which can be found in the Samples Template Category. In this diagram, the server shapes on the topology page use the Topology 1 Data Graphic, which can be seen in the Data Graphics panel.
Microsoft had to introduce a new capability in Visio 2007 in order to get Data Graphics working, namely the ability for a shape instance to hold a reference to a DataGraphic master in addition to its normal master. So, if you open the Drawing Explorer window, you can see the normal Server master, in addition to the Topology 1 Data Graphic master. If you open the Topology 1 master, you can see the full Data Graphic, and you can expand the Master Explorer to show that there are multiple shapes inside it. These shapes are the ones that you see displayed in a more friendly way in the Edit Data Graphic dialog. However, you may also notice that this particular Data Graphic uses the same Text callout Graphic Item multiple times. This is evident if you select Edit Item for Operating System, CPU (MHz), Memory (MB) or IP Address Data Fields in the Edit Data Graphic dialog. In fact, you can only tell which Graphic Item master is being used in the Data Graphic master in code, or by opening the ShapeSheet of each of the sub-shapes. You can see on the Edit Text dialog that you can edit certain properties, but font is not one of them! SO, how can you edit the font? Well, you could go around each shape in the diagram, sub-select the shapes and change it that way, or you can create a variation of the Text callout Graphic Item master. In the Drawing Explorer window, select the Text callout master, then Duplicate on its right mouse menu. You can then rename the new Text callout.xxx as whatever you like (I have used Text callout A). Once you have a copy, you can double-click (or use select Edit Master Shape from its right mouse menu). You will see that the Text callout master is comprised of two shapes, Sheet.5 (which is the group) and Sheet.6 (a sub-shape of the group). The Label text is part of Sheet.5, whilst the value (Abc) is part of Sheet.6. You can now edit the font of either the whole lot by selecting the shape, or you can just do the value by selecting Sheet.6 in the Master Explorer window. Now, you can close the Master Edit window to save the changes. Now, when you go to the Edit Data Graphic dialog for Toplogy 1 Data Graphic, and select Edit Item for, say, Operating System, you will find your new variation, Text callout A, listed. So, when you select your new variation of Text callout, all of the shapes that use it will be updated automatically! Q.E.D. By the way, there’s more like this in my book … May 25 Visio FMPrint Add-onA recent newsgroup post asked about accessing a network printers management page from a Visio page, so I thought I would share some things that I discovered a while back. Visio 2003 and Visio 2007 Professional edition include an add-on called FMPrint, which you can use with any shape in Visio. I used it with some network printer shapes in a couple of add-ins myself. I'm not aware of any public documentation about this handy little add-on, so here is what I have discovered. You can see the add-on in action by opening the Shapes \ Maps and Floor Plans \ Building Plan \ Resources stencil and dropping the Printer shape onto your page. Alternativaly you can start a new Maps and Floor Plans \ Space Plan drawing. Notice the SmartTag in the bottom left corner which gives you access to the FMPrint add-on: If you open the ShapeSheet, then you will see that there are three Shape Data rows; four Actions; and 1 SmartTag associated with the add-on. Shape Data Rows
Actions
SmartTagThe visPrintern Actions appear under the SmartTag because they have the same TagName value.
Find a printer in the directoryThis enables you to search your Active Directory to locate a specific printer... When you select one, then the Printer Model, Location and Path values are automatically filled in. Open print queueOnce you have a value for the Printer Path Shape Data (which can be manually entered or automatically filled in from Find or Browse functions), then you are able to open the printer queue... This will give you access to the printer's properties... Set as Default PrinterThis function does give you the ability to set the selected printer as the default, but you may get a security warning.... Browse for printerI have never managed to get this to return the Printer Model, and sometimes it just seems to hang, so I recommend either using Find or manually enter the values. Well, that's all I know about the FMPrint add-on ... does anyone know more? April 24 Linking Visio WBS Modeler Diagrams to ProjectI have recently been asked if it is possible to update the % Complete data diagrams created with the WBS Modeler Visio 2007 Add-in (http://www.microsoft.com/downloads/details.aspx?FamilyID=34c28a49-e14c-4a7d-8d49-90061fe08ab4&DisplayLang=en). Well, it is always possible with custom code, but it is intended that the WBS Modeler diagrams can be refreshed using the Link Data to Shapes feature in Visio 2007 Professional. I know this because I wrote WBS Modeler, and in this article, I will tell you how. Firstly, I will use the Commercial Construction project that is installed with the Visio SDK for this example, which I show an extract from below. Then I created a new WBS Modeler diagram based on the above project. I simply imported the whole project using the WBS Modeler / Import from Microsoft Office Project menu action. The Element shapes are color coded according to their Outline Level by default, and they are labeled with their Outline Number and a truncated version of the Element Name shape data. Notice that the Shape Data window shows more of the Project data fields than is displayed on the shape. NB If you do see all of these Shape Data rows, then click on the page and ensure that the page Hide extra Project properties is set to False in the Shape Data window. In this particular sample project, there are no costs, nor are there any non-zero % Complete values, so I'll change some of these in the original project, then update the Visio diagram. Therefore, I revealed the Unique ID, % Complete and Cost fields in Project. I then exported the Project tasks to Microsoft Excel using File / SaveAs and Selected Data in the Project Export Wizard. You then need to select the Unique ID and any other fields that you want to export. You can optionally save the Map for future use, but you should end up with an Excel spreadsheet that contains the data that you requested. Then, in Visio 2007 Professional, you can click Data / Link Data to Shapes and select the Excel workbook that you just created. There should be just one region, Task_Table1$, and you should ensure that the Unique_ID column is checked. When you click Finish, the Excel data is copied into the Visio document as External Data. You must now ensure that the column labels match those on the Element shapes by opening the Column Settings dialog from the right-mouse menu of the External Data window. So, Unique_ID becomes Unique ID and Percent_Complete becomes % Complete. This will ensure that the data is copied into existing Shape Data rows rather than creating new ones. In addition, I changed the Data Type for the Cost field to String because my original Element shape is expecting a string. You can then choose Automatically Link from the right-mouse menu of the External Data window, and use the All shapes on this page option. Finally, you must ensure that the Data Column Unique ID equals the Shape Field Unique ID. When the links have been created, you will probably think that something has gone wrong because everything has turned black. However, this is normal because Visio has automatically assigned a Data Graphic to all the shapes, so all you need to do is edit it. In this example, I simply deleted the two text fields that Visio had automatically created, and then added a new Data Bars for the % Complete and Cost fields, and Color By Value for the Parent Element. I entered the Custom Formula={% Complete}*100 so that the numbers would be between 0 and 100. You can enter these formulae by selecting More Fields at the bottom of the Data Fields drop-down list on the New Data Bar dialog. I also edited the Label text and selected the position to be Center/Bottom Edge. Although I set the Cost property as String for the import, Visio is still able to treat the contents as a number for the Data Graphics, so I thought a Thermometer Data Bar would be interesting. Note that I set the Maximum Value to more than the known data values. (See my Visio Conference blog for code on how to automatically update maxima and minima values). Finally, I decided to use Color By Value on the Parent Element property rather than on the Outline Level one ... just to make the diagram more interesting. When all of this is applied, then you will hopefully see how much more understandable the data is when Link Data to Shapes and Data Graphics are combined in Visio 2007 Professional. So,the overall effect is a linked WBS Modeler diagram that can be refreshed whenever the data is published into the Excel workbook from Project. Of course, any Visio diagram that utilises Data Graphics is much enhanced by a legends for the linked recordsets, Color By Value and Icon Sets. However, this is not available out-of-the-box, so you will have to trial (then hopefully buy) my own DataLegends add-in (http://www.bvisual.net/Products/DataLegends.aspx) The files above are available for download at http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/CommercialConstruction.zip April 21 Wanna See Some Visio MVPs?Last week, Microsoft invited all worldwide MVPs to the annual MVP shindig in Seattle. So, I thought it may be interesting for some to see what a Visio MVP looks like! Left to right - me (MVP UK), Senaj Lelic (MVP Germany) and John Marshall (MVP Canada) - the oldest and longest serving Visio MVP! David Salaguinto (Microsoft), Dave Edson (MVP USA - currently), Tim Davenport (Microsoft), Graham Wideman (MVP USA/Canada), and Dan Albertson (Microsoft). Senaj Lelic (again), Al Edlund (MVP USA) and Chris Roth (MVP USA/Austria/Germany/...) We would like to thank Microsoft Visio product team for two very enjoyable days on campus (trying to beat the Outlook guys to the food), and I'm sure they really do appreciate our feedback! April 20 Setting Visio Shape Cell Values By ConnectionsA recent newsgroup poster asked me to explain how to set the line color and weight of a connector according to the shapes it is connected to. So, in this article, I have tried to explain one method of achieving this with minimal external coding. In this example, I have created a rectangle shape that has a single Shape Data row, MyData, which has a fixed list of values, A;B;C. The connector shape has been modified to trigger an event whenever a connection is made or unmade. If the user successfully connects two rectangles with the same MyData value, then the line (weight and color) of the connector shape is amended to match the rectangle shapes. The diagram below attempts to explain the relationships between the cells in the rectangle, connector and page. The red arrows indicate the values updated by the VBA code; the green arrows indicate the values referenced from the page shapesheet, and the blue arrows indicate the values referenced within the same shapesheet.
PageI modified the page shapesheet to have three new User-defined rows in order to have a centralised list of possible data values, and the corresponding line weights and colors for each value. This is done with a simple semi-colon separated list, which could have been updated from an external data source. User.MyDataList="A;B;C" User.MyLineWeights="1pt;2pt;3pt" User.MyLineColors="RGB(255,0,0);RGB(0,255,0);RGB(0,0,255)" In fact, these page cells could be inserted into the Master page of both the Rectangle and Connector shape (as in the sample diagram available below) and the act of dropping either master onto a new page will have the effect of duplicating these cells in the page shapesheet. RectangleThen I modified a rectangle to have a new Shape Data row (Prop.MyData), where the format cell referenced the page User.MyDataList cell. Prop.MyData.Format=ThePage!User.MyDataList The line weight and color of the rectangle is changed with the following formulae: LineWeight=GUARD(INDEX(LOOKUP(Prop.MyData,Prop.MyData.Format),ThePage!User.MyLineWeights)) LineColor=GUARD(INDEX(LOOKUP(Prop.MyData,Prop.MyData.Format),ThePage!User.MyLineColors)) Dynamic ConnectorNow, in order to get the connector shape to fire an event whenever the connector shape is connected or disconnected, it is necessary to call a bit of code, ConnectIT, whenever the value in the BegTrigger or EndTrigger changes. These cells are automatically updated whenever a connect or disconnect is done. User.ConnectITTrigger=DEPENDSON(BegTrigger,EndTrigger)+CALLTHIS("ConnectIT","") User.BegIdx=0 User.EndIdx=0 I amended the LineWeight and LineColor formulae to respond to values in the User.BegIdx and User.EndIdx cells. LineWeight=THEMEGUARD(IF(AND(User.BegIdx=User.EndIdx,User.BegIdx>0,ISERRVALUE(BeginX)=FALSE,ISERRVALUE(EndX)=FALSE),INDEX(User.BegIdx,ThePage!User.MyLineWeights),IF(CELLISTHEMED(FALSE),THEME("ConnectorWeight"),SETATREFEXPR(THEME("ConnectorWeight"))))) LineColor=THEMEGUARD(IF(AND(User.BegIdx=User.EndIdx,User.BegIdx>0,ISERRVALUE(BeginX)=FALSE,ISERRVALUE(EndX)=FALSE),INDEX(User.BegIdx,ThePage!User.MyLineColors),IF(CELLISTHEMED(FALSE),SETATREFEXPR(THEME("ConnectorColor")),SETATREFEXPR(0)))) The bold characters are those bits that I added into the existing LineWeight and LineColor formulae, in order to check that the index of the values of the rectangle shapes at either end match each other. If they do, then the line is changed too. The ISERRVALUE(BeginX)=FALSE and ISERRVALUE(EndX)=FALSE part trap the changes due to either rectangle from being deleted. VBA CodeWhenever the code is called, it clears the values in the User.BegIdx and User.EndIdx cells, then sets a formula to return the index of the value in the connected rectangle shapes, if they exist. The following subroutine was added to a new module in the VBA project of the document: Public Sub ConnectIT(ByVal shp As Visio.Shape)
End Sub Consequently, the connector shape responds to connections, disconnections and data changes in the connected rectangle shapes. You can download the sample drawing here: http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/ConnectTrigger.vsd or http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/ConnectTrigger.zip April 08 UK User Groups IT Pro Community EventIn my quest to promote Visio 2007 Professional as the visual information system of choice, I am presenting at the IT Pro Community event for the next two days, so I have posted my slides here. (Day 1 has little code, but Day 2 has lots of VBA code examples.): http://www.ukusergroups.co.uk/index.html Day 1 - Visualizing Information with Microsoft Visio 2007 slides: http://cid-3350d61bc93733a9.skydrive.live.com/self.aspx/Blogs/Visio%202007%20visualising%20data.pptx Visio is a unique data visualization application, and the 2007 edition adds three new important data features that provide brand new data links, data graphics and pivot diagrams. These capabilities, along with the existing and often under-exploited tools, firmly position Visio as the foremost practical, easy to use visual information system that can be applied to a multitude of business scenarios. Microsoft Visio has been able to link ODBC data sources for many years via the Database Wizard, but this has limitations such as only a single data link per shape, and no support for stored procedures. Microsoft Visio 2007 overcomes both of these with the new Link Data programmable API, making it simple for end users and developers to create data rich diagrams that can be refreshed simply. In addition, the new Data Graphic features enable you to enhance linked shapes with icons, data bars, text callouts and color by value. The new Pivot Diagrams can be linked to data sources, including SQL Server Analysis Services, to provide interactive drill-downs of data diagrams, allowing the user to visualise, analyse, and present aggregate information in a new appealing manner. I'll demonstrate the new features...and show how these data links can be made.
Day 2 - Visualizing Information the Smart (Diagram) Way slides: Visio is a smart drawing tool, but it is even smarter when linked to corporate data, systems or processes, enabling it to be automatically refreshed to visualize the latest facts and figures. Data-linked Visio diagrams can be used for visualization of complex information; analysis of statistics; and communication to a broader audience with the Visio Viewer or as web pages. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||