Class: Axlsx::BarSeries
- Defined in:
- lib/axlsx/drawing/bar_series.rb
Overview
Note:
The recommended way to manage series is to use Chart#add_series
A BarSeries defines the title, data and labels for bar charts
Instance Attribute Summary collapse
-
#data ⇒ Array, SimpleTypedList
readonly
The data for this series.
-
#labels ⇒ Array, SimpleTypedList
readonly
The labels for this series.
-
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:percentStacked, :clustered, :standard, :stacked].
Attributes inherited from Series
Instance Method Summary collapse
-
#initialize(chart, options = {}) ⇒ BarSeries
constructor
Creates a new series.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods inherited from Series
Constructor Details
#initialize(chart, options = {}) ⇒ BarSeries
Creates a new series
29 30 31 32 33 34 |
# File 'lib/axlsx/drawing/bar_series.rb', line 29 def initialize(chart, ={}) @shape = :box super(chart, ) self.labels = CatAxisData.new([:labels]) unless [:labels].nil? self.data = ValAxisData.new([:data]) unless [:data].nil? end |
Instance Attribute Details
#data ⇒ Array, SimpleTypedList
The data for this series.
12 13 14 |
# File 'lib/axlsx/drawing/bar_series.rb', line 12 def data @data end |
#labels ⇒ Array, SimpleTypedList
The labels for this series.
16 17 18 |
# File 'lib/axlsx/drawing/bar_series.rb', line 16 def labels @labels end |
#shape ⇒ Symbol
The shabe of the bars or columns must be one of [:percentStacked, :clustered, :standard, :stacked]
21 22 23 |
# File 'lib/axlsx/drawing/bar_series.rb', line 21 def shape @shape end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
46 47 48 49 50 51 52 |
# File 'lib/axlsx/drawing/bar_series.rb', line 46 def to_xml_string(str = '') super(str) do |str_inner| @labels.to_xml_string(str_inner) unless @labels.nil? @data.to_xml_string(str_inner) unless @data.nil? str_inner << '<shape val="' << @shape.to_s << '"/>' end end |