Sha256: 79f8f9a211eda7fbc72bb46ac5b2d7e85b6ac477ba949da576232c74bdd1c770

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# encoding: UTF-8
module Axlsx

  # A ScatterSeries defines the x and y position of data in the chart
  # @note The recommended way to manage series is to use Chart#add_series
  # @see Worksheet#add_chart
  # @see Chart#add_series
  # @see examples/example.rb
  class ScatterSeries < Series

    # The x data for this series.
    # @return [NamedAxisData]
    attr_reader :xData

    # The y data for this series.
    # @return [NamedAxisData]
    attr_reader :yData

    # Creates a new ScatterSeries
    def initialize(chart, options={})
      @xData, @yData = nil
      super(chart, options)

      @xData = NamedAxisData.new("xVal", options[:xData]) unless options[:xData].nil?
      @yData = NamedAxisData.new("yVal", options[:yData]) unless options[:yData].nil?
    end

    # Serializes the object
    # @param [String] str
    # @return [String]
    def to_xml_string(str = '')
      super(str) do |inner_str|
        @xData.to_xml_string(inner_str) unless @xData.nil?
        @yData.to_xml_string(inner_str) unless @yData.nil?
      end
      str
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
axlsx-1.1.3 lib/axlsx/drawing/scatter_series.rb
axlsx-1.1.2 lib/axlsx/drawing/scatter_series.rb
axlsx-1.1.1 lib/axlsx/drawing/scatter_series.rb
axlsx-1.1.0 lib/axlsx/drawing/scatter_series.rb