Class: Writexlsx::Chart::Column
- Inherits:
-
Writexlsx::Chart
- Object
- Writexlsx::Chart
- Writexlsx::Chart::Column
- Includes:
- Utility
- Defined in:
- lib/write_xlsx/chart/column.rb
Overview
The Column chart module also supports the following sub-types:
stacked
percent_stacked
These can be specified at creation time via the add_chart() Worksheet method:
chart = workbook.add_chart( :type => 'column', :subtype => 'stacked' )
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, #id, #index, #palette
Instance Method Summary collapse
-
#initialize ⇒ Column
constructor
A new instance of Column.
-
#write_bar_dir ⇒ Object
Write the <c:barDir> element.
-
#write_chart_type ⇒ Object
Override the virtual superclass method with a chart specific method.
-
#write_number_format(format_code = nil) ⇒ Object
Over-ridden to add % format.
-
#write_series ⇒ Object
Over-ridden to add c:overlap.
Methods included from Utility
#absolute_char, delete_files, #put_deprecate_message, #substitute_cellref, #underline_attributes, #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, factory, #set_chartarea, #set_embedded_config_data, #set_legend, #set_plotarea, #set_style, #set_title, #set_x_axis, #set_xml_writer, #set_y_axis, #write_bar_chart
Constructor Details
#initialize ⇒ Column
Returns a new instance of Column.
31 32 33 34 35 |
# File 'lib/write_xlsx/chart/column.rb', line 31 def initialize super(self.class) @subtype = 'clustered' @horiz_val_axis = 0 end |
Instance Method Details
#write_bar_dir ⇒ Object
Write the <c:barDir> element.
48 49 50 51 52 53 54 |
# File 'lib/write_xlsx/chart/column.rb', line 48 def val = 'col' attributes = ['val', val] @writer.empty_tag('c:barDir', attributes) end |
#write_chart_type ⇒ Object
Override the virtual superclass method with a chart specific method.
40 41 42 43 |
# File 'lib/write_xlsx/chart/column.rb', line 40 def write_chart_type # Write the c:barChart element. end |
#write_number_format(format_code = nil) ⇒ Object
Over-ridden to add % format. TODO. This will be refactored back up to the SUPER class later.
Write the <c:numFmt> element.
72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/write_xlsx/chart/column.rb', line 72 def write_number_format(format_code = nil) format_code ||= 'General' source_linked = 1 format_code = '0%' if @subtype == 'percent_stacked' attributes = [ 'formatCode', format_code, 'sourceLinked', source_linked ] @writer.empty_tag('c:numFmt', attributes) end |
#write_series ⇒ Object
Over-ridden to add c:overlap.
Write the series elements.
62 63 64 |
# File 'lib/write_xlsx/chart/column.rb', line 62 def write_series write_series_base {write_overlap if @subtype =~ /stacked/} end |