Module: RailsCharts::Helpers
- Defined in:
- lib/rails_charts/helpers.rb
Instance Method Summary collapse
- #area_chart(data, options = {}) ⇒ Object
- #bar_chart(data, options = {}) ⇒ Object
- #calendar_chart(data, options = {}) ⇒ Object
- #candlestick_chart(data, options = {}) ⇒ Object
- #custom_chart(options = {}) ⇒ Object
- #donut_chart(data, options = {}) ⇒ Object
- #funnel_chart(data, options = {}) ⇒ Object
- #gauge_chart(data, options = {}) ⇒ Object
- #generate_rails_chart(klass, data, options = {}) ⇒ Object
- #line_chart(data, options = {}) ⇒ Object
- #parallel_chart(data, options = {}) ⇒ Object
- #pie_chart(data, options = {}) ⇒ Object
- #radar_chart(data, options = {}) ⇒ Object
- #sankey_chart(data, options = {}) ⇒ Object
- #scatter_chart(data, options = {}) ⇒ Object
- #stacked_bar_chart(data, options = {}) ⇒ Object
Instance Method Details
#area_chart(data, options = {}) ⇒ Object
39 40 41 |
# File 'lib/rails_charts/helpers.rb', line 39 def area_chart(data, = {}) generate_rails_chart AreaChart, data, end |
#bar_chart(data, options = {}) ⇒ Object
11 12 13 |
# File 'lib/rails_charts/helpers.rb', line 11 def (data, = {}) generate_rails_chart BarChart, data, end |
#calendar_chart(data, options = {}) ⇒ Object
47 48 49 |
# File 'lib/rails_charts/helpers.rb', line 47 def calendar_chart(data, = {}) generate_rails_chart CalendarChart, data, end |
#candlestick_chart(data, options = {}) ⇒ Object
59 60 61 |
# File 'lib/rails_charts/helpers.rb', line 59 def candlestick_chart(data, = {}) generate_rails_chart CandlestickChart, data, end |
#custom_chart(options = {}) ⇒ Object
63 64 65 |
# File 'lib/rails_charts/helpers.rb', line 63 def custom_chart( = {}) generate_rails_chart CustomChart, [], end |
#donut_chart(data, options = {}) ⇒ Object
31 32 33 |
# File 'lib/rails_charts/helpers.rb', line 31 def donut_chart(data, = {}) generate_rails_chart DonutChart, data, end |
#funnel_chart(data, options = {}) ⇒ Object
51 52 53 |
# File 'lib/rails_charts/helpers.rb', line 51 def funnel_chart(data, = {}) generate_rails_chart FunnelChart, data, end |
#gauge_chart(data, options = {}) ⇒ Object
55 56 57 |
# File 'lib/rails_charts/helpers.rb', line 55 def gauge_chart(data, = {}) generate_rails_chart GaugeChart, data, end |
#generate_rails_chart(klass, data, options = {}) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/rails_charts/helpers.rb', line 67 def generate_rails_chart(klass, data, = {}) klass = klass.new(data, ) if [:code] tag.textarea(row: 20, cols: 80, style: 'width: 100%; height: 300px') do klass.js_code end else # tag.pre(debug(data.inspect)) + # tag.textarea(row: 20, cols: 80, style: 'width: 100%; height: 300px') do # klass.js_code # end + raw(klass.js_code) end end |
#line_chart(data, options = {}) ⇒ Object
7 8 9 |
# File 'lib/rails_charts/helpers.rb', line 7 def line_chart(data, = {}) generate_rails_chart LineChart, data, end |
#parallel_chart(data, options = {}) ⇒ Object
27 28 29 |
# File 'lib/rails_charts/helpers.rb', line 27 def parallel_chart(data, = {}) generate_rails_chart ParallelChart, data, end |
#pie_chart(data, options = {}) ⇒ Object
19 20 21 |
# File 'lib/rails_charts/helpers.rb', line 19 def pie_chart(data, = {}) generate_rails_chart PieChart, data, end |
#radar_chart(data, options = {}) ⇒ Object
43 44 45 |
# File 'lib/rails_charts/helpers.rb', line 43 def radar_chart(data, = {}) generate_rails_chart RadarChart, data, end |
#sankey_chart(data, options = {}) ⇒ Object
35 36 37 |
# File 'lib/rails_charts/helpers.rb', line 35 def sankey_chart(data, = {}) generate_rails_chart SankeyChart, data, end |
#scatter_chart(data, options = {}) ⇒ Object
23 24 25 |
# File 'lib/rails_charts/helpers.rb', line 23 def scatter_chart(data, = {}) generate_rails_chart ScatterChart, data, end |
#stacked_bar_chart(data, options = {}) ⇒ Object
15 16 17 |
# File 'lib/rails_charts/helpers.rb', line 15 def (data, = {}) generate_rails_chart StackedBarChart, data, end |