diff options
| author | Oleg Yakovenko <[email protected]> | 2021-03-01 18:37:28 +0200 |
|---|---|---|
| committer | Oleg Yakovenko <[email protected]> | 2021-03-01 18:37:28 +0200 |
| commit | 8dd92ebff726f60fbd31f5f0dcb05849745dea39 (patch) | |
| tree | 031dd95c741e7828cae93e8c0012afefa8586cd5 /lib/axlsx/drawing/scatter_series.rb | |
| parent | d74a588a2f5b3e15a4fe94a946f058d0dfaa1c5e (diff) | |
| download | caxlsx-8dd92ebff726f60fbd31f5f0dcb05849745dea39.tar.gz caxlsx-8dd92ebff726f60fbd31f5f0dcb05849745dea39.zip | |
feature: marker symbol management for scatter series
Diffstat (limited to 'lib/axlsx/drawing/scatter_series.rb')
| -rw-r--r-- | lib/axlsx/drawing/scatter_series.rb | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/lib/axlsx/drawing/scatter_series.rb b/lib/axlsx/drawing/scatter_series.rb index 1e116860..b62fc006 100644 --- a/lib/axlsx/drawing/scatter_series.rb +++ b/lib/axlsx/drawing/scatter_series.rb @@ -30,11 +30,15 @@ module Axlsx # Line markers presence # @return [Boolean] - attr_reader :marker + attr_reader :show_marker + + # custom marker symbol + # @return [String] + attr_reader :marker_symbol # Creates a new ScatterSeries def initialize(chart, options={}) - @xData, @yData = nil + @xData, @yData, @marker_symbol = nil if options[:smooth].nil? # If caller hasn't specified smoothing or not, turn smoothing on or off based on scatter style @smooth = [:smooth, :smoothMarker].include?(chart.scatter_style) @@ -44,7 +48,7 @@ module Axlsx @smooth = options[:smooth] end @ln_width = options[:ln_width] unless options[:ln_width].nil? - @marker = [:lineMarker, :marker, :smoothMarker].include?(chart.scatter_style) + @show_marker = [:lineMarker, :marker, :smoothMarker].include?(chart.scatter_style) super(chart, options) @xData = AxDataSource.new(:tag_name => :xVal, :data => options[:xData]) unless options[:xData].nil? @@ -67,6 +71,12 @@ module Axlsx @ln_width = v end + # @see marker_symbol + def marker_symbol=(v) + Axlsx::validate_marker_symbol(v) + @marker_symbol = v + end + # Serializes the object # @param [String] str # @return [String] @@ -87,7 +97,13 @@ module Axlsx str << '<a:ln><a:solidFill>' str << ('<a:srgbClr val="' << color << '"/></a:solidFill></a:ln>') str << '</c:spPr>' - str << '<c:symbol val="none"/>' unless marker + + 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 + str << '</c:marker>' end if ln_width |
