Class: GoogleChart::PieChart

Inherits:
Base
  • Object
show all
Defined in:
lib/google_chart/pie_chart.rb

Constant Summary

Constants inherited from Base

Base::BASE_URL, Base::COMPLEX_ENCODING_ALPHABET, Base::DEFAULT_LINE_STYLE, Base::SHAPE_MARKERS, Base::SIMPLE_ENCODING

Instance Attribute Summary collapse

Attributes inherited from Base

#chart_size, #chart_title, #chart_type, #data_encoding, #params, #show_legend, #title_color, #title_font_size

Instance Method Summary collapse

Methods inherited from Base

#axis, #data, #fill, #fill_area, #grid, #max_value, #range_marker, #shape_marker, #to_escaped_url, #to_url

Constructor Details

#initialize(chart_size = '300x200', chart_title = nil, is_3d = false) {|_self| ... } ⇒ PieChart

Initializes a Pie Chart object with a chart_size and chart_title. Specify is_3d as true to generate a 3D Pie chart

Yields:

  • (_self)

Yield Parameters:



12
13
14
15
16
17
18
# File 'lib/google_chart/pie_chart.rb', line 12

def initialize(chart_size='300x200', chart_title=nil, is_3d = false) # :yield: self
    super(chart_size, chart_title)
    self.is_3d = is_3d
    self.show_legend = false
    self.show_labels = true
    yield self if block_given?
end

Instance Attribute Details

#is_3dObject

set to true or false to indicate if this is a 3d chart



6
7
8
# File 'lib/google_chart/pie_chart.rb', line 6

def is_3d
  @is_3d
end

#show_labelsObject

set to true or false to show or hide pie chart labels



9
10
11
# File 'lib/google_chart/pie_chart.rb', line 9

def show_labels
  @show_labels
end

Instance Method Details

#process_dataObject



29
30
31
# File 'lib/google_chart/pie_chart.rb', line 29

def process_data
    encode_data(@data, max_data_value)
end