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]:
Daru::View.dependent_scripts(['nyaplot', 'highcharts', 'googlecharts'])
Out[2]:
["nyaplot", "highcharts", "googlecharts"]
In [3]:
# line chart : inverted axis
opts = {
  chart:  {
          type: 'spline',
          inverted: true
      },
  title: {
      text: 'Atmosphere Temperature by Altitude'
  },
  subtitle: {
      text: 'According to the Standard Atmosphere Model'
  },
  adapter: :highcharts
}

data = [[0, 15], [10, -50], [20, -56.5], [30, -46.5], [40, -22.1],
              [50, -2.5], [60, -27.7], [70, -55.7], [80, -76.5]]
line_6 = Daru::View::Plot.new(data, opts)
line_6.show_in_iruby
Out[3]:
In [4]:
line_basic_options = {
  title: 'Atmosphere Temperature by Altitude',
   curveType: 'function',
  legend: { position: 'bottom' },
  adapter: :googlecharts
}
# We can pass dataframe/vector/data array/ google datatable or Daru-view Table  as data source
line_basic_chart = Daru::View::Plot.new(data, line_basic_options)
line_basic_chart.show_in_iruby
Out[4]:
In [5]:
dv = Daru::Vector.new [:a, :a, :a, :b, :b, :c], type: :category
bar_graph2_frac = Daru::View::Plot.new(dv, type: :bar, method: :fraction, adapter: :nyaplot)
bar_graph2_frac.chart.y_label 'Fraction'
bar_graph2_frac.show_in_iruby