diff options
| author | Joe Kain <[email protected]> | 2012-03-16 20:29:35 -0700 |
|---|---|---|
| committer | Joe Kain <[email protected]> | 2012-03-22 21:55:47 -0700 |
| commit | 8a0f840313df5ab5543b491d475650b1b63b558e (patch) | |
| tree | 7bcace32256656a13afe8649bcf02a97bb66747b /lib/axlsx/drawing/scatter_chart.rb | |
| parent | 7881ee37e08d7768f8ba7c9270f2f07ea8b78cd0 (diff) | |
| download | caxlsx-8a0f840313df5ab5543b491d475650b1b63b558e.tar.gz caxlsx-8a0f840313df5ab5543b491d475650b1b63b558e.zip | |
Add Scatter charts
Diffstat (limited to 'lib/axlsx/drawing/scatter_chart.rb')
| -rw-r--r-- | lib/axlsx/drawing/scatter_chart.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb new file mode 100644 index 00000000..f257303a --- /dev/null +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -0,0 +1,50 @@ +# encoding: UTF-8 +module Axlsx + class ScatterChart < Chart + attr_reader :scatterStyle + + # the x value axis + # @return [ValAxis] + attr_reader :xValAxis + + # the y value axis + # @return [ValAxis] + attr_reader :yValAxis + + def initialize(frame, options={}) + @scatterStyle = :lineMarker + @xValAxId = rand(8 ** 8) + @yValAxId = rand(8 ** 8) + @xValAxis = ValAxis.new(@xValAxId, @yValAxId) + @yValAxis = ValAxis.new(@yValAxId, @xValAxId) + super(frame, options) + @series_type = ScatterSeries + end + + # Serializes the bar chart + # @return [String] + def to_xml + super() do |xml| + xml.scatterChart { + xml.scatterStyle :val=>scatterStyle + + # This is all repeated from line_3D_chart.rb! + xml.varyColors :val=>1 + @series.each { |ser| ser.to_xml(xml) } + xml.dLbls { + xml.showLegendKey :val=>0 + xml.showVal :val=>0 + xml.showCatName :val=>0 + xml.showSerName :val=>0 + xml.showPercent :val=>0 + xml.showBubbleSize :val=>0 + } + xml.axId :val=>@xValAxId + xml.axId :val=>@yValAxId + } + @xValAxis.to_xml(xml) + @yValAxis.to_xml(xml) + end + end + end +end |
