Method: Axlsx::ValAxisData#to_xml

Defined in:
lib/axlsx/drawing/val_axis_data.rb

#to_xml(xml) ⇒ String

Serializes the value axis data

Parameters:

  • xml (Nokogiri::XML::Builder)

    The document builder instance this objects xml will be added to.

Returns:

  • (String)


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/axlsx/drawing/val_axis_data.rb', line 8

def to_xml(xml)
  xml.send('c:val') {
    xml.send('c:numRef') {
      xml.send('c:f', Axlsx::cell_range(@list))
      xml.send('c:numCache') {
        xml.send('c:formatCode', 'General')
        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