2009-07-02

Choosing scatter chart library for web application

So I definitely know that I have to make web based UI for medical diagnostic application. It's not so complicated as I initially though. It is a kind of scatter chart that has to display delivered XY data and use as reference some kind of meta data like description, database id etc. Basic functionality of that module is adding and editing points. It should be somehow interactive - like has clickable points that can fire various events. Graph zooming is also needed.

There are articles with list of interesting solutions: 13 useful graphing solutions, 10 Free Chart Scripts. I reviewed few charting libraries that can be divided into three categories:
  • HTML canvas charts
  • Java applets
  • Flash based charts
There where also other interesting ideas like SVG based interactive chart, or image chart with imagemap and added DHTML tricks, but still without enough support and needed writing more code.

Needed charting solutions should be lightweight so I thought about html canvas drawing, but unfortunately there are serious IE issues - It does not implement such feature, so excanvas ActiveX is used not always successfully (new IE changes are breaking excanvas functionality).

Another good choice from point of customization and extending functionality is Java applet based on JFreeChart, or lighter jchart2d library. Using Java applet was tempting. I made some serious applet work some time ago so I had to make some user experience tests of deploying UI as applet. The large group of users has no technical computer background, and can be confused about accepting prompts for Java installation (Java is not preinstalled with system in here), waiting for runtime download and finally for applet initializing. That may cause serious problems with acceptance tests.

So I tried Open Flash Chart 2- the nice flash based chart library. It has fixed but all basic features I need. Flash player is king of the browsers (large deployments ratio) today. That and smaller than Java's runtime should cause less problems with runtime installation. It has wrapper libraries in most popular programming languages including Java. I have choose third party jofc2 library for quite easy integration with code sample from Open Flash Chart and Wicket example.

Open Flash Chart has enough javascript interface, to dynamically change data, graph style, add tooltips and script onclick events on data points. It has no direct zooming support but can be implemented as changing chart properties by adding external scripted controls. Redrawing after data delivery is fast also.

Near future brings even more choices like Silverlight, improved Applet/JavaFX runtime or adoption of canvas like solutions.


Further reading:
Scatter chart library - moving to Flot
Looking for simple python chart library