Class: Igs::BarChart
- Inherits:
-
Object
- Object
- Igs::BarChart
- Defined in:
- lib/igs_bar_chart/bar_chart.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#target_element ⇒ Object
readonly
Returns the value of attribute target_element.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #height=(height) ⇒ Object
- #initialize(title, width, height, target_element = 'body', data) ⇒ BarChart constructor
- #labels ⇒ Object
- #render ⇒ Object
- #script ⇒ Object
- #style ⇒ Object
- #to_s ⇒ Object
- #width=(width) ⇒ Object
Constructor Details
#initialize(title, width, height, target_element = 'body', data) ⇒ BarChart
4 5 6 7 8 9 10 11 12 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 4 def initialize(title,width,height,target_element='body',data) @title = title @width = width @height = height @data = data.values @labels = data.keys @target_element = target_element @default_attribution=false end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
2 3 4 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 2 def data @data end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
2 3 4 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 2 def size @size end |
#target_element ⇒ Object (readonly)
Returns the value of attribute target_element.
2 3 4 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 2 def target_element @target_element end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
2 3 4 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 2 def title @title end |
Instance Method Details
#height=(height) ⇒ Object
48 49 50 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 48 def height=(height) @height = height end |
#labels ⇒ Object
22 23 24 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 22 def labels return eval_erb('labels.html') end |
#render ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 26 def render rendering = "<style>\n" rendering+= self.style rendering+= "</style>\n" rendering+= self.script #rendering+= self.labels return rendering end |
#script ⇒ Object
14 15 16 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 14 def script return eval_erb('script.html') end |
#style ⇒ Object
18 19 20 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 18 def style return eval_erb('style.css') end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 36 def to_s render end |
#width=(width) ⇒ Object
44 45 46 |
# File 'lib/igs_bar_chart/bar_chart.rb', line 44 def width=(width) @width = width end |