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.
Instance Attribute Summary collapse
-
#gap_depth ⇒ Integer
(also: #gapDepth)
space between bar or column clusters, as a percentage of the bar or column width.
Attributes inherited from Chart
#bg_color, #display_blanks_as, #graphic_frame, #legend_position, #plot_visible_only, #rounded_corners, #series, #series_type, #show_legend, #style, #title, #vary_colors, #view_3D
Instance Method Summary collapse
-
#axes ⇒ Axes
A hash of axes used by this chart.
-
#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].
-
#cat_axis ⇒ CatAxis
(also: #catAxis)
the category axis.
-
#gap_width ⇒ Integer
(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.
-
#val_axis ⇒ ValAxis
(also: #valAxis)
the value axis.
Methods inherited from Chart
#add_series, #d_lbls, #end_at, #from, #index, #pn, #relationship, #start_at, #title_size=, #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 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 75 def initialize(frame, = {}) @vary_colors = true @gap_width, @gap_depth, @shape = nil, nil, nil super(frame, ) @series_type = BarSeries @view_3D = View3D.new({ r_ang_ax: 1 }.merge()) @d_lbls = nil end |
Instance Attribute Details
#gap_depth ⇒ Integer Also known as: gapDepth
space between bar or column clusters, as a percentage of the bar or column width.
34 35 36 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 34 def gap_depth @gap_depth end |
Instance Method Details
#axes ⇒ Axes
A hash of axes used by this chart. Bar charts have a value and category axes specified via axes[:val_axes] and axes[:cat_axis]
143 144 145 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 143 def axes @axes ||= Axes.new(cat_axis: CatAxis, val_axis: ValAxis) end |
#bar_dir ⇒ Symbol Also known as: barDir
The direction of the bars in the chart must be one of [:bar, :col]
27 28 29 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 27 def @bar_dir ||= :bar end |
#bar_dir=(v) ⇒ Object Also known as: barDir=
The direction of the bars in the chart must be one of [:bar, :col]
86 87 88 89 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 86 def (v) RestrictionValidator.validate "Bar3DChart.bar_dir", [:bar, :col], v @bar_dir = v end |
#cat_axis ⇒ CatAxis Also known as: catAxis
the category axis
12 13 14 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 12 def cat_axis axes[:cat_axis] end |
#gap_width ⇒ Integer Also known as: gapWidth
space between bar or column clusters, as a percentage of the bar or column width.
39 40 41 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 39 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.
100 101 102 103 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 100 def gap_width=(v) RangeValidator.validate "Bar3DChart.gap_width", 0, 500, v @gap_width = v end |
#grouping ⇒ Symbol
grouping for a column, line, or area chart. must be one of [:percentStacked, :clustered, :standard, :stacked]
47 48 49 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 47 def grouping @grouping ||= :clustered end |
#grouping=(v) ⇒ Object
grouping for a column, line, or area chart. must be one of [:percentStacked, :clustered, :standard, :stacked]
94 95 96 97 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 94 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]
54 55 56 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 54 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]
115 116 117 118 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 115 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
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 123 def to_xml_string(str = +'') super(str) do str << '<c:bar3DChart>' str << '<c:barDir val="' << .to_s << '"/>' str << '<c:grouping val="' << grouping.to_s << '"/>' str << '<c:varyColors val="' << vary_colors.to_s << '"/>' @series.each { |ser| ser.to_xml_string(str) } @d_lbls.to_xml_string(str) if @d_lbls str << '<c:gapWidth val="' << @gap_width.to_s << '"/>' unless @gap_width.nil? str << '<c:gapDepth val="' << @gap_depth.to_s << '"/>' unless @gap_depth.nil? str << '<c:shape val="' << @shape.to_s << '"/>' unless @shape.nil? axes.to_xml_string(str, ids: true) str << '</c:bar3DChart>' axes.to_xml_string(str) end end |
#val_axis ⇒ ValAxis Also known as: valAxis
the value axis
19 20 21 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 19 def val_axis axes[:val_axis] end |