Class: Writexlsx::Chart::Bar

Inherits:
Writexlsx::Chart show all
Includes:
Utility
Defined in:
lib/write_xlsx/chart/bar.rb

Constant Summary

Constants included from Utility

Utility::COL_MAX, Utility::ROW_MAX, Utility::SHEETNAME_MAX, Utility::STR_MAX

Instance Attribute Summary

Attributes inherited from Writexlsx::Chart

#embedded, #formula_data, #formula_ids, #height, #id, #index, #name, #palette, #protection, #width, #x_offset, #x_scale, #y_offset, #y_scale

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 Writexlsx::Chart

#add_series, #assemble_xml_file, #convert_font_args, #data_id, factory, #params_to_font, #process_names, #set_chartarea, #set_drop_lines, #set_embedded_config_data, #set_high_low_lines, #set_legend, #set_plotarea, #set_size, #set_style, #set_table, #set_title, #set_up_down_bars, #set_x2_axis, #set_x_axis, #set_xml_writer, #set_y2_axis, #set_y_axis, #show_blanks_as, #show_hidden_data, #write_bar_chart

Constructor Details

#initialize(subtype) ⇒ Bar

Returns a new instance of Bar.



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

def initialize(subtype)
  super(subtype)
  @subtype = subtype || 'clustered'
  @cat_axis_position = 'l'
  @val_axis_position = 'b'
  @horiz_val_axis    = 0
  @horiz_cat_axis    = 1
  @show_crosses      = false
  # Override and reset the default axis values.
  axis_defaults_set
  set_x_axis
  set_y_axis
end

Instance Method Details

#write_bar_dirObject

Write the <c:barDir> element.



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

def write_bar_dir
  @writer.empty_tag('c:barDir', [ ['val', 'bar'] ])
end

#write_chart_type(params) ⇒ Object

Override the virtual superclass method with a chart specific method.



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/write_xlsx/chart/bar.rb', line 39

def write_chart_type(params)
  if params[:primary_axes] != 0
    # Reverse X and Y axes for Bar charts.
    @y_axis, @x_axis = @x_axis, @y_axis
    if @y2_axis.position == 'r'
      @y2_axis.position = 't'
    end
  end

  # Write the c:barChart element.
  write_bar_chart(params)
end

#write_err_dir(direction) ⇒ Object

Write the <c:errDir> element. Overridden from Chart class since it is not used in Bar charts.



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

def write_err_dir(direction)
  # do nothing
end