class OoxmlParser::ChartAxis

Parsing Chart axis tags ‘catAx’, ‘valAx’

Attributes

display[RW]
major_grid_lines[RW]
minor_grid_lines[RW]
position[RW]
scaling[R]

@return [Scaling] scaling attribute

tick_label_position[R]

@return [ValuedChild] the position of the tick labels

title[RW]

Public Class Methods

new(params = {}) click to toggle source
Calls superclass method
# File lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb, line 14
def initialize(params = {})
  @title = params.fetch(:title, ChartAxisTitle.new)
  @display = params.fetch(:display, true)
  @minor_grid_lines = params.fetch(:minor_grid_lines, false)
  @major_grid_lines = params.fetch(:major_grid_lines, false)
  super(parent: params[:parent])
end

Public Instance Methods

parse(node) click to toggle source

Parse ChartAxis object @param node [Nokogiri::XML:Element] node to parse @return [ChartAxis] result of parsing

# File lib/ooxml_parser/common_parser/common_data/alternate_content/chart/chart_axis.rb, line 25
def parse(node)
  node.xpath('*').each do |node_child|
    case node_child.name
    when 'delete'
      @display = false if node_child.attribute('val').value == '1'
    when 'title'
      @title = ChartAxisTitle.new(parent: self).parse(node_child)
    when 'majorGridlines'
      @major_grid_lines = true
    when 'minorGridlines'
      @minor_grid_lines = true
    when 'scaling'
      @scaling = Scaling.new(parent: self).parse(node_child)
    when 'tickLblPos'
      @tick_label_position = ValuedChild.new(:symbol, parent: self).parse(node_child)
    when 'axPos'
      @position = value_to_symbol(node_child.attribute('val'))
    end
  end
  @display = false unless @title.visible?
  self
end