summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonathan Tron <[email protected]>2015-07-05 14:32:47 +0200
committerJonathan Tron <[email protected]>2015-07-05 14:32:47 +0200
commite36dbc979496d6e95667804cafb9448046912c1b (patch)
treec2442a9e1b9b8fced408bf8f39cf02347425b2f1
parentebb8c19b6231dc24a3ca280fc4c0f78e78b91ef5 (diff)
parent1aed4d61f773fb24d198d643ae4ae062e2789620 (diff)
downloadcaxlsx-e36dbc979496d6e95667804cafb9448046912c1b.tar.gz
caxlsx-e36dbc979496d6e95667804cafb9448046912c1b.zip
Merge branch 'marker_symbols' of https://github.com/mfrank01/axlsx into mfrank01-marker_symbols
-rw-r--r--lib/axlsx/drawing/line_series.rb19
-rw-r--r--lib/axlsx/util/validators.rb4
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb
index 50df27b8..55b5245d 100644
--- a/lib/axlsx/drawing/line_series.rb
+++ b/lib/axlsx/drawing/line_series.rb
@@ -23,6 +23,10 @@ module Axlsx
# @return [Boolean]
attr_reader :show_marker
+ # custom marker symbol
+ # @return [String]
+ attr_reader :marker_symbol
+
# line smoothing on values
# @return [Boolean]
attr_reader :smooth
@@ -33,6 +37,7 @@ module Axlsx
# @param [Chart] chart
def initialize(chart, options={})
@show_marker = false
+ @marker_symbol = options[:marker_symbol] ? options[:marker_symbol] : :default
@smooth = false
@labels, @data = nil, nil
super(chart, options)
@@ -51,6 +56,12 @@ module Axlsx
@show_marker = v
end
+ # @see marker_symbol
+ def marker_symbol(v)
+ Axlsx::validate_marker_symbol(v)
+ @marker_symbol = v
+ end
+
# @see smooth
def smooth=(v)
Axlsx::validate_boolean(v)
@@ -74,7 +85,13 @@ module Axlsx
str << '<a:round/>'
str << '</c:spPr>'
end
- str << '<c:marker><c:symbol val="none"/></c:marker>' unless @show_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
+
@labels.to_xml_string(str) unless @labels.nil?
@data.to_xml_string(str) unless @data.nil?
str << ('<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>')
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index c9ee2e6e..9c6f34aa 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -304,4 +304,8 @@ module Axlsx
RestrictionValidator.validate :visibility, [:visible, :hidden, :very_hidden], v
end
+ # Requires that the value is one of :default, :circle, :dash, :diamond, :dot, :picture, :plus, :square, :star, :triangle, :x
+ def self.validate_marker_symbol(v)
+ RestrictionValidator.validate :marker_symbol, [:default, :circle, :dash, :diamond, :dot, :picture, :plus, :square, :star, :triangle, :x], v
+ end
end