Module: Seer::Chart
- Defined in:
- lib/seer/chart.rb
Overview
:nodoc:
Constant Summary collapse
- DEFAULT_COLORS =
['#324F69','#919E4B', '#A34D4D', '#BEC8BE']
- DEFAULT_LEGEND_LOCATION =
'bottom'
- DEFAULT_HEIGHT =
350
- DEFAULT_WIDTH =
550
Instance Attribute Summary collapse
-
#chart_element ⇒ Object
Returns the value of attribute chart_element.
-
#colors ⇒ Object
Returns the value of attribute colors.
Instance Method Summary collapse
Instance Attribute Details
#chart_element ⇒ Object
Returns the value of attribute chart_element.
5 6 7 |
# File 'lib/seer/chart.rb', line 5 def chart_element @chart_element end |
#colors ⇒ Object
Returns the value of attribute colors.
5 6 7 |
# File 'lib/seer/chart.rb', line 5 def colors @colors end |
Instance Method Details
#data_columns ⇒ Object
34 35 36 37 38 39 |
# File 'lib/seer/chart.rb', line 34 def data_columns _data_columns = " data.addRows(#{data_table.size});\r" _data_columns << " data.addColumn('string', '#{label_method}');\r" _data_columns << " data.addColumn('number', '#{data_method}');\r" _data_columns end |
#formatted_colors ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/seer/chart.rb', line 26 def formatted_colors if @colors.include?('darker') @colors else "[#{@colors.map{|color| "'#{color.gsub(/\#/,'')}'"} * ','}]" end end |
#in_element=(elem) ⇒ Object
12 13 14 |
# File 'lib/seer/chart.rb', line 12 def in_element=(elem) @chart_element = elem end |
#options ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/seer/chart.rb', line 41 def = "" .each do |opt| next unless self.send(opt) if opt == :colors << " options['#{opt.to_s.camelize(:lower)}'] = #{self.send(:formatted_colors)};\r" else << " options['#{opt.to_s.camelize(:lower)}'] = #{self.send(opt)};\r" end end .each do |opt| next unless self.send(opt) << " options['#{opt.to_s.camelize(:lower)}'] = '#{self.send(opt)}';\r" end end |