Skip to main content

Map Visualization using Graphite in Silverlight

Have you ever seen how boardrooom connections page of WotNews, Australia (http://wotnews.com.au/boardroom_connections/) works? Few days back, I was working on a similar requirement where we had Silverlight 3/4 to implement the same feature. While searching for Silverlight feature to implement this, we discovered Graphite (a product from Orbifold) which could give similar features as required.

If you are new to Graphite then for you, Graphite is a diagramming control with a (auto-layout) spring-embedder algorithm for Silverlight. The control is designed to display a small set of data without having to define a particular layout or without much customization. The Silverlight version of it can be used for website navigation, inside SharePoint, to visualize CRM/Dynamics relationships etc.

Conceptually, Graphite control works managing components at 2 levels - one at Visual level and another at Non-Visual level. Visual level ensures creation and maintenance of visual parts (node, connector etc.) and Non-visual level ensures information attached to each node is maintained in the background. Graphite control represents the visual part in the form of GraphCanvas and the non-visual part in the form of Graph classes.

Adding a new Node could be represented as -

Courtesy : http://visualizationtools.net/

To use it in the application, we need/may implement the following steps.
1) Add Graphite control to the XAML code (download Graphite control from http://visualizationtools.net/)
2) On the click of parent Node, get the data from database using a RIA service (can use other methods of communication like WCF Services, ASP.NET Web Services, Sockets calls, REST calls to fetch data from the database)
3) Create child nodes using the data fetched from the database and set the Info property of the Node if you want to display anything on MouseOver or Click of the node as a tooltip or in a separate panel.

Now, I will take you through a sample code implementing Graphite control for visualization.

1) In XAML code, put the following code to include Graphite control in the page


2) Then we need to put the code to load data from the database using a WCF service and populate data by adding nodes to the Graphite control. Use AddNode and AddEdge methods of Graphite control to add nodes and links between nodes respectively.

In this code, I have tried to call a WCF service (be default asynchronous) and populate data on the completion of service call. Here I will not talk about how to build a WCF service because I assume you all know how to build a WCF service to fetch data from a database and send it back to client for further usage in the client side.

Once you complete the code then run the project to see the output. You will see a fantastic mapper and click on each node to see how it expands the child nodes and rebuilds the layout. You can explore functionalities like changing color and style of nodes and connectors by defining and changing the styles in the XAMP page.

I am thankful to Francois of Orbifold for providing required inputs to work with Graphite control.

Please post if you have any questions while implementing it.

Comments

Popular posts from this blog

Office 2013 Installation Error : Code 1603

Wanted to share one error that I got while installing Microsoft Office Professional 2013 for which I had to spend almost 3 days to find the root cause. I also googled and found that many people have also faced the same issue but did not get if anyone had the solution. Sharing the solution that worked for me. Thanks to Dhaval Metrani, my colleague, who also helped me with this. If you get the following error in the log file (in the %temp% folder) while installing Office 2013 Failed to install product OSMMUI.msi ErrorCode: 1603  and the detail log shows ERROR: The network address is invalid then the same is because of Task Scheduler service is not enabled on the machine. 1603 is a generic error and some people have mentioned that the same could be related to deleting/renaming  %programdata% /Microsoft Help but the solution seemed to be related to Task Scheduler when the exact error was related to 'Network address invalid'. By default in Windows 7 and Windows Vista ...

jQuery Intellisense support in Eclipse 3.4.2

To have jQuery Intellisense feature in Eclipse, I tried to find out the way in Google and everyone suggested to use modified version of Eclipse WTP. After doing some research I found out another way of having jQuery Intellisense in Eclipse i.e. integrating Spket IDE with Eclipse. I am using Eclipse 3.4.2 Ganymede version. Download Download and Install Spket IDE and jQuery Download Spket plugin for Eclipse using Eclipse Update Manager, from Spket update site - http://www.spket.com/update/ Once the Spket IDE is installed then download jQuery from http://jquery.com/ and save in your local disk. Configure The steps to configure jQuery Intellisense are: Open Eclipse IDE Select the menu item Window > Preferences... to open the workbench preferences. Select the Spket > JavaScript Profile preference page to display the installed JavaScript Profiles. Click the New.. button. In the Name field, type jQuery (you can type anything) as the name for the new profile. Then click OK . Click th...

Working with ExtJS and Java

If you are new to extjs then for you ExtJS is a cross-browser Javascript framework for building RIA (Rich Internet Application) based web application. It allows to use any server based technologies for building your application. In my application, I am using ExtJS 3.0 as client side technology, Java (JSP+Hibernate) as server side technology and MySQL 5.x as database. Here I will tell you how to setup the above tools and technologies. ExtJS Setup Download latest version of ExtJS from http://extjs.com/products/extjs/download.php . I am using ExtJS 3.0 in my application. If you are using 3.0 version then you can view the API Documentation online at http://extjs.com/deploy/ext-3.0-rc2/docs/ and you can download the API documentation from download page if you are using any older version than 3.0 Extract the contents to any local folders in your disk. ExtJS IDE Setup It is difficult to remember all ExtJS components and its functions, so we need an IDE for development. Although there are few...