class Axlsx::BarSeries

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

def colors=(v) DataTypeValidator.validate "BarSeries.colors", [Array], v; @colors = v end

Other tags:
    See: colors -
def colors=(v) DataTypeValidator.validate "BarSeries.colors", [Array], v; @colors = v end

def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end

assigns the data for this series
def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end

def initialize(chart, options = {})

Parameters:
  • chart (Chart) --

Options Hash: (**options)
  • series_color (String) -- a color to use when rendering series
  • colors (String) -- an array of colors to use when rendering each data point
  • shape (String) --
  • title (String) --
  • labels (Array, SimpleTypedList) --
  • data (Array, SimpleTypedList) --
def initialize(chart, options = {})
  @shape = :box
  @colors = []
  super(chart, options)
  self.labels = AxDataSource.new({ :data => options[:labels] }) unless options[:labels].nil?
  self.data = NumDataSource.new(options) unless options[:data].nil?
end

def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end

assigns the labels for this series
def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end

def series_color=(v)

def series_color=(v)
  @series_color = v
end

def shape=(v)

Other tags:
    See: shape -
def shape=(v)
  RestrictionValidator.validate "BarSeries.shape", [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax], v
  @shape = v
end

def to_xml_string(str = '')

Returns:
  • (String) -

Parameters:
  • str (String) --
def to_xml_string(str = '')
  super(str) do
    colors.each_with_index do |c, index|
      str << '<c:dPt>'
      str << ('<c:idx val="' << index.to_s << '"/>')
      str << '<c:spPr><a:solidFill>'
      str << ('<a:srgbClr val="' << c << '"/>')
      str << '</a:solidFill></c:spPr></c:dPt>'
    end
    if series_color
      str << '<c:spPr><a:solidFill>'
      str << ('<a:srgbClr val="' << series_color << '"/>')
      str << '</a:solidFill>'
      str << '</c:spPr>'
    end
    @labels.to_xml_string(str) unless @labels.nil?
    @data.to_xml_string(str) unless @data.nil?
    # this is actually only required for shapes other than box
    str << ('<c:shape val="' << shape.to_s << '"></c:shape>')
  end
end