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_rows = [
['Mon', 20, 28, 38, 45],
['Tue', 31, 38, 55, 66],
['Wed', 50, 55, 77, 80],
['Thu', 77, 77, 66, 50],
['Fri', 68, 66, 22, 15]
]
df_Candlestick = Daru::DataFrame.rows(data_rows)
df_Candlestick
0 | 1 | 2 | 3 | 4 | |
---|---|---|---|---|---|
0 | Mon | 20 | 28 | 38 | 45 |
1 | Tue | 31 | 38 | 55 | 66 |
2 | Wed | 50 | 55 | 77 | 80 |
3 | Thu | 77 | 77 | 66 | 50 |
4 | Fri | 68 | 66 | 22 | 15 |
candlestick_chart = Daru::View::Plot.new(df_Candlestick, type: :candlestick, height: 500)
candlestick_chart.show_in_iruby
opts = {
type: :candlestick, height: 500,
legend: 'none',
bar: { groupWidth: '100%' }, # Remove space between bars.
candlestick: {
fallingColor: { strokeWidth: 0, fill: '#a52714' }, # red
risingColor: { strokeWidth: 0, fill: '#0f9d58' } # green
}
}
waterfall_chart = Daru::View::Plot.new(df_Candlestick, opts)
waterfall_chart.show_in_iruby