summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/val_axis.rb
blob: 3ae8f73af5d5cb28ae4bc10b0133bc1e63c5d09c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module Axlsx
  # the ValAxis class defines a chart value axis.
  class ValAxis < Axis
    # This element specifies how the value axis crosses the category axis.
    # must be one of [:between, :midCat]
    # @return [Symbol]
    attr_reader :cross_between
    alias :crossBetween :cross_between

    # Creates a new ValAxis object
    # @option options [Symbol] crosses_between
    def initialize(options = {})
      self.cross_between = :between
      super(options)
    end

    # @see cross_between
    def cross_between=(v)
      RestrictionValidator.validate "ValAxis.cross_between", [:between, :midCat], v
      @cross_between = v
    end
    alias :crossBetween= :cross_between=

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = +'')
      str << '<c:valAx>'
      super(str)
      str << '<c:crossBetween val="' << @cross_between.to_s << '"/>'
      str << '</c:valAx>'
    end
  end
end