diff options
| author | Randy Morgan <[email protected]> | 2013-04-19 23:34:50 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-04-19 23:34:50 +0900 |
| commit | 08f04d573d00e91bb92d4d727f56d4bb21259eb0 (patch) | |
| tree | 6cc96940c4529af386ce7d811ccd9943c705be30 /lib | |
| parent | db18c28df9fe5c44404e5f9af70a3db14a4b1f9a (diff) | |
| download | caxlsx-08f04d573d00e91bb92d4d727f56d4bb21259eb0.tar.gz caxlsx-08f04d573d00e91bb92d4d727f56d4bb21259eb0.zip | |
Added prep for 1.3.6 release
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/drawing/axes.rb | 19 | ||||
| -rw-r--r-- | lib/axlsx/drawing/axis.rb | 6 | ||||
| -rw-r--r-- | lib/axlsx/drawing/bar_3D_chart.rb | 3 | ||||
| -rw-r--r-- | lib/axlsx/drawing/line_chart.rb | 7 | ||||
| -rw-r--r-- | lib/axlsx/drawing/scatter_chart.rb | 3 | ||||
| -rw-r--r-- | lib/axlsx/util/serialized_attributes.rb | 1 | ||||
| -rw-r--r-- | lib/axlsx/version.rb | 2 |
7 files changed, 36 insertions, 5 deletions
diff --git a/lib/axlsx/drawing/axes.rb b/lib/axlsx/drawing/axes.rb index 99565cb6..c3a8dd85 100644 --- a/lib/axlsx/drawing/axes.rb +++ b/lib/axlsx/drawing/axes.rb @@ -1,17 +1,31 @@ module Axlsx - + + # The Axes class creates and manages axis information and + # serialization for charts. 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. def initialize(options={}) options.each do |name, axis_class| add_axis(name, axis_class) end end + # [] provides assiciative access to a specic axis store in an axes + # instance. + # @return [Axis] def [](name) axes.assoc(name)[1] end + # Serializes the object + # @param [String] str + # @param [Hash] options + # @option options ids + # If the ids option is specified only the axis identifier is + # 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 << '"/>' } @@ -20,6 +34,9 @@ module Axlsx end end + # Adds an axis to the collection + # @param [Symbol] name The name of the axis + # @param [Axis] axis_class The axis class to generate def add_axis(name, axis_class) axis = axis_class.new set_cross_axis(axis) diff --git a/lib/axlsx/drawing/axis.rb b/lib/axlsx/drawing/axis.rb index 16c087a2..32e40373 100644 --- a/lib/axlsx/drawing/axis.rb +++ b/lib/axlsx/drawing/axis.rb @@ -7,7 +7,7 @@ module Axlsx include Axlsx::OptionsParser # Creates an Axis object - # @param [Integer] cross_axis the perpendicular axis + # @option options [Axis] cross_axis the perpendicular axis # @option options [Symbol] ax_pos # @option options [Symbol] crosses # @option options [Symbol] tick_lbl_pos @@ -90,7 +90,9 @@ module Axlsx def color=(color_rgb) @color = color_rgb end - + + # The crossing axis for this axis + # @param [Axis] axis def cross_axis=(axis) DataTypeValidator.validate "#{self.class}.cross_axis", [Axis], axis @cross_axis = axis diff --git a/lib/axlsx/drawing/bar_3D_chart.rb b/lib/axlsx/drawing/bar_3D_chart.rb index 0e2b37bb..3315ad80 100644 --- a/lib/axlsx/drawing/bar_3D_chart.rb +++ b/lib/axlsx/drawing/bar_3D_chart.rb @@ -141,6 +141,9 @@ module Axlsx end 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] + # @return [Axes] def axes @axes ||= Axes.new(:val_axis => ValAxis, :cat_axis => CatAxis) end diff --git a/lib/axlsx/drawing/line_chart.rb b/lib/axlsx/drawing/line_chart.rb index afe6154e..699050dc 100644 --- a/lib/axlsx/drawing/line_chart.rb +++ b/lib/axlsx/drawing/line_chart.rb @@ -59,6 +59,10 @@ module Axlsx @grouping = v end + # The node name to use in serialization. As LineChart is used as the + # base class for Liine3DChart we need to be sure to serialize the + # chart based on the actual class type and not a fixed node name. + # @return [String] def node_name path = self.class.to_s if i = path.rindex('::') @@ -85,6 +89,9 @@ module Axlsx end end + # The axes for this chart. LineCharts have a category and value + # axis. + # @return [Axes] def axes @axes ||= Axes.new(:cat_axis => CatAxis, :val_axis => ValAxis) end diff --git a/lib/axlsx/drawing/scatter_chart.rb b/lib/axlsx/drawing/scatter_chart.rb index f069e346..526bd6d5 100644 --- a/lib/axlsx/drawing/scatter_chart.rb +++ b/lib/axlsx/drawing/scatter_chart.rb @@ -64,6 +64,9 @@ module Axlsx str end + # The axes for the scatter chart. ScatterChart has an x_val_axis and + # a y_val_axis + # @return [Axes] def axes @axes ||= Axes.new(:x_val_axis => ValAxis, :y_val_axis => ValAxis) end diff --git a/lib/axlsx/util/serialized_attributes.rb b/lib/axlsx/util/serialized_attributes.rb index 5519f843..e421984b 100644 --- a/lib/axlsx/util/serialized_attributes.rb +++ b/lib/axlsx/util/serialized_attributes.rb @@ -59,7 +59,6 @@ module Axlsx # break the xml and 1.8.7 does not support ordered hashes. # @param [String] str The string instance to which serialized data is appended # @param [Array] additional_attributes An array of additional attribute names. - # @param [Proc] block A which will be called with the value for each element. # @return [String] The serialized output. def serialized_element_attributes(str='', additional_attributes=[], &block) attrs = self.class.xml_element_attributes + additional_attributes diff --git a/lib/axlsx/version.rb b/lib/axlsx/version.rb index 6b0df7df..546f601d 100644 --- a/lib/axlsx/version.rb +++ b/lib/axlsx/version.rb @@ -1,5 +1,5 @@ module Axlsx # The current version - VERSION = "1.3.5" + VERSION = "1.3.6" end |
