Class: Axlsx::Title
- Inherits:
-
Object
- Object
- Axlsx::Title
- Defined in:
- lib/axlsx/drawing/title.rb
Overview
A Title stores information about the title of a chart
Direct Known Subclasses
Instance Attribute Summary collapse
-
#cell ⇒ Cell
The cell that holds the text for the title.
-
#text ⇒ String
The text to be shown.
Instance Method Summary collapse
-
#initialize(title = "") ⇒ Title
constructor
Creates a new Title object.
-
#to_xml(xml) ⇒ String
Serializes the chart title.
Constructor Details
Instance Attribute Details
#cell ⇒ Cell
The cell that holds the text for the title. Setting this property will automatically update the text attribute.
11 12 13 |
# File 'lib/axlsx/drawing/title.rb', line 11 def cell @cell end |
#text ⇒ String
The text to be shown. Setting this property directly with a string will remove the cell reference.
7 8 9 |
# File 'lib/axlsx/drawing/title.rb', line 7 def text @text end |
Instance Method Details
#to_xml(xml) ⇒ String
Serializes the chart title
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/axlsx/drawing/title.rb', line 44 def to_xml(xml) xml[:c].title { unless @text.empty? xml[:c].tx { xml[:c].strRef { xml[:c].f Axlsx::cell_range([@cell]) xml[:c].strCache { xml[:c].ptCount :val=>1 xml[:c].pt(:idx=>0) { xml[:c].v @text } } } } end xml[:c].layout xml[:c]. :val=>0 } end |