IN THIS CHAPTER
• Developing a Data-Driven Visio Web Drawing
• Publish a Drawing to a SharePoint 2010 Document Library
• Browsing a Visio Web Drawing Online
• Refreshing Data in a Visio Web Drawing
• Embedding a Drawing into a SharePoint Page Using the Visio Web Access Web Part
• Interaction with other SharePoint 2010 Applications
To gain a full view of information that matters to your business requires both a high-level perspective and detailed data. Visio 2010 in integration with SharePoint 2010 lets you share your Visio drawings with your users in an effective manner. Users can see your real-time data through web drawings in their browsers without having Visio installed on their local machines. They can pan and zoom in the online diagram, follow hyperlinks embedded in shapes, and refresh the data manually or on a set schedule. They can interact with other SharePoint web parts to create visually compelling and interactive dashboards. Visio Graphics Service allows publishing diagrams directly from Visio Professional or Premium edition to a SharePoint document library.
Developing Visio Graphics Service content is all done from Microsoft Visio 2010, which is installed as a separate component of Microsoft Office 2010. Data-driven Visio web drawings can be developed using either Microsoft Visio 2010 Professional or Premium. You can download a trial version of Visio 2010 Premium edition from http://technet.microsoft.com/en-us/evalcenter/ee390821.
You can learn more about Microsoft Visio 2010 version differences at http://office.microsoft.com/en-us/visio/visio-edition-comparison-FX101838162.aspx.
This chapter requires that you have a basic understanding of how Visio drawings are created. We do not cover all available features of Visio 2010 Premium edition in this chapter. Our focus is mainly on how to create a data-driven Visio web drawing using data from Excel Services, SharePoint Foundation List, and SQL Server database.
In this chapter, we first develop a data-driven Visio web drawing using Visio 2010 Premium edition. We use multiple external data sources to pull data into the same drawing. The ContosoRetailDW database is used for all development work. After the Visio web drawing is created, we publish it online in our SharePoint 2010 document library. We review features available for browsing the drawing online. You also learn how to refresh the data embedded in the drawing manually and via automated schedule. Toward the end of this chapter, you learn how to make your drawing interactive by integrating it with other SharePoint 2010 web parts.
You can download the ContosoRetailDW database from http://www.microsoft.com/downloads/en/details.aspx?FamilyID=868662DC-187A-4A85-B611-B7DF7DC909FC&displaylang=en.
To develop a data-driven Visio web drawing connected to an Excel workbook, first we need to confirm that workbook is hosted on a same SharePoint farm where we are planning to deploy our Visio web drawing. Also verify that Excel and Visio Graphics Services are running on the SharePoint farm. Once confirmed then set up a connection to that workbook using following steps:
Figure 12.2. Data provider selection.
For this section, we prepare an Excel data sheet manually and upload it to our SharePoint document library first. We use this Excel sheet as an external data source. I have executed the following SQL query against the ContosoRetailDW database to extract sales data by channel. You can either manually prepare this Excel sheet or use this book’s resource material to access the ContosoSalesData Excel sheet.
SELECT b.CalendarYear
, a.ChannelKey
, MAX(c.ChannelLabel) AS ChannelLabel
, MAX(c.ChannelName) AS ChannelName
, SUM(a.salesamount) AS SalesAmount
, SUM(a.TotalCost) AS TotalCost
FROM FactSales a
INNER JOIN DimDate b ON a.Datekey = b.Datekey
INNER JOIN DimChannel c ON a.ChannelKey = c.ChannelKey
GROUP BY b.CalendarYear, a.ChannelKey
ORDER BY b.CalendarYear, a.ChannelKey
You should now see the data from Excel sheet at the bottom of your drawing as shown in Figure 12.6
Figure 12.6. Linked data from Excel workbook.
We will now put some shapes and text boxes on our drawing, which we want to link with this external dataset. You can choose shapes of your own choice or retrieve the Visio drawing file (ContosoSalesByChannel.vdw) from this book’s resource material. ContosoSalesByChannel.vdw file looks similar to Figure 12.7.
Figure 12.7. Visio web drawing.
Figure 12.11. View Selection window.
A view (V_Profit) has been created under the ContosoRetailDW database using the following SQL statement. This view calculates profit by calendar year. We will use this view as an additional data source for our Visio drawing. Create the view in your ContosoRetailDW database using following SQL statement:
Create View V_Profit
AS
SELECT TOP (100) PERCENT
b.CalendarYear
, SUM(a.SalesAmount) - SUM(a.TotalCost) AS Profit
FROM dbo.FactSales AS a
INNER JOIN dbo.DimDate AS b ON a.DateKey = b.Datekey
GROUP BY b.CalendarYear
ORDER BY b.CalendarYear
You will notice another dataset at the bottom of your drawing (Figure 12.14). This dataset is using SQL Server as its external data source.
Figure 12.17. Visio web drawing connected to SQL server database.
We will now create a new connection to a SharePoint list to use it as an external data source on the same Visio drawing. We will use the same process as before:
A SharePoint Foundation List was manually created that displays the top three employee names as list items (Figure 12.18). These three employees have done the most business in the past three years. We will use the same list as an additional data source for our drawing. You can create one yourself before moving forward with this exercise. The list should have three columns: RecordKey, EmployeeName, and Total Profit.
Figure 12.18. SharePoint list.
Figure 12.20. Custom list selection.
You will now see a new dataset at the bottom of your drawing, TopThreeEmployees (Figure 12.21).
Figure 12.21. SharePoint Foundation List external data source.
You will now have TopThreeEmployees list data displayed as a progress bar on your Visio drawing (Figure 12.23).
Figure 12.23. Visio web drawing connected to SharePoint list.
We now have our Visio drawing ready, which is using SQL Server, Excel Services, and SharePoint Foundation List as an external data source. The next section explains how you can save this web drawing to a SharePoint document library.
Under the Data tab on the top menu there is a button named Automatic Link. After you click it, it will start the Automatic Link Wizard. The Automatic Link enables you to quickly link rows of data to shapes in your diagram if existing values in the shape equal values in the row.
The Visio web drawing (VDW file) is a new Visio file type that allows diagrams to be rendered in the browser using Visio Services on SharePoint 2010. To save your Visio drawing as a web drawing file in a SharePoint 2010 document library, follow these steps:
After your Visio web drawing file has been saved to the SharePoint document library, you can continue to work on it in Visio. You can edit Visio web drawing files using the complete set of features provided by Visio and then save again. When the file appears in your document library, you can open it in a browser by clicking it.
A Visio diagram saved to a SharePoint document library as a Visio web drawing can be viewed in any web browser by just clicking its filename in the document library.
The diagram renders in the browser if the viewer has Silverlight installed on his or her machine. Visio Services renders seamlessly anything you can draw in Visio (see Figure 12.25).
Figure 12.25. Visio web drawing in a browser.
Visio Services enables you to navigate diagrams using easy-to-use control features for panning, zooming, switching pages, following hyperlinks, and discovering shape data. You can also open a drawing in Visio directly from the browser with one click using the Open in Visio button.
Because Visio web drawings are stored in a SharePoint document library, users get a variety of useful document management features, such as access control using permission management and change control using version management. Drawings can also be integrated with SharePoint workflows.
By default, Visio web drawings open in their own web page for a full-screen viewing experience. Visio Graphics Service allows Visio web drawings to be embedded in other SharePoint pages using Visio Web Access web parts. Using the Visio Web Access web part, you can embed Visio web drawings in SharePoint pages. By putting all relevant information onto one page, you save viewers time and enable them to understand the information fully. You will learn more about Visio Web Access web parts in later sections.
The next section covers options available for refreshing data in Visio web drawings.
Visio Graphics Service has taken Visio’s data refresh features to the browser. When Visio Graphics Service renders a data-driven drawing in a browser, it fetches the linked external data from the data source. After you publish your drawing to the SharePoint document library, your diagram will always visually represent the most up-to-date data. You can also refresh data manually by clicking the Refresh button. Visio Graphics Service supports refresh on open, manual refresh and automatic periodic refresh.
The next section explains how the ContosoSalesByChannel.vdw drawing can be presented using the Visio Web Access web part.
There are multiple ways to share your Visio web drawings with viewers online. One of the options is to upload the drawing file (.vdw file) to the document library. Users can then open it in a browser by clicking on the actual file name. Another option is to embed your web drawing directly into a SharePoint page using the Visio Web Access web part. This is helpful when you are developing a dashboard page. Contribute, Approve, Manage Hierarchy, Design, or Full Control level permissions let you embed your Visio web drawings into an existing SharePoint page. This section will provide you step-by-step guidelines on how to embed drawings in a SharePoint page using Visio Web Access web part. To do so, follow these steps:
You can only embed web drawings that are hosted within the same SharePoint farm as the site hosting the web part. Also note that Visio Services checks the permissions of page viewers before it renders a web drawing. If the viewer does not have at least View permissions, Visio Services will not render the web drawing.
Table 12.1 lists other settings options to further customize your Visio Web Access web part page.
Table 12.1. Further Customizing Your Visio Web Access Web Part Page
In this section, we review how the Visio Web Access web part can interact with other SharePoint 2010 web parts. We use our previously created web drawing to set up an interaction with other web parts. You have to make sure the ContosoSalesByChannel.vdw drawing is published in a SharePoint 2010 document library. Also verify whether you have the Visio Web Access web part working on your home page. After confirming such, you can set up an interaction as follows:
Just as with Get Shapes to Highlight From, you can use a few more connection actions. Table 12.2 describes each possible connection action.
Table 12.2. Possible Connection Actions
When you want to use an external data source that is not compatible with Visio Graphics Service, you can create a custom data provider using steps shared at http://msdn.microsoft.com/en-us/library/ff394595.aspx.
This MSDN article shares the most important classes and methods available in the Visio Services class library to create and deploy a custom data provider. The custom data provider in this article reads data from an XML file and then displays the same data in a Visio web drawing file.
Microsoft Visio 2010 integration with SharePoint 2010 has opened a whole new way to display Visio diagrams more effectively. Visio developers can now create interactive, dynamic, data-driven Visio web drawings using Microsoft Visio 2010 Premium and Professional editions. They can publish their drawings online in a SharePoint document library for others to view without having Visio installed on their local machines.
This chapter walked through the process of developing each piece of Visio Graphics Service content. It explained you how you can access data from different external data sources. In addition, the chapter explained how to set up an interaction between the Visio Web Access web part and other SharePoint web parts. In later chapters, a complete end-to-end solution shows how Visio Graphics Service fits into the overall BI stack and how the components from this chapter are used to build the complete solution.
The following are best practices from this chapter:
• It is important to understand how much space you need to store your web drawings and how many users will be simultaneously accessing your web drawings. You can access an article about capacity planning for Visio Graphics Service at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=fd1eac86-ad47-4865-9378-80040d08ac55&displaylang=en.
• For large diagrams, use the Get Shape to View From connection setting to configure the zoom settings.
• Most data providers are already listed with Visio Graphics Service, but if not, make sure all your external data sources are listed as a trusted data provider.
• Make sure ODC files, SharePoint lists, and Excel sheets are stored on the same SharePoint site as your drawing, if used as an external data source.