Class: Axlsx::Bar3DChart
- Defined in:
- lib/axlsx/drawing/bar_3D_chart.rb
Overview
The Bar3DChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet.
Constant Summary collapse
- GAP_AMOUNT_PERCENT =
validation regex for gap amount percent
/0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
Instance Attribute Summary collapse
-
#cat_axis ⇒ CatAxis
(also: #catAxis)
readonly
the category axis.
-
#gap_depth ⇒ String
(also: #gapDepth)
space between bar or column clusters, as a percentage of the bar or column width.
-
#val_axis ⇒ ValAxis
(also: #valAxis)
readonly
the value axis.
Attributes inherited from Chart
#graphic_frame, #series, #series_type, #show_legend, #style, #title, #vary_colors, #view_3D
Instance Method Summary collapse
-
#bar_dir ⇒ Symbol
(also: #barDir)
The direction of the bars in the chart must be one of [:bar, :col].
-
#bar_dir=(v) ⇒ Object
(also: #barDir=)
The direction of the bars in the chart must be one of [:bar, :col].
-
#gap_width ⇒ String
(also: #gapWidth)
space between bar or column clusters, as a percentage of the bar or column width.
-
#gap_width=(v) ⇒ Object
(also: #gapWidth=)
space between bar or column clusters, as a percentage of the bar or column width.
-
#grouping ⇒ Symbol
grouping for a column, line, or area chart.
-
#grouping=(v) ⇒ Object
grouping for a column, line, or area chart.
-
#initialize(frame, options = {}) ⇒ Bar3DChart
constructor
Creates a new bar chart object.
-
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax].
-
#shape=(v) ⇒ Object
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax].
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods inherited from Chart
#add_series, #d_lbls, #end_at, #from, #index, #pn, #relationship, #start_at, #to
Methods included from OptionsParser
Constructor Details
#initialize(frame, options = {}) ⇒ Bar3DChart
Creates a new bar chart object
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 75 def initialize(frame, ={}) @vary_colors = true @gap_width, @gap_depth, @shape = nil, nil, nil @cat_ax_id = rand(8 ** 8) @val_ax_id = rand(8 ** 8) @cat_axis = CatAxis.new(@cat_ax_id, @val_ax_id) @val_axis = ValAxis.new(@val_ax_id, @cat_ax_id, :tick_lbl_pos => :low, :ax_pos => :l) super(frame, ) @series_type = BarSeries @view_3D = View3D.new({:r_ang_ax=>1}.merge()) @d_lbls = nil end |
Instance Attribute Details
#cat_axis ⇒ CatAxis (readonly) Also known as: catAxis
the category axis
13 14 15 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 13 def cat_axis @cat_axis end |
#gap_depth ⇒ String Also known as: gapDepth
space between bar or column clusters, as a percentage of the bar or column width.
31 32 33 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 31 def gap_depth @gap_depth end |
#val_axis ⇒ ValAxis (readonly) Also known as: valAxis
the value axis
18 19 20 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 18 def val_axis @val_axis end |
Instance Method Details
#bar_dir ⇒ Symbol Also known as: barDir
The direction of the bars in the chart must be one of [:bar, :col]
24 25 26 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 24 def ||= :bar end |
#bar_dir=(v) ⇒ Object Also known as: barDir=
The direction of the bars in the chart must be one of [:bar, :col]
90 91 92 93 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 90 def (v) RestrictionValidator.validate "Bar3DChart.bar_dir", [:bar, :col], v = v end |
#gap_width ⇒ String Also known as: gapWidth
space between bar or column clusters, as a percentage of the bar or column width.
36 37 38 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 36 def gap_width @gap_width ||= 150 end |
#gap_width=(v) ⇒ Object Also known as: gapWidth=
space between bar or column clusters, as a percentage of the bar or column width.
104 105 106 107 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 104 def gap_width=(v) RegexValidator.validate "Bar3DChart.gap_width", GAP_AMOUNT_PERCENT, v @gap_width=(v) end |
#grouping ⇒ Symbol
grouping for a column, line, or area chart. must be one of [:percentStacked, :clustered, :standard, :stacked]
44 45 46 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 44 def grouping @grouping ||= :clustered end |
#grouping=(v) ⇒ Object
grouping for a column, line, or area chart. must be one of [:percentStacked, :clustered, :standard, :stacked]
98 99 100 101 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 98 def grouping=(v) RestrictionValidator.validate "Bar3DChart.grouping", [:percentStacked, :clustered, :standard, :stacked], v @grouping = v end |
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
51 52 53 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 51 def shape @shape ||= :box end |
#shape=(v) ⇒ Object
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
119 120 121 122 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 119 def shape=(v) RestrictionValidator.validate "Bar3DChart.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v @shape = v end |
#to_xml_string(str = '') ⇒ String
Serializes the object
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 127 def to_xml_string(str = '') super(str) do |str_inner| str_inner << '<c:bar3DChart>' str_inner << '<c:barDir val="' << .to_s << '"/>' str_inner << '<c:grouping val="' << grouping.to_s << '"/>' str_inner << '<c:varyColors val="' << vary_colors.to_s << '"/>' @series.each { |ser| ser.to_xml_string(str_inner) } @d_lbls.to_xml_string(str) if @d_lbls str_inner << '<c:gapWidth val="' << @gap_width.to_s << '"/>' unless @gap_width.nil? str_inner << '<c:gapDepth val="' << @gap_depth.to_s << '"/>' unless @gap_depth.nil? str_inner << '<c:shape val="' << @shape.to_s << '"/>' unless @shape.nil? str_inner << '<c:axId val="' << @cat_ax_id.to_s << '"/>' str_inner << '<c:axId val="' << @val_ax_id.to_s << '"/>' str_inner << '<c:axId val="0"/>' str_inner << '</c:bar3DChart>' @cat_axis.to_xml_string str_inner @val_axis.to_xml_string str_inner end end |