Candlestick chart is typically used to illustrate movements in the price of a financial instrument over time. This chart is also popular by the name "ohlc chart". That's why you can call it with ohlc_chart too.
So, here's how you make it.
Given:
<%
require 'date'
def candlestick_data
@acc = rand(6570..6650)
60.times.map {|i| [Date.today - 60 + i, ohlc] }.to_h
end
def ohlc
open = @acc + rand(-20..20)
high = open + rand(0..100)
low = open - rand(0..100)
@acc = close = open + rand(-((high-low)/3)..((high-low)/2))
[open, high, low, close]
end
candlestick_options = {
plot_options: {
candlestick: {
colors: {
upward: '#3C90EB',
downward: '#DF7D46'
}
}
}
}
%>