summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/scatter_chart.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-04-03 08:38:37 +0900
committerRandy Morgan <[email protected]>2012-04-03 08:38:37 +0900
commit7df172a8f3815e1291f41098705650afd5a2b41d (patch)
tree35f25742e09201a50c595ac0250c000a3c272c65 /lib/axlsx/drawing/scatter_chart.rb
parent6f998ecb098c2a3a5eabc6f8ef44a0f25632f2c8 (diff)
downloadcaxlsx-7df172a8f3815e1291f41098705650afd5a2b41d.tar.gz
caxlsx-7df172a8f3815e1291f41098705650afd5a2b41d.zip
pre-release cleanup
Diffstat (limited to 'lib/axlsx/drawing/scatter_chart.rb')
-rw-r--r--lib/axlsx/drawing/scatter_chart.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb
index d8d7bb6d..1495a907 100644
--- a/lib/axlsx/drawing/scatter_chart.rb
+++ b/lib/axlsx/drawing/scatter_chart.rb
@@ -1,6 +1,15 @@
# encoding: UTF-8
module Axlsx
+
+ # The ScatterChart allows you to insert a scatter chart into your worksheet
+ # @see Worksheet#add_chart
+ # @see Chart#add_series
+ # @see README for an example
class ScatterChart < Chart
+
+ # The Style for the scatter chart
+ # must be one of :none | :line | :lineMarker | :marker | :smooth | :smoothMarker
+ # return [Symbol]
attr_reader :scatterStyle
# the x value axis
@@ -11,6 +20,7 @@ module Axlsx
# @return [ValAxis]
attr_reader :yValAxis
+ # Creates a new scatter chart
def initialize(frame, options={})
@scatterStyle = :lineMarker
@xValAxId = rand(8 ** 8)
@@ -19,8 +29,20 @@ module Axlsx
@yValAxis = ValAxis.new(@yValAxId, @xValAxId)
super(frame, options)
@series_type = ScatterSeries
+ options.each do |o|
+ self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
+ end
+ end
+
+ # see #scatterStyle
+ def scatterStyle=(v)
+ Axlsx.validate_scatter_style(v)
+ @scatterStyle = v
end
+ # Serializes the object
+ # @param [String] str
+ # @return [String]
def to_xml_string(str = '')
super do |str|
str << '<c:scatterChart>'