summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/bar_3D_chart.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2011-11-23 12:28:10 +0900
committerRandy Morgan <[email protected]>2011-11-23 12:28:10 +0900
commit6739c249e7bf3cf7d2132b2aa49b6faf6bebec29 (patch)
treec68e1527212c3665464debeebd2d97c127b0887e /lib/axlsx/drawing/bar_3D_chart.rb
parent099a1d5a7824b7a6392bfe2f124ebeaf9d8122db (diff)
downloadcaxlsx-6739c249e7bf3cf7d2132b2aa49b6faf6bebec29.tar.gz
caxlsx-6739c249e7bf3cf7d2132b2aa49b6faf6bebec29.zip
-refactoring chart position and axis data/category for chart.
-additional specs and documentation improvements.
Diffstat (limited to 'lib/axlsx/drawing/bar_3D_chart.rb')
-rw-r--r--lib/axlsx/drawing/bar_3D_chart.rb42
1 files changed, 12 insertions, 30 deletions
diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb
index 1d7e2bba..3d7f6296 100644
--- a/lib/axlsx/drawing/bar_3D_chart.rb
+++ b/lib/axlsx/drawing/bar_3D_chart.rb
@@ -1,43 +1,17 @@
module Axlsx
# The Bar3DChart is a three dimentional barchart (who would have guessed?) that you can add to your worksheet.
- # @example Creating a chart
- # # This example creates two charts in a single sheet.
- # # The first uses data directly fed to the sheet, while the second references cells withing the worksheet for data.
- #
- # require "rubygems" # if that is your preferred way to manage gems!
- # require "axlsx"
- #
- # p = Axlsx::Package.new
- # ws = p.workbook.add_worksheet
- # ws.add_row :values => ["This is a chart with no data in the sheet"]
- #
- # chart = ws.add_chart(Axlsx::Bar3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets")
- # chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"]
- #
- # ws.add_row :values => ["This chart uses the data below"]
- # title_row = ws.add_row :values => ["Least Popular Pets"]
- # label_row = ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"]
- # data_row = ws.add_row :values => ["Votes", 6, 4, 1]
- #
- # chart = ws.add_chart(Axlsx::Pie3DChart, :start_at => [0,11], :end_at =>[0,16], :title => title_row.cells.last)
- # chart.add_series :data => data_row.cells[(1..-1)], :labels => label_row.cells
- #
- # f = File.open('example_pie_3d_chart.xlsx', 'w')
- # p.serialize(f)
- #
# @see Worksheet#add_chart
- # @see Worksheet#add_row
# @see Chart#add_series
- # @see Series
# @see Package#serialize
+ # @see README for an example
class Bar3DChart < Chart
# the category axis
# @return [CatAxis]
attr_reader :catAxis
- # the category axis
+ # the valueaxis
# @return [ValAxis]
attr_reader :valAxis
@@ -60,7 +34,7 @@ module Axlsx
attr_accessor :grouping
# The shabe of the bars or columns
- # must be one of [:percentStacked, :clustered, :standard, :stacked]
+ # must be one of [:cone, :coneToMax, :box, :cylinder, :pyramid, :pyramidToMax]
# @return [Symbol]
attr_accessor :shape
@@ -76,6 +50,14 @@ module Axlsx
# @option options [String] gapWidth
# @option options [String] gapDepth
# @option options [Symbol] shape
+ # @option options [Integer] rotX
+ # @option options [String] hPercent
+ # @option options [Integer] rotY
+ # @option options [String] depthPercent
+ # @option options [Boolean] rAngAx
+ # @option options [Integer] perspective
+ # @see Chart
+ # @see View3D
def initialize(frame, options={})
@barDir = :bar
@grouping = :clustered
@@ -83,9 +65,9 @@ module Axlsx
@valAxId = rand(8 ** 8)
@catAxis = CatAxis.new(@catAxId, @valAxId)
@valAxis = ValAxis.new(@valAxId, @catAxId)
- @view3D = View3D.new(:rAngAx=>1)
super(frame, options)
@series_type = BarSeries
+ @view3D = View3D.new({:rAngAx=>1}.merge(options))
end
def barDir=(v)