{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\n", "Install the spreadsheet gem version ~>1.1.1 for using spreadsheet functions.\n", "\n", "Install the mechanize gem version ~>2.7.5 for using mechanize functions.\n" ] }, { "data": { "text/plain": [ "true" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "require 'daru/view'" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "application/javascript": [ "\n", " /* BEGIN google_visualr.js */\n", "\n", "if(!window['googleLT_']){window['googleLT_']=(new Date()).getTime();}if (!window['google']) {\n", "window['google'] = {};\n", "}\n", "if (!window['google']['loader']) {\n", "window['google']['loader'] = {};\n", "google.loader.ServiceBase = 'https://www.google.com/uds';\n", "google.loader.GoogleApisBase = 'https://ajax.googleapis.com/ajax';\n", "google.loader.ApiKey = 'notsupplied';\n", "google.loader.KeyVerified = true;\n", "google.loader.LoadFailure = false;\n", "google.loader.Secure = true;\n", "google.loader.GoogleLocale = 'www.google.com';\n", "google.loader.ClientLocation = null;\n", "google.loader.AdditionalParams = '';\n", "(function() {function g(a){return a in l?l[a]:l[a]=-1!=navigator.userAgent.toLowerCase().indexOf(a)}var l={};function m(a,b){var c=function(){};c.prototype=b.prototype;a.ca=b.prototype;a.prototype=new c}function n(a,b,c){var d=Array.prototype.slice.call(arguments,2)||[];return function(){return a.apply(b,d.concat(Array.prototype.slice.call(arguments)))}}function p(a){a=Error(a);a.toString=function(){return this.message};return a}\n", "function q(a,b){a=a.split(/\\./);for(var c=window,d=0;d\\x3c/script>\"):(g(\"safari\")||g(\"konqueror\"))&&window.setTimeout(B,10)),x.push(a)):y(window,\"load\",a)};t(\"google.setOnLoadCallback\",google.ba);\n", "function y(a,b,c){if(a.addEventListener)a.addEventListener(b,c,!1);else if(a.attachEvent)a.attachEvent(\"on\"+b,c);else{var d=a[\"on\"+b];a[\"on\"+b]=null!=d?C([c,d]):c}}function C(a){return function(){for(var b=0;b\\x3c/script>'):\"css\"==a&&document.write('')};\n", "t(\"google.loader.writeLoadTag\",google.loader.f);google.loader.Z=function(a){w=a};t(\"google.loader.rfm\",google.loader.Z);google.loader.aa=function(a){for(var b in a)\"string\"==typeof b&&b&&\":\"==b.charAt(0)&&!v[b]&&(v[b]=new E(b.substring(1),a[b]))};t(\"google.loader.rpl\",google.loader.aa);google.loader.$=function(a){if((a=a.specs)&&a.length)for(var b=0;b\\x3c/script>')},K.Hi=function(b){var c=K.global.document,d=c.createElement(\"script\");d.type=C;d.src=b;d.defer=!1;d.async=!1;c.head.appendChild(d)},\n", "K.Ql=function(b,c){if(K.og()){var d=K.global.document;if(!K.Fe&&d.readyState==t){if(/\\bdeps.js$/.test(b))return!1;throw Error('Cannot write \"'+b+'\" after document load');}void 0===c?K.$h?(K.Zg=!0,c=\" onreadystatechange='goog.onScriptLoad_(this, \"+ ++K.Ng+\")' \",d.write(n+b+'\"'+c+\">\\x3c/script>\")):K.Fe?K.Hi(b):K.Pl(b):d.write('\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t1.show_in_iruby" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t1.div" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "IRuby.html t1.div" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n", " \n", "
Daru::DataFrame(4x3)
012
0Mike{:v=>10000, :f=>\"$10,000\"}true
1Jim{:v=>8000, :f=>\"$8,000\"}false
2Alice{:v=>12500, :f=>\"$12,500\"}true
3Bob{:v=>7000, :f=>\"$7,000\"}true
" ], "text/plain": [ "#\n", " 0 1 2\n", " 0 Mike {:v=>10000 true\n", " 1 Jim {:v=>8000, false\n", " 2 Alice {:v=>12500 true\n", " 3 Bob {:v=>7000, true" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rows = [\n", " ['Mike', {v: 10000, f: '$10,000'}, true],\n", " ['Jim', {v:8000, f: '$8,000'}, false],\n", " ['Alice', {v: 12500, f: '$12,500'}, true],\n", " ['Bob', {v: 7000, f: '$7,000'}, true]\n", "]\n", "\n", "df2 = Daru::DataFrame.rows(rows)\n" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#\n", " 0 1 2\n", " 0 Mike {:v=>10000 true\n", " 1 Jim {:v=>8000, false\n", " 2 Alice {:v=>12500 true\n", " 3 Bob {:v=>7000, true, @options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#\"string\", :label=>\"0\"}, {:type=>\"number\", :label=>\"1\"}, {:type=>\"boolean\", :label=>\"2\"}], @rows=[[#, #, #], [#, #, #], [#, #, #], [#, #, #]], @options={}>>" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t2 = Daru::View::Table.new(df2)" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t2.show_in_iruby" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{:showRowNumber=>true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# adding pagination\n", "opts_pagination = {\n", " showRowNumber: true, width: '100%', height: '100%' ,\n", " page: 'enable',\n", " pageSize: 2,\n", " pagingSymbols: {\n", " prev: 'prev',\n", " next: 'next'\n", " },\n", " pagingButtonsConfiguration: 'auto'}" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#\n", " 0 1 2\n", " 0 Mike {:v=>10000 true\n", " 1 Jim {:v=>8000, false\n", " 2 Alice {:v=>12500 true\n", " 3 Bob {:v=>7000, true, @options={:showRowNumber=>true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#\"string\", :label=>\"0\"}, {:type=>\"number\", :label=>\"1\"}, {:type=>\"boolean\", :label=>\"2\"}], @rows=[[#, #, #], [#, #, #], [#, #, #], [#, #, #]], @options={:showRowNumber=>true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}>>" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t3 = Daru::View::Table.new(df2,opts)" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t3.show_in_iruby" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Daru::View::Table" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t3.class" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}>>" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t4 = Daru::View::Table.new([],opts)" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[[\"2004\", 1000, 400, 1111], [\"2005\", 1170, 460, 2111], [\"2006\", 660, 1120, 3111], [\"2007\", 1030, 540, 1112]]" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# users are free to use the Google charts features, by accessing the google chart table using `#table`\n", "# Add Column Headers\n", "t4.table.new_column('string', 'Year' )\n", "t4.table.new_column('number', 'Sales')\n", "t4.table.new_column('number', 'Expenses')\n", "t4.table.new_column('number', 'Expenses2')\n", "\n", " # Add Rows and Values\n", "t4.table.add_rows([\n", " ['2004', 1000, 400, 1111],\n", " ['2005', 1170, 460, 2111],\n", " ['2006', 660, 1120, 3111],\n", " ['2007', 1030, 540, 1112]\n", " ])" ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t4.show_in_iruby" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{: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=>#, :f=>\"2/28/08 12:31 AM\"}]}, {:c=>[{:v=>\"b\"}, {:v=>2.0, :f=>\"Two\"}, {:v=>#, :f=>\"3/30/08 12:31 AM\"}]}, {:c=>[{:v=>\"c\"}, {:v=>3.0, :f=>\"Three\"}, {:v=>#, :f=>\"4/30/08 12:31 AM\"}]}]}" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "opts = {\n", " cols: [\n", " {id: 'A', label: 'NEW A', type: 'string'},\n", " {id: 'B', label: 'B-label', type: 'number'},\n", " {id: 'C', label: 'C-label', type: 'date'} \n", " ],\n", " rows: [\n", " {c:[\n", " {v: 'a'},\n", " {v: 1.0, f: 'One'},\n", " {:v => Date.parse('2008-1-28 00:31:26'), f: '2/28/08 12:31 AM'}\n", " ]},\n", " {c:[\n", " {v: 'b'},\n", " {v: 2.0, f: 'Two'},\n", " {:v =>Date.parse('2008-2-12 00:31:27'), f: '3/30/08 12:31 AM'}\n", " ]},\n", " {c:[\n", " {v: 'c'},\n", " {v: 3.0, f: 'Three'},\n", " {v: Date.parse('2008-3-30 00:31:26'), f: '4/30/08 12:31 AM'}\n", " ]}\n", " ]\n", "}" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#[{: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=>#, :f=>\"2/28/08 12:31 AM\"}]}, {:c=>[{:v=>\"b\"}, {:v=>2.0, :f=>\"Two\"}, {:v=>#, :f=>\"3/30/08 12:31 AM\"}]}, {:c=>[{:v=>\"c\"}, {:v=>3.0, :f=>\"Three\"}, {:v=>#, :f=>\"4/30/08 12:31 AM\"}]}]}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#\"string\", :label=>\"NEW A\", :id=>\"A\"}, {:type=>\"number\", :label=>\"B-label\", :id=>\"B\"}, {:type=>\"date\", :label=>\"C-label\", :id=>\"C\"}], @rows=[[#, #, #, @type=\"date\", @f=\"2/28/08 12:31 AM\", @p=nil>], [#, #, #, @type=\"date\", @f=\"3/30/08 12:31 AM\", @p=nil>], [#, #, #, @type=\"date\", @f=\"4/30/08 12:31 AM\", @p=nil>]], @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=>#, :f=>\"2/28/08 12:31 AM\"}]}, {:c=>[{:v=>\"b\"}, {:v=>2.0, :f=>\"Two\"}, {:v=>#, :f=>\"3/30/08 12:31 AM\"}]}, {:c=>[{:v=>\"c\"}, {:v=>3.0, :f=>\"Three\"}, {:v=>#, :f=>\"4/30/08 12:31 AM\"}]}]}>>" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_ops = Daru::View::Table.new([],opts)" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "\"
\\n\\n\"" ] }, "execution_count": 23, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_ops.show_in_iruby # or t_ops.table" ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#>" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update = Daru::View::Table.new" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[{:type=>\"string\", :label=>\"Employee Name\"}, {:type=>\"date\", :label=>\"Start Date\"}]" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.new_column(type= 'string', 'Employee Name');\n", "t_update.table.new_column(type= 'date', 'Start Date');" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "#\"string\", :label=>\"Employee Name\"}, {:type=>\"date\", :label=>\"Start Date\"}], @rows=[], @options={}>" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "6" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.add_rows(6)\n" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.set_cell(0, 0, 'Mike');\n" ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#, @type=\"date\">" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.set_cell(0, 1, Date.parse('2008-1-28'));\n", "t_update.table.set_cell(1, 0, 'Bob');\n", "t_update.table.set_cell(1, 1, Date.parse('2007-5-1'));\n", "t_update.table.set_cell(2, 0, 'Alice');\n", "t_update.table.set_cell(2, 1, Date.parse('2006-7-16'));\n", "t_update.table.set_cell(3, 0, 'Frank');\n", "t_update.table.set_cell(3, 1, Date.parse('2007-11-28'));\n", "t_update.table.set_cell(4, 0, 'Floyd');\n", "t_update.table.set_cell(4, 1, Date.parse('2005-3-13'));\n", "t_update.table.set_cell(5, 0, 'Fritz');\n", "t_update.table.set_cell(5, 1, Date.parse('2007-9-2'));" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "#\"string\", :label=>\"Employee Name\"}, {:type=>\"date\", :label=>\"Start Date\"}], @rows=[[#, #, @type=\"date\">], [#, #, @type=\"date\">], [#, #, @type=\"date\">], [#, #, @type=\"date\">], [#, #, @type=\"date\">], [#, #, @type=\"date\">]], @options={}>" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[\"Mike\", \"Bob\", \"Alice\", \"Frank\", \"Floyd\", \"Fritz\"]" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.get_column(0)" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[\"Mike\", #]" ] }, "execution_count": 32, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.get_row(0)" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "\"Frank\"" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_update.table.get_cell(3,0)" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "#\n", " 0 43934\n", " 1 52503\n", " 2 57177\n", " 3 69658\n", " 4 97031\n", " 5 119931\n", " 6 137133\n", " 7 154175, @options={}, @adapter=Daru::View::Adapter::GooglechartsAdapter, @table=#\"number\", :label=>\"Series\"}], @rows=[[#], [#], [#], [#], [#], [#], [#], [#]], @options={}>>" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dv = Daru::Vector.new [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]\n", "t_vec = Daru::View::Table.new(dv)" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "#\"number\", :label=>\"Series\"}], @rows=[[#], [#], [#], [#], [#], [#], [#], [#]], @options={}>" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_vec.table" ] }, { "cell_type": "code", "execution_count": 36, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{}" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_vec.table.options" ] }, { "cell_type": "code", "execution_count": 44, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{:showRowNumber=>true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# set new options in the table. This feature is not present in the basic google_visualr\n", "t_vec.table.options = opts_pagination" ] }, { "cell_type": "code", "execution_count": 45, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "#\"number\", :label=>\"Series\"}], @rows=[[#], [#], [#], [#], [#], [#], [#], [#]], @options={:showRowNumber=>true, :width=>\"100%\", :height=>\"100%\", :page=>\"enable\", :pageSize=>2, :pagingSymbols=>{:prev=>\"prev\", :next=>\"next\"}, :pagingButtonsConfiguration=>\"auto\"}>" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_vec.table" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{: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\"}}" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# css styling\n", "cssClassNames = {\n", " 'headerRow': 'italic-darkblue-font large-font bold-font',\n", " 'tableRow': '',\n", " 'oddTableRow': 'beige-background',\n", " 'selectedTableRow': 'orange-background large-font',\n", " 'hoverTableRow': '',\n", " 'headerCell': 'gold-border',\n", " 'tableCell': '',\n", " 'rowNumberCell': 'underline-blue-font'\n", " };\n", "opts_css = {'showRowNumber': true, pageSize: 5, 'allowHtml': true, 'cssClassNames': cssClassNames};\n" ] }, { "cell_type": "code", "execution_count": 70, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{: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\"}}" ] }, "execution_count": 70, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t_vec.table.options = opts_css" ] }, { "cell_type": "code", "execution_count": 71, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n" ], "text/plain": [ "#\"number\", :label=>\"Series\"}], @rows=[[#], [#], [#], [#], [#], [#], [#], [#]], @options={: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\"}}>" ] }, "execution_count": 71, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# FixMe: css is not working. May be there is other way to pass cssClassName\n", "t_vec.table" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Ruby 2.3.1", "language": "ruby", "name": "ruby" }, "language_info": { "file_extension": ".rb", "mimetype": "application/x-ruby", "name": "ruby", "version": "2.3.1" } }, "nbformat": 4, "nbformat_minor": 2 }