Wednesday, March 21, 2012

GWT wrapper for visualization treemap with mouse events

A treemap is a helpful visualization of a data tree. It would be nice if the treemap had features like weighted box sizes for intermediate levels and explicitly setting up colors for non-leaf nodes. I wrote a  quick Google Web Toolkit(GWT) wrapper for Google visualization treemap-

 public class TreeMap extends Visualization<TreeMap.Options>
   public static class Options extends AbstractDrawOptions {
       public static Options create() {
           return JavaScriptObject.createObject().cast();

       protected Options() { }

   public static final String PACKAGE = "treemap";

   public TreeMap() {

   public TreeMap(AbstractDataTable data, Options options) {
       super(data, options);

   protected native JavaScriptObject createJso(Element parent) /*-{
       return new $;                
   public final void addOnMouseOverHandler(OnMouseOverHandler handler) {
       Handler.addHandler(this, "onmouseover", handler);
   public final void addOnMouseOutHandler(OnMouseOutHandler handler) {
       Handler.addHandler(this, "onmouseout", handler);

1 comment:

Jackson said...

Do you know how to get the selected cell upon selection event in a treemap, e.g. the 'getSelections()' method implementation?