Module: Seer::Chart
- Included in:
- AreaChart, BarChart, ColumnChart, Gauge, Geomap, LineChart, PieChart
- Defined in:
- lib/seer/chart.rb
Overview
:nodoc:
Constant Summary
- DEFAULT_COLORS =
['#324F69','#919E4B', '#A34D4D', '#BEC8BE']
- DEFAULT_LEGEND_LOCATION =
'bottom'- DEFAULT_HEIGHT =
350- DEFAULT_WIDTH =
550
Instance Attribute Summary (collapse)
-
- (Object) chart_element
Returns the value of attribute chart_element.
-
- (Object) colors
Returns the value of attribute colors.
Instance Method Summary (collapse)
Instance Attribute Details
- (Object) chart_element
Returns the value of attribute chart_element
5 6 7 |
# File 'lib/seer/chart.rb', line 5 def chart_element @chart_element end |
- (Object) colors
Returns the value of attribute colors
5 6 7 |
# File 'lib/seer/chart.rb', line 5 def colors @colors end |
Instance Method Details
- (Object) data_columns
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 |
- (Object) formatted_colors
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 |
- (Object) in_element=(elem)
12 13 14 |
# File 'lib/seer/chart.rb', line 12 def in_element=(elem) @chart_element = elem end |
- (Object) options
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 |