Class: Writexlsx::Chart::Axis
- Inherits:
-
Object
- Object
- Writexlsx::Chart::Axis
- Includes:
- Utility::Common, Utility::RichText
- Defined in:
- lib/write_xlsx/chart/axis.rb
Constant Summary
Constants included from Utility::Common
Utility::Common::PERL_TRUE_VALUES
Instance Attribute Summary collapse
-
#crossing ⇒ Object
readonly
Returns the value of attribute crossing.
-
#defaults ⇒ Object
Returns the value of attribute defaults.
-
#display_units ⇒ Object
readonly
Returns the value of attribute display_units.
-
#display_units_visible ⇒ Object
readonly
Returns the value of attribute display_units_visible.
-
#fill ⇒ Object
readonly
Returns the value of attribute fill.
-
#interval_tick ⇒ Object
readonly
Returns the value of attribute interval_tick.
-
#interval_unit ⇒ Object
readonly
Returns the value of attribute interval_unit.
-
#label_align ⇒ Object
readonly
Returns the value of attribute label_align.
-
#label_position ⇒ Object
readonly
Returns the value of attribute label_position.
-
#layout ⇒ Object
readonly
Returns the value of attribute layout.
-
#line ⇒ Object
readonly
Returns the value of attribute line.
-
#log_base ⇒ Object
readonly
Returns the value of attribute log_base.
-
#major_gridlines ⇒ Object
readonly
Returns the value of attribute major_gridlines.
-
#major_tick_mark ⇒ Object
Returns the value of attribute major_tick_mark.
-
#major_unit ⇒ Object
readonly
Returns the value of attribute major_unit.
-
#major_unit_type ⇒ Object
readonly
Returns the value of attribute major_unit_type.
-
#max ⇒ Object
Returns the value of attribute max.
-
#min ⇒ Object
Returns the value of attribute min.
-
#minor_gridlines ⇒ Object
readonly
Returns the value of attribute minor_gridlines.
-
#minor_tick_mark ⇒ Object
Returns the value of attribute minor_tick_mark.
-
#minor_unit ⇒ Object
readonly
Returns the value of attribute minor_unit.
-
#minor_unit_type ⇒ Object
readonly
Returns the value of attribute minor_unit_type.
-
#num_font ⇒ Object
readonly
Returns the value of attribute num_font.
-
#num_format ⇒ Object
Returns the value of attribute num_format.
-
#num_format_linked ⇒ Object
readonly
Returns the value of attribute num_format_linked.
-
#position ⇒ Object
Returns the value of attribute position.
-
#position_axis ⇒ Object
readonly
Returns the value of attribute position_axis.
-
#reverse ⇒ Object
readonly
Returns the value of attribute reverse.
-
#text_axis ⇒ Object
readonly
Returns the value of attribute text_axis.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#visible ⇒ Object
readonly
Returns the value of attribute visible.
Instance Method Summary collapse
- #apply_axis_display_options(args) ⇒ Object
- #apply_axis_format_options(args) ⇒ Object
- #apply_axis_options(args) ⇒ Object
- #apply_axis_tick_options(args) ⇒ Object
- #apply_axis_title_options(args) ⇒ Object
-
#apply_options(params) ⇒ Object
Convert user defined axis values into axis instance.
-
#initialize(chart) ⇒ Axis
constructor
A new instance of Axis.
-
#write_cat_number_format(writer, cat_has_num_fmt) ⇒ Object
Write the <c:numFmt> element.
-
#write_number_format(writer) ⇒ Object
Write the <c:numberFormat> element.
Methods included from Utility::RichText
#convert_font_args, #get_font_latin_attributes, #get_font_style_attributes, #params_to_font, #underline_attributes, #write_a_body_pr, #write_a_def_rpr, #write_a_end_para_rpr, #write_a_lst_style, #write_a_p_formula, #write_a_p_pr_formula, #write_def_rpr_r_pr_common, #write_tx_pr
Methods included from Utility::Common
#absolute_char, #check_parameter, #float_to_str, #ptrue?, #put_deprecate_message
Constructor Details
Instance Attribute Details
#crossing ⇒ Object (readonly)
Returns the value of attribute crossing.
18 19 20 |
# File 'lib/write_xlsx/chart/axis.rb', line 18 def crossing @crossing end |
#defaults ⇒ Object
Returns the value of attribute defaults.
13 14 15 |
# File 'lib/write_xlsx/chart/axis.rb', line 13 def defaults @defaults end |
#display_units ⇒ Object (readonly)
Returns the value of attribute display_units.
17 18 19 |
# File 'lib/write_xlsx/chart/axis.rb', line 17 def display_units @display_units end |
#display_units_visible ⇒ Object (readonly)
Returns the value of attribute display_units_visible.
17 18 19 |
# File 'lib/write_xlsx/chart/axis.rb', line 17 def display_units_visible @display_units_visible end |
#fill ⇒ Object (readonly)
Returns the value of attribute fill.
21 22 23 |
# File 'lib/write_xlsx/chart/axis.rb', line 21 def fill @fill end |
#interval_tick ⇒ Object (readonly)
Returns the value of attribute interval_tick.
20 21 22 |
# File 'lib/write_xlsx/chart/axis.rb', line 20 def interval_tick @interval_tick end |
#interval_unit ⇒ Object (readonly)
Returns the value of attribute interval_unit.
19 20 21 |
# File 'lib/write_xlsx/chart/axis.rb', line 19 def interval_unit @interval_unit end |
#label_align ⇒ Object (readonly)
Returns the value of attribute label_align.
21 22 23 |
# File 'lib/write_xlsx/chart/axis.rb', line 21 def label_align @label_align end |
#label_position ⇒ Object (readonly)
Returns the value of attribute label_position.
18 19 20 |
# File 'lib/write_xlsx/chart/axis.rb', line 18 def label_position @label_position end |
#layout ⇒ Object (readonly)
Returns the value of attribute layout.
19 20 21 |
# File 'lib/write_xlsx/chart/axis.rb', line 19 def layout @layout end |
#line ⇒ Object (readonly)
Returns the value of attribute line.
21 22 23 |
# File 'lib/write_xlsx/chart/axis.rb', line 21 def line @line end |
#log_base ⇒ Object (readonly)
Returns the value of attribute log_base.
18 19 20 |
# File 'lib/write_xlsx/chart/axis.rb', line 18 def log_base @log_base end |
#major_gridlines ⇒ Object (readonly)
Returns the value of attribute major_gridlines.
20 21 22 |
# File 'lib/write_xlsx/chart/axis.rb', line 20 def major_gridlines @major_gridlines end |
#major_tick_mark ⇒ Object
Returns the value of attribute major_tick_mark.
15 16 17 |
# File 'lib/write_xlsx/chart/axis.rb', line 15 def major_tick_mark @major_tick_mark end |
#major_unit ⇒ Object (readonly)
Returns the value of attribute major_unit.
16 17 18 |
# File 'lib/write_xlsx/chart/axis.rb', line 16 def major_unit @major_unit end |
#major_unit_type ⇒ Object (readonly)
Returns the value of attribute major_unit_type.
16 17 18 |
# File 'lib/write_xlsx/chart/axis.rb', line 16 def major_unit_type @major_unit_type end |
#max ⇒ Object
Returns the value of attribute max.
14 15 16 |
# File 'lib/write_xlsx/chart/axis.rb', line 14 def max @max end |
#min ⇒ Object
Returns the value of attribute min.
14 15 16 |
# File 'lib/write_xlsx/chart/axis.rb', line 14 def min @min end |
#minor_gridlines ⇒ Object (readonly)
Returns the value of attribute minor_gridlines.
20 21 22 |
# File 'lib/write_xlsx/chart/axis.rb', line 20 def minor_gridlines @minor_gridlines end |
#minor_tick_mark ⇒ Object
Returns the value of attribute minor_tick_mark.
15 16 17 |
# File 'lib/write_xlsx/chart/axis.rb', line 15 def minor_tick_mark @minor_tick_mark end |
#minor_unit ⇒ Object (readonly)
Returns the value of attribute minor_unit.
16 17 18 |
# File 'lib/write_xlsx/chart/axis.rb', line 16 def minor_unit @minor_unit end |
#minor_unit_type ⇒ Object (readonly)
Returns the value of attribute minor_unit_type.
16 17 18 |
# File 'lib/write_xlsx/chart/axis.rb', line 16 def minor_unit_type @minor_unit_type end |
#num_font ⇒ Object (readonly)
Returns the value of attribute num_font.
19 20 21 |
# File 'lib/write_xlsx/chart/axis.rb', line 19 def num_font @num_font end |
#num_format ⇒ Object
Returns the value of attribute num_format.
14 15 16 |
# File 'lib/write_xlsx/chart/axis.rb', line 14 def num_format @num_format end |
#num_format_linked ⇒ Object (readonly)
Returns the value of attribute num_format_linked.
19 20 21 |
# File 'lib/write_xlsx/chart/axis.rb', line 19 def num_format_linked @num_format_linked end |
#position ⇒ Object
Returns the value of attribute position.
14 15 16 |
# File 'lib/write_xlsx/chart/axis.rb', line 14 def position @position end |
#position_axis ⇒ Object (readonly)
Returns the value of attribute position_axis.
18 19 20 |
# File 'lib/write_xlsx/chart/axis.rb', line 18 def position_axis @position_axis end |
#reverse ⇒ Object (readonly)
Returns the value of attribute reverse.
20 21 22 |
# File 'lib/write_xlsx/chart/axis.rb', line 20 def reverse @reverse end |
#text_axis ⇒ Object (readonly)
Returns the value of attribute text_axis.
21 22 23 |
# File 'lib/write_xlsx/chart/axis.rb', line 21 def text_axis @text_axis end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
22 23 24 |
# File 'lib/write_xlsx/chart/axis.rb', line 22 def title @title end |
#visible ⇒ Object (readonly)
Returns the value of attribute visible.
18 19 20 |
# File 'lib/write_xlsx/chart/axis.rb', line 18 def visible @visible end |
Instance Method Details
#apply_axis_display_options(args) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/write_xlsx/chart/axis.rb', line 53 def (args) set_major_minor_gridlines(args) set_display_units(args) set_display_units_visible(args) set_position(args) set_position_axis if ptrue?(args[:text_axis]) @chart.date_category = false @text_axis = true end end |
#apply_axis_format_options(args) ⇒ Object
66 67 68 69 70 |
# File 'lib/write_xlsx/chart/axis.rb', line 66 def (args) @num_font = convert_font_args(args[:num_font]) @line = @chart.line_properties(args[:line]) @fill = @chart.fill_properties(args[:fill]) end |
#apply_axis_options(args) ⇒ Object
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/write_xlsx/chart/axis.rb', line 42 def (args) %i[ reverse min max minor_unit major_unit minor_unit_type major_unit_type log_base crossing position_axis label_position num_format num_format_linked interval_unit interval_tick line fill label_align ].each { |val| instance_variable_set("@#{val}", args[val]) } @visible = args[:visible] || 1 end |
#apply_axis_tick_options(args) ⇒ Object
72 73 74 75 |
# File 'lib/write_xlsx/chart/axis.rb', line 72 def (args) @major_tick_mark = get_tick_type(args[:major_tick_mark]) @minor_tick_mark = get_tick_type(args[:minor_tick_mark]) end |
#apply_axis_title_options(args) ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/write_xlsx/chart/axis.rb', line 77 def (args) # Set the axis title properties. @title.( name: args[:name], name_formula: args[:name_formula], data: args[:data], name_font: args[:name_font], layout: args[:name_layout] ) # Set the format properties. @title.( line: args[:name_line], border: args[:name_border], fill: args[:name_fill], pattern: args[:name_pattern], gradient: args[:name_gradient] ) end |
#apply_options(params) ⇒ Object
Convert user defined axis values into axis instance.
32 33 34 35 36 37 38 39 40 |
# File 'lib/write_xlsx/chart/axis.rb', line 32 def (params) # :nodoc: args = (defaults || {}).merge(params) (args) (args) (args) (args) (args) end |
#write_cat_number_format(writer, cat_has_num_fmt) ⇒ Object
Write the <c:numFmt> element. Special case handler for category axes which don't always have a number format.
111 112 113 114 115 |
# File 'lib/write_xlsx/chart/axis.rb', line 111 def write_cat_number_format(writer, cat_has_num_fmt) return unless user_defined_num_fmt_set? || cat_has_num_fmt writer.empty_tag('c:numFmt', num_fmt_attributes) end |
#write_number_format(writer) ⇒ Object
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 attribute is 0. The user can override this if required.
103 104 105 |
# File 'lib/write_xlsx/chart/axis.rb', line 103 def write_number_format(writer) # :nodoc: writer.empty_tag('c:numFmt', num_fmt_attributes) end |