Unless you’ve been hiding under a fairly large rock, you’ll have at least a vague of whatSharePoint is about. It’s that ubiquitous Microsoft Server Product that seems to be burrowing its way steadily through the whole Microsoft Platform. At its most expansive it’s becoming the glue at the application level which joins many (and maybe one day all) of the Microsoft Server Products. For example, you currently have Microsoft Exchange, Project Server and Team Foundation Server, all of which have direct links into SharePoint Farms. Conversely, at its most concise, SharePoint is a quick and easy way to create highly functional web sites. People oftentimes complain about its look and feel, but hey, that can be changed, so don’t get bent out of shape about that. At its very heart, SharePoint 2010 is nothing more than a rather large ASP.NET 3.5 application.
However, if you’re not working with SharePoint regularly, you may not be aware of the new SharePoint 2010 Service Applications. “What the heck are these?” I hear you ask. Well, Service Applications (SAs) provide a mechanism for delivering common functionality across a SharePoint Farm, and also between SharePoint Farms. Some examples of SAs include:
- Managed Metadata Service, which allows the establishment of a common taxonomy of metadata,
- the Secure Storage Service, which delivers an encrypted container for credentials you want available in SAs,
- Excel Services, which allows you to publish Excel Worksheets on an Intranet,
…and of course you can write your own SAs. However, in this article I’m going to talk about my favourite SA, namely Visio Services, which sits in the Microsoft Stack as shown in Figure 1.
What are Visio Services?
So what does Visio Services do? As the name suggests, it serves up Visio Drawings. Moreover it does so in a format which allows them to be viewed in a web browser, so the viewers do not need Visio 2010 to view the drawings themselves. This alone provides a great capability to distribute diagrams centrally and in controlled and versioned manner. However, add to the mix the very cool ability to bind data to Visio Shapes (added in Visio 2007) and you now have an incredibly powerful new way to present business data!
The natural question is how does Visio Services render a Visio Diagram on a web page? Does it need an ActiveX control, extra components or maybe browser Add-Ins? In short – no! You certainly don’t need an ActiveX control, nor do you need to download and install a browser add-in to view the Visio Diagrams (though I’ll come back to that in just a moment). In its most basic rendering, the Visio Diagram is served up as a PNG image. However, if you want a full fidelity experience, then it’s advisable to install Silverlight and then you get the ability to pan, zoom and so forth – everything you might expect to be able to do with a vector based drawing.
“Whoa whoa, Silverlight? Does this mean I need to learn how to write Silverlight applications to use Visio Services?“
Not at all; the really clever part of Visio Services is that it takes a standard Visio 2010 Diagram with a .vsd extension, converts it to a new .vdw file format, and then publishes it straight to your SharePoint 2010 Server. When your diagram is requested via a SharePoint URL, Visio Services takes the .vdw file and converts it to a Silverlight file on-the-fly without you needing to do anything at all! This process is shown in Figure 2.
If you’re wondering how you can plug data into your diagram, look no further- that’s done in Visio 2010 itself. Much as you can bind to data sources in Excel and Word, you have the option to connect to various data sources such as an Excel workbook (but see a gotcha below!), SQL Server databases, SharePoint Lists, OLEDB or ODBC data sources and even custom data sources which you can write yourself. Once you’ve connected to your data, it’s really a very simple matter to connect Visio Shapes to data. I know you have heard it before, but it really is as easy as ‘drag-and-drop’.
A Powerful Combination but…
This combination of on-the-fly Silverlight generation and drag-and-drop Data Binding of Visio Shapes makes for a truly powerful data visualization tool. As far as the web is concerned, we’ve always had data grids of some form, even if it was just HTML tables, and charting needs have been fairly well served with Microsoft and several other vendors supplying charting tools. More recently, mapping has become a fairly popular way of showing or filtering data, but creating dynamic data-driven floor plans, engineering diagrams, organisational charts, or network diagrams has all been much harder and very much the preserve of third-party tools. Visio Services now changes this situation but, as with all things, there are some gotcha’s, and here are the ones I think you need to watch out for:
Firstly, Visio Services only comes with the Enterprise Client Access License edition of SharePoint 2010 Server at present. This is important; you will not get Visio Services with SharePoint 2010 Standard Client Access License or with SharePoint 2010 Foundation. A shame, but there it is.
Secondly, Visio Services is not currently suitable for showing data which changes quickly in shape. By this I mean that if, for instance, you want to use Visio Services to illustrate sales achievements on a Sales Organisational Chart, that is fine and I would say a good use case, provided that its only the data for each Sales Person that changes rapidly. If you are hiring new sales staff at the rate of one a week or month, then perhaps Visio Services may not be so suitable; this is because you bind an individual row of data to an individual shape. There is no way in Visio 2010, at present, to bind a variable number of rows to a diagram and get it to generate the appropriate number of Visio Shapes on the fly.
Thirdly, if you are using an Excel workbook as a Data Source, the workbook must be hosted in the SharePoint Site as the Visio Web Drawing. Additionally the Site must have Excel Services enabled.
Lastly, you need to ensure that you have your authentication story correctly setup, especially relating to custom data sources. This can be tricky at the best of times, and its entirely up to you to sort it out, as Visio Services offers no help in this regard.
That’s the initial top level overview, so now we’ll do a “My First Visio Services Web Page” type of run through, just to give you a taste of the capabilities available.
You’ll need three things to get started. First off, you need a SharePoint Server 2010 installation with a Visio Services Service Application installed and configured. You could build one yourself, but you can also download a VM with everything you need on it from Microsoft downloads. Creating a Visio Services SA is a straightforward process, and you can get the instructions from TechNet. Secondly, you need a copy of Visio 2010, and a basic understanding of how to create a Visio Diagram. You can produce Visio-Services-compatible diagrams using Visio 2010 Professional or Visio 2010 Premium, but Visio Premium is the only version that is compatible with SharePoint 2010 Workflows. Thirdly, you need a data source to drive your diagram. That’s it! You’re now ready to start creating a new wave of Business Intelligence Diagrams for your company.
The next question is how do you create a data driven diagram? Happily, its a very easy 7-step process.
Step 1: Get your data organised. In this example I’m going to connect a Sales Organisation diagram to a simple Sales SQL Server database with just two tables; SalesPerson and Order. The Order table contains the value of the order and also a link to the SalesPerson in the form of a Foreign Key Relationship. I’ve also created a View on this data, to the extent that the Sales Manager Sales is actually the aggregation of his own sales plus the total of all his staff’s sales. Each sales person, including the manager, also has a Sales Quota which are they required to meet, which is stored against the Sales Person. The raw data is at Figure 3.
Step 2: Create a new Diagram. In this example, I created a Sales Organisation diagram and also added some map shapes. Remember, this must be done in Visio 2010.
Step 3: Create a Connection to the Data. I linked my Visio Diagram to my data by creating a link to the SQL Server View which I created in Step 1. The data appears in a separate Data Connection window within Visio 2010 (see figure 4).
Step 4: Bind the Data to Visio Shapes. I linked the data to the Sales Organisational Chart AND the associated Region represented by the Map. This is done most easily by dragging and dropping a data row onto a shape, as you can see in Figure 4.
Step 5: Add in Data Graphics. I added in a data graphic such that, when the sales for a given region are within certain ranges, the maps are coloured bright red, dark red, ochre, darker green or green. This is actually achieved by binding a vary colour data graphic to the SalePercentage field, in which you simply specify which values to bind to what colour – It even auto-suggests ranges of colours. I also added a Gauge Graphic against each SalesPerson which indicates the percentage of quota achieved. And before you ask, yes you can create your own Data Graphics!
Step 6: Publish your Data Diagram. This is a simple matter of saving the Visio Drawing as a Web Diagram to the SharePoint Site which you can do from within Visio 2010 using File -> Save & Send -> Save to SharePoint -> Save As ….
Step 7: View the Diagram. The diagram can be viewed simply by clicking on the .vdw document link from within a SharePoint Library, or by adding a Visio Diagram WebPart to a page and referencing the Visio file’s SharePoint URL.
So now, when data changes in the database, let’s say the sales values change for example, then the shapes will change colour and the data bar will indicate a different value.
As you can imagine, the processing required to generate a data-driven Silverlight control on-the-fly is not trivial, and if the number of users on the system is large then there could be performance issues. So, by default in Visio Services, the diagrams are cached, and there’s a simple setting in Central Administration to alter the length of time for which diagrams are cached.
Using the new Data-Driven Diagram
Now that we have our data-driven diagram, there are a number of options for how can we make use of it. We can simply view it on the standard Visio Services viewer page by selecting the diagram we want from the SharePoint UI. Alternatively, we can add a Visio Services WebPart to a page and configure the WebPart to display our Visio Diagram. This has a number of benefits. Such as the fact that you can choose to hide the default toolbar and prevent panning and zooming, so that your Visio Diagram looks like a pure image or Silverlight control.
More importantly, because Visio Services exposes the shapes within your Visio Diagram as objects that can be referenced on your webpage, you can use standard SharePoint WebPart connections as shown in Figure 5 or the Visio Services Mashup API to link your diagram to other content on your SharePoint site.
So, for example, a diagram can be used to filter a list, or perhaps selecting an item in a list can be used to highlight a shape in the diagram. Or if you prefer, selecting a shape in a diagram can be used as a trigger to show a secondary diagram which might vary depending on which shape was selected. These are relatively obvious examples, and you can hopefully see how the Visio Services Mashup API can be used in many ways to create Business Intelligence Dashboards which incorporate Visio Diagrams and other content.
If you’re wondering where does .NET programming come in? There is actually none involved in any of the above; the creation, editing, configuration and deployment of Visio Services diagrams is a SharePoint 2010 No Code solution. Where you do have to open up Visual Studio is when you need to connect to a custom data source. At this point you’ll need to write a .NET component which inherits from the AddonDataHandler class which exists in the Microsoft.Office.Visio.Server namespace in Microsoft.Office.Visio.Server.dll assembly. The class must also implement the IAsyncResult interfacedeployed to the Global Assembly Cache on the server running Visio Services. You then configure Visio Services to use this .NET component to refresh the data bound to the shapes.
So there we have it; that was our brief overview of Visio Services. To quickly recap, Visio Services was introduced to provide Enterprise Data Driven Diagramming, a capability not previously readily available on the Microsoft platform. Visio Services is a SharePoint 2010 Services Application available with the SharePoint 2010 Enterprise Client Access License, and one which allows the rendering of diagrams created in Visio 2010 as PNG or Silverlight files on a SharePoint 2010 Web Site. Finally, you can easily combine Visio Services Diagrams with other SharePoint content by using the Visio Services Mashup API and webpart connections.
I’m really excited about the potential of Visio Services in the field of Business Intelligence, and I love talking about it, so please feel free to post a comment below with any questions you have about this exciting new development.
How does your SharePoint application perform? The Beta release of ANTS Performance Profiler 8 adds support for SharePoint 2013, helping rapidly identify and understand SharePoint performance issues. Try the Beta.