class Axlsx::Bar3DChart

The Bar3DChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet. @see Worksheet#add_chart @see Chart#add_series @see Package#serialize @see README for an example

Constants

GAP_AMOUNT_PERCENT

validation regex for gap amount percent

Attributes

gapDepth[R]

space between bar or column clusters, as a percentage of the bar or column width. @return [String]

gap_depth[R]

space between bar or column clusters, as a percentage of the bar or column width. @return [String]

Public Class Methods

new(frame, options={}) click to toggle source

Creates a new bar chart object @param [GraphicFrame] frame The workbook that owns this chart. @option options [Cell, String] title @option options [Boolean] show_legend @option options [Symbol] bar_dir @option options [Symbol] grouping @option options [String] gap_width @option options [String] gap_depth @option options [Symbol] shape @option options [Integer] rot_x @option options [String] h_percent @option options [Integer] rot_y @option options [String] depth_percent @option options [Boolean] r_ang_ax @option options [Integer] perspective @see Chart @see View3D

Calls superclass method
# File lib/axlsx/drawing/bar_3D_chart.rb, line 79
def initialize(frame, options={})
  @vary_colors = true
  @gap_width, @gap_depth, @shape = nil, nil, nil
  super(frame, options)
  @series_type = BarSeries
  @view_3D = View3D.new({:r_ang_ax=>1}.merge(options))
  @d_lbls = nil
end

Public Instance Methods

axes() click to toggle source

A hash of axes used by this chart. Bar charts have a value and category axes specified via axes and axes @return [Axes]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 147
def axes
 @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis)
end
barDir()
Alias for: bar_dir
barDir=(v)
Alias for: bar_dir=
bar_dir() click to toggle source

The direction of the bars in the chart must be one of [:bar, :col] @return [Symbol]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 28
def bar_dir
  @bar_dir ||= :bar
end
Also aliased as: barDir
bar_dir=(v) click to toggle source

The direction of the bars in the chart must be one of [:bar, :col]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 90
def bar_dir=(v)
  RestrictionValidator.validate "Bar3DChart.bar_dir", [:bar, :col], v
  @bar_dir = v
end
Also aliased as: barDir=
catAxis()
Alias for: cat_axis
cat_axis() click to toggle source

the category axis @return [CatAxis]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 13
def cat_axis
  axes[:cat_axis]
end
Also aliased as: catAxis
gapDepth=(v)
Alias for: gap_depth=
gapWidth()
Alias for: gap_width
gapWidth=(v)
Alias for: gap_width=
gap_depth=(v) click to toggle source

space between bar or column clusters, as a percentage of the bar or column width.

# File lib/axlsx/drawing/bar_3D_chart.rb, line 111
def gap_depth=(v)
  RegexValidator.validate "Bar3DChart.gap_didth", GAP_AMOUNT_PERCENT, v
  @gap_depth=(v)
end
Also aliased as: gapDepth=
gap_width() click to toggle source

space between bar or column clusters, as a percentage of the bar or column width. @return [String]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 40
def gap_width
  @gap_width ||= 150
end
Also aliased as: gapWidth
gap_width=(v) click to toggle source

space between bar or column clusters, as a percentage of the bar or column width.

# 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
Also aliased as: gapWidth=
grouping() click to toggle source

grouping for a column, line, or area chart.

must be one of  [:percentStacked, :clustered, :standard, :stacked]
@return [Symbol]
# File lib/axlsx/drawing/bar_3D_chart.rb, line 48
def grouping
  @grouping ||= :clustered
end
grouping=(v) click to toggle source

grouping for a column, line, or area chart.

must be one of  [:percentStacked, :clustered, :standard, :stacked]
# 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() click to toggle source

The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax] @return [Symbol]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 55
def shape
  @shape ||= :box
end
shape=(v) click to toggle source

The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]

# 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 = '') click to toggle source

Serializes the object @param [String] str @return [String]

Calls superclass method
# File lib/axlsx/drawing/bar_3D_chart.rb, line 127
def to_xml_string(str = '')
  super(str) do
    str << '<c:bar3DChart>'
    str << ('<c:barDir val="' << bar_dir.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
valAxis()
Alias for: val_axis
val_axis() click to toggle source

the value axis @return [ValAxis]

# File lib/axlsx/drawing/bar_3D_chart.rb, line 20
def val_axis
  axes[:val_axis]
end
Also aliased as: valAxis