|Editor’s Note: The Visual Studio project included in the source code for this article requires ‘Office XP Web Components’ (OCW10). The development and run-time machines must have these installed. You will find the installation file on the Office XP installation CD. The file is called: OWC10.msi.).
Graphical representation of data is a very hot topic. One only has to leaf through the pages of any journal to see the number of companies that are offering complex graphical packages that allow you to manipulate and visualize your data.
|Figure 1: Architecture of the Chart Server. This shows the overall architecture of the system developed in this article. You can see how the chart server uses XML configuration files to call and parse the data sources.
Most of them have a common problem: They require you to format your XML data to a specific standard that they can ‘understand’ before they can chart your data. The flexibility XML affords is lost, as you have to reformat the data, usually using XSLT. This isn’t always as trivial as it sounds, as sometimes developers have to take XML documents from third-party sources and add to them before dispatching them to their clients. For example, a financial services company might have to take basic data about a company from a rented database and apply analytics to the data before pushing it downstream for XSL styling.
This article takes you through the steps of developing a business graphics server using VB.NET. The server calls your data sources and parses the data according to XPath variables that you set up to create data series and categories. It then loads the data into the charting engine, in this case the Microsoft Office Web Components.
The chart is eventually returned to the caller of this server as a JPEG file so that it can be sent to a browser-based product without requiring a downloaded footprint.
The server that I’ve developed for this article—chart server—is a basic version, calling fixed XML documents as data sources. At the end of the article, I’ll discuss how to extend this to call data servers that require parameter sets of their own. In addition, this example builds its charts using the Office Web Components Charting engine on the server side. It would be very simple to adapt the code to use any other charting engine.