lib/write_xlsx/chart/axis.rb in write_xlsx-0.70.0 vs lib/write_xlsx/chart/axis.rb in write_xlsx-0.71.0
- old
+ new
@@ -1,30 +1,29 @@
# -*- encoding: utf-8 -*-
require 'write_xlsx/package/xml_writer_simple'
require 'write_xlsx/utility'
+require 'write_xlsx/chart/caption'
module Writexlsx
class Chart
- class Axis
+ class Axis < Caption
include Writexlsx::Utility
- attr_accessor :defaults, :name, :formula, :data_id, :reverse
+ attr_accessor :defaults, :reverse
attr_accessor :min, :max
attr_accessor :minor_unit, :major_unit, :minor_unit_type, :major_unit_type
attr_accessor :log_base, :crossing, :position, :label_position, :visible
- attr_accessor :num_format, :num_format_linked, :num_font, :name_font
+ attr_accessor :num_format, :num_format_linked, :num_font
attr_accessor :major_gridlines, :minor_gridlines, :major_tick_mark
#
# Convert user defined axis values into axis instance.
#
- def merge_with_hash(chart, params) # :nodoc:
- @chart = chart
+ def merge_with_hash(params) # :nodoc:
+ super
args = (defaults || {}).merge(params)
- @name, @formula = @chart.process_names(args[:name], args[:name_formula])
- @data_id = @chart.get_data_id(@formula, args[:data])
@reverse = args[:reverse]
@min = args[:min]
@max = args[:max]
@minor_unit = args[:minor_unit]
@major_unit = args[:major_unit]
@@ -51,10 +50,9 @@
@position = args[:position]
@position = @position.downcase[0, 1] if @position
# Set the font properties if present.
@num_font = @chart.convert_font_args(args[:num_font])
- @name_font = @chart.convert_font_args(args[:name_font])
end
#
# Write the <c:numberFormat> element. Note: It is assumed that if a user
# defined number format is supplied (i.e., non-default) then the sourceLinked