diff options
| author | Randy Morgan <[email protected]> | 2013-03-17 15:38:55 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-03-17 15:38:55 +0900 |
| commit | ae75ef360e3e0da253188d408a3cbc81ed3897e6 (patch) | |
| tree | 9bf184d72c4a78b3f14731af511aad26002a51ad /lib/axlsx/drawing/line_3D_chart.rb | |
| parent | 17f135ab215ba05b85ef92a15ed0038ea7556de9 (diff) | |
| download | caxlsx-ae75ef360e3e0da253188d408a3cbc81ed3897e6.tar.gz caxlsx-ae75ef360e3e0da253188d408a3cbc81ed3897e6.zip | |
Fixed LineChart and refactored chart axes management
Diffstat (limited to 'lib/axlsx/drawing/line_3D_chart.rb')
| -rw-r--r-- | lib/axlsx/drawing/line_3D_chart.rb | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/lib/axlsx/drawing/line_3D_chart.rb b/lib/axlsx/drawing/line_3D_chart.rb index 627cfe83..183f3250 100644 --- a/lib/axlsx/drawing/line_3D_chart.rb +++ b/lib/axlsx/drawing/line_3D_chart.rb @@ -11,7 +11,7 @@ module Axlsx # ws = p.workbook.add_worksheet # ws.add_row ["This is a chart with no data in the sheet"] # - # chart = ws.add_chart(Axlsx::Line3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets") + # chart = ws.add_chart(Axlsx::Line3DChart, :start_at=> [0,1], :end_at=>[0,6], :t#itle=>"Most Popular Pets") # chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"] # # @see Worksheet#add_chart @@ -19,48 +19,50 @@ module Axlsx # @see Chart#add_series # @see Series # @see Package#serialize - class Line3DChart < LineChart + class Line3DChart < Axlsx::LineChart # space between bar or column clusters, as a percentage of the bar or column width. # @return [String] - attr_reader :gapDepth + attr_reader :gap_depth + alias :gapDepth :gap_depth # validation regex for gap amount percent GAP_AMOUNT_PERCENT = /0*(([0-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/ + # the category axis + # @return [Axis] + def ser_axis + axes[:ser_axis] + end + alias :serAxis :ser_axis + # Creates a new line chart object - # @param [GraphicFrame] frame The workbook that owns this chart. - # @option options [Cell, String] title - # @option options [Boolean] show_legend - # @option options [Symbol] grouping - # @option options [String] gapDepth - # @option options [Integer] rotX - # @option options [String] hPercent - # @option options [Integer] rotY - # @option options [String] depthPercent - # @option options [Boolean] rAngAx - # @option options [Integer] perspective + # @option options [String] gap_depth # @see Chart + # @see lineChart # @see View3D def initialize(frame, options={}) - @gapDepth = nil + @gap_depth = nil + @view_3D = View3D.new({:r_ang_ax=>1}.merge(options)) super(frame, options) - @view_3D = View3D.new({:perspective=>30}.merge(options)) + axes.add_axis :ser_axis, SerAxis end + # @see gapDepth - def gapDepth=(v) - RegexValidator.validate "Bar3DChart.gapWidth", GAP_AMOUNT_PERCENT, v - @gapDepth=(v) + def gap_depth=(v) + RegexValidator.validate "Line3DChart.gapWidth", GAP_AMOUNT_PERCENT, v + @gap_depth=(v) end + alias :gapDepth= :gap_depth= - # Serializes the object - # @param [String] str - # @return [String] - def to_xml_string(str = '') - super(str) do |str_inner| - str_inner << '<c:gapDepth val="' << @gapDepth.to_s << '"/>' unless @gapDepth.nil? + # Serializes the object + # @param [String] str + # @return [String] + def to_xml_string(str = '') + super(str) do |str_inner| + str_inner << '<c:gapDepth val="' << @gap_depth.to_s << '"/>' unless @gap_depth.nil? + end end - end end end |
