diff options
| author | Randy Morgan <[email protected]> | 2012-04-01 00:35:26 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2012-04-01 00:35:26 +0900 |
| commit | 22a341841f191a5aa00e87b1f166b4f25cc67f0a (patch) | |
| tree | 505f46708d5cac7d33d0dd6679c125e2eb819075 /lib/axlsx/drawing/chart.rb | |
| parent | bb2117ba17297e02a0fc6d5ad5a22462e72a9a79 (diff) | |
| download | caxlsx-22a341841f191a5aa00e87b1f166b4f25cc67f0a.tar.gz caxlsx-22a341841f191a5aa00e87b1f166b4f25cc67f0a.zip | |
part way through changing all serialization to use string concatenation prior to dropping Nokogiri dep in production.
Diffstat (limited to 'lib/axlsx/drawing/chart.rb')
| -rw-r--r-- | lib/axlsx/drawing/chart.rb | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index b612fbed..a0bc75ba 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -113,6 +113,37 @@ module Axlsx @series.last end + + def to_xml_string + str << '<?xml version="1.0" encoding="UTF-8"?>' + str << '<c:chartSpace xmlns:c="' << XML_NS_C << '" xmlns:a="' << XML_NS_A << '">' + str << '<c:date1904 val="' << Axlsx::Workbook.date1904.to_s << '"/>' + str << '<c:style val="' << style.to_s << '"/>' + str << '<c:chart>' + @title.to_xml_string str + # do these need the c: namespace as well??? + str << '<autoTitleDeleted val="0"/>' + @view3D.to_xml_string(str) if @view3D + str << '<floor thickness="0"/>' + str << '<sideWall thickness="0"/>' + str << '<backWall thickness="0"/>' + str << '<plotArea>' + str << '<layout/>' + yield str if block_given? + str << '</plotArea>' + if @show_legend + str << '<legend>' + str << '<legendPos val="r"/>' + str << '<layout/>' + str << '<overlay val="0"/>' + str << '</legend>' + end + str << '<plotVisOnly val="1"/>' + str << '<dispBlanksAs val="zero"/>' + str << '<showDLblsOverMax val="1"/>' + str << '</c:chart>' + str << '</c:chartSpace>' + end # Chart Serialization # serializes the chart def to_xml @@ -133,7 +164,7 @@ module Axlsx yield xml if block_given? } if @show_legend - xml.legend { + xml.legend { xml.legendPos :val => "r" xml.layout xml.overlay :val => 0 |
