require 'daru/view' Daru::View.plotting_library = :googlecharts line1 = Daru::View::Plot.new([]) line1.class line1.show_in_iruby time_popularity = [ [0, 0], [1, 10], [2, 23], [3, 17], [4, 18], [5, 9], [6, 11], [7, 27], [8, 33], [9, 40], [10, 32], [11, 35], [12, 30], [13, 40], [14, 42], [15, 47], [16, 44], [17, 48], [18, 52], [19, 54], [20, 42], [21, 55], [22, 56], [23, 57], [24, 60], [25, 50], [26, 52], [27, 51], [28, 49], [29, 53], [30, 55], [31, 60], [32, 61], [33, 59], [34, 62], [35, 65], [36, 62], [37, 58], [38, 55], [39, 61], [40, 64], [41, 65], [42, 63], [43, 66], [44, 67], [45, 69], [46, 69], [47, 70], [48, 72], [49, 68], [50, 66], [51, 65], [52, 67], [53, 70], [54, 71], [55, 72], [56, 73], [57, 75], [58, 70], [59, 68], [60, 64], [61, 60], [62, 65], [63, 67], [64, 68], [65, 69], [66, 70], [67, 72], [68, 75], [69, 80] ] df_tp = Daru::DataFrame.rows(time_popularity) line_dv = Daru::View::Plot.new(df_tp) line_dv.chart line_dv.chart.data_table line_dv.chart.data_table.options = {pageSize: 10} line_dv.chart.data_table p line_dv.chart.options line_dv.chart.options = { hAxis: { title: 'Time' }, vAxis: { title: 'Popularity' } } line_dv.show_in_iruby # dataframe `df_tp` column name is default (df_tp.vectors is 0, 1) . Let's update it. line_dv.chart.data_table.cols[0] = {type: 'number',label: 'X'} line_dv.chart.data_table.cols[1] = {type: 'number', label: 'Dogs'} line_dv.show_in_iruby city = Daru::Vector.new(['New York City, NY','Los Angeles, CA','Chicago, IL', 'Houston, TX', 'Philadelphia, PA'], name: 'city') population = Daru::Vector.new([ 8175000, 3792000,2695000,2099000, 1526000], name: '2010 Population') df_population_us_city = Daru::DataFrame.new(city: city, population: population) line_basic = Daru::View::Plot.new(df_population_us_city) line_basic.chart bar_basic = Daru::View::Plot.new(df_population_us_city, type: :bar) bar_basic.show_in_iruby options = { title: 'Population of Largest U.S. Cities', chartArea: {width: '50%'}, hAxis: { title: 'Total Population', minValue: 0 }, vAxis: { title: 'City' } }; bar_basic.chart.options= options bar_basic.chart bar_basic.chart.options[:pageSize] = 3 bar_basic.show_in_iruby # or bar_basic.chart bar_basic.chart.options lang = Daru::Vector.new(['Assamese', 'Bengali','Bodo','Dogri', 'Gujarati', 'Hindi','Kannada', 'Kashmiri', 'Konkani','Maithili', 'Malayalam', 'Manipuri','Marathi', 'Nepali', 'Oriya','Punjabi', 'Sanskrit', 'Santhali', 'Sindhi', 'Tamil', 'Telugu','Urdu'] , name: 'Language') speakers = Daru::Vector.new([13, 83, 1.4, 2.3, 46, 300, 38, 5.5, 5, 20, 33, 1.5, 72, 2.9,33,29, 0.01, 6.5,2.5, 61, 74, 52] , name: 'Speakers (in millions)') df_lang = Daru::DataFrame.new(lang: lang, speakers: speakers) t_lang = Daru::View::Table.new(df_lang, {pageSize: 5}) t_lang.show_in_iruby pie_lang = Daru::View::Plot.new(t_lang.table, {type: :pie, title: 'Indian Language Use', width: 800, height: 700}) pie_lang.show_in_iruby # add/update new options # there are a lot of options and configuration we can do in google pie charts # refere : https://developers.google.com/chart/interactive/docs/gallery/piechart pie_lang.chart.options[:is3D] = true pie_lang.show_in_iruby