From e8d3b693b3dfaef80a2047afe2a955f1f376f43a Mon Sep 17 00:00:00 2001 From: Stefan Date: Wed, 1 Jun 2022 10:06:40 +0200 Subject: Implement “rounded corners” setting for charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Until now this setting was not present in the generated XML. According to the ECMA spec the setting defaults to true, so charts always had rounded corners. Now rounded corners can be disabled explicitly. --- lib/axlsx/drawing/chart.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/axlsx/drawing/chart.rb b/lib/axlsx/drawing/chart.rb index 723c79d8..500353cf 100644 --- a/lib/axlsx/drawing/chart.rb +++ b/lib/axlsx/drawing/chart.rb @@ -15,6 +15,7 @@ module Axlsx # @option options [Array|String|Cell] start_at The X, Y coordinates defining the top left corner of the chart. # @option options [Array|String|Cell] end_at The X, Y coordinates defining the bottom right corner of the chart. # @option options [Boolean] plot_visible_only (true) Whether only data from visible cells should be plotted. + # @option options [Boolean] rounded_corners (true) Whether the chart area shall have rounded corners. def initialize(frame, options={}) @style = 18 @view_3D = nil @@ -28,6 +29,7 @@ module Axlsx @title = Title.new @bg_color = nil @plot_visible_only = true + @rounded_corners = true parse_options options start_at(*options[:start_at]) if options[:start_at] end_at(*options[:end_at]) if options[:end_at] @@ -104,6 +106,10 @@ module Axlsx # @return [Boolean] attr_reader :plot_visible_only + # Whether the chart area shall have rounded corners. + # @return [Boolean] + attr_reader :rounded_corners + # The relationship object for this chart. # @return [Relationship] def relationship @@ -191,6 +197,11 @@ module Axlsx # @return [Boolean] def plot_visible_only=(v) Axlsx::validate_boolean(v); @plot_visible_only = v; end + # Whether the chart area shall have rounded corners. + # @param [Boolean] v + # @return [Boolean] + def rounded_corners=(v) Axlsx::validate_boolean(v); @rounded_corners = v; end + # Serializes the object # @param [String] str # @return [String] @@ -198,6 +209,7 @@ module Axlsx str << '' str << ('') str << ('') + str << ('') str << ('') str << '' @title.to_xml_string(str) unless @title.empty? -- cgit v1.2.3