Class: Axlsx::LineSeries
- Defined in:
- lib/axlsx/drawing/line_series.rb
Overview
Note:
The recommended way to manage series is to use Chart#add_series
A LineSeries defines the title, data and labels for line charts
Instance Attribute Summary collapse
-
#color ⇒ String
The fill color for this series.
-
#data ⇒ ValAxisData
readonly
The data for this series.
-
#labels ⇒ CatAxisData
readonly
The labels for this series.
-
#show_marker ⇒ Boolean
show markers on values.
Attributes inherited from Series
Instance Method Summary collapse
-
#initialize(chart, options = {}) ⇒ LineSeries
constructor
Creates a new series.
-
#to_xml_string(str = '') ⇒ String
Serializes the object.
Methods inherited from Series
Methods included from OptionsParser
Constructor Details
#initialize(chart, options = {}) ⇒ LineSeries
Creates a new series
30 31 32 33 34 35 36 |
# File 'lib/axlsx/drawing/line_series.rb', line 30 def initialize(chart, ={}) @show_marker = false @labels, @data = nil, nil super(chart, ) @labels = AxDataSource.new(:data => [:labels]) unless [:labels].nil? @data = NumDataSource.new() unless [:data].nil? end |
Instance Attribute Details
#color ⇒ String
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.
20 21 22 |
# File 'lib/axlsx/drawing/line_series.rb', line 20 def color @color end |
#data ⇒ ValAxisData
The data for this series.
11 12 13 |
# File 'lib/axlsx/drawing/line_series.rb', line 11 def data @data end |
#labels ⇒ CatAxisData
The labels for this series.
15 16 17 |
# File 'lib/axlsx/drawing/line_series.rb', line 15 def labels @labels end |
#show_marker ⇒ Boolean
show markers on values
24 25 26 |
# File 'lib/axlsx/drawing/line_series.rb', line 24 def show_marker @show_marker end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# 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 |