Sha256: e03346b5c22c0dc22045a0f9b9e7067132d9c60b7b1dc0a001e5ce5c1cf7d754

Contents?: true

Size: 474 Bytes

Versions: 1

Compression:

Stored size: 474 Bytes

Contents

module Highcharts
  class Series < Base
    
    attr_accessor :name, :type, :xAxis, :yAxis, :data
    
    def to_s
      rendered_options = render_options(:strings => 'name type', :objects => 'xAxis yAxis')
      return nil if rendered_options.length == 0
      "{" +
        [rendered_options, render_data].flatten.compact.join(',') +
      "}"
    end
    
    def render_data
      "data: #{data.first.is_a?(Array) ? data : data.collect(&:to_f)}"
    end
    
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
highcharts-js-rails-0.0.1 lib/highcharts/series.rb