class Axlsx::LineSeries

A LineSeries defines the title, data and labels for line charts @note The recommended way to manage series is to use Chart#add_series @see Worksheet#add_chart @see Chart#add_series

Attributes

color[R]

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]

data[R]

The data for this series. @return [ValAxisData]

labels[R]

The labels for this series. @return [CatAxisData]

show_marker[R]

show markers on values @return [Boolean]

Public Class Methods

new(chart, options={}) click to toggle source

Creates a new series @option options [Array, SimpleTypedList] data @option options [Array, SimpleTypedList] labels @param [Chart] chart

Calls superclass method
# File lib/axlsx/drawing/line_series.rb, line 30
def initialize(chart, options={})
  @show_marker = false
  @labels, @data = nil, nil
  super(chart, options)
  @labels = AxDataSource.new(:data => options[:labels]) unless options[:labels].nil?
  @data = NumDataSource.new(options) unless options[:data].nil?
end

Public Instance Methods

color=(v) click to toggle source

@see color

# File lib/axlsx/drawing/line_series.rb, line 39
def color=(v)
  @color = v
end
show_marker=(v) click to toggle source

@see show_marker

# File lib/axlsx/drawing/line_series.rb, line 44
def show_marker=(v)
  Axlsx::validate_boolean(v)
  @show_marker = v
end
to_xml_string(str = '') click to toggle source

Serializes the object @param [String] str @return [String]

Calls superclass method
# File lib/axlsx/drawing/line_series.rb, line 52
def to_xml_string(str = '')
  super(str) do
    if color
      str << '<c:spPr><a:solidFill>'
      str << '<a:srgbClr val="' << color << '"/>'
      str << '</a:solidFill>'
      str << '<a:ln w="28800">'
      str << '<a:solidFill>'
      str << '<a:srgbClr val="' << color << '"/>'
      str << '</a:solidFill>'
      str << '</a:ln>'
      str << '<a:round/>'
      str << '</c:spPr>'
    end
    str << '<c:marker><c:symbol val="none"/></c:marker>' unless @show_marker
    @labels.to_xml_string(str) unless @labels.nil?
    @data.to_xml_string(str) unless @data.nil?
  end
end

Private Instance Methods

data=(v) click to toggle source

assigns the data for this series

# File lib/axlsx/drawing/line_series.rb, line 75
def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end
labels=(v) click to toggle source

assigns the labels for this series

# File lib/axlsx/drawing/line_series.rb, line 78
def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end