diff options
| author | Stefan <[email protected]> | 2022-06-01 10:06:40 +0200 |
|---|---|---|
| committer | Stefan Daschek <[email protected]> | 2022-06-05 11:58:52 +0200 |
| commit | e8d3b693b3dfaef80a2047afe2a955f1f376f43a (patch) | |
| tree | b53f0690f063e2ae0999d89442e138ec07dfad8d /lib | |
| parent | 022b5271a2a0c800c863643af278ba3067d136d2 (diff) | |
| download | caxlsx-e8d3b693b3dfaef80a2047afe2a955f1f376f43a.tar.gz caxlsx-e8d3b693b3dfaef80a2047afe2a955f1f376f43a.zip | |
Implement “rounded corners” setting for charts
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.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/drawing/chart.rb | 12 |
1 files changed, 12 insertions, 0 deletions
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 << '<?xml version="1.0" encoding="UTF-8"?>' str << ('<c:chartSpace xmlns:c="' << XML_NS_C << '" xmlns:a="' << XML_NS_A << '" xmlns:r="' << XML_NS_R << '">') str << ('<c:date1904 val="' << Axlsx::Workbook.date1904.to_s << '"/>') + str << ('<c:roundedCorners val="' << rounded_corners.to_s << '"/>') str << ('<c:style val="' << style.to_s << '"/>') str << '<c:chart>' @title.to_xml_string(str) unless @title.empty? |
