Class: Axlsx::NumDataSource
- Inherits:
-
Object
- Object
- Axlsx::NumDataSource
- Includes:
- OptionsParser
- Defined in:
- lib/axlsx/drawing/num_data_source.rb
Overview
A numeric data source for use by charts.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#tag_name ⇒ Symbol
The tag name to use when serializing this data source.
Class Method Summary collapse
-
.allowed_tag_names ⇒ Array
allowed element tag names.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ NumDataSource
constructor
creates a new NumDataSource object.
-
#to_xml_string(str = "") ⇒ Object
serialize the object.
Methods included from OptionsParser
Constructor Details
#initialize(options = {}) ⇒ NumDataSource
creates a new NumDataSource object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/axlsx/drawing/num_data_source.rb', line 11 def initialize(={}) # override these three in child classes @data_type ||= NumData @tag_name ||= :val @ref_tag_name ||= :numRef @f = nil @data = @data_type.new() if [:data] && [:data].first.is_a?(Cell) @f = Axlsx::cell_range([:data]) end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
31 32 33 |
# File 'lib/axlsx/drawing/num_data_source.rb', line 31 def data @data end |
#tag_name ⇒ Symbol
The tag name to use when serializing this data source. Only items defined in allowed_tag_names are allowed
29 30 31 |
# File 'lib/axlsx/drawing/num_data_source.rb', line 29 def tag_name @tag_name end |
Class Method Details
.allowed_tag_names ⇒ Array
allowed element tag names
35 36 37 |
# File 'lib/axlsx/drawing/num_data_source.rb', line 35 def self.allowed_tag_names [:yVal, :val, :bubbleSize] end |
Instance Method Details
#to_xml_string(str = "") ⇒ Object
serialize the object
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/axlsx/drawing/num_data_source.rb', line 48 def to_xml_string(str="") str << ('<c:' << tag_name.to_s << '>') if @f str << ('<c:' << @ref_tag_name.to_s << '>') str << ('<c:f>' << @f.to_s << '</c:f>') end @data.to_xml_string str if @f str << ('</c:' << @ref_tag_name.to_s << '>') end str << ('</c:' << tag_name.to_s << '>') end |