Class: Igs::Pie::Chart
- Inherits:
-
Object
- Object
- Igs::Pie::Chart
- Defined in:
- lib/igs_pie_chart/chart.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#endomargin ⇒ Object
readonly
Returns the value of attribute endomargin.
-
#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, size, endomargin = 0, target_element = 'body', data) ⇒ Chart constructor
- #labels ⇒ Object
- #render ⇒ Object
- #script ⇒ Object
- #style ⇒ Object
- #to_s ⇒ Object
- #width=(width) ⇒ Object
Constructor Details
#initialize(title, size, endomargin = 0, target_element = 'body', data) ⇒ Chart
6 7 8 9 10 11 12 13 14 |
# File 'lib/igs_pie_chart/chart.rb', line 6 def initialize(title,size,endomargin=0,target_element='body',data) @title = title @size = size @endomargin = endomargin @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.
4 5 6 |
# File 'lib/igs_pie_chart/chart.rb', line 4 def data @data end |
#endomargin ⇒ Object (readonly)
Returns the value of attribute endomargin.
4 5 6 |
# File 'lib/igs_pie_chart/chart.rb', line 4 def endomargin @endomargin end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
4 5 6 |
# File 'lib/igs_pie_chart/chart.rb', line 4 def size @size end |
#target_element ⇒ Object (readonly)
Returns the value of attribute target_element.
4 5 6 |
# File 'lib/igs_pie_chart/chart.rb', line 4 def target_element @target_element end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/igs_pie_chart/chart.rb', line 4 def title @title end |
Instance Method Details
#height=(height) ⇒ Object
50 51 52 |
# File 'lib/igs_pie_chart/chart.rb', line 50 def height=(height) @height = height end |
#labels ⇒ Object
24 25 26 |
# File 'lib/igs_pie_chart/chart.rb', line 24 def labels return eval_erb('labels.html') end |
#render ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/igs_pie_chart/chart.rb', line 28 def render rendering = "<style>\n" rendering+= self.style rendering+= "</style>\n" rendering+= self.script rendering+= self.labels return rendering end |
#script ⇒ Object
16 17 18 |
# File 'lib/igs_pie_chart/chart.rb', line 16 def script return eval_erb('script.html') end |
#style ⇒ Object
20 21 22 |
# File 'lib/igs_pie_chart/chart.rb', line 20 def style return eval_erb('style.css') end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/igs_pie_chart/chart.rb', line 38 def to_s render end |
#width=(width) ⇒ Object
46 47 48 |
# File 'lib/igs_pie_chart/chart.rb', line 46 def width=(width) @width = width end |