Class: GoogleVisualr::Image::SparkLine

Inherits:
BaseChart
  • Object
show all
Includes:
Packages::ImageChart
Defined in:
lib/google_visualr/image/spark_line.rb

Overview

Constant Summary

Constants included from Packages::ImageChart

Packages::ImageChart::IMAGE_DEFAULTS

Constants inherited from BaseChart

BaseChart::DEFAULT_VERSION

Instance Attribute Summary

Attributes inherited from BaseChart

#data_table, #language, #listeners, #material, #version

Instance Method Summary collapse

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 sparkline. 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
# File 'lib/google_visualr/image/spark_line.rb', line 16

def uri(params = {})
  query_params = {}
  
  # Chart type: line
  query_params[:cht] = "ls"
  
  # showValueLabels  (works as long as :chxt => "x,y")
  labels = "0:||"
  if @options["showValueLabels"] == false || !@options["showAxisLines"]
    labels += "1:||"
  end
  
  query_params[:chxl] = labels

  chart_image_url(query_params.merge(params))
end