diff options
| author | Randy Morgan <[email protected]> | 2013-01-23 08:22:16 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-01-23 08:22:39 +0900 |
| commit | 0e953a4f162bcd8a9d54a39504cea9c074551012 (patch) | |
| tree | 2e416f627a4127578cc1f2b7aa59e5ca440fa8a6 /lib/axlsx/drawing/bar_3D_chart.rb | |
| parent | 92448544db44106853b3f20a998a36f34a062c4d (diff) | |
| download | caxlsx-0e953a4f162bcd8a9d54a39504cea9c074551012.tar.gz caxlsx-0e953a4f162bcd8a9d54a39504cea9c074551012.zip | |
Updated chart vary_colors
This sets the proper default for each chart type and lets us change it
as we need.
Diffstat (limited to 'lib/axlsx/drawing/bar_3D_chart.rb')
| -rw-r--r-- | lib/axlsx/drawing/bar_3D_chart.rb | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 50dbecb2..6f69f703 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -21,7 +21,9 @@ module Axlsx # The direction of the bars in the chart # must be one of [:bar, :col] # @return [Symbol] - attr_reader :bar_dir + def bar_dir + @bar_dir ||= :bar + end alias :barDir :bar_dir # space between bar or column clusters, as a percentage of the bar or column width. @@ -31,18 +33,24 @@ module Axlsx # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] - attr_reader :gap_width + def gap_width + @gap_width ||= 150 + end alias :gapWidth :gap_width - + #grouping for a column, line, or area chart. # must be one of [:percentStacked, :clustered, :standard, :stacked] # @return [Symbol] - attr_reader :grouping + def grouping + @grouping ||= :clustered + end # The shabe of the bars or columns # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax] # @return [Symbol] - attr_reader :shape + def shape + @shape ||= :box + end # validation regex for gap amount percent GAP_AMOUNT_PERCENT = /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/ @@ -65,10 +73,7 @@ module Axlsx # @see Chart # @see View3D def initialize(frame, options={}) - @bar_dir = :bar - @grouping = :clustered - @shape = :box - @gap_width = 150 + @vary_colors = true @gap_width, @gap_depth, @shape = nil, nil, nil @cat_ax_id = rand(8 ** 8) @val_ax_id = rand(8 ** 8) @@ -124,7 +129,7 @@ module Axlsx str_inner << '<c:bar3DChart>' str_inner << '<c:barDir val="' << bar_dir.to_s << '"/>' str_inner << '<c:grouping val="' << grouping.to_s << '"/>' - str_inner << '<c:varyColors val="1"/>' + str_inner << '<c:varyColors val="' << vary_colors.to_s << '"/>' @series.each { |ser| ser.to_xml_string(str_inner) } @d_lbls.to_xml_string(str) if @d_lbls str_inner << '<c:gapWidth val="' << @gap_width.to_s << '"/>' unless @gap_width.nil? |
