Silverlight diagramming with spring-embedder layout

Many years ago when Java appeared on the scene a little demo applet was delivered together with the Java SDK. It was not a huge piece of software but it sparked many ideas and a whole industry evolved around it (see TouchGraph for example), especially in the academic world. In those days things were frustrating for a Visual Basic developer, well any Microsoft developer in fact, because we only had ActiveX controls and these were far behind in many respects. It took many years for Microsoft to get over the COM and ActiveX disaster, it took us developers many years to finally have the possibility to do what Java was enabling then. Through Silverlight there’s finally the ease of .Net inside the browser and, in fact, much more; a lightweight version of WPF which includes animation and other fancy Flash-like stuff.

It took me little effort to shift my WPF experience to Silverlight and to transpose some layout algorithms. There are some difference, for sure, but hardly anything I can complain about. Alltogether I truly enjoyed the hours I spent on developing this little ‘applet’. Graphite is very similar to the Java applet but the implementation is more clean and I have taken much care of the API. The only significant part is the layout algorithm, which you can almost copy/paste from the Java applet or fetch from some Netron code. Hyperbolic layout and tree layout are easily implemented but I’m not sure I will, because I have to focus my attention back to GraphSquare.

See for yourself:

Usage:

  • use CTRL-click on nodes or on the canvas to add random nodes
  • use SHIFT-click to select nodes before creating a new edge. Note that you can select only two of them.
  • use ALT-click to delete a node and its bindings
  • hover over a node to see the underlying info

Features:

  • things are pretty much all encapsulated into a custom Canvas object
  • the API and events make it easy to manipulte the diagram in any context
  • the architecture is model-view based, the model being a straightforward graph data structure
  • data can be imported from flat text files or from XML
  • the visualization is based on WPF/SIlverlight templating and styling features outside the control, which means one can customize colors and appearance. The flexibility of WPF’s triggers and other subtleties is missing in Silverlight but one can get quite far nevertheless.
  • the layout algorithm is continous, which means you can drag nodes around like beans in jam. It all behaves very ‘organic’.

Addendum: due to a different font on your side you might see node titles a little bit bigger or smaller than on the screenshots.
Demo: go ahead and have fun with the Graphite demo.

15 Responses to Silverlight diagramming with spring-embedder layout

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

top