Class: Igs::Pie::Chart

Inherits:
Object
  • Object
show all
Defined in:
lib/igs_pie_chart/chart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/igs_pie_chart/chart.rb', line 4

def data
  @data
end

#endomarginObject (readonly)

Returns the value of attribute endomargin.



4
5
6
# File 'lib/igs_pie_chart/chart.rb', line 4

def endomargin
  @endomargin
end

#sizeObject (readonly)

Returns the value of attribute size.



4
5
6
# File 'lib/igs_pie_chart/chart.rb', line 4

def size
  @size
end

#target_elementObject (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

#titleObject (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

#labelsObject



24
25
26
# File 'lib/igs_pie_chart/chart.rb', line 24

def labels
  return eval_erb('labels.html')
end

#renderObject



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

#scriptObject



16
17
18
# File 'lib/igs_pie_chart/chart.rb', line 16

def script
  return eval_erb('script.html')
end

#styleObject



20
21
22
# File 'lib/igs_pie_chart/chart.rb', line 20

def style
  return eval_erb('style.css')
end

#to_sObject



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