In [1]:
require 'daru/view'
Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.

Install the mechanize gem version ~>2.7.5 for using mechanize functions.
Out[1]:
true
In [2]:
# used for creating table and charts
Daru::View.plotting_library = :googlecharts
Out[2]:
:googlecharts

Using Daru DataFrame

In [3]:
df = Daru::DataFrame.new({b: [11,12,13,14,15], a: [1,2,3,4,5],
      c: [11,22,33,44,55]},
      order: [:a, :b, :c],
      index: [:one, :two, :three, :four, :five])
Out[3]:
Daru::DataFrame(5x3)
a b c
one 1 11 11
two 2 12 22
three 3 13 33
four 4 14 44
five 5 15 55
In [4]:
t1 = Daru::View::Table.new(df)
Out[4]:
#<Daru::View::Table:0x00000003d65490 @data=#<Daru::DataFrame(5x3)>
           a     b     c
   one     1    11    11
   two     2    12    22
 three     3    13    33
  four     4    14    44
  five     5    15    55, @options={}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000003d653f0 @cols=[{:type=>"number", :label=>:a}, {:type=>"number", :label=>:b}, {:type=>"number", :label=>:c}], @rows=[[#<GoogleVisualr::DataTable::Cell:0x000000034ac470 @v=1, @type="number">, #<GoogleVisualr::DataTable::Cell:0x000000034ac3a8 @v=11, @type="number">, #<GoogleVisualr::DataTable::Cell:0x000000034ac290 @v=11, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x000000034ac128 @v=2, @type="number">, #<GoogleVisualr::DataTable::Cell:0x000000034ac060 @v=12, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73f90 @v=22, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003d73ea0 @v=3, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73e28 @v=13, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73db0 @v=33, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003d73cc0 @v=4, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73c48 @v=14, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73bd0 @v=44, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003d73ae0 @v=5, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d73a68 @v=15, @type="number">, #<GoogleVisualr::DataTable::Cell:0x00000003d739f0 @v=55, @type="number">]], @listeners=[], @options={}, @data=#<Daru::DataFrame(5x3)>
           a     b     c
   one     1    11    11
   two     2    12    22
 three     3    13    33
  four     4    14    44
  five     5    15    55, @user_options={}>>
In [5]:
t1.table.class
Out[5]:
GoogleVisualr::DataTable
In [6]:
t1.table.cols
Out[6]:
[{:type=>"number", :label=>:a}, {:type=>"number", :label=>:b}, {:type=>"number", :label=>:c}]
In [7]:
t1.class
Out[7]:
Daru::View::Table
In [8]:
t1.show_in_iruby
Out[8]:
In [9]:
t1.div
Out[9]:
"\n<div id='7584b250-894e-4caa-86a0-fb719790ebf8'></div>\n<script>\n\n  google.load('visualization', 1.0,  {packages: ['table'], callback: draw_7584b250_894e_4caa_86a0_fb719790ebf8});\n  function draw_7584b250_894e_4caa_86a0_fb719790ebf8() {\n    var data_table = new google.visualization.DataTable();data_table.addColumn({\"type\":\"number\",\"label\":\"a\"});data_table.addColumn({\"type\":\"number\",\"label\":\"b\"});data_table.addColumn({\"type\":\"number\",\"label\":\"c\"});data_table.addRow([{v: 1}, {v: 11}, {v: 11}]);data_table.addRow([{v: 2}, {v: 12}, {v: 22}]);data_table.addRow([{v: 3}, {v: 13}, {v: 33}]);data_table.addRow([{v: 4}, {v: 14}, {v: 44}]);data_table.addRow([{v: 5}, {v: 15}, {v: 55}]);\n    var table = new google.visualization.Table(document.getElementById('7584b250-894e-4caa-86a0-fb719790ebf8'));\n    table.draw(data_table, {}); \n  };\n</script>\n"
In [10]:
IRuby.html t1.div
Out[10]:
In [11]:
rows = [
  ['Mike',  {v: 10000, f: '$10,000'}, true],
  ['Jim',   {v:8000,   f: '$8,000'},  false],
  ['Alice', {v: 12500, f: '$12,500'}, true],
  ['Bob',   {v: 7000,  f: '$7,000'},  true]
]

df2 = Daru::DataFrame.rows(rows)
Out[11]:
Daru::DataFrame(4x3)
0 1 2
0 Mike {:v=>10000, :f=>"$10,000"} true
1 Jim {:v=>8000, :f=>"$8,000"} false
2 Alice {:v=>12500, :f=>"$12,500"} true
3 Bob {:v=>7000, :f=>"$7,000"} true
In [12]:
t2 = Daru::View::Table.new(df2)
Out[12]:
#<Daru::View::Table:0x00000003f65010 @data=#<Daru::DataFrame(4x3)>
                     0          1          2
          0       Mike {:v=>10000       true
          1        Jim {:v=>8000,      false
          2      Alice {:v=>12500       true
          3        Bob {:v=>7000,       true, @options={}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000003f64f98 @cols=[{:type=>"string", :label=>"0"}, {:type=>"number", :label=>"1"}, {:type=>"boolean", :label=>"2"}], @rows=[[#<GoogleVisualr::DataTable::Cell:0x00000003340118 @v="Mike", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000003340078 @v=10000, @type="number", @f="$10,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000003f73f70 @v=true, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x00000003f73ea8 @v="Jim", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000003f73e30 @v=8000, @type="number", @f="$8,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000003f73d90 @v=false, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x00000003f73cc8 @v="Alice", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000003f73c50 @v=12500, @type="number", @f="$12,500", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000003f73bb0 @v=true, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x00000003f73ae8 @v="Bob", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000003f73a70 @v=7000, @type="number", @f="$7,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000003f739d0 @v=true, @type="boolean">]], @listeners=[], @options={}, @data=#<Daru::DataFrame(4x3)>
                     0          1          2
          0       Mike {:v=>10000       true
          1        Jim {:v=>8000,      false
          2      Alice {:v=>12500       true
          3        Bob {:v=>7000,       true, @user_options={}>>
In [13]:
t2.show_in_iruby
Out[13]:
In [14]:
# adding pagination
opts_pagination = {
  showRowNumber: true, width: '100%', height: '100%' ,
  page: 'enable',
  pageSize: 2,
  pagingSymbols: {
    prev: 'prev',
    next: 'next'
  },
  pagingButtonsConfiguration: 'auto'}
Out[14]:
{:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}
In [15]:
t3 = Daru::View::Table.new(df2,opts_pagination)
Out[15]:
#<Daru::View::Table:0x00000002f3f2d0 @data=#<Daru::DataFrame(4x3)>
                     0          1          2
          0       Mike {:v=>10000       true
          1        Jim {:v=>8000,      false
          2      Alice {:v=>12500       true
          3        Bob {:v=>7000,       true, @options={:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000002f3f280 @cols=[{:type=>"string", :label=>"0"}, {:type=>"number", :label=>"1"}, {:type=>"boolean", :label=>"2"}], @rows=[[#<GoogleVisualr::DataTable::Cell:0x000000040355a8 @v="Mike", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000004035530 @v=10000, @type="number", @f="$10,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000004035490 @v=true, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x000000040353c8 @v="Jim", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000004035350 @v=8000, @type="number", @f="$8,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x000000040352b0 @v=false, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x000000040351e8 @v="Alice", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000004035170 @v=12500, @type="number", @f="$12,500", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x000000040350d0 @v=true, @type="boolean">], [#<GoogleVisualr::DataTable::Cell:0x00000004035008 @v="Bob", @type="string">, #<GoogleVisualr::DataTable::Cell:0x00000004034f90 @v=7000, @type="number", @f="$7,000", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000004034ef0 @v=true, @type="boolean">]], @listeners=[], @options={:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}, @data=#<Daru::DataFrame(4x3)>
                     0          1          2
          0       Mike {:v=>10000       true
          1        Jim {:v=>8000,      false
          2      Alice {:v=>12500       true
          3        Bob {:v=>7000,       true, @user_options={}>>
In [16]:
t3.show_in_iruby
Out[16]:
In [17]:
t3.class
Out[17]:
Daru::View::Table
In [18]:
t4 = Daru::View::Table.new([],opts_pagination)
Out[18]:
#<Daru::View::Table:0x00000004100a78 @data=[], @options={:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000004100a28 @cols=[], @rows=[], @listeners=[], @options={:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}, @data=[], @user_options={}>>
In [19]:
# users are free to use the Google charts features, by accessing the google chart table using `#table`
# Add Column Headers
t4.table.new_column('string', 'Year' )
t4.table.new_column('number', 'Sales')
t4.table.new_column('number', 'Expenses')
t4.table.new_column('number', 'Expenses2')

    # Add Rows and Values
t4.table.add_rows([
      ['2004', 1000, 400, 1111],
      ['2005', 1170, 460, 2111],
      ['2006', 660, 1120, 3111],
      ['2007', 1030, 540, 1112]
    ])
Out[19]:
[["2004", 1000, 400, 1111], ["2005", 1170, 460, 2111], ["2006", 660, 1120, 3111], ["2007", 1030, 540, 1112]]
In [20]:
t4.show_in_iruby
Out[20]:
In [21]:
opts = {
  cols: [
    {id: 'A', label: 'NEW A', type: 'string'},
    {id: 'B', label: 'B-label', type: 'number'},
    {id: 'C', label: 'C-label', type: 'date'}  
  ],
  rows: [
    {c:[
      {v: 'a'},
      {v: 1.0, f: 'One'},
      {:v => Date.parse('2008-1-28 00:31:26'), f: '2/28/08 12:31 AM'}
    ]},
    {c:[
      {v: 'b'},
      {v: 2.0, f: 'Two'},
      {:v =>Date.parse('2008-2-12 00:31:27'), f: '3/30/08 12:31 AM'}
    ]},
    {c:[
      {v: 'c'},
      {v: 3.0, f: 'Three'},
      {v: Date.parse('2008-3-30 00:31:26'), f: '4/30/08 12:31 AM'}
    ]}
  ]
}
Out[21]:
{:cols=>[{:id=>"A", :label=>"NEW A", :type=>"string"}, {:id=>"B", :label=>"B-label", :type=>"number"}, {:id=>"C", :label=>"C-label", :type=>"date"}], :rows=>[{:c=>[{:v=>"a"}, {:v=>1.0, :f=>"One"}, {:v=>#<Date: 2008-01-28 ((2454494j,0s,0n),+0s,2299161j)>, :f=>"2/28/08 12:31 AM"}]}, {:c=>[{:v=>"b"}, {:v=>2.0, :f=>"Two"}, {:v=>#<Date: 2008-02-12 ((2454509j,0s,0n),+0s,2299161j)>, :f=>"3/30/08 12:31 AM"}]}, {:c=>[{:v=>"c"}, {:v=>3.0, :f=>"Three"}, {:v=>#<Date: 2008-03-30 ((2454556j,0s,0n),+0s,2299161j)>, :f=>"4/30/08 12:31 AM"}]}]}
In [22]:
t_ops = Daru::View::Table.new([],opts)
Out[22]:
#<Daru::View::Table:0x0000000421c858 @data=[], @options={:cols=>[{:id=>"A", :label=>"NEW A", :type=>"string"}, {:id=>"B", :label=>"B-label", :type=>"number"}, {:id=>"C", :label=>"C-label", :type=>"date"}], :rows=>[{:c=>[{:v=>"a"}, {:v=>1.0, :f=>"One"}, {:v=>#<Date: 2008-01-28 ((2454494j,0s,0n),+0s,2299161j)>, :f=>"2/28/08 12:31 AM"}]}, {:c=>[{:v=>"b"}, {:v=>2.0, :f=>"Two"}, {:v=>#<Date: 2008-02-12 ((2454509j,0s,0n),+0s,2299161j)>, :f=>"3/30/08 12:31 AM"}]}, {:c=>[{:v=>"c"}, {:v=>3.0, :f=>"Three"}, {:v=>#<Date: 2008-03-30 ((2454556j,0s,0n),+0s,2299161j)>, :f=>"4/30/08 12:31 AM"}]}]}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x0000000421c808 @cols=[{:type=>"string", :label=>"NEW A", :id=>"A"}, {:type=>"number", :label=>"B-label", :id=>"B"}, {:type=>"date", :label=>"C-label", :id=>"C"}], @rows=[[#<GoogleVisualr::DataTable::Cell:0x0000000421c5d8 @v="a", @type="string", @f=nil, @p=nil>, #<GoogleVisualr::DataTable::Cell:0x0000000421c560 @v=1.0, @type="number", @f="One", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x0000000421c448 @v=#<Date: 2008-01-28 ((2454494j,0s,0n),+0s,2299161j)>, @type="date", @f="2/28/08 12:31 AM", @p=nil>], [#<GoogleVisualr::DataTable::Cell:0x0000000421c380 @v="b", @type="string", @f=nil, @p=nil>, #<GoogleVisualr::DataTable::Cell:0x0000000421c308 @v=2.0, @type="number", @f="Two", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x0000000421c1f0 @v=#<Date: 2008-02-12 ((2454509j,0s,0n),+0s,2299161j)>, @type="date", @f="3/30/08 12:31 AM", @p=nil>], [#<GoogleVisualr::DataTable::Cell:0x0000000421c128 @v="c", @type="string", @f=nil, @p=nil>, #<GoogleVisualr::DataTable::Cell:0x0000000421c0b0 @v=3.0, @type="number", @f="Three", @p=nil>, #<GoogleVisualr::DataTable::Cell:0x00000002c33460 @v=#<Date: 2008-03-30 ((2454556j,0s,0n),+0s,2299161j)>, @type="date", @f="4/30/08 12:31 AM", @p=nil>]], @listeners=[], @options={:cols=>[{:id=>"A", :label=>"NEW A", :type=>"string"}, {:id=>"B", :label=>"B-label", :type=>"number"}, {:id=>"C", :label=>"C-label", :type=>"date"}], :rows=>[{:c=>[{:v=>"a"}, {:v=>1.0, :f=>"One"}, {:v=>#<Date: 2008-01-28 ((2454494j,0s,0n),+0s,2299161j)>, :f=>"2/28/08 12:31 AM"}]}, {:c=>[{:v=>"b"}, {:v=>2.0, :f=>"Two"}, {:v=>#<Date: 2008-02-12 ((2454509j,0s,0n),+0s,2299161j)>, :f=>"3/30/08 12:31 AM"}]}, {:c=>[{:v=>"c"}, {:v=>3.0, :f=>"Three"}, {:v=>#<Date: 2008-03-30 ((2454556j,0s,0n),+0s,2299161j)>, :f=>"4/30/08 12:31 AM"}]}]}, @data=[], @user_options={}>>
In [23]:
t_ops.show_in_iruby # or t_ops.table
Out[23]:
In [24]:
t_update = Daru::View::Table.new
Out[24]:
#<Daru::View::Table:0x000000042655f8 @data=[], @options={}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000004265558 @cols=[], @rows=[], @listeners=[], @options={}, @data=[], @user_options={}>>
In [25]:
t_update.table.new_column(type= 'string', 'Employee Name');
t_update.table.new_column(type= 'date', 'Start Date');
Out[25]:
[{:type=>"string", :label=>"Employee Name"}, {:type=>"date", :label=>"Start Date"}]
In [26]:
t_update.table
Out[26]:
In [27]:
t_update.table.add_rows(6)
Out[27]:
6
In [28]:
t_update.table.set_cell(0, 0, 'Mike');
Out[28]:
#<GoogleVisualr::DataTable::Cell:0x00000004150938 @v="Mike", @type="string">
In [29]:
t_update.table.set_cell(0, 1, Date.parse('2008-1-28'));
t_update.table.set_cell(1, 0, 'Bob');
t_update.table.set_cell(1, 1, Date.parse('2007-5-1'));
t_update.table.set_cell(2, 0, 'Alice');
t_update.table.set_cell(2, 1, Date.parse('2006-7-16'));
t_update.table.set_cell(3, 0, 'Frank');
t_update.table.set_cell(3, 1, Date.parse('2007-11-28'));
t_update.table.set_cell(4, 0, 'Floyd');
t_update.table.set_cell(4, 1, Date.parse('2005-3-13'));
t_update.table.set_cell(5, 0, 'Fritz');
t_update.table.set_cell(5, 1, Date.parse('2007-9-2'));
Out[29]:
#<GoogleVisualr::DataTable::Cell:0x00000004102300 @v=#<Date: 2007-09-02 ((2454346j,0s,0n),+0s,2299161j)>, @type="date">
In [30]:
t_update.table
Out[30]:
In [31]:
t_update.table.get_column(0)
Out[31]:
["Mike", "Bob", "Alice", "Frank", "Floyd", "Fritz"]
In [32]:
t_update.table.get_row(0)
Out[32]:
["Mike", #<Date: 2008-01-28 ((2454494j,0s,0n),+0s,2299161j)>]
In [33]:
t_update.table.get_cell(3,0)
Out[33]:
"Frank"

Using Daru Vector

In [34]:
dv = Daru::Vector.new [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
t_vec = Daru::View::Table.new(dv)
Out[34]:
#<Daru::View::Table:0x00000003f7aff0 @data=#<Daru::Vector(8)>
      0  43934
      1  52503
      2  57177
      3  69658
      4  97031
      5 119931
      6 137133
      7 154175, @options={}, @user_options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#<GoogleVisualr::DataTable:0x00000003f7af78 @cols=[{:type=>"number", :label=>"Series"}], @rows=[[#<GoogleVisualr::DataTable::Cell:0x00000003f7aaf0 @v=43934, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7aa00 @v=52503, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a910 @v=57177, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a820 @v=69658, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a730 @v=97031, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a640 @v=119931, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a550 @v=137133, @type="number">], [#<GoogleVisualr::DataTable::Cell:0x00000003f7a460 @v=154175, @type="number">]], @listeners=[], @options={}, @data=#<Daru::Vector(8)>
      0  43934
      1  52503
      2  57177
      3  69658
      4  97031
      5 119931
      6 137133
      7 154175, @user_options={}>>
In [35]:
t_vec.table
Out[35]:
In [36]:
t_vec.table.options
Out[36]:
{}
In [37]:
# set new options in the table. This feature is not present in the basic google_visualr
t_vec.table.options = opts_pagination
Out[37]:
{:showRowNumber=>true, :width=>"100%", :height=>"100%", :page=>"enable", :pageSize=>2, :pagingSymbols=>{:prev=>"prev", :next=>"next"}, :pagingButtonsConfiguration=>"auto"}
In [38]:
t_vec.table
Out[38]:
In [39]:
# css styling
cssClassNames = {
    'headerRow': 'italic-darkblue-font large-font bold-font',
    'tableRow': '',
    'oddTableRow': 'beige-background',
    'selectedTableRow': 'orange-background large-font',
    'hoverTableRow': '',
    'headerCell': 'gold-border',
    'tableCell': '',
    'rowNumberCell': 'underline-blue-font'
  };
opts_css = {'showRowNumber': true, pageSize: 5, 'allowHtml': true, 'cssClassNames': cssClassNames};
Out[39]:
{:showRowNumber=>true, :pageSize=>5, :allowHtml=>true, :cssClassNames=>{:headerRow=>"italic-darkblue-font large-font bold-font", :tableRow=>"", :oddTableRow=>"beige-background", :selectedTableRow=>"orange-background large-font", :hoverTableRow=>"", :headerCell=>"gold-border", :tableCell=>"", :rowNumberCell=>"underline-blue-font"}}
In [40]:
t_vec.table.options = opts_css
Out[40]:
{:showRowNumber=>true, :pageSize=>5, :allowHtml=>true, :cssClassNames=>{:headerRow=>"italic-darkblue-font large-font bold-font", :tableRow=>"", :oddTableRow=>"beige-background", :selectedTableRow=>"orange-background large-font", :hoverTableRow=>"", :headerCell=>"gold-border", :tableCell=>"", :rowNumberCell=>"underline-blue-font"}}
In [41]:
# FixMe: css is not working. May be there is other way to pass cssClassName
t_vec.table
Out[41]:

Using option Hash

In [42]:
data = {
  cols: [{id: 'Name', label: 'Name', type: 'string'},
          {id: 'Salary', label: 'Salary', type: 'number'},
          {type: 'boolean', label: 'Full Time Employee' },
        ],
  rows: [
    {c:[{v: 'Mike'}, {v: 10000, f: '$10,000'}, {v: true}]},
    {c:[{v: 'Jim'}, {v:8000,   f: '$8,000'}, {v: false}]},
    {c:[{v: 'Alice'}, {v: 12500, f: '$12,500'}, {v: true}]},
    {c:[{v: 'Bob'}, {v: 7000,  f: '$7,000'}, {v: true}]},
    ]
  }
table = Daru::View::Table.new(data, {height: 300, width: 200})
table.show_in_iruby
Out[42]:

From Data Array (First row should be column vector for google data table)

In [43]:
data = [
  ['Galaxy', 'Distance', 'Brightness'],
          ['Canis Major Dwarf', 8000, 230.3],
          ['Sagittarius Dwarf', 24000, 4000.5],
          ['Ursa Major II Dwarf', 30000, 1412.3],
          ['Lg. Magellanic Cloud', 50000, 120.9],
          ['Bootes I', 60000, 1223.1]
  ]
table = Daru::View::Table.new(data)
table.show_in_iruby
Out[43]: