summaryrefslogtreecommitdiffhomepage
path: root/lib/axlsx/drawing/axis.rb
diff options
context:
space:
mode:
authorRandy Morgan <[email protected]>2012-07-10 20:27:42 +0900
committerRandy Morgan <[email protected]>2012-07-10 20:27:42 +0900
commite82f217d5d94d5e07c195323b61f9e3195ac6634 (patch)
tree1cfccdba9f632722ee3464742ee5083923845e44 /lib/axlsx/drawing/axis.rb
parent8f0e868940fe7fd56e2c43e2b1102ec1d3e58a0e (diff)
downloadcaxlsx-e82f217d5d94d5e07c195323b61f9e3195ac6634.tar.gz
caxlsx-e82f217d5d94d5e07c195323b61f9e3195ac6634.zip
more cleanup
Diffstat (limited to 'lib/axlsx/drawing/axis.rb')
-rw-r--r--lib/axlsx/drawing/axis.rb63
1 files changed, 33 insertions, 30 deletions
diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb
index 5706f4ad..e13426cd 100644
--- a/lib/axlsx/drawing/axis.rb
+++ b/lib/axlsx/drawing/axis.rb
@@ -1,9 +1,34 @@
# encoding: UTF-8
module Axlsx
- # the access class defines common properties and values for a chart axis.
- class Axis
+ # the access class defines common properties and values for a chart axis.
+ class Axis
+ # Creates an Axis object
+ # @param [Integer] ax_id the id of this axis
+ # @param [Integer] cross_ax the id of the perpendicular axis
+ # @option options [Symbol] ax_pos
+ # @option options [Symbol] crosses
+ # @option options [Symbol] tick_lbl_pos
+ # @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
+ def initialize(ax_id, cross_ax, options={})
+ Axlsx::validate_unsigned_int(ax_id)
+ Axlsx::validate_unsigned_int(cross_ax)
+ @ax_id = ax_id
+ @cross_ax = cross_ax
+ @format_code = "General"
+ @delete = @label_rotation = 0
+ @scaling = Scaling.new(:orientation=>:minMax)
+ @title = @color = nil
+ self.ax_pos = :b
+ self.tick_lbl_pos = :nextTo
+ self.format_code = "General"
+ self.crosses = :autoZero
+ self.gridlines = true
+ options.each do |name, value|
+ self.send("#{name}=", value) if self.respond_to? "#{name}="
+ end
+ end
# the fill color to use in the axis shape properties. This should be a 6 character long hex string
# e.g. FF0000 for red
@@ -62,35 +87,14 @@ module Axlsx
# the title for the axis. This can be a cell or a fixed string.
attr_reader :title
- # Creates an Axis object
- # @param [Integer] ax_id the id of this axis
- # @param [Integer] cross_ax the id of the perpendicular axis
- # @option options [Symbol] ax_pos
- # @option options [Symbol] crosses
- # @option options [Symbol] tick_lbl_pos
- # @raise [ArgumentError] If axi_id or cross_ax are not unsigned integers
- def initialize(ax_id, cross_ax, options={})
- Axlsx::validate_unsigned_int(ax_id)
- Axlsx::validate_unsigned_int(cross_ax)
- @ax_id = ax_id
- @cross_ax = cross_ax
- @format_code = "General"
- @delete = @label_rotation = 0
- @scaling = Scaling.new(:orientation=>:minMax)
- @title = @color = nil
- self.ax_pos = :b
- self.tick_lbl_pos = :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
- end
-
+ # The color for this axis. This value is used when rendering the axis line in the chart.
+ # colors should be in 6 character rbg format
+ # @return [String] the rbg color assinged.
+ # @see color
def color=(color_rgb)
@color = color_rgb
end
+
# The position of the axis
# must be one of [:l, :r, :t, :b]
def ax_pos=(v) RestrictionValidator.validate "#{self.class}.ax_pos", [:l, :r, :b, :t], v; @ax_pos = v; end
@@ -109,7 +113,6 @@ module Axlsx
# default true
def gridlines=(v) Axlsx::validate_boolean(v); @gridlines = v; end
-
# Specify if axis should be removed from the chart
# default false
def delete=(v) Axlsx::validate_boolean(v); @delete = v; end
@@ -127,7 +130,6 @@ module Axlsx
@label_rotation = adjusted
end
-
# The title object for the chart.
# @param [String, Cell] v
# @return [Title]
@@ -178,4 +180,5 @@ module Axlsx
end
end
+
end