summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/axis.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-03-10 01:27:47 +0900
committerRandy Morgan <[email protected]>2012-03-10 01:27:47 +0900
commit94663f5523112b11ec9bf6a213acf6c838ed60f5 (patch)
tree5d3d3c64a0ae6d88d0370ef01333a0f539c4716e /lib/axlsx/drawing/axis.rb
parent5befcc4e3b949967f0cc3cb85d2a92b5705fbb79 (diff)
downloadcaxlsx-94663f5523112b11ec9bf6a213acf6c838ed60f5.tar.gz
caxlsx-94663f5523112b11ec9bf6a213acf6c838ed60f5.zip
adding in quick patch for catAxis, valAxis on charts to specify gridlines = false. Needs specs once I work out what the hell happened to nokogiri in 1.5.1
Diffstat (limited to 'lib/axlsx/drawing/axis.rb')
-rw-r--r--lib/axlsx/drawing/axis.rb29
1 files changed, 23 insertions, 6 deletions
diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb
index ad550269..183cbcad 100644
--- a/lib/axlsx/drawing/axis.rb
+++ b/lib/axlsx/drawing/axis.rb
@@ -3,7 +3,7 @@ module Axlsx
# the access class defines common properties and values for a chart axis.
class Axis
- # the id of the axis.
+ # the id of the axis.
# @return [Integer]
attr_reader :axId
@@ -15,7 +15,7 @@ module Axlsx
# @see Scaling
# @return [Scaling]
attr_reader :scaling
-
+
# The position of the axis
# must be one of [:l, :r, :t, :b]
# @return [Symbol]
@@ -34,7 +34,11 @@ module Axlsx
# specifies how the perpendicular axis is crossed
# must be one of [:autoZero, :min, :max]
# @return [Symbol]
- attr_reader :crosses
+ attr_reader :crosses
+
+ # specifies if gridlines should be shown in the chart
+ # @return [Boolean]
+ attr_reader :gridlines
# Creates an Axis object
# @param [Integer] axId the id of this axis
@@ -49,11 +53,12 @@ module Axlsx
@axId = axId
@crossAx = crossAx
@format_code = "General"
- @scaling = Scaling.new(:orientation=>:minMax)
+ @scaling = Scaling.new(:orientation=>:minMax)
self.axPos = :b
self.tickLblPos = :nextTo
self.format_code = "General"
self.crosses = :autoZero
+ self.gridlines = true
options.each do |o|
self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
end
@@ -70,6 +75,10 @@ module Axlsx
# default :General
def format_code=(v) Axlsx::validate_string(v); @format_code = v; end
+ # Specify if gridlines should be shown for this axis
+ # default true
+ def gridlines=(v) Axlsx::validate_boolean(v); @gridlines = v; end
+
# specifies how the perpendicular axis is crossed
# must be one of [:autoZero, :min, :max]
def crosses=(v) RestrictionValidator.validate "#{self.class}.crosses", [:autoZero, :min, :max], v; @crosses = v; end
@@ -82,13 +91,21 @@ module Axlsx
@scaling.to_xml(xml)
xml.delete :val=>0
xml.axPos :val=>@axPos
- xml.majorGridlines
+ xml.majorGridlines {
+ if self.gridlines == false
+ xml.spPr {
+ xml[:a].ln {
+ xml[:a].noFill
+ }
+ }
+ end
+ }
xml.numFmt :formatCode => @format_code, :sourceLinked=>"1"
xml.majorTickMark :val=>"none"
xml.minorTickMark :val=>"none"
xml.tickLblPos :val=>@tickLblPos
xml.crossAx :val=>@crossAx
xml.crosses :val=>@crosses
- end
+ end
end
end