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.
-
#marker_symbol ⇒ String
custom marker symbol.
-
#show_marker ⇒ Boolean
show markers on values.
-
#smooth ⇒ Boolean
line smoothing 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
36 37 38 39 40 41 42 43 44 |
# File 'lib/axlsx/drawing/line_series.rb', line 36 def initialize(chart, = {}) @show_marker = false @marker_symbol = [:marker_symbol] ? [:marker_symbol] : :default @smooth = 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.
18 19 20 |
# File 'lib/axlsx/drawing/line_series.rb', line 18 def color @color end |
#data ⇒ ValAxisData
The data for this series.
9 10 11 |
# File 'lib/axlsx/drawing/line_series.rb', line 9 def data @data end |
#labels ⇒ CatAxisData
The labels for this series.
13 14 15 |
# File 'lib/axlsx/drawing/line_series.rb', line 13 def labels @labels end |
#marker_symbol ⇒ String
custom marker symbol
26 27 28 |
# File 'lib/axlsx/drawing/line_series.rb', line 26 def marker_symbol @marker_symbol end |
#show_marker ⇒ Boolean
show markers on values
22 23 24 |
# File 'lib/axlsx/drawing/line_series.rb', line 22 def show_marker @show_marker end |
#smooth ⇒ Boolean
line smoothing on values
30 31 32 |
# File 'lib/axlsx/drawing/line_series.rb', line 30 def smooth @smooth end |
Instance Method Details
#to_xml_string(str = '') ⇒ String
Serializes the object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/axlsx/drawing/line_series.rb', line 72 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 if !@show_marker str << '<c:marker><c:symbol val="none"/></c:marker>' elsif @marker_symbol != :default str << '<c:marker><c:symbol val="' + @marker_symbol.to_s + '"/></c:marker>' end @labels.to_xml_string(str) unless @labels.nil? @data.to_xml_string(str) unless @data.nil? str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>') end end |