Class: Axlsx::CatAxisData
- Inherits:
-
SimpleTypedList
- Object
- SimpleTypedList
- Axlsx::CatAxisData
- Defined in:
- lib/axlsx/drawing/cat_axis_data.rb
Overview
The CatAxisData class serializes the category axis data for a chart
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from SimpleTypedList
#allowed_types, #locked_at, #serialize_as
Instance Method Summary collapse
-
#initialize(data = []) ⇒ CatAxisData
constructor
Create a new CatAxisData object.
-
#to_xml(xml) ⇒ String
Serializes the category axis data.
Methods inherited from SimpleTypedList
#<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock
Constructor Details
#initialize(data = []) ⇒ CatAxisData
Create a new CatAxisData object
7 8 9 10 |
# File 'lib/axlsx/drawing/cat_axis_data.rb', line 7 def initialize(data=[]) super Object @list.concat data if data.is_a?(Array) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Axlsx::SimpleTypedList
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the category axis data
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/axlsx/drawing/cat_axis_data.rb', line 15 def to_xml(xml) xml.send('c:cat') { xml.send('c:strRef') { xml.send('c:f', Axlsx::cell_range(@list)) xml.send('c:strCache') { xml.send('c:ptCount', :val=>size) each_with_index do |item, index| v = item.is_a?(Cell) ? item.value : item xml.send('c:pt', :idx=>index) { xml.send('c:v', v) } end } } } end |