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/series.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/series.rb')
| -rw-r--r-- | lib/axlsx/drawing/series.rb | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/axlsx/drawing/series.rb b/lib/axlsx/drawing/series.rb index 1544bc48..5960f508 100644 --- a/lib/axlsx/drawing/series.rb +++ b/lib/axlsx/drawing/series.rb @@ -25,7 +25,7 @@ module Axlsx options.each do |o| self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}=" end - end + end # The index of this series in the chart's series. # @return [Integer] @@ -44,16 +44,25 @@ module Axlsx def order=(v) Axlsx::validate_unsigned_int(v); @order = v; end # @see title - def title=(v) + def title=(v) v = SeriesTitle.new(v) if v.is_a?(String) || v.is_a?(Cell) DataTypeValidator.validate "#{self.class}.title", SeriesTitle, v @title = v end - - private - + + private + # assigns the chart for this series - def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end + def chart=(v) DataTypeValidator.validate "Series.chart", Chart, v; @chart = v; end + + def to_xml_string(str = '') + str << '<ser>' + str << '<idx val="' << index.to_s << '"/>' + str << '<order val="' << (order || index).to_s << '"/>' + title.to_xml_string(str) unless title.nil? + yeild str if block_given? + str << '</ser>' + end # Serializes the series # @param [Nokogiri::XML::Builder] xml The document builder instance this objects xml will be added to. |
