lib/axlsx/drawing/scatter_series.rb in axlsx-2.1.0.pre vs lib/axlsx/drawing/scatter_series.rb in axlsx-3.0.0.pre

- old
+ new

@@ -19,14 +19,17 @@ # The fill color for this series. # Red, green, and blue is expressed as sequence of hex digits, RRGGBB. A perceptual gamma of 2.2 is used. # @return [String] attr_reader :color + # @return [String] + attr_reader :ln_width + # Line smoothing between data points # @return [Boolean] attr_reader :smooth - + # Creates a new ScatterSeries def initialize(chart, options={}) @xData, @yData = nil if options[:smooth].nil? # If caller hasn't specified smoothing or not, turn smoothing on or off based on scatter style @@ -34,10 +37,11 @@ else # Set smoothing according to the option provided Axlsx::validate_boolean(options[:smooth]) @smooth = options[:smooth] end + @ln_width = options[:ln_width] unless options[:ln_width].nil? super(chart, options) @xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil? @yData = NumDataSource.new({:tag_name => :yVal, :data => options[:yData]}) unless options[:yData].nil? end @@ -49,11 +53,16 @@ # @see smooth def smooth=(v) Axlsx::validate_boolean(v) @smooth = v end - + + # @see ln_width + def ln_width=(v) + @ln_width = v + end + # Serializes the object # @param [String] str # @return [String] def to_xml_string(str = '') super(str) do @@ -71,9 +80,14 @@ str << '</a:solidFill>' str << '<a:ln><a:solidFill>' str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>') str << '</c:spPr>' str << '</c:marker>' + end + if ln_width + str << '<c:spPr>' + str << '<a:ln w="' << ln_width.to_s << '"/>' + str << '</c:spPr>' end @xData.to_xml_string(str) unless @xData.nil? @yData.to_xml_string(str) unless @yData.nil? str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>') end