summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRandy Morgan (@morgan_randy) <[email protected]>2013-09-26 16:50:23 -0700
committerRandy Morgan (@morgan_randy) <[email protected]>2013-09-26 16:50:23 -0700
commitf7ef48248db87faaf2229c14ceec5633c662614c (patch)
tree38ee901720f6cadc9b1f372a12eb57e79ee194fd /lib
parent168fcb8406d80f863d5d1b50a38e585580f89acf (diff)
parent70eb08fdbbd7b36d2cd1bcb40eba1eaf381a63ac (diff)
downloadcaxlsx-f7ef48248db87faaf2229c14ceec5633c662614c.tar.gz
caxlsx-f7ef48248db87faaf2229c14ceec5633c662614c.zip
Merge pull request #245 from patorash/feature-line-chart-smooth
smooth line for line chart
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/drawing/line_chart.rb3
-rw-r--r--lib/axlsx/drawing/line_series.rb12
2 files changed, 12 insertions, 3 deletions
diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb
index 8ff32412..699050dc 100644
--- a/lib/axlsx/drawing/line_chart.rb
+++ b/lib/axlsx/drawing/line_chart.rb
@@ -39,8 +39,6 @@ module Axlsx
# @return [Symbol]
attr_reader :grouping
- attr_accessor :smooth
-
# Creates a new line chart object
# @param [GraphicFrame] frame The workbook that owns this chart.
# @option options [Cell, String] title
@@ -85,7 +83,6 @@ module Axlsx
@series.each { |ser| ser.to_xml_string(str_inner) }
@d_lbls.to_xml_string(str_inner) if @d_lbls
yield str_inner if block_given?
- str_inner << '<c:smooth val="1"/>' if smooth
axes.to_xml_string(str_inner, :ids => true)
str_inner << "</c:" << node_name << ">"
axes.to_xml_string(str_inner)
diff --git a/lib/axlsx/drawing/line_series.rb b/lib/axlsx/drawing/line_series.rb
index b011e0b6..93478b8f 100644
--- a/lib/axlsx/drawing/line_series.rb
+++ b/lib/axlsx/drawing/line_series.rb
@@ -23,12 +23,17 @@ module Axlsx
# @return [Boolean]
attr_reader :show_marker
+ # line smoothing on values
+ # @return [Boolean]
+ attr_reader :smooth
+
# Creates a new series
# @option options [Array, SimpleTypedList] data
# @option options [Array, SimpleTypedList] labels
# @param [Chart] chart
def initialize(chart, options={})
@show_marker = false
+ @smooth = false
@labels, @data = nil, nil
super(chart, options)
@labels = AxDataSource.new(:data => options[:labels]) unless options[:labels].nil?
@@ -46,6 +51,12 @@ module Axlsx
@show_marker = v
end
+ # @see smooth
+ def smooth=(v)
+ Axlsx::validate_boolean(v)
+ @smooth = v
+ end
+
# Serializes the object
# @param [String] str
# @return [String]
@@ -66,6 +77,7 @@ module Axlsx
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?
+ str << '<c:smooth val="' << ((smooth) ? '1' : '0') << '"/>'
end
end