summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/scatter_series.rb
blob: 03b2cbdd538a8d7926db3c9d2166b8dd7ac96e85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# encoding: UTF-8
module Axlsx
  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

    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

    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