diff options
| author | Randy Morgan <[email protected]> | 2011-11-21 23:42:03 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2011-11-21 23:42:03 +0900 |
| commit | 11729af6e1dc9492ba1fadb3681b885a4ff7dbbb (patch) | |
| tree | c47d5e007b9711066bc46be5914fe73e75bace6c /lib/axlsx/drawing/chart.rb | |
| parent | e53a0b7223e531046dd263ff5686d6e34196512a (diff) | |
| download | caxlsx-11729af6e1dc9492ba1fadb3681b885a4ff7dbbb.tar.gz caxlsx-11729af6e1dc9492ba1fadb3681b885a4ff7dbbb.zip | |
Adding in support for line charts, style attribute for all charts and minor bug fixes.
Diffstat (limited to 'lib/axlsx/drawing/chart.rb')
| -rw-r--r-- | lib/axlsx/drawing/chart.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 764e90e4..69932842 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- module Axlsx # A Chart is the superclass for specific charts # @note Worksheet#add_chart is the recommended way to create charts for your worksheets. @@ -7,6 +8,11 @@ module Axlsx # @return [Title] attr_accessor :title + # The style for the chart. + # see ECMA Part 1 ยง21.2.2.196 + # @return [Integer] + attr_accessor :style + # The 3D view properties for the chart attr_accessor :view3D @@ -50,6 +56,7 @@ module Axlsx # @option options [Cell, String] title # @option options [Boolean] show_legend def initialize(frame, options={}) + @style = 2 @graphic_frame=frame @graphic_frame.anchor.drawing.worksheet.workbook.charts << self @series = SimpleTypedList.new Series @@ -79,6 +86,8 @@ module Axlsx def show_legend=(v) Axlsx::validate_boolean(v); @show_legend = v; end + def style=(v) DataTypeValidator "Chart.style", Integer, v, lambda { |v| v >= 1 && v <= 48 }; @style = v; end + # Adds a new series to the chart's series collection. # @return [Series] # @see Series @@ -92,6 +101,8 @@ module Axlsx def to_xml builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml| xml.send('c:chartSpace',:'xmlns:c' => XML_NS_C, :'xmlns:a' => XML_NS_A) { + xml.send('c:date1904', :val=>Axlsx::Workbook.date1904) + xml.send('c:style', :val=>style) xml.send('c:chart') { @title.to_xml(xml) unless @title.nil? @view3D.to_xml(xml) unless @view3D.nil? |
