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(xml) ⇒ String
Serializes the series.
Methods inherited from Series
Constructor Details
permalink #initialize(chart, options = {}) ⇒ BarSeries
Creates a new series
28 29 30 31 32 33 |
# File 'lib/axlsx/drawing/bar_series.rb', line 28 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
permalink #data ⇒ Array, SimpleTypedList
The data for this series.
11 12 13 |
# File 'lib/axlsx/drawing/bar_series.rb', line 11 def data @data end |
permalink #labels ⇒ Array, SimpleTypedList
The labels for this series.
15 16 17 |
# File 'lib/axlsx/drawing/bar_series.rb', line 15 def labels @labels end |
permalink #shape ⇒ Symbol
The shabe of the bars or columns must be one of [:percentStacked, :clustered, :standard, :stacked]
20 21 22 |
# File 'lib/axlsx/drawing/bar_series.rb', line 20 def shape @shape end |
Instance Method Details
permalink #to_xml(xml) ⇒ String
Serializes the series
45 46 47 48 49 50 51 |
# File 'lib/axlsx/drawing/bar_series.rb', line 45 def to_xml(xml) super(xml) do |xml_inner| @labels.to_xml(xml_inner) unless @labels.nil? @data.to_xml(xml_inner) unless @data.nil? xml_inner.shape :val=>@shape end end |