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.
true
Daru::View.plotting_library = :googlecharts
: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
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
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
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