Class: Highcharts::Series

Inherits:
Base
  • Object
show all
Defined in:
lib/highcharts/series.rb

Instance Attribute Summary

Attributes inherited from Base

#default, #options, #skip_quotation, #suboptions

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect

Constructor Details

This class inherits a constructor from Highcharts::Base

Instance Method Details

#to_jsonObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/highcharts/series.rb', line 4

def to_json
  @options[:data] = if options[:data].first.is_a?(Array) || options[:data].first.is_a?(Hash)
    options[:data].collect do |d|
      if d.is_a?(Array)
        [d.first, d.last.to_f]
      else
        d[:y] = d[:y].to_f
        d
      end
    end
  else
    options[:data].collect(&:to_f)
  end

  super
end