Monday, October 29th, 2007

GChart: GWT charts without JSNI, plugins, or server round-trips

Category: GWT, Java, JavaScript, Library

John C. Gunther is building a technical computing application that generates all of the data that it charts via client-side computations. He didn’t want to create the charts on the server side, and decided to use GWT to do the work for him.

This is how he created GChart.

To see it at work, check out the chart gallery that has examples such as:


  1. package com.googlecode.gchartdemo.client;
  2. import com.googlecode.gchart.client.GChart;
  3. /**
  4.  * Defines a scatter-plot of x*x vs. x.
  5.  */
  6. public class GChartExample00 extends GChart {
  7.   GChartExample00() {
  8.      setChartTitle("<b>x<sup>2</sup> vs x</b>");
  9.      setChartSize(150, 150);
  10.      addCurve();
  11.      for (int i = 0; i < 10; i++)
  12.        getCurve().addPoint(i,i*i);
  13.      getCurve().setLegendLabel("x<sup>2");
  14.      getXAxis().setAxisLabel("x");
  15.      getYAxis().setAxisLabel("x<sup>2</sup>");
  16.      update();
  17.   }
  18. }

Which creates:

For other graphing needs check out Plotkit and Dojo Charting.

Posted by Dion Almaer at 10:51 am

3.8 rating from 25 votes


Comments feed TrackBack URI

Hey Dion,

Thanks for the link to dojo.charting. For those who are wondering about Dojo charting on the 0.9+ versions, here’s a peek at the awesome work Eugene Lazutkin has been cooking up for 1.0:


Comment by Alex Russell — October 29, 2007

GFlot is another GWT charting library that is worth checking out. Some examples are shown on this demo

Comment by alexjdl — March 9, 2009

Leave a comment

You must be logged in to post a comment.