summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorMoses Hohman <[email protected]>2013-06-23 01:06:26 -0500
committerMoses Hohman <[email protected]>2013-06-23 01:06:26 -0500
commit173f1c49fb449aebc5ddf30a9387006ee54e5260 (patch)
tree15262ded1d8fe4a6d4ce814423e22ccf0c3fa6e5 /lib
parent21fce3b99e639abe757716750a2a7f9970e572ab (diff)
downloadcaxlsx-173f1c49fb449aebc5ddf30a9387006ee54e5260.tar.gz
caxlsx-173f1c49fb449aebc5ddf30a9387006ee54e5260.zip
Fixes Issue #202 Axes are borked in Bar3DChart
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/drawing/axes.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb
index c3a8dd85..fc440b1a 100644
--- a/lib/axlsx/drawing/axes.rb
+++ b/lib/axlsx/drawing/axes.rb
@@ -28,7 +28,9 @@ module Axlsx
# serialized. Otherwise, each axis is serialized in full.
def to_xml_string(str = '', options = {})
if options[:ids]
- axes.inject(str) { |string, axis| string << '<c:axId val="' << axis[1].id.to_s << '"/>' }
+ # CatAxis must come first in the XML (for Microsoft Excel at least)
+ sorted = axes.sort_by { |name, axis| axis.kind_of?(CatAxis) ? 0 : 1 }
+ sorted.inject(str) { |string, axis| string << '<c:axId val="' << axis[1].id.to_s << '"/>' }
else
axes.each { |axis| axis[1].to_xml_string(str) }
end