Producing Charts in Open Wonderland

One of the challenges of the +Spaces project is to provide our users with charts of the results from their participation in polls, debates and so on. In Wonderland, one way of doing this would be to create from scratch a new 2D Swing Cell that employs an existing open source Java library such as JFreeChart. This library seems to provide all the charts we need, including pie charts and bar charts.

However, instead of starting from scratch it’s always easier to steal someone else’s ideas “stand on the shoulders of giants.” The “giants” in this case are Google, and their Chart API. The API returns a chart image in response to a URL GET or POST request, where the URL contains all the information about the chart you want, including its data, size and colours. By using such a URL in the HTML of a Poster cell, we can now easily create charts in Wonderland.

For example, here is a very brief video of creating a poster to display the example chart that Google provides.

The advantage of this approach over the Swing approach is flexibility: using a Poster means that we can embed a Chart in other text, and update the Poster programmatically or from the web.

(The modules employed in the video were the new Poster and the Web-based Poster Manager.)

About these ads

2 Responses to Producing Charts in Open Wonderland

  1. Nigel Wynne says:

    Most excellent!!!!

  2. Nice idea. You could also try JFreeChart running behind a servlet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 56 other followers

%d bloggers like this: