Gable.js - beta release, feedback requested

32 views
Skip to first unread message

Taylor Buley

unread,
Jan 30, 2012, 3:35:23 PM1/30/12
to google-visua...@googlegroups.com
I am fortunate enough to be able to work with the Google Visualization API frequently. I found myself writing similar code over and over and started to build out a wrapper library in my spare time.

The library is called Gable (G(oogle)+(T)able) and what it does is take semi-structured JavaScript objects and dumps them to a Google Table object literal or to CSV -- kind of like google.visualization.arrayToDataTable() but for objects of all types. 

It's meant to be really lightweight API, such that you can build Google visualizations in one line of JS. Examples are here: http://editor.github.com/Gable/#examples

For example, a pie chart looks like this (source: ):

Gable( 'food_data_pie' )
.add( {
    value: [
{ 'Food': 'Apple Pie', 'kCal': 405 }
, [ 'Beer, Light', 95 ]
, [ 'Carrots, Raw, Whole', 30 ]
, [ 'Doughnuts, Cake Type, Plain', 210 ]
, [ 'Enchilada', 235 ]
, [ 'Froot Loops Cereal', 110 ]
, [ 'Grape Soda', 180 ]
, [ 'Hamburger, 4oz Patty', 445 ]
    ], meta: {
        title: 'USDA Nutrient Database'
  }
} )
.draw( {
    target: 'example4'
  , type: 'pie'
  , meta: {
      backgroundColor: '#FDF6E3'
      , height: 400
      , series: [ { color: '#586E75' }, { color: '#EEE8D5' } ]
      , legend: { position: 'bottom', textStyle: { color: 'black', fontSize: 16 } }
    }
} );

I've cross-browser tested it and am getting ready to put it into production use where I work. Before that point, I'm planning to release the code under a dual MIT/GPL license so a wider software community can enjoy the work.  


Check it out and let me know how it could be improved, or just submit a pull request on Github. I've benefitted greatly from the Visualization API and I'd love to help spur adoption of this wonderful library.

Best,
Taylor
Reply all
Reply to author
Forward
0 new messages