Class: GoogleVisualr::Image::PieChart
- Includes:
- Packages::ImageChart
- Defined in:
- lib/google_visualr/image/pie_chart.rb
Overview
Constant Summary
Constants included from Packages::ImageChart
Packages::ImageChart::IMAGE_DEFAULTS
Constants inherited from BaseChart
Instance Attribute Summary
Attributes inherited from BaseChart
#data_table, #language, #listeners, #material, #version
Instance Method Summary collapse
-
#uri(params = {}) ⇒ Object
Create URI for image pie chart.
Methods included from Packages::ImageChart
#chart_image_url, #class_name, #package_name
Methods inherited from BaseChart
#add_listener, #chart_class, #chart_function_name, #chart_name, #class_name, #draw_js, #initialize, #load_js, #options, #options=, #package_name, #to_js
Methods included from ParamHelpers
#js_parameters, #stringify_keys!, #typecast
Constructor Details
This class inherits a constructor from GoogleVisualr::BaseChart
Instance Method Details
#uri(params = {}) ⇒ Object
Create URI for image pie chart. Override parameters by passing in a hash. (see code.google.com/apis/chart/image/docs/chart_params.html)
Parameters:
*params [Optional] Hash of url query parameters
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/google_visualr/image/pie_chart.rb', line 16 def uri(params = {}) query_params = {} # Chart Type: normal or 3D query_params[:cht] = @options["is3D"] ? "p3" : "p" # Legend (override generic image chart behavior) query_params[:chdl] = @data_table.get_column(0).join('|') # Labels case ["labels"] when "name" query_params[:chl] = @data_table.get_column(0).join('|') when "value" query_params[:chl] = @data_table.get_column(1).join('|') else query_params[:chl] = "" end # data (override generic chart behavior) query_params[:chd] = "t:" + @data_table.get_column(1).join(',') # Chart Colors (override generic chart default) query_params[:chco] = @options["colors"].join('|').gsub(/#/, '') if @options["colors"] chart_image_url(query_params.merge(params)) end |