Class: Highcharts::Axis::X

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

Instance Attribute Summary collapse

Attributes inherited from Base

#default, #options, #skip_quotation, #suboptions

Instance Method Summary collapse

Methods inherited from Base

#inspect

Constructor Details

#initialize(opts = {}) ⇒ X

Returns a new instance of X.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/highcharts/axis/x.rb', line 7

def initialize(opts = {})
  @default = :categories
  @suboptions = {
    events: 'Axis::Events',
    labels: 'Labels',
    plotBands: 'Axis::PlotBands',
    plotLines: 'Axis::PlotLines',
    title: 'Title'
  }
  # Check to see if we want to skip automatic formatting of categories.
  @skip_category_formatting = true if opts.delete(:skip_category_formatting)
  super
end

Instance Attribute Details

#skip_category_formattingObject (readonly)

Returns the value of attribute skip_category_formatting.



5
6
7
# File 'lib/highcharts/axis/x.rb', line 5

def skip_category_formatting
  @skip_category_formatting
end

Instance Method Details

#to_jsonObject



21
22
23
24
25
# File 'lib/highcharts/axis/x.rb', line 21

def to_json
  @options[:categories] = options[:categories].collect {|c| format_category(c)} if options[:categories].present? && !skip_category_formatting
  automate_tick_interval if options[:tickInterval] == :auto || options[:tickInterval].blank?
  super
end