Class: IgsPieChart
- Inherits:
-
Object
- Object
- IgsPieChart
- Defined in:
- lib/igs_pie_chart.rb
Instance Method Summary collapse
- #data=(data) ⇒ Object
- #height=(height) ⇒ Object
- #initialize(size, endomargin = 0, target_element = 'body', data) ⇒ IgsPieChart constructor
- #render ⇒ Object
- #to_s ⇒ Object
- #width=(width) ⇒ Object
Constructor Details
#initialize(size, endomargin = 0, target_element = 'body', data) ⇒ IgsPieChart
7 8 9 10 11 12 13 |
# File 'lib/igs_pie_chart.rb', line 7 def initialize(size,endomargin=0,target_element='body',data) @size = size @endomargin = endomargin @data = data.values @labels = data.keys @target_element = target_element end |
Instance Method Details
#data=(data) ⇒ Object
30 31 32 |
# File 'lib/igs_pie_chart.rb', line 30 def data=(data) @data=data end |
#height=(height) ⇒ Object
38 39 40 |
# File 'lib/igs_pie_chart.rb', line 38 def height=(height) @height = height end |
#render ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/igs_pie_chart.rb', line 15 def render begin path = File.("../../templates/pie_chart.html.erb", __FILE__) rendering = ERB.new(File.read(path)).result(binding) rescue Exception => e STDERR.puts "Erro ao renderizar JavaScript! #{e}" rendering = nil end return rendering end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/igs_pie_chart.rb', line 26 def to_s render end |
#width=(width) ⇒ Object
34 35 36 |
# File 'lib/igs_pie_chart.rb', line 34 def width=(width) @width = width end |