Class: Axlsx::NamedAxisData
- Inherits:
-
CatAxisData
- Object
- SimpleTypedList
- CatAxisData
- Axlsx::NamedAxisData
- Defined in:
- lib/axlsx/drawing/named_axis_data.rb
Overview
The ValAxisData class manages the values for a chart value series.
Instance Method Summary collapse
-
#initialize(name, data = []) ⇒ NamedAxisData
constructor
creates a new NamedAxisData Object.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Constructor Details
#initialize(name, data = []) ⇒ NamedAxisData
creates a new NamedAxisData Object
10 11 12 13 |
# File 'lib/axlsx/drawing/named_axis_data.rb', line 10 def initialize(name, data=[]) super(data) @name = name end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/axlsx/drawing/named_axis_data.rb', line 18 def to_xml_string(str = '') str << '<c:' << @name.to_s << '>' str << '<c:numRef>' str << '<c:f>' << Axlsx::cell_range(@list) << '</c:f>' str << '<c:numCache>' str << '<c:formatCode>General</c:formatCode>' str << '<c:ptCount val="' << size.to_s << '"/>' each_with_index do |item, index| v = item.is_a?(Cell) ? item.value.to_s : item str << '<c:pt idx="' << index.to_s << '"><c:v>' << v << '</c:v></c:pt>' end str << '</c:numCache>' str << '</c:numRef>' str << '</c:' << @name.to_s << '>' end |