Thursday, July 2nd, 2009

GChart 2.5: Faster, sharper, canvas-rendered, pie, line, and area charts

Category: Component, GWT, Library

<p>John Gunther has released GChart 2.5, a client-side library that adds a new canvas-rendering option for sharper, better looking, alpha-transparent, pie, line, and area charts.

John told us:

Canvas-rendering corrects GChart’s most serious visual quality limitations (including the most often mentioned problem by its users: the banded-filled pie slice).

Coupled with its existing feature set and ease of GWT integration, the canvas-rendering option makes GChart an excellent choice for those who want to add basic charts to a GWT application without a lot of fuss.

To access these features, you’ll need to plug an external canvas library into GChart (GWTCanvas in the gwt-incubator is reccommended) as described in detail in the setCanvasFactory method.

With the external canvas in place, the next step is to tell GChart you want a curve to be “continuously filled” by invoking setFillSpacing(0).

With each such continuously filled curve, GChart automatically exploits your external canvas library to improved the quality and speed of that curve’s rendering. Specifically, banded-filled pie slices become solid filled, dotted connecting lines become continuously connected, and (the biggest stretch) bar charts become area charts. See the setFillSpacing method’s javadocs for a detailed description of how each existing symbol type implements this new “continuously-filled”, canvas-powered, rendering option.

Note that GChart’s previous HTML-only rendering is still available, and is the default rendering mode if you don’t bother to plug in an external canvas.

Check out the demo

Related Content:

Posted by Dion Almaer at 6:44 am
4 Comments

+++--
3.3 rating from 25 votes

4 Comments »

Comments feed TrackBack URI

Great, now all they need to do is also create a clientside API that doesn’t look like spaghetti so that we can use it from plain JS :)

Comment by SchizoDuckie — July 2, 2009

This is pretty great stuff. I’m always looking for new charts.

Comment by okonomiyaki3000 — July 2, 2009

@SchizoDuckie: Exactly. It’s JS all the way for me. I don’t touch Java.

Comment by andysky — July 2, 2009

Dion – The link very much appreciated (and it isn’t even April 1)

@SchizoDuckie, andysky: I prefer Java to JS for a very simple reason: I was unable to master JS in a reasonable time frame. GWT solved this and many other practical problems (“how do I use the JS debugger in IE”) for me by creating a bridge between the tools I knew (Java + Eclipse) and the browsers I had to get my stuff to run in.

Comment by JohnGunther — July 3, 2009

Leave a comment

You must be logged in to post a comment.