summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorMoses Hohman <[email protected]>2013-06-27 15:36:34 -0500
committerMoses Hohman <[email protected]>2013-06-27 15:42:05 -0500
commita960e6be4032e7f5638359503c81cdfa31a1f7b5 (patch)
treed26d1f5397a16df5ed9ea87ba4557bd32875c86f /lib
parent4954543cc0892008f580f05cfb810fb0986b107f (diff)
downloadcaxlsx-a960e6be4032e7f5638359503c81cdfa31a1f7b5.tar.gz
caxlsx-a960e6be4032e7f5638359503c81cdfa31a1f7b5.zip
Fixes Issue #202 Axes are borked in Bar3DChart by requiring axis order in the constructor
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/drawing/axes.rb6
-rw-r--r--lib/axlsx/drawing/bar_3D_chart.rb4
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb
index c3a8dd85..40364d10 100644
--- a/lib/axlsx/drawing/axes.rb
+++ b/lib/axlsx/drawing/axes.rb
@@ -5,9 +5,11 @@ module Axlsx
class Axes
# @param [Hash] options options used to generate axis each key
- # should be an axis name like :val_axix and its value should be the
- # class of the axis type to construct.
+ # should be an axis name like :val_axis and its value should be the
+ # class of the axis type to construct. The :cat_axis, if there is one,
+ # must come first (we assume a Ruby 1.9+ Hash or an OrderedHash).
def initialize(options={})
+ raise(ArgumentError, "CatAxis must come first") if options.keys.include?(:cat_axis) && options.keys.first != :cat_axis
options.each do |name, axis_class|
add_axis(name, axis_class)
end
diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb
index 3315ad80..755f334c 100644
--- a/lib/axlsx/drawing/bar_3D_chart.rb
+++ b/lib/axlsx/drawing/bar_3D_chart.rb
@@ -142,10 +142,10 @@ module Axlsx
end
# A hash of axes used by this chart. Bar charts have a value and
- # category axes specified via axex[:val_axes] and axes[:cat_axis]
+ # category axes specified via axes[:val_axes] and axes[:cat_axis]
# @return [Axes]
def axes
- @axes ||= Axes.new(:val_axis => ValAxis, :cat_axis => CatAxis)
+ @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis)
end
end
end