Class: Writexlsx::Chart::Axis

Inherits:
Caption
  • Object
show all
Includes:
Utility
Defined in:
lib/write_xlsx/chart/axis.rb

Constant Summary

Constants included from Utility

Utility::CHAR_WIDTHS, Utility::COL_MAX, Utility::PERL_TRUE_VALUES, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX

Instance Attribute Summary collapse

Attributes inherited from Caption

#data_id, #formula, #name, #name_font, #none, #overlay

Instance Method Summary collapse

Methods included from Utility

#absolute_char, #check_dimensions, #check_dimensions_and_update_max_min_values, #check_parameter, #color, #convert_date_time, #convert_font_args, #dash_types, delete_files, #escape_url, #fill_properties, #float_to_str, #get_font_latin_attributes, #get_font_style_attributes, #get_image_properties, #layout_properties, #legend_properties, #line_fill_properties, #line_properties, #palette_color, #params_to_font, #pattern_properties, #pixels_to_points, #process_bmp, #process_gif, #process_jpg, #process_png, #process_workbook_options, #ptrue?, #put_deprecate_message, #quote_sheetname, #r_id_attributes, #row_col_notation, #shape_style_base, #store_col_max_min_values, #store_row_max_min_values, #substitute_cellref, #underline_attributes, #v_shape_attributes_base, #v_shape_style_base, #value_or_raise, #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_a_solid_fill, #write_a_srgb_clr, #write_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_def_rpr_r_pr_common, #write_div, #write_fill, #write_font, #write_stroke, #write_tx_pr, #write_xml_declaration, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #xl_string_pixel_width, #xml_str

Methods inherited from Caption

#initialize

Constructor Details

This class inherits a constructor from Writexlsx::Chart::Caption

Instance Attribute Details

#crossingObject (readonly)

Returns the value of attribute crossing.



18
19
20
# File 'lib/write_xlsx/chart/axis.rb', line 18

def crossing
  @crossing
end

#defaultsObject

Returns the value of attribute defaults.



13
14
15
# File 'lib/write_xlsx/chart/axis.rb', line 13

def defaults
  @defaults
end

#display_unitsObject (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_visibleObject (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

#fillObject (readonly)

Returns the value of attribute fill.



21
22
23
# File 'lib/write_xlsx/chart/axis.rb', line 21

def fill
  @fill
end

#interval_tickObject (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_unitObject (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_alignObject (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_positionObject (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

#layoutObject (readonly)

Returns the value of attribute layout.



19
20
21
# File 'lib/write_xlsx/chart/axis.rb', line 19

def layout
  @layout
end

#lineObject (readonly)

Returns the value of attribute line.



21
22
23
# File 'lib/write_xlsx/chart/axis.rb', line 21

def line
  @line
end

#log_baseObject (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_gridlinesObject (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_markObject

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_unitObject (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_typeObject (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

#maxObject

Returns the value of attribute max.



14
15
16
# File 'lib/write_xlsx/chart/axis.rb', line 14

def max
  @max
end

#minObject

Returns the value of attribute min.



14
15
16
# File 'lib/write_xlsx/chart/axis.rb', line 14

def min
  @min
end

#minor_gridlinesObject (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_markObject

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_unitObject (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_typeObject (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_fontObject (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_formatObject

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_linkedObject (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

#positionObject

Returns the value of attribute position.



14
15
16
# File 'lib/write_xlsx/chart/axis.rb', line 14

def position
  @position
end

#position_axisObject (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

#reverseObject (readonly)

Returns the value of attribute reverse.



20
21
22
# File 'lib/write_xlsx/chart/axis.rb', line 20

def reverse
  @reverse
end

#text_axisObject (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

#visibleObject (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

#merge_with_hash(params) ⇒ Object

Convert user defined axis values into axis instance.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/write_xlsx/chart/axis.rb', line 26

def merge_with_hash(params) # :nodoc:
  super
  args      = (defaults || {}).merge(params)

  %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]) }
  set_major_minor_gridlines(args)

  @visible           = args[:visible] || 1
  set_display_units(args)
  set_display_units_visible(args)
  set_position(args)
  set_position_axis
  set_font_properties(args)
  set_axis_name_layout(args)
  set_axis_line(args)
  set_axis_fill(args)
  if ptrue?(args[:text_axis])
    @chart.date_category = false
    @text_axis = true
  end

  # Set the tick marker types.
  @major_tick_mark = get_tick_type(params[:major_tick_mark])
  @minor_tick_mark = get_tick_type(params[:minor_tick_mark])
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.



71
72
73
74
75
# File 'lib/write_xlsx/chart/axis.rb', line 71

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.



63
64
65
# File 'lib/write_xlsx/chart/axis.rb', line 63

def write_number_format(writer) # :nodoc:
  writer.empty_tag('c:numFmt', num_fmt_attributes)
end