Module: PlotSimple::Charts
- Defined in:
- lib/plot_simple.rb
Instance Method Summary collapse
- #addCategory(tick, size, link) ⇒ Object
- #newBarChart ⇒ Object
- #renderXML(chart = nil) ⇒ Object
- #setBackgroundColor(color) ⇒ Object
- #setBackgroundImage(image) ⇒ Object
- #setBorderColor(color) ⇒ Object
- #setChartHeight(height) ⇒ Object
- #setChartWidth(width) ⇒ Object
- #setLineColor(color) ⇒ Object
- #setTitle(title) ⇒ Object
Instance Method Details
#addCategory(tick, size, link) ⇒ Object
38 39 40 41 42 |
# File 'lib/plot_simple.rb', line 38 def addCategory(tick,size,link) category = Hash[:tick=>tick,:bar_size=>size,:link=>link] @chart[:categories] << category @chart[:pointLabels] << size end |
#newBarChart ⇒ Object
4 5 6 7 8 9 |
# File 'lib/plot_simple.rb', line 4 def newBarChart @chart = Hash[] @chart.merge!(:categories=>[]) #following line is to avoid URLS from being shown for point labels @chart.merge!(:pointLabels=>[]) end |
#renderXML(chart = nil) ⇒ Object
44 45 46 47 |
# File 'lib/plot_simple.rb', line 44 def renderXML(chart = nil) chart ||= @chart render :partial=>"plot_simple/chartxml",:locals=>{:chart=>chart} end |
#setBackgroundColor(color) ⇒ Object
19 20 21 |
# File 'lib/plot_simple.rb', line 19 def setBackgroundColor(color) @chart.merge!(Hash[:background_color,color]) end |
#setBackgroundImage(image) ⇒ Object
15 16 17 |
# File 'lib/plot_simple.rb', line 15 def setBackgroundImage(image) @chart.merge!(Hash[:background_image,image]) end |
#setBorderColor(color) ⇒ Object
23 24 25 |
# File 'lib/plot_simple.rb', line 23 def setBorderColor(color) @chart.merge!(Hash[:border_color,color]) end |
#setChartHeight(height) ⇒ Object
34 35 36 |
# File 'lib/plot_simple.rb', line 34 def setChartHeight(height) @chart.merge!(Hash[:chart_height,height]) end |
#setChartWidth(width) ⇒ Object
30 31 32 |
# File 'lib/plot_simple.rb', line 30 def setChartWidth(width) @chart.merge!(Hash[:chart_width,width]) end |
#setLineColor(color) ⇒ Object
27 28 29 |
# File 'lib/plot_simple.rb', line 27 def setLineColor(color) @chart.merge!(Hash[:line_color,color]) end |
#setTitle(title) ⇒ Object
11 12 13 |
# File 'lib/plot_simple.rb', line 11 def setTitle(title) @chart.merge!(Hash[:title,title]) end |