Sha256: defbf282af425520c2c5c080bac1a81384470ddf37a6a0ae243270b47c58d5b5

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 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

    private
      def render_data
        "data: #{data.first.is_a?(Array) ? data : data.collect(&:to_f)}"
      end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
highcharts-js-rails-0.0.3 lib/highcharts/series.rb
highcharts-js-rails-0.0.2 lib/highcharts/series.rb