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
-
#barDir ⇒ Symbol
The direction of the bars in the chart must be one of [:bar, :col].
-
#catAxis ⇒ CatAxis
readonly
the category axis.
-
#gapDepth ⇒ String
space between bar or column clusters, as a percentage of the bar or column width.
-
#gapWidth ⇒ String
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.
-
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax].
-
#valAxis ⇒ ValAxis
readonly
the valueaxis.
Attributes inherited from Chart
#graphic_frame, #series, #series_type, #show_legend, #style, #title, #view3D
Instance Method Summary collapse
-
#initialize(frame, options = {}) ⇒ Bar3DChart
constructor
Creates a new bar chart object.
-
#to_xml ⇒ String
Serializes the bar chart.
Methods inherited from Chart
#add_series, #end_at, #from, #index, #pn, #start_at, #to
Constructor Details
#initialize(frame, options = {}) ⇒ Bar3DChart
Creates a new bar chart object
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 61 def initialize(frame, ={}) @barDir = :bar @grouping = :clustered @gapWidth, @gapDepth, @shape = nil, nil, nil @catAxId = rand(8 ** 8) @valAxId = rand(8 ** 8) @catAxis = CatAxis.new(@catAxId, @valAxId) @valAxis = ValAxis.new(@valAxId, @catAxId, :tickLblPos => :low) super(frame, ) @series_type = BarSeries @view3D = View3D.new({:rAngAx=>1}.merge()) end |
Instance Attribute Details
#barDir ⇒ Symbol
The direction of the bars in the chart must be one of [:bar, :col]
21 22 23 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 21 def @barDir end |
#catAxis ⇒ CatAxis (readonly)
the category axis
12 13 14 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 12 def catAxis @catAxis end |
#gapDepth ⇒ String
space between bar or column clusters, as a percentage of the bar or column width.
25 26 27 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 25 def gapDepth @gapDepth end |
#gapWidth ⇒ String
space between bar or column clusters, as a percentage of the bar or column width.
29 30 31 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 29 def gapWidth @gapWidth end |
#grouping ⇒ Symbol
grouping for a column, line, or area chart. must be one of [:percentStacked, :clustered, :standard, :stacked]
34 35 36 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 34 def grouping @grouping end |
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
39 40 41 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 39 def shape @shape end |
#valAxis ⇒ ValAxis (readonly)
the valueaxis
16 17 18 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 16 def valAxis @valAxis end |
Instance Method Details
#to_xml ⇒ String
Serializes the bar chart
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/axlsx/drawing/bar_3D_chart.rb', line 109 def to_xml super() do |xml| xml. { xml. :val => xml.grouping :val=>grouping xml.varyColors :val=>1 @series.each { |ser| ser.to_xml(xml) } xml.dLbls { xml.showLegendKey :val=>0 xml.showVal :val=>0 xml.showCatName :val=>0 xml.showSerName :val=>0 xml.showPercent :val=>0 xml.showBubbleSize :val=>0 } xml.gapWidth :val=>@gapWidth unless @gapWidth.nil? xml.gapDepth :val=>@gapDepth unless @gapDepth.nil? xml.shape :val=>@shape unless @shape.nil? xml.axId :val=>@catAxId xml.axId :val=>@valAxId xml.axId :val=>0 } @catAxis.to_xml(xml) @valAxis.to_xml(xml) end end |