summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/series_title.rb
blob: de977633dcd621a60fb2376b246030a07c3d9f5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Axlsx
  # A series title is a Title with a slightly different serialization than chart titles.
  class SeriesTitle < Title

    # Serializes the series title
    # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to.
    # @return [String]
    def to_xml(xml)
      xml.send('c:tx') {
        xml.send('c:strRef') {
          xml.send('c:f', Axlsx::cell_range([@cell]))
          xml.send('c:strCache') {
            xml.send('c:ptCount', :val=>1)
            xml.send('c:pt', :idx=>0) {
              xml.send('c:v', @text)
            }
          }
        }
      }
    end
  end
end