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, #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_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.



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

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

#display_unitsObject (readonly)

Returns the value of attribute display_units.



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

def display_units
  @display_units
end

#display_units_visibleObject (readonly)

Returns the value of attribute display_units_visible.



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

def display_units_visible
  @display_units_visible
end

#fillObject (readonly)

Returns the value of attribute fill.



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

def fill
  @fill
end

#interval_unitObject (readonly)

Returns the value of attribute interval_unit.



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

def interval_unit
  @interval_unit
end

#label_positionObject (readonly)

Returns the value of attribute label_position.



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

def label_position
  @label_position
end

#layoutObject (readonly)

Returns the value of attribute layout.



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

def layout
  @layout
end

#lineObject (readonly)

Returns the value of attribute line.



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

def line
  @line
end

#log_baseObject (readonly)

Returns the value of attribute log_base.



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

def log_base
  @log_base
end

#major_gridlinesObject (readonly)

Returns the value of attribute major_gridlines.



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

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.



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

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.



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

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.



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

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.



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

def position_axis
  @position_axis
end

#reverseObject (readonly)

Returns the value of attribute reverse.



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

def reverse
  @reverse
end

#text_axisObject (readonly)

Returns the value of attribute text_axis.



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

def text_axis
  @text_axis
end

#visibleObject (readonly)

Returns the value of attribute visible.



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

def visible
  @visible
end

Instance Method Details

#merge_with_hash(params) ⇒ Object

Convert user defined axis values into axis instance.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/write_xlsx/chart/axis.rb', line 22

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

  set_major_minor_gridlines(args)
  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
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.



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

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.



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

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