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::COL_MAX, 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, #convert_date_time, #dash_types, delete_files, #fill_properties, #float_to_str, #layout_properties, #line_fill_properties, #line_properties, #palette_color, #pixels_to_points, #ptrue?, #put_deprecate_message, #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_anchor, #write_auto_fill, #write_color, #write_comment_path, #write_div, #write_fill, #write_font, #write_stroke, #write_xml_declaration, #xl_cell_to_rowcol, #xl_col_to_name, #xl_range, #xl_range_formula, #xl_rowcol_to_cell, #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.



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

def crossing
  @crossing
end

#defaultsObject

Returns the value of attribute defaults.



11
12
13
# File 'lib/write_xlsx/chart/axis.rb', line 11

def defaults
  @defaults
end

#interval_unitObject (readonly)

Returns the value of attribute interval_unit.



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

def interval_unit
  @interval_unit
end

#label_positionObject (readonly)

Returns the value of attribute label_position.



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

def label_position
  @label_position
end

#layoutObject (readonly)

Returns the value of attribute layout.



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

def layout
  @layout
end

#log_baseObject (readonly)

Returns the value of attribute log_base.



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

def log_base
  @log_base
end

#major_gridlinesObject (readonly)

Returns the value of attribute major_gridlines.



16
17
18
# File 'lib/write_xlsx/chart/axis.rb', line 16

def major_gridlines
  @major_gridlines
end

#major_tick_markObject

Returns the value of attribute major_tick_mark.



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

def major_tick_mark
  @major_tick_mark
end

#major_unitObject (readonly)

Returns the value of attribute major_unit.



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

def major_unit
  @major_unit
end

#major_unit_typeObject (readonly)

Returns the value of attribute major_unit_type.



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

def major_unit_type
  @major_unit_type
end

#maxObject

Returns the value of attribute max.



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

def max
  @max
end

#minObject

Returns the value of attribute min.



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

def min
  @min
end

#minor_gridlinesObject (readonly)

Returns the value of attribute minor_gridlines.



16
17
18
# File 'lib/write_xlsx/chart/axis.rb', line 16

def minor_gridlines
  @minor_gridlines
end

#minor_unitObject (readonly)

Returns the value of attribute minor_unit.



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

def minor_unit
  @minor_unit
end

#minor_unit_typeObject (readonly)

Returns the value of attribute minor_unit_type.



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

def minor_unit_type
  @minor_unit_type
end

#num_fontObject (readonly)

Returns the value of attribute num_font.



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

def num_font
  @num_font
end

#num_formatObject

Returns the value of attribute num_format.



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

def num_format
  @num_format
end

#num_format_linkedObject (readonly)

Returns the value of attribute num_format_linked.



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

def num_format_linked
  @num_format_linked
end

#positionObject

Returns the value of attribute position.



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

def position
  @position
end

#position_axisObject (readonly)

Returns the value of attribute position_axis.



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

def position_axis
  @position_axis
end

#reverseObject (readonly)

Returns the value of attribute reverse.



16
17
18
# File 'lib/write_xlsx/chart/axis.rb', line 16

def reverse
  @reverse
end

#visibleObject (readonly)

Returns the value of attribute visible.



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

def visible
  @visible
end

Instance Method Details

#merge_with_hash(params) ⇒ Object

Convert user defined axis values into axis instance.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/write_xlsx/chart/axis.rb', line 21

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

  [
   :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, :major_tick_mark
  ].each { |val| instance_variable_set("@#{val}", args[val]) }
  @visible           = args[:visible] || 1

  set_major_minor_gridlines(args)
  set_position(args)
  set_position_axis
  set_font_properties(args)
  set_axis_name_layout(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.



53
54
55
56
57
# File 'lib/write_xlsx/chart/axis.rb', line 53

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.



45
46
47
# File 'lib/write_xlsx/chart/axis.rb', line 45

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