Sha256: 238b713f47f3a3eef0a008d6a5db756320befb4aa15fe645458b5717a86f23e4
Contents?: true
Size: 1.78 KB
Versions: 14
Compression:
Stored size: 1.78 KB
Contents
# encoding: UTF-8 module Axlsx # 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 class LineSeries < Series # The data for this series. # @return [ValAxisData] attr_reader :data # The labels for this series. # @return [CatAxisData] attr_reader :labels # 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 # Creates a new series # @option options [Array, SimpleTypedList] data # @option options [Array, SimpleTypedList] labels # @param [Chart] chart def initialize(chart, options={}) @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 # @see color def color=(v) @color = v end # Serializes the object # @param [String] str # @return [String] def to_xml_string(str = '') super(str) do if color str << '<c:spPr><a:solidFill>' str << '<a:srgbClr val="' << color << '"/>' str << '</a:solidFill></c:spPr>' end @labels.to_xml_string(str) unless @labels.nil? @data.to_xml_string(str) unless @data.nil? end end private # assigns the data for this series def data=(v) DataTypeValidator.validate "Series.data", [NumDataSource], v; @data = v; end # assigns the labels for this series def labels=(v) DataTypeValidator.validate "Series.labels", [AxDataSource], v; @labels = v; end end end
Version data entries
14 entries across 14 versions & 1 rubygems