Class: GChart::Pie

Inherits:
Base
  • Object
show all
Defined in:
lib/gchart/pie.rb

Direct Known Subclasses

Pie3D

Instance Attribute Summary

Attributes inherited from Base

#axes, #chart_background, #colors, #data, #entire_background, #extras, #height, #legend, #max, #title, #width

Instance Method Summary collapse

Methods inherited from Base

#axis, #fetch, #initialize, #size, #size=, #to_url, #write

Constructor Details

This class inherits a constructor from GChart::Base

Instance Method Details

#data=(data) ⇒ Object

A single array of chart data. Raises ArgumentError if more than one data set is provided.



5
6
7
8
9
10
11
# File 'lib/gchart/pie.rb', line 5

def data=(data)
  if data.is_a?(Array) and data.first.is_a?(Array) and data.size > 1
    raise ArgumentError, "Pie charts only have one data set" 
  end
  
  super(data)
end

#render_chart_typeObject

:nodoc:



13
14
15
# File 'lib/gchart/pie.rb', line 13

def render_chart_type #:nodoc:
  "p"
end

#render_legend(params) ⇒ Object

:nodoc:



17
18
19
# File 'lib/gchart/pie.rb', line 17

def render_legend(params) #:nodoc:
  params["chl"] = legend.join("|") if legend
end