require 'daru/view' Daru::View.plotting_library = :googlecharts data = [ ['Year', 'Sales', 'Expenses'], ['2013', 1000, 400], ['2014', 1170, 460], ['2015', 660, 1120], ['2016', 1030, 540] ] area_chart_table = Daru::View::Table.new(data) area_chart_table.show_in_iruby area_chart_options = { type: :area } area_chart_chart = Daru::View::Plot.new(area_chart_table.table, area_chart_options) area_chart_chart.show_in_iruby # Try to run this cell after uncommenting the below line to export this chart in png format # area_chart_chart.export area_chart_options = { title: 'Company Performance', hAxis: {title: 'Year', titleTextStyle: {color: '#333'}}, vAxis: {minValue: 0}, type: :area } area_chart_chart = Daru::View::Plot.new(area_chart_table.table, area_chart_options) area_chart_chart.show_in_iruby # Try to run this cell after uncommenting the below line to export this chart in png format # area_chart_chart.export('png') area_chart_options = { isStacked: true, height: 300, legend: {position: 'top', maxLines: 3}, vAxis: {minValue: 0}, type: :area } area_chart_chart = Daru::View::Plot.new(area_chart_table.table, area_chart_options) area_chart_chart.show_in_iruby # Try to run this cell after uncommenting the below line to export this chart in png format with file name as 'daru' # area_chart_chart.export('png', 'daru') area_chart_options = { isStacked: 'relative', height: 300, legend: {position: 'top', maxLines: 3}, vAxis: { minValue: 0, ticks: [0, 0.3, 0.6, 0.9, 1] }, type: :area } area_chart_chart = Daru::View::Plot.new(area_chart_table.table, area_chart_options) area_chart_chart.show_in_iruby