From 6739c249e7bf3cf7d2132b2aa49b6faf6bebec29 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Wed, 23 Nov 2011 12:28:10 +0900 Subject: -refactoring chart position and axis data/category for chart. -additional specs and documentation improvements. --- doc/Axlsx/App.html | 2 +- doc/Axlsx/Axis.html | 64 ++-- doc/Axlsx/Bar3DChart.html | 241 +++++++------ doc/Axlsx/BarSeries.html | 70 +--- doc/Axlsx/Border.html | 2 +- doc/Axlsx/BorderPr.html | 2 +- doc/Axlsx/CatAxis.html | 65 ++-- doc/Axlsx/CatAxisData.html | 400 ++++++++++++++++++++++ doc/Axlsx/Cell.html | 2 +- doc/Axlsx/CellAlignment.html | 2 +- doc/Axlsx/CellProtection.html | 2 +- doc/Axlsx/CellStyle.html | 2 +- doc/Axlsx/Chart.html | 661 ++++++++++++++++++++++++------------ doc/Axlsx/Color.html | 2 +- doc/Axlsx/ContentType.html | 4 +- doc/Axlsx/Core.html | 2 +- doc/Axlsx/DataTypeValidator.html | 2 +- doc/Axlsx/Default.html | 2 +- doc/Axlsx/Drawing.html | 156 ++++----- doc/Axlsx/Fill.html | 2 +- doc/Axlsx/Font.html | 2 +- doc/Axlsx/GradientFill.html | 2 +- doc/Axlsx/GradientStop.html | 2 +- doc/Axlsx/GraphicFrame.html | 12 +- doc/Axlsx/Line3DChart.html | 137 ++++++-- doc/Axlsx/LineSeries.html | 90 +---- doc/Axlsx/Marker.html | 2 +- doc/Axlsx/NumFmt.html | 2 +- doc/Axlsx/Override.html | 2 +- doc/Axlsx/Package.html | 2 +- doc/Axlsx/PatternFill.html | 2 +- doc/Axlsx/Pie3DChart.html | 184 ++++++---- doc/Axlsx/PieSeries.html | 119 ++----- doc/Axlsx/RegexValidator.html | 2 +- doc/Axlsx/Relationship.html | 2 +- doc/Axlsx/Relationships.html | 4 +- doc/Axlsx/RestrictionValidator.html | 2 +- doc/Axlsx/Row.html | 2 +- doc/Axlsx/Scaling.html | 2 +- doc/Axlsx/SerAxis.html | 89 +++-- doc/Axlsx/Series.html | 35 +- doc/Axlsx/SeriesTitle.html | 5 +- doc/Axlsx/SimpleTypedList.html | 103 +++++- doc/Axlsx/Styles.html | 2 +- doc/Axlsx/TableStyle.html | 4 +- doc/Axlsx/TableStyleElement.html | 2 +- doc/Axlsx/TableStyles.html | 4 +- doc/Axlsx/Title.html | 2 +- doc/Axlsx/TwoCellAnchor.html | 320 +++-------------- doc/Axlsx/ValAxis.html | 15 +- doc/Axlsx/ValAxisData.html | 326 ++++++++++++++++++ doc/Axlsx/View3D.html | 78 ++--- doc/Axlsx/Workbook.html | 2 +- doc/Axlsx/Worksheet.html | 123 ++++--- doc/Axlsx/Xf.html | 2 +- 55 files changed, 2114 insertions(+), 1255 deletions(-) create mode 100644 doc/Axlsx/CatAxisData.html create mode 100644 doc/Axlsx/ValAxisData.html (limited to 'doc/Axlsx') diff --git a/doc/Axlsx/App.html b/doc/Axlsx/App.html index ead90508..fcbd72ee 100644 --- a/doc/Axlsx/App.html +++ b/doc/Axlsx/App.html @@ -2631,7 +2631,7 @@ The document as a string diff --git a/doc/Axlsx/Axis.html b/doc/Axlsx/Axis.html index 7f4d1e0b..4ae315c3 100644 --- a/doc/Axlsx/Axis.html +++ b/doc/Axlsx/Axis.html @@ -95,7 +95,7 @@

Overview

-the access class defines common properties and values for chart axis +the access class defines common properties and values for a chart axis.

@@ -242,7 +242,7 @@ specifies how the perpendicular axis is crossed must be one of [:autoZero,

-The number format format code for this axis. +The number format format code for this axis default :General.

@@ -487,6 +487,25 @@ a customizable set of options +

Raises:

+
    + +
  • + + + (ArgumentError) + + + + — +

    +If axId or crossAx are not unsigned integers +

    +
    + +
  • + +
@@ -494,7 +513,6 @@ a customizable set of options
 
 
-44
 45
 46
 47
@@ -507,20 +525,21 @@ a customizable set of options
 54
 55
 56
-57
+57 +58
-
# File 'lib/axlsx/drawing/axis.rb', line 44
+      
# File 'lib/axlsx/drawing/axis.rb', line 45
 
 def initialize(axId, crossAx, options={})
   Axlsx::validate_unsigned_int(axId)
   Axlsx::validate_unsigned_int(crossAx)
   @axId = axId
   @crossAx = crossAx
+  @scaling = Scaling.new(:orientation=>:minMax)
   self.axPos = :l
   self.tickLblPos = :nextTo
-  @scaling = Scaling.new(:orientation=>:minMax)
-  @formatCode = ""
+  self.format_code = "General"
   self.crosses = :autoZero
   options.each do |o|
     self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
@@ -550,7 +569,7 @@ a customizable set of options
 

-the id of the axis +the id of the axis.

@@ -578,12 +597,12 @@ the id of the axis
 
 
+7
 8
-9
-10
+9
-
# File 'lib/axlsx/drawing/axis.rb', line 8
+      
# File 'lib/axlsx/drawing/axis.rb', line 7
 
 def axId
   @axId
@@ -692,12 +711,12 @@ The perpendicular axis
       
 
 
+11
 12
-13
-14
+13
-
# File 'lib/axlsx/drawing/axis.rb', line 12
+      
# File 'lib/axlsx/drawing/axis.rb', line 11
 
 def crossAx
   @crossAx
@@ -779,7 +798,7 @@ specifies how the perpendicular axis is crossed must be one of [:autoZero,
 

-The number format format code for this axis +The number format format code for this axis default :General

@@ -858,6 +877,13 @@ The scaling of the axis +

See Also:

+ +
@@ -1003,7 +1029,6 @@ The document builder instance this objects xml will be added to.
 
 
-67
 68
 69
 70
@@ -1012,10 +1037,11 @@ The document builder instance this objects xml will be added to.
 73
 74
 75
-76
+76 +77
-
# File 'lib/axlsx/drawing/axis.rb', line 67
+      
# File 'lib/axlsx/drawing/axis.rb', line 68
 
 def to_xml(xml)
   xml.send('c:axId', :val=>@axId)
@@ -1038,7 +1064,7 @@ The document builder instance this objects xml will be added to.
 
     
     
diff --git a/doc/Axlsx/Bar3DChart.html b/doc/Axlsx/Bar3DChart.html
index 8cb43ac0..fcee1a86 100644
--- a/doc/Axlsx/Bar3DChart.html
+++ b/doc/Axlsx/Bar3DChart.html
@@ -106,54 +106,18 @@ that you can add to your worksheet.
 
 
-
-

Examples:

- -

-Creating a chart -

-

-
# This example creates two charts in a single sheet.
-# The first uses data directly fed to the sheet, while the second references cells withing the worksheet for data.
-
-require "rubygems" # if that is your preferred way to manage gems!
-require "axlsx"
-
-p = Axlsx::Package.new
-ws = p.workbook.add_worksheet
-ws.add_row :values => ["This is a chart with no data in the sheet"]
-
-chart = ws.add_chart(Axlsx::Bar3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets")
-chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"]
-
-ws.add_row :values => ["This chart uses the data below"]
-title_row = ws.add_row :values => ["Least Popular Pets"]
-label_row = ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"]
-data_row = ws.add_row :values => ["Votes", 6, 4, 1]
-
-chart = ws.add_chart(Axlsx::Pie3DChart, :start_at => [0,11], :end_at =>[0,16], :title => title_row.cells.last)
-chart.add_series :data => data_row.cells[(1..-1)], :labels => label_row.cells  
-
-f = File.open('example_pie_3d_chart.xlsx', 'w')
-p.serialize(f)
-
- -
-

See Also:

@@ -347,8 +311,8 @@ grouping for a column, line, or area chart.

-The shabe of the bars or columns must be one of [:percentStacked, -:clustered, :standard, :stacked]. +The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, +:cylinder, :pyramid, :pyramidToMax].

@@ -375,7 +339,7 @@ The shabe of the bars or columns must be one of [:percentStacked,

-the category axis. +the valueaxis.

@@ -392,7 +356,7 @@ the category axis.

Attributes inherited from Chart

-

end_at, graphic_frame, index, pn, series, series_type, show_legend, start_at, style, title, view3D

+

graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

@@ -465,7 +429,7 @@ Serializes the bar chart.

Methods inherited from Chart

-

#add_series

+

#add_series, #end_at, #from, #start_at, #to

Constructor Details

@@ -598,30 +562,93 @@ a customizable set of options +
  • + rotX + (Integer) + + + + +
  • + +
  • + hPercent + (String) + + + + +
  • + +
  • + rotY + (Integer) + + + + +
  • + +
  • + depthPercent + (String) + + + + +
  • + +
  • + rAngAx + (Boolean) + + + + +
  • + +
  • + perspective + (Integer) + + + + +
  • + +

    See Also:

    + +
    @@ -686,12 +713,12 @@ The direction of the bars in the chart must be one of [:bar, :col]
     
     
    -47
    -48
    -49
    +21 +22 +23 @@ -674,73 +674,15 @@ The document builder instance this objects xml will be added to. 46 47 48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 +49 @@ -529,12 +532,12 @@ based on the data that is used for the axis labels, not a specific choice.
     
     
    -6
     7
    -8
    +8 +9 @@ -1137,19 +1138,19 @@ The starting marker for this chart - - + +
    -

    +

    - - (Integer) style + - (Title) title

    -The style for the chart. see ECMA Part 1 §21.2.2.196 +The title object for the chart.

    @@ -1163,7 +1164,7 @@ The style for the chart. see ECMA Part 1 §21.2.2.196
  • - (Integer) + (Title) @@ -1177,15 +1178,15 @@ The style for the chart. see ECMA Part 1 §21.2.2.196
     
     
    -14
    -15
    -16
    +37 +38 +39
  • @@ -1194,19 +1195,67 @@ The style for the chart. see ECMA Part 1 §21.2.2.196 - - + +
    -

    +

    - - (Title) title + - (Object) view3D

    -The title object for the chart. +The 3D view properties for the chart +

    + + +
    +
    +
    + + +
     
     
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    -87
    -88
    -89
    +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 79
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 61
     
     def initialize(frame, options={})
       @barDir = :bar
    @@ -630,9 +657,9 @@ a customizable set of options
       @valAxId = rand(8 ** 8)
       @catAxis = CatAxis.new(@catAxId, @valAxId)
       @valAxis = ValAxis.new(@valAxId, @catAxId)
    -  @view3D = View3D.new(:rAngAx=>1)
       super(frame, options)      
       @series_type = BarSeries
    +  @view3D = View3D.new({:rAngAx=>1}.merge(options))
     end
     
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 47
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 21
     
     def barDir
       @barDir
    @@ -743,12 +770,12 @@ the category axis
           
     
     
    -38
    -39
    -40
    +12 +13 +14
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 38
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 12
     
     def catAxis
       @catAxis
    @@ -801,12 +828,12 @@ width.
           
     
     
    -51
    -52
    -53
    +25 +26 +27
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 51
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 25
     
     def gapDepth
       @gapDepth
    @@ -859,12 +886,12 @@ width.
           
     
     
    -55
    -56
    -57
    +29 +30 +31
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 55
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 29
     
     def gapWidth
       @gapWidth
    @@ -917,12 +944,12 @@ grouping for a column, line, or area chart. must be one of
           
     
     
    -60
    -61
    -62
    +34 +35 +36
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 60
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 34
     
     def grouping
       @grouping
    @@ -946,8 +973,8 @@ grouping for a column, line, or area chart. must be one of
     

    -The shabe of the bars or columns must be one of [:percentStacked, -:clustered, :standard, :stacked] +The shabe of the bars or columns must be one of [:cone, :coneToMax, :box, +:cylinder, :pyramid, :pyramidToMax]

    @@ -975,12 +1002,12 @@ The shabe of the bars or columns must be one of [:percentStacked,
     
     
    -65
    -66
    -67
    +39 +40 +41
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 65
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 39
     
     def shape
       @shape
    @@ -1004,7 +1031,7 @@ The shabe of the bars or columns must be one of [:percentStacked,
     

    -the category axis +the valueaxis

    @@ -1032,12 +1059,12 @@ the category axis
     
     
    -42
    -43
    -44
    +16 +17 +18
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 42
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 16
     
     def valAxis
       @valAxis
    @@ -1093,27 +1120,27 @@ Serializes the bar chart
           
     
     
    -119
    -120
    -121
    -122
    -123
    -124
    -125
    -126
    -127
    -128
    -129
    -130
    -131
    -132
    -133
    -134
    -135
    -136
    +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118
    -
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 119
    +      
    # File 'lib/axlsx/drawing/bar_3D_chart.rb', line 101
     
     def to_xml
       super() do |xml|
    @@ -1144,7 +1171,7 @@ Serializes the bar chart
     
         
         
    diff --git a/doc/Axlsx/BarSeries.html b/doc/Axlsx/BarSeries.html
    index 749762da..303d12f3 100644
    --- a/doc/Axlsx/BarSeries.html
    +++ b/doc/Axlsx/BarSeries.html
    @@ -416,8 +416,8 @@ a customizable set of options
     def initialize(chart, options={})
       @shape = :box
       super(chart, options)
    -  self.data = options[:data]  || []
    -  self.labels = options[:labels] || []
    +  self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
    +  self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
     end
     
    # File 'lib/axlsx/drawing/bar_series.rb', line 43
     
     def to_xml(xml)
       super(xml) do |xml|
    -    if !labels.empty?
    -      xml.send('c:cat') {
    -        xml.send('c:strRef') {
    -          xml.send('c:f', Axlsx::cell_range(labels))
    -          xml.send('c:strCache') {
    -            xml.send('c:ptCount', :val=>labels.size)
    -            labels.each_with_index do |cell, index|
    -              v = cell.is_a?(Cell) ? cell.value : cell
    -              xml.send('c:pt', :idx=>index) {
    -                xml.send('c:v', v)
    -              }                          
    -            end
    -          }
    -        }
    -      }
    -    end
    -    xml.send('c:val') {
    -      xml.send('c:numRef') {
    -        xml.send('c:f', Axlsx::cell_range(data))
    -        xml.send('c:numCache') {
    -          xml.send('c:formatCode', 'General')
    -          xml.send('c:ptCount', :val=>data.size)
    -          data.each_with_index do |cell, index|
    -            v = cell.is_a?(Cell) ? cell.value : cell
    -            xml.send('c:pt', :idx=>index) {
    -              xml.send('c:v', v) 
    -            }
    -          end
    -        }                        
    -      }
    -    }
    +    @labels.to_xml(xml) unless @labels.nil?
    +    @data.to_xml(xml) unless @data.nil?
         xml.send('c:shape', :val=>@shape)
       end      
     end
    @@ -755,7 +697,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/Border.html b/doc/Axlsx/Border.html
    index acb2adbc..209a4388 100644
    --- a/doc/Axlsx/Border.html
    +++ b/doc/Axlsx/Border.html
    @@ -766,7 +766,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/BorderPr.html b/doc/Axlsx/BorderPr.html
    index cbacb66f..e4bcb6ab 100644
    --- a/doc/Axlsx/BorderPr.html
    +++ b/doc/Axlsx/BorderPr.html
    @@ -700,7 +700,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/CatAxis.html b/doc/Axlsx/CatAxis.html
    index 82f7c980..5babf097 100644
    --- a/doc/Axlsx/CatAxis.html
    +++ b/doc/Axlsx/CatAxis.html
    @@ -336,7 +336,7 @@ Creates a new CatAxis object
           
             —
             

    -the id of this axis +the id of this axis. Inherited

    @@ -353,7 +353,7 @@ the id of this axis —

    -the id of the perpendicular axis +the id of the perpendicular axis. Inherited

    @@ -391,30 +391,39 @@ a customizable set of options
    • - axPos + axPos. (Symbol) - + —

      +Inherited +

      +
    • - tickLblPos + tickLblPos. (Symbol) - + —

      +Inherited +

      +
    • - crosses + crosses. (Symbol) - + —

      +Inherited +

      +
    • @@ -454,27 +463,21 @@ a customizable set of options
       
       
      -30
       31
       32
       33
       34
       35
      -36
      -37
      -38
      +36
    -
    # File 'lib/axlsx/drawing/cat_axis.rb', line 30
    +      
    # File 'lib/axlsx/drawing/cat_axis.rb', line 31
     
     def initialize(axId, crossAx, options={})
    -  super(axId, crossAx, options)
       self.auto = true
       self.lblAlgn = :ctr
       self.lblOffset = "100%"
    -  options.each do |o|
    -    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
    -  end
    +  super(axId, crossAx, options)
     end
     
    -
    # File 'lib/axlsx/drawing/cat_axis.rb', line 6
    +      
    # File 'lib/axlsx/drawing/cat_axis.rb', line 7
     
     def auto
       @auto
    @@ -587,12 +590,12 @@ specifies how the perpendicular axis is crossed must be one of [:ctr, :l,
           
     
     
    -11
     12
    -13
    +13 +14
    -
    # File 'lib/axlsx/drawing/cat_axis.rb', line 11
    +      
    # File 'lib/axlsx/drawing/cat_axis.rb', line 12
     
     def lblAlgn
       @lblAlgn
    @@ -644,12 +647,12 @@ The offset of the labels must be between a string between 0 and 1000
           
     
     
    -16
     17
    -18
    +18 +19
    -
    # File 'lib/axlsx/drawing/cat_axis.rb', line 16
    +      
    # File 'lib/axlsx/drawing/cat_axis.rb', line 17
     
     def lblOffset
       @lblOffset
    @@ -726,17 +729,17 @@ The document builder instance this objects xml will be added to.
           
     
     
    +45
    +46
     47
     48
     49
     50
     51
    -52
    -53
    -54
    +52
    -
    # File 'lib/axlsx/drawing/cat_axis.rb', line 47
    +      
    # File 'lib/axlsx/drawing/cat_axis.rb', line 45
     
     def to_xml(xml)
       xml.send('c:catAx') {
    @@ -757,7 +760,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/CatAxisData.html b/doc/Axlsx/CatAxisData.html
    new file mode 100644
    index 00000000..fd0ea3aa
    --- /dev/null
    +++ b/doc/Axlsx/CatAxisData.html
    @@ -0,0 +1,400 @@
    +
    +
    +  
    +    
    +
    +  Class: Axlsx::CatAxisData
    +  
    +    — Documentation by YARD 0.7.3
    +  
    +
    +
    +  
    +
    +  
    +
    +
    +
    +  
    +
    +  
    +
    +
    +  
    +  
    +    
    +    
    +    
    +    
    +    
    +    
    +    

    Class: Axlsx::CatAxisData + + + +

    + +
    + +
    Inherits:
    +
    + SimpleTypedList + + + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/axlsx/drawing/cat_axis_data.rb
    + +
    +
    + +

    Overview

    +
    +

    +The CatAxisData class serializes the category axis data for a chart +

    + + +
    +
    +
    + + +
    +

    Direct Known Subclasses

    +

    ValAxisData

    +
    + + + + + + + + + + + +

    Instance Attribute Summary

    + +

    Attributes inherited from SimpleTypedList

    +

    allowed_types, locked_at, serialize_as

    + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + + + + + + + +

    Methods inherited from SimpleTypedList

    +

    #<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    +
    +

    Constructor Details

    + +
    +

    + + - (CatAxisData) initialize(data = []) + + + +

    +
    +

    +Create a new CatAxisData object +

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + data + + + (Array, SimpleTypedList) + + + (defaults to: []) + + + — +

      +the data for this category axis. This can be a simple array or a simple +typed list of cells. +

      +
      + +
    • + +
    + + +
    + + + + +
    +
    +
    +
    +7
    +8
    +9
    +10
    +
    +
    # File 'lib/axlsx/drawing/cat_axis_data.rb', line 7
    +
    +def initialize(data=[])
    +  super Object
    +  @list.concat data if data.is_a?(Array)
    +end
    +
    +
    +
    + +
    +
    +

    Dynamic Method Handling

    +

    + This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + - (String) to_xml(xml) + + + +

    +
    +

    +Serializes the category axis data +

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

      +The document builder instance this objects xml will be added to. +

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +25
    +26
    +27
    +28
    +29
    +30
    +
    +
    # File 'lib/axlsx/drawing/cat_axis_data.rb', line 15
    +
    +def to_xml(xml)
    +  xml.send('c:cat') {
    +    xml.send('c:strRef') {
    +      xml.send('c:f', Axlsx::cell_range(@list))
    +      xml.send('c:strCache') {
    +        xml.send('c:ptCount', :val=>size)
    +        each_with_index do |item, index|
    +          v = item.is_a?(Cell) ? item.value : item
    +          xml.send('c:pt', :idx=>index) {
    +            xml.send('c:v', v)
    +          }                          
    +        end
    +      }
    +    }
    +  }
    +end
    +
    +
    +
    + +
    + +
    + + + + + \ No newline at end of file diff --git a/doc/Axlsx/Cell.html b/doc/Axlsx/Cell.html index 44da43ed..bef1219e 100644 --- a/doc/Axlsx/Cell.html +++ b/doc/Axlsx/Cell.html @@ -1614,7 +1614,7 @@ xml text for the cell diff --git a/doc/Axlsx/CellAlignment.html b/doc/Axlsx/CellAlignment.html index 3da3113f..4ac86068 100644 --- a/doc/Axlsx/CellAlignment.html +++ b/doc/Axlsx/CellAlignment.html @@ -1238,7 +1238,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/CellProtection.html b/doc/Axlsx/CellProtection.html index 9088a55b..267d5865 100644 --- a/doc/Axlsx/CellProtection.html +++ b/doc/Axlsx/CellProtection.html @@ -556,7 +556,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/CellStyle.html b/doc/Axlsx/CellStyle.html index a8769cbe..26d4d512 100644 --- a/doc/Axlsx/CellStyle.html +++ b/doc/Axlsx/CellStyle.html @@ -940,7 +940,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Chart.html b/doc/Axlsx/Chart.html index 2f1a6465..6665f8a0 100644 --- a/doc/Axlsx/Chart.html +++ b/doc/Axlsx/Chart.html @@ -114,6 +114,13 @@ A Chart is the superclass for specific charts
    +

    See Also:

    +
      + +
    • for examples
    • + +
    +

    Direct Known Subclasses

    Bar3DChart, Line3DChart, Pie3DChart

    @@ -126,14 +133,14 @@ A Chart is the superclass for specific charts
  • - - (Marker) end_at + - (GraphicFrame) graphic_frame - + readonly @@ -143,7 +150,7 @@ A Chart is the superclass for specific charts

    -The ending marker for this chart. +A reference to the graphic frame that owns this chart.

    @@ -153,7 +160,7 @@ The ending marker for this chart.
  • - - (GraphicFrame) graphic_frame + - (Integer) index @@ -170,7 +177,7 @@ The ending marker for this chart.

    -A reference to the graphic frame that owns this chart. +The index of this chart in the workbooks charts collection.

    @@ -180,7 +187,7 @@ A reference to the graphic frame that owns this chart.
  • - - (Integer) index + - (String) pn @@ -197,7 +204,7 @@ A reference to the graphic frame that owns this chart.

    -The index of this chart in the workbooks charts collection. +The part name for this chart.

    @@ -207,7 +214,7 @@ The index of this chart in the workbooks charts collection.
  • - - (String) pn + - (SimpleTypedList) series @@ -224,7 +231,7 @@ The index of this chart in the workbooks charts collection.

    -The part name for this chart. +A collection of series objects that are applied to the chart.

    @@ -234,7 +241,7 @@ The part name for this chart.
  • - - (SimpleTypedList) series + - (Series) series_type @@ -251,7 +258,7 @@ The part name for this chart.

    -A collection of series objects that are applied to the chart. +The type of series to use for this chart.

    @@ -261,14 +268,14 @@ A collection of series objects that are applied to the chart.
  • - - (Series) series_type + - (Boolean) show_legend - readonly + @@ -278,7 +285,7 @@ A collection of series objects that are applied to the chart.

    -The type of series to use for this chart. +Show the legend in the chart.

    @@ -288,7 +295,7 @@ The type of series to use for this chart.
  • - - (Boolean) show_legend + - (Integer) style @@ -305,7 +312,7 @@ The type of series to use for this chart.

    -Show the legend in the chart. +The style for the chart.

    @@ -315,7 +322,7 @@ Show the legend in the chart.
  • - - (Marker) start_at + - (Title) title @@ -332,7 +339,7 @@ Show the legend in the chart.

    -The starting marker for this chart. +The title object for the chart.

    @@ -342,7 +349,7 @@ The starting marker for this chart.
  • - - (Integer) style + - (Object) view3D @@ -359,26 +366,36 @@ The starting marker for this chart.

    -The style for the chart. +The 3D view properties for the chart.

  • -
  • + + + + + + +

    + Instance Method Summary + (collapse) +

    + + - - + + + + constructor + + + + + + -

    - Instance Method Summary - (collapse) -

    +

    +Creates a new chart object. +

    +
    + +
  • -
    • - - (Series) add_series(options = {}) + - (Marker) start_at(x, y) @@ -450,7 +503,9 @@ The 3D view properties for the chart.

      -Adds a new series to the chart’s series collection. +This is a short cut method to set the start anchor position If you need +finer granularity in positioning use graphic_frame.anchor.from.colOff / +rowOff.

      @@ -460,14 +515,12 @@ Adds a new series to the chart’s series collection.
    • - - (Chart) initialize(frame, options = {}) {|_self| ... } + - (Object) to - constructor - @@ -476,7 +529,8 @@ Adds a new series to the chart’s series collection.

      -Creates a new chart object. +backwards compatibility to allow chart.to and chart.from access to anchor +markers.

      @@ -641,6 +695,12 @@ the object that the method was called on
       
       
      +52
      +53
      +54
      +55
      +56
      +57
       58
       59
       60
      @@ -648,14 +708,10 @@ the object that the method was called on
       62
       63
       64
      -65
      -66
      -67
      -68
      -69
      +65
    -
    # File 'lib/axlsx/drawing/chart.rb', line 58
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 52
     
     def initialize(frame, options={})
       @style = 2
    @@ -667,6 +723,8 @@ the object that the method was called on
       options.each do |o|
         self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
       end
    +  start_at *options[:start_at] if options[:start_at]
    +  end_at *options[:end_at] if options[:start_at]
       yield self if block_given?
     end
     
    @@ -681,67 +739,10 @@ the object that the method was called on

    Instance Attribute Details

    - - -
    -

    - - - (Marker) end_at - - - -

    -
    -

    -The ending marker for this chart -

    - - -
    -
    -
    - -

    Returns:

    -
      - -
    • - - - (Marker) - - - -
    • - -
    - -
    - - - - -
    -
    -
    -
    -48
    -49
    -50
    -
    -
    # File 'lib/axlsx/drawing/chart.rb', line 48
    -
    -def end_at
    -  @end_at
    -end
    -
    -
    -
    - - -
    -

    +

    +

    - (GraphicFrame) graphic_frame (readonly) @@ -778,12 +779,12 @@ A reference to the graphic frame that owns this chart

     
     
    -21
    -22
    -23
    +14 +15 +16
    -
    # File 'lib/axlsx/drawing/chart.rb', line 21
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 14
     
     def graphic_frame
       @graphic_frame
    @@ -835,12 +836,12 @@ The index of this chart in the workbooks charts collection
           
     
     
    -33
    -34
    -35
    +26 +27 +28
    -
    # File 'lib/axlsx/drawing/chart.rb', line 33
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 26
     
     def index
       @graphic_frame.anchor.drawing.worksheet.workbook.charts.index(self)
    @@ -892,12 +893,12 @@ The part name for this chart
           
     
     
    -37
    -38
    -39
    +30 +31 +32
    -
    # File 'lib/axlsx/drawing/chart.rb', line 37
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 30
     
     def pn
       "#{CHART_PN % (index+1)}"
    @@ -949,12 +950,12 @@ A collection of series objects that are applied to the chart
           
     
     
    -25
    -26
    -27
    +18 +19 +20
    -
    # File 'lib/axlsx/drawing/chart.rb', line 25
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 18
     
     def series
       @series
    @@ -978,7 +979,7 @@ A collection of series objects that are applied to the chart
     

    -The type of series to use for this chart +The type of series to use for this chart.

    @@ -1006,12 +1007,12 @@ The type of series to use for this chart
     
     
    -29
    -30
    -31
    +22 +23 +24
    -
    # File 'lib/axlsx/drawing/chart.rb', line 29
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 22
     
     def series_type
       @series_type
    @@ -1063,12 +1064,12 @@ Show the legend in the chart
           
     
     
    -52
    -53
    -54
    +46 +47 +48
    -
    # File 'lib/axlsx/drawing/chart.rb', line 52
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 46
     
     def show_legend
       @show_legend
    @@ -1080,19 +1081,19 @@ Show the legend in the chart
     
         
           
    -      
    -      
    +      
    +      
           
    -

    +

    - - (Marker) start_at + - (Integer) style

    -The starting marker for this chart +The style for the chart. see ECMA Part 1 §21.2.2.196

    @@ -1106,7 +1107,7 @@ The starting marker for this chart
  • - (Marker) + (Integer) @@ -1120,15 +1121,15 @@ The starting marker for this chart
     
     
    -44
    -45
    -46
    +42 +43 +44
  • -
    # File 'lib/axlsx/drawing/chart.rb', line 44
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 42
     
    -def start_at
    -  @start_at
    +def style
    +  @style
     end
     
    -
    # File 'lib/axlsx/drawing/chart.rb', line 14
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 37
     
    -def style
    -  @style
    +def title
    +  @title
     end
     
    + + + + +
    +
    +
    +
    +10
    +11
    +12
    +
    +
    # File 'lib/axlsx/drawing/chart.rb', line 10
    +
    +def view3D
    +  @view3D
    +end
    +
    +
    + + + + + +
    +

    Instance Method Details

    + + +
    +

    + + - (Series) add_series(options = {}) + + + +

    +
    +

    +Adds a new series to the chart’s series collection.

    @@ -1220,7 +1269,7 @@ The title object for the chart.
  • - (Title) + (Series) @@ -1228,21 +1277,30 @@ The title object for the chart. +

    See Also:

    + +
  • @@ -1250,27 +1308,76 @@ The title object for the chart.
     
     
    -9
    -10
    -11
    +101 +102 +103 +104
    -
    # File 'lib/axlsx/drawing/chart.rb', line 9
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 101
     
    -def title
    -  @title
    +def add_series(options={})
    +  @series_type.new(self, options)
    +  @series.last
     end
     
    - - -
    -

    +

    - - (Object) view3D + - (Marker) end_at(x, y)

    -The 3D view properties for the chart +This is a short cut method to set the end anchor position If you need finer +granularity in positioning use graphic_frame.anchor.to.colOff / rowOff

    +

    Parameters:

    +
      + +
    • + + x + + + (Integer) + + + + — +

      +The column +

      +
      + +
    • + +
    • + + y + + + (Integer) + + + + — +

      +The row +

      +
      + +
    • +
    + +

    Returns:

    +
      + +
    • + + + (Marker) + + + +
    • + +
    @@ -1278,15 +1385,17 @@ The 3D view properties for the chart
     
     
    -17
    -18
    -19
    +149 +150 +151 +152 @@ -1294,38 +1403,122 @@ The 3D view properties for the chart
    -
    # File 'lib/axlsx/drawing/chart.rb', line 17
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 149
     
    -def view3D
    -  @view3D
    +def end_at(x, y)
    +  @graphic_frame.anchor.to.col = x
    +  @graphic_frame.anchor.to.row = y
     end
     
    +
    +

    + + - (Object) from + + + +

    +
    + +
    + Note: +

    +This will be disconinued in version 2.0.0. please use the start_at method +

    +
    +

    +backwards compatibility to allow chart.to and chart.from access to anchor +markers +

    -
    -

    Instance Method Details

    - + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +94
    +95
    +96
    +
    +
    # File 'lib/axlsx/drawing/chart.rb', line 94
    +
    +def from
    +  @graphic_frame.anchor.from
    +end
    +
    +
    +
    -
    -

    +

    +

    - - (Series) add_series(options = {}) + - (Marker) start_at(x, y)

    -Adds a new series to the chart’s series collection. +This is a short cut method to set the start anchor position If you need +finer granularity in positioning use graphic_frame.anchor.from.colOff / +rowOff

    +

    Parameters:

    +
      +
    • + + x + + + (Integer) + + + + — +

      +The column +

      +
      + +
    • + +
    • + + y + + + (Integer) + + + + — +

      +The row +

      +
      + +
    • + +
    +

    Returns:

    • - (Series) + (Marker) @@ -1333,12 +1526,58 @@ Adds a new series to the chart’s series collection.
    -

    See Also:

    -
      +
    + + + + +
    +
    +
    +
    +138
    +139
    +140
    +141
    +
    +
    # File 'lib/axlsx/drawing/chart.rb', line 138
    +
    +def start_at(x, y)
    +  @graphic_frame.anchor.from.col = x
    +  @graphic_frame.anchor.from.row = y
    +end
    +
    +
    +
    -
  • Series
  • +
    +

    + + - (Object) to + + + +

    +
    - +
    + Note: +

    +This will be disconinued in version 2.0.0. Please use the end_at method +

    +
    +
    + +

    +backwards compatibility to allow chart.to and chart.from access to anchor +markers +

    + + +
    +
    +
    +
    @@ -1346,17 +1585,15 @@ Adds a new series to the chart’s series collection.
     
     
    -94
    -95
    -96
    -97
    +87 +88 +89 @@ -1389,13 +1626,6 @@ Chart Serialization serializes the chart
     
     
    -101
    -102
    -103
    -104
    -105
    -106
    -107
     108
     109
     110
    @@ -1411,10 +1641,17 @@ Chart Serialization serializes the chart
     120
     121
     122
    -123
    +123 +124 +125 +126 +127 +128 +129 +130
    -
    # File 'lib/axlsx/drawing/chart.rb', line 94
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 87
     
    -def add_series(options={})
    -  @series_type.new(self, options)
    -  @series.last
    +def to
    +  @graphic_frame.anchor.to
     end
     
    -
    # File 'lib/axlsx/drawing/chart.rb', line 101
    +      
    # File 'lib/axlsx/drawing/chart.rb', line 108
     
     def to_xml
       builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
    @@ -1450,7 +1687,7 @@ Chart Serialization serializes the chart
     
         
         
    diff --git a/doc/Axlsx/Color.html b/doc/Axlsx/Color.html
    index e856e81f..e1479faf 100644
    --- a/doc/Axlsx/Color.html
    +++ b/doc/Axlsx/Color.html
    @@ -656,7 +656,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/ContentType.html b/doc/Axlsx/ContentType.html
    index 293926d4..21d7c70d 100644
    --- a/doc/Axlsx/ContentType.html
    +++ b/doc/Axlsx/ContentType.html
    @@ -194,7 +194,7 @@ Generates the xml document for [Content_Types].xml.
       
       
       

    Methods inherited from SimpleTypedList

    -

    #<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    +

    #<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    Constructor Details

    @@ -331,7 +331,7 @@ The document as a string.
    diff --git a/doc/Axlsx/Core.html b/doc/Axlsx/Core.html index 1271d383..ed241c2b 100644 --- a/doc/Axlsx/Core.html +++ b/doc/Axlsx/Core.html @@ -456,7 +456,7 @@ time when this method is called. diff --git a/doc/Axlsx/DataTypeValidator.html b/doc/Axlsx/DataTypeValidator.html index dedc619a..6f2f98ac 100644 --- a/doc/Axlsx/DataTypeValidator.html +++ b/doc/Axlsx/DataTypeValidator.html @@ -315,7 +315,7 @@ types or the block passed returns false diff --git a/doc/Axlsx/Default.html b/doc/Axlsx/Default.html index 27bf8b21..b53c8ea5 100644 --- a/doc/Axlsx/Default.html +++ b/doc/Axlsx/Default.html @@ -566,7 +566,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Drawing.html b/doc/Axlsx/Drawing.html index 82b6dd0a..1d2bce32 100644 --- a/doc/Axlsx/Drawing.html +++ b/doc/Axlsx/Drawing.html @@ -99,14 +99,16 @@ Note:

    The recommended way to manage drawings is to use the Worksheet.add_chart -method, specifying the chart class, start and end marker locations. +method.

    A Drawing is a canvas for charts. Each worksheet has a single drawing that -can specify multiple anchors which reference charts. +manages anchors. The anchors reference the charts via graphical frames. +This is not a trivial relationship so please do follow the advice in the +note. see README for an example of how to create a chart.

    @@ -120,8 +122,6 @@ can specify multiple anchors which reference charts.
  • Worksheet#add_chart
  • -
  • TwoCellAnchor
  • -
  • Chart
  • @@ -151,7 +151,8 @@ can specify multiple anchors which reference charts.

    -A collection of anchors for this drawing. +A collection of anchors for this drawing only TwoCellAnchors are supported +in this version.

    @@ -487,15 +488,15 @@ The worksheet that owns this drawing
     
     
    -67
    -68
    -69
    -70
     71
    -72
    +72 +73 +74 +75 +76
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 67
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 71
     
     def initialize(worksheet)
       DataTypeValidator.validate "Drawing.worksheet", Worksheet, worksheet
    @@ -527,7 +528,8 @@ The worksheet that owns this drawing
     

    -A collection of anchors for this drawing +A collection of anchors for this drawing only TwoCellAnchors are supported +in this version

    @@ -555,12 +557,12 @@ A collection of anchors for this drawing
     
     
    -39
    -40
    -41
    +43 +44 +45
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 39
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 43
     
     def anchors
       @anchors
    @@ -612,12 +614,12 @@ An array of charts that are associated with this drawing’s anchors
           
     
     
    -43
    -44
    -45
    +47 +48 +49
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 43
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 47
     
     def charts
       @anchors.map { |a| a.graphic_frame.chart }
    @@ -670,12 +672,12 @@ collection.
           
     
     
    -47
    -48
    -49
    +51 +52 +53
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 47
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 51
     
     def index
       @worksheet.workbook.drawings.index(self)
    @@ -727,12 +729,12 @@ The part name for this drawing
           
     
     
    -55
    -56
    -57
    +59 +60 +61
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 55
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 59
     
     def pn
       "#{DRAWING_PN % (index+1)}"
    @@ -784,17 +786,17 @@ The drawing’s relationships.
           
     
     
    -63
    -64
    -65
    -66
     67
     68
     69
    -70
    +70 +71 +72 +73 +74
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 63
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 67
     
     def relationships
       r = Relationships.new
    @@ -851,12 +853,12 @@ The relational part name for this drawing
           
     
     
    -59
    -60
    -61
    +63 +64 +65
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 59
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 63
     
     def rels_pn
       "#{DRAWING_RELS_PN % (index+1)}"
    @@ -908,12 +910,12 @@ The relation reference id for this drawing
           
     
     
    -51
    -52
    -53
    +55 +56 +57
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 51
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 55
     
     def rId
       "rId#{index+1}"
    @@ -965,12 +967,12 @@ The worksheet that owns the drawing
           
     
     
    -34
    -35
    -36
    +38 +39 +40
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 34
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 38
     
     def worksheet
       @worksheet
    @@ -1001,7 +1003,8 @@ The worksheet that owns the drawing
       
    Note:

    -The recommended way to manage charts is to use Worksheet.add_chart. +The recommended way to manage charts is to use Worksheet.add_chart. Please +refer to that method for documentation.

    @@ -1014,41 +1017,14 @@ Adds a chart to the drawing.
    -

    Parameters:

    -
      -
    • - - chart_type - - - (Chart) - - - - — -

      -The class of the chart to be added to the drawing -

      -
      - -
    • - -
    • - - options - - - (Hash) - - - (defaults to: {}) - - -
    • - -
    +

    See Also:

    +
    @@ -1056,17 +1032,15 @@ The class of the chart to be added to the drawing
     
     
    -79
    -80
    -81
     82
    -83
    +83 +84 +85
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 79
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 82
     
     def add_chart(chart_type, options={})
    -  DataTypeValidator.validate "Drawing.chart_type", Chart, chart_type 
       TwoCellAnchor.new(self, chart_type, options)
       @anchors.last.graphic_frame.chart
     end
    @@ -1114,17 +1088,17 @@ Serializes the drawing
           
     
     
    -116
    -117
     118
     119
     120
     121
     122
    -123
    +123 +124 +125
    -
    # File 'lib/axlsx/drawing/drawing.rb', line 116
    +      
    # File 'lib/axlsx/drawing/drawing.rb', line 118
     
     def to_xml
       builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
    @@ -1145,7 +1119,7 @@ Serializes the drawing
     
         
         
    diff --git a/doc/Axlsx/Fill.html b/doc/Axlsx/Fill.html
    index da35b662..f5c9b6fa 100644
    --- a/doc/Axlsx/Fill.html
    +++ b/doc/Axlsx/Fill.html
    @@ -451,7 +451,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/Font.html b/doc/Axlsx/Font.html
    index ee723a16..0091cf69 100644
    --- a/doc/Axlsx/Font.html
    +++ b/doc/Axlsx/Font.html
    @@ -1545,7 +1545,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/GradientFill.html b/doc/Axlsx/GradientFill.html
    index 7fa542ec..7cb1494f 100644
    --- a/doc/Axlsx/GradientFill.html
    +++ b/doc/Axlsx/GradientFill.html
    @@ -1017,7 +1017,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/GradientStop.html b/doc/Axlsx/GradientStop.html
    index 6f5ca4d4..89bc1e26 100644
    --- a/doc/Axlsx/GradientStop.html
    +++ b/doc/Axlsx/GradientStop.html
    @@ -517,7 +517,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/GraphicFrame.html b/doc/Axlsx/GraphicFrame.html
    index f7e91018..0c328ab9 100644
    --- a/doc/Axlsx/GraphicFrame.html
    +++ b/doc/Axlsx/GraphicFrame.html
    @@ -329,12 +329,14 @@ Creates a new GraphicFrame object
     24
     25
     26
    -27
    +27 +28
    # File 'lib/axlsx/drawing/graphic_frame.rb', line 24
     
     def initialize(anchor, chart_type, options)
    +  DataTypeValidator.validate "Drawing.chart_type", Chart, chart_type 
       @anchor = anchor
       @chart = chart_type.new(self, options)
     end
    @@ -586,7 +588,6 @@ The document builder instance this objects xml will be added to.
           
     
     
    -36
     37
     38
     39
    @@ -603,10 +604,11 @@ The document builder instance this objects xml will be added to.
     50
     51
     52
    -53
    +53 +54
    -
    # File 'lib/axlsx/drawing/graphic_frame.rb', line 36
    +      
    # File 'lib/axlsx/drawing/graphic_frame.rb', line 37
     
     def to_xml(xml)
       xml.send('xdr:graphicFrame') {        
    @@ -637,7 +639,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/Line3DChart.html b/doc/Axlsx/Line3DChart.html
    index 589a6d54..3512d2a7 100644
    --- a/doc/Axlsx/Line3DChart.html
    +++ b/doc/Axlsx/Line3DChart.html
    @@ -323,7 +323,7 @@ the category axis.
       
       
       

    Attributes inherited from Chart

    -

    end_at, graphic_frame, index, pn, series, series_type, show_legend, start_at, style, title, view3D

    +

    graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

    @@ -396,7 +396,7 @@ Serializes the bar chart.

    Methods inherited from Chart

    -

    #add_series

    +

    #add_series, #end_at, #from, #start_at, #to

    Constructor Details

    @@ -466,6 +466,24 @@ a customizable set of options

    Options Hash (options):

      +
    • + title + (Cell, String) + + + + +
    • + +
    • + show_legend + (Boolean) + + + + +
    • +
    • grouping (Symbol) @@ -484,31 +502,94 @@ a customizable set of options
    • +
    • + rotX + (Integer) + + + + +
    • + +
    • + hPercent + (String) + + + + +
    • + +
    • + rotY + (Integer) + + + + +
    • + +
    • + depthPercent + (String) + + + + +
    • + +
    • + rAngAx + (Boolean) + + + + +
    • + +
    • + perspective + (Integer) + + + + +
    • +
    +

    See Also:

    + +
    @@ -865,25 +946,25 @@ Serializes the bar chart
     
     
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
     86
     87
     88
     89
     90
    -91
    +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 @@ -388,7 +389,7 @@ a customizable set of options

    - - (Array, SimpleTypedList) data + - (ValAxisData) data @@ -409,7 +410,7 @@ The data for this series.

  • - (Array, SimpleTypedList) + (ValAxisData) @@ -445,7 +446,7 @@ The data for this series.

    - - (Array, SimpleTypedList) labels + - (CatAxisData) labels @@ -466,7 +467,7 @@ The labels for this series.

  • - (Array, SimpleTypedList) + (CatAxisData) @@ -513,7 +514,8 @@ The labels for this series.

    -Serializes the series +Serializes the series TODO create series_cat and series_val classes as this +serialization is duplicated

    @@ -562,78 +564,20 @@ The document builder instance this objects xml will be added to.
     
     
    -29
     30
     31
     32
     33
     34
    -35
    -36
    -37
    -38
    -39
    -40
    -41
    -42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    +35
  •  
     
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
     61
    -62
    +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72
    -
    # File 'lib/axlsx/drawing/line_3D_chart.rb', line 51
    +      
    # File 'lib/axlsx/drawing/line_3D_chart.rb', line 61
     
     def initialize(frame, options={})
       @grouping = :standard
    @@ -518,9 +599,9 @@ a customizable set of options
       @catAxis = CatAxis.new(@catAxId, @valAxId)
       @valAxis = ValAxis.new(@valAxId, @catAxId)
       @serAxis = SerAxis.new(@serAxId, @valAxId)
    -  @view3D = View3D.new(:perspective=>30)
       super(frame, options)      
       @series_type = LineSeries
    +  @view3D = View3D.new({:perspective=>30}.merge(options))
     end
     
    -
    # File 'lib/axlsx/drawing/line_3D_chart.rb', line 76
    +      
    # File 'lib/axlsx/drawing/line_3D_chart.rb', line 86
     
     def to_xml
       super() do |xml|
    @@ -912,7 +993,7 @@ Serializes the bar chart
     
         
         
    diff --git a/doc/Axlsx/LineSeries.html b/doc/Axlsx/LineSeries.html
    index f6d997da..b1b59a0b 100644
    --- a/doc/Axlsx/LineSeries.html
    +++ b/doc/Axlsx/LineSeries.html
    @@ -136,7 +136,7 @@ A LineSeries defines the title, data and labels for line charts
           
  • - - (Array, SimpleTypedList) data + - (ValAxisData) data @@ -163,7 +163,7 @@ The data for this series.
  • - - (Array, SimpleTypedList) labels + - (CatAxisData) labels @@ -251,7 +251,8 @@ Creates a new series.

    -Serializes the series. +Serializes the series TODO create series_cat and series_val classes as this +serialization is duplicated.

    @@ -368,8 +369,8 @@ a customizable set of options def initialize(chart, options={}) super(chart, options) - self.data = options[:data] || [] - self.labels = options[:labels] || [] + self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil? + self.data = ValAxisData.new(options[:data]) unless options[:data].nil? end
  • -
    # File 'lib/axlsx/drawing/line_series.rb', line 29
    +      
    # File 'lib/axlsx/drawing/line_series.rb', line 30
     
     def to_xml(xml)
       super(xml) do |xml|
    -    if !labels.empty?
    -      xml.send('c:cat') {
    -        xml.send('c:strRef') {
    -          xml.send('c:f', Axlsx::cell_range(labels))
    -          xml.send('c:strCache') {
    -            xml.send('c:ptCount', :val=>labels.size)
    -            labels.each_with_index do |cell, index|
    -              v = cell.is_a?(Cell) ? cell.value : cell
    -              xml.send('c:pt', :idx=>index) {
    -                xml.send('c:v', v)
    -              }                          
    -            end
    -          }
    -        }
    -      }
    -    end
    -    xml.send('c:val') {
    -      xml.send('c:numRef') {
    -        xml.send('c:f', Axlsx::cell_range(data))
    -        xml.send('c:numCache') {
    -          xml.send('c:formatCode', 'General')
    -          xml.send('c:ptCount', :val=>data.size)
    -          data.each_with_index do |cell, index|
    -            v = cell.is_a?(Cell) ? cell.value : cell
    -            xml.send('c:pt', :idx=>index) {
    -              xml.send('c:v', v) 
    -            }
    -          end
    -        }                        
    -      }
    -    }
    +    @labels.to_xml(xml) unless @labels.nil?
    +    @data.to_xml(xml) unless @data.nil?
       end      
     end
     
    @@ -647,7 +591,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Marker.html b/doc/Axlsx/Marker.html index 3a5e0864..a35500f7 100644 --- a/doc/Axlsx/Marker.html +++ b/doc/Axlsx/Marker.html @@ -848,7 +848,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/NumFmt.html b/doc/Axlsx/NumFmt.html index b530f49a..2fe65d34 100644 --- a/doc/Axlsx/NumFmt.html +++ b/doc/Axlsx/NumFmt.html @@ -553,7 +553,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Override.html b/doc/Axlsx/Override.html index 0eeec0b6..2157fc29 100644 --- a/doc/Axlsx/Override.html +++ b/doc/Axlsx/Override.html @@ -559,7 +559,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Package.html b/doc/Axlsx/Package.html index a8875b81..dccd861b 100644 --- a/doc/Axlsx/Package.html +++ b/doc/Axlsx/Package.html @@ -1284,7 +1284,7 @@ An array of all validation errors encountered. diff --git a/doc/Axlsx/PatternFill.html b/doc/Axlsx/PatternFill.html index 00371bc9..22009d77 100644 --- a/doc/Axlsx/PatternFill.html +++ b/doc/Axlsx/PatternFill.html @@ -672,7 +672,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Pie3DChart.html b/doc/Axlsx/Pie3DChart.html index f34d11e8..668d4797 100644 --- a/doc/Axlsx/Pie3DChart.html +++ b/doc/Axlsx/Pie3DChart.html @@ -106,53 +106,15 @@ that you can add to your worksheet.
    -
    -

    Examples:

    - -

    -Creating a chart -

    -

    -
    # This example creates two charts in a single sheet.
    -# The first uses data directly fed to the sheet, while the second references cells withing the worksheet for data.
    -
    -require "rubygems" # if that is your preferred way to manage gems!
    -require "axlsx"
    -
    -p = Axlsx::Package.new
    -ws = p.workbook.add_worksheet
    -ws.add_row :values => ["This is a chart with no data in the sheet"]
    -
    -chart = ws.add_chart(Axlsx::Pie3DChart, :start_at=> [0,1], :end_at=>[0,6], :title=>"Most Popular Pets")
    -chart.add_series :data => [1, 9, 10], :labels => ["Slimy Reptiles", "Fuzzy Bunnies", "Rottweiler"]
    -
    -ws.add_row :values => ["This chart uses the data below"]
    -title_row = ws.add_row :values => ["Least Popular Pets"]
    -label_row = ws.add_row :values => ["", "Dry Skinned Reptiles", "Bald Cats", "Violent Parrots"]
    -data_row = ws.add_row :values => ["Votes", 6, 4, 1]
    -
    -chart = ws.add_chart(Axlsx::Pie3DChart, :start_at => [0,11], :end_at =>[0,16], :title => title_row.cells.last)
    -chart.add_series :data => data_row.cells[(1..-1)], :labels => label_row.cells  
    -
    -f = File.open('example_pie_3d_chart.xlsx', 'w')
    -p.serialize(f)
    -
    - -
    -

    See Also:

    @@ -170,7 +132,7 @@ Creating a chart

    Instance Attribute Summary

    Attributes inherited from Chart

    -

    end_at, graphic_frame, index, pn, series, series_type, show_legend, start_at, style, title, view3D

    +

    graphic_frame, index, pn, series, series_type, show_legend, style, title, view3D

    @@ -184,7 +146,7 @@ Creating a chart
  • - - (Pie3DChart) initialize(workbook, options = {}) + - (Pie3DChart) initialize(frame, options = {}) @@ -243,14 +205,14 @@ Serializes the pie chart.

    Methods inherited from Chart

    -

    #add_series

    +

    #add_series, #end_at, #from, #start_at, #to

    Constructor Details

    - - (Pie3DChart) initialize(workbook, options = {}) + - (Pie3DChart) initialize(frame, options = {}) @@ -269,10 +231,10 @@ Creates a new pie chart object

  • - workbook + frame - (Workbook) + (GraphicFrame) @@ -322,31 +284,121 @@ a customizable set of options
  • +
  • + show_legend + (Boolean) + + + + +
  • + +
  • + grouping + (Symbol) + + + + +
  • + +
  • + gapDepth + (String) + + + + +
  • + +
  • + rotX + (Integer) + + + + +
  • + +
  • + hPercent + (String) + + + + +
  • + +
  • + rotY + (Integer) + + + + +
  • + +
  • + depthPercent + (String) + + + + +
  • + +
  • + rAngAx + (Boolean) + + + + +
  • + +
  • + perspective + (Integer) + + + + +
  • + +

    See Also:

    + +
    @@ -399,17 +451,17 @@ Serializes the pie chart
     
     
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    +33 +34 +35 +36 +37 +38 +39 +40 @@ -433,7 +434,7 @@ a customizable set of options

    - - (Array, SimpleTypedList) data + - (SimpleTypedList) data @@ -454,7 +455,7 @@ The data for this series.

  • - (Array, SimpleTypedList) + (SimpleTypedList) @@ -490,7 +491,7 @@ The data for this series.

    - - (Array, SimpleTypedList) explosion + - (Integert) explosion @@ -511,7 +512,7 @@ The explosion for this series

  • - (Array, SimpleTypedList) + (Integert) @@ -525,12 +526,12 @@ The explosion for this series
     
     
    -20
    -21
    -22
    +18 +19 +20
  • @@ -418,13 +427,16 @@ a customizable set of options

    - - (Boolean) tickLblSkip + - (Integer) tickLblSkip

    - +

    +The number of tick lables to skip between labels +

    +
    @@ -436,7 +448,7 @@ a customizable set of options
  • - (Boolean) + (Integer) @@ -450,12 +462,12 @@ a customizable set of options
     
     
    -6
     7
    -8
    +8 +9
  • @@ -815,199 +767,7 @@ A marker that returns the to cell anchor. The default to column and row are
    -

    - - - (Marker) end_at(x, y) - - - -

    -
    -

    -This is a short cut method to set the end anchor position -

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - x - - - (Integer) - - - - — -

      -The column -

      -
      - -
    • - -
    • - - y - - - (Integer) - - - - — -

      -The row -

      -
      - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Marker) - - - -
    • - -
    - -
     
     
    -41
    -42
    -43
    -44
    -45
    -46
    +24 +25 +26 +27 +28 +29
    -
    # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 41
    +      
    # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 24
     
    -def initialize(workbook, options={})
    -  # this charts series type
    -  super(workbook, options)
    +def initialize(frame, options={})
    +  super(frame, options)
       @series_type = PieSeries
    -  @view3D = View3D.new(:rotX => 30, :perspective => 30)
    +  @view3D = View3D.new({:rotX=>30, :perspective=>30}.merge(options))
    +
     end
     
    -
    # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 50
    +      
    # File 'lib/axlsx/drawing/pie_3D_chart.rb', line 33
     
     def to_xml
       super() do |xml|
    @@ -430,7 +482,7 @@ Serializes the pie chart
     
         
         
    diff --git a/doc/Axlsx/PieSeries.html b/doc/Axlsx/PieSeries.html
    index 7e5d747b..07ca6f75 100644
    --- a/doc/Axlsx/PieSeries.html
    +++ b/doc/Axlsx/PieSeries.html
    @@ -106,7 +106,8 @@ The recommended way to manage series is to use Chart#add_series
       
     
     

    -A PieSeries defines the title, data and labels for pie charts +A PieSeries defines the data and labels and explosion for pie charts +series.

    @@ -136,7 +137,7 @@ A PieSeries defines the title, data and labels for pie charts
  • - - (Array, SimpleTypedList) data + - (SimpleTypedList) data @@ -163,7 +164,7 @@ The data for this series.
  • - - (Array, SimpleTypedList) explosion + - (Integert) explosion @@ -190,7 +191,7 @@ The explosion for this series.
  • - - (Array, SimpleTypedList) labels + - (SimpleTypedList) labels @@ -402,19 +403,19 @@ a customizable set of options
     
     
    +26
    +27
     28
     29
    -30
    -31
    -32
    +30
  • -
    # File 'lib/axlsx/drawing/pie_series.rb', line 28
    +      
    # File 'lib/axlsx/drawing/pie_series.rb', line 26
     
     def initialize(chart, options={})
       super(chart, options)
    -  self.data = options[:data]  || []
    -  self.labels = options[:labels] || []
    +  self.labels = CatAxisData.new(options[:labels]) unless options[:labels].nil?
    +  self.data = ValAxisData.new(options[:data]) unless options[:data].nil?
     end
     
    -
    # File 'lib/axlsx/drawing/pie_series.rb', line 20
    +      
    # File 'lib/axlsx/drawing/pie_series.rb', line 18
     
     def explosion
       @explosion
    @@ -547,7 +548,7 @@ The explosion for this series
           

    - - (Array, SimpleTypedList) labels + - (SimpleTypedList) labels @@ -568,7 +569,7 @@ The labels for this series.

  • - (Array, SimpleTypedList) + (SimpleTypedList) @@ -582,12 +583,12 @@ The labels for this series.
     
     
    +14
     15
    -16
    -17
    +16
  • -
    # File 'lib/axlsx/drawing/pie_series.rb', line 15
    +      
    # File 'lib/axlsx/drawing/pie_series.rb', line 14
     
     def labels
       @labels
    @@ -664,82 +665,22 @@ The document builder instance this objects xml will be added to.
           
     
     
    +37
     38
     39
     40
     41
     42
    -43
    -44
    -45
    -46
    -47
    -48
    -49
    -50
    -51
    -52
    -53
    -54
    -55
    -56
    -57
    -58
    -59
    -60
    -61
    -62
    -63
    -64
    -65
    -66
    -67
    -68
    -69
    -70
    -71
    -72
    -73
    -74
    +43
    -
    # File 'lib/axlsx/drawing/pie_series.rb', line 38
    +      
    # File 'lib/axlsx/drawing/pie_series.rb', line 37
     
     def to_xml(xml)
       super(xml) do  |xml|
         xml.send('c:explosion', :val=>@explosion) unless @explosion.nil?
    -    if !labels.empty?
    -      xml.send('c:cat') {
    -        xml.send('c:strRef') {
    -          xml.send('c:f', Axlsx::cell_range(labels))
    -          xml.send('c:strCache') {
    -            xml.send('c:ptCount', :val=>labels.size)
    -            labels.each_with_index do |cell, index|
    -              v = cell.is_a?(Cell) ? cell.value : cell
    -              xml.send('c:pt', :idx=>index) {
    -                xml.send('c:v', v)
    -              }                          
    -            end
    -          }
    -        }
    -      }
    -    end
    -    xml.send('c:val') {
    -      xml.send('c:numRef') {
    -        xml.send('c:f', Axlsx::cell_range(data))
    -        xml.send('c:numCache') {
    -          xml.send('c:formatCode', 'General')
    -          xml.send('c:ptCount', :val=>data.size)
    -          data.each_with_index do |cell, index|
    -            v = cell.is_a?(Cell) ? cell.value : cell
    -            xml.send('c:pt', :idx=>index) {
    -              xml.send('c:v', v) 
    -            }
    -          end
    -        }                        
    -      }
    -    }
    -    
    +    @labels.to_xml(xml) unless @labels.nil?
    +    @data.to_xml(xml) unless @data.nil?
       end      
     end
     
    @@ -753,7 +694,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/RegexValidator.html b/doc/Axlsx/RegexValidator.html index c3ad45b1..f644c404 100644 --- a/doc/Axlsx/RegexValidator.html +++ b/doc/Axlsx/RegexValidator.html @@ -259,7 +259,7 @@ The value to validate. diff --git a/doc/Axlsx/Relationship.html b/doc/Axlsx/Relationship.html index 486b348c..f9786c69 100644 --- a/doc/Axlsx/Relationship.html +++ b/doc/Axlsx/Relationship.html @@ -545,7 +545,7 @@ the reference id of the object. diff --git a/doc/Axlsx/Relationships.html b/doc/Axlsx/Relationships.html index b1687dcb..95e4f3b3 100644 --- a/doc/Axlsx/Relationships.html +++ b/doc/Axlsx/Relationships.html @@ -203,7 +203,7 @@ Serializes the relationships document.

    Methods inherited from SimpleTypedList

    -

    #<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    +

    #<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    Constructor Details

    @@ -334,7 +334,7 @@ Serializes the relationships document.
    diff --git a/doc/Axlsx/RestrictionValidator.html b/doc/Axlsx/RestrictionValidator.html index 1ea8d71f..dcb9402f 100644 --- a/doc/Axlsx/RestrictionValidator.html +++ b/doc/Axlsx/RestrictionValidator.html @@ -291,7 +291,7 @@ Raised if the value provided is not in the list of choices. diff --git a/doc/Axlsx/Row.html b/doc/Axlsx/Row.html index 2d7802f0..cd95e0ec 100644 --- a/doc/Axlsx/Row.html +++ b/doc/Axlsx/Row.html @@ -762,7 +762,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/Scaling.html b/doc/Axlsx/Scaling.html index 540ac273..341bd7d8 100644 --- a/doc/Axlsx/Scaling.html +++ b/doc/Axlsx/Scaling.html @@ -731,7 +731,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/SerAxis.html b/doc/Axlsx/SerAxis.html index 17fe2a43..e46afa7e 100644 --- a/doc/Axlsx/SerAxis.html +++ b/doc/Axlsx/SerAxis.html @@ -97,7 +97,7 @@

    Overview

    -A SarAxis object defines a series axis +A SerAxis object defines a series axis

    @@ -118,7 +118,7 @@ A SarAxis object defines a series axis
  • - - (Boolean) tickLblSkip + - (Integer) tickLblSkip @@ -134,7 +134,10 @@ A SarAxis object defines a series axis -
    +

    +The number of tick lables to skip between labels. +

    +
  • @@ -158,7 +161,10 @@ A SarAxis object defines a series axis -
    +

    +The number of tickmarks to be skipped before the next one is rendered. +

    +
    @@ -276,7 +282,7 @@ Creates a new SerAxis object —

    -the id of this axis +the id of this axis. Inherited

    @@ -293,7 +299,7 @@ the id of this axis —

    -the id of the perpendicular axis +the id of the perpendicular axis. Inherited

    @@ -331,35 +337,44 @@ a customizable set of options
    • - axPos + axPos. (Symbol) - + —

      +Inherited +

      +
    • - tickLblPos + tickLblPos. (Symbol) - + —

      +Inherited +

      +
    • - crosses + crosses. (Symbol) - + —

      +Inherited +

      +
    • tickLblSkip - (Boolean) + (Integer) @@ -368,7 +383,7 @@ a customizable set of options
    • tickMarkSkip - (Symbol) + (Integer) @@ -385,21 +400,15 @@ a customizable set of options
       
       
      -19
      -20
       21
       22
      -23
      -24
      +23
    -
    # File 'lib/axlsx/drawing/ser_axis.rb', line 19
    +      
    # File 'lib/axlsx/drawing/ser_axis.rb', line 21
     
     def initialize(axId, crossAx, options={})
       super(axId, crossAx, options)
    -  options.each do |o|
    -    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
    -  end
     end
     
    -
    # File 'lib/axlsx/drawing/ser_axis.rb', line 6
    +      
    # File 'lib/axlsx/drawing/ser_axis.rb', line 7
     
     def tickLblSkip
       @tickLblSkip
    @@ -478,7 +490,10 @@ a customizable set of options
       
     

    - +

    +The number of tickmarks to be skipped before the next one is rendered. +

    +
    @@ -504,12 +519,12 @@ a customizable set of options
     
     
    -9
    -10
    -11
    +11 +12 +13
    -
    # File 'lib/axlsx/drawing/ser_axis.rb', line 9
    +      
    # File 'lib/axlsx/drawing/ser_axis.rb', line 11
     
     def tickMarkSkip
       @tickMarkSkip
    @@ -586,16 +601,16 @@ The document builder instance this objects xml will be added to.
           
     
     
    +31
     32
     33
     34
     35
     36
    -37
    -38
    +37
    -
    # File 'lib/axlsx/drawing/ser_axis.rb', line 32
    +      
    # File 'lib/axlsx/drawing/ser_axis.rb', line 31
     
     def to_xml(xml)
       xml.send('c:serAx') {
    @@ -615,7 +630,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/Series.html b/doc/Axlsx/Series.html
    index 668ede03..32106681 100644
    --- a/doc/Axlsx/Series.html
    +++ b/doc/Axlsx/Series.html
    @@ -104,7 +104,8 @@ The recommended way to manage series is to use Chart#add_series
       
     
     

    -A Series defines the title, data and labels for chart data. +A Series defines the common series attributes and is the super class for +all concrete series types.

    @@ -161,7 +162,7 @@ The chart that owns this series.
  • - - (Object) index + - (Integer) index @@ -178,7 +179,7 @@ The chart that owns this series.

    -retrieves the series index in the chart’s series collection. +The index of this series in the chart’s series.

    @@ -488,14 +489,14 @@ The chart that owns this series

    - - (Object) index (readonly) + - (Integer) index (readonly)

    -retrieves the series index in the chart’s series collection +The index of this series in the chart’s series.

    @@ -503,6 +504,19 @@ retrieves the series index in the chart’s series collection
    +

    Returns:

    +
      + +
    • + + + (Integer) + + + +
    • + +
    @@ -539,7 +553,8 @@ retrieves the series index in the chart’s series collection

    -The order of this series in the chart’s series. +The order of this series in the chart’s series. By default the order +is the index of the series.

    @@ -706,17 +721,17 @@ The document builder instance this objects xml will be added to.
     
     
    +60
     61
     62
     63
     64
     65
     66
    -67
    -68
    +67
    -
    # File 'lib/axlsx/drawing/series.rb', line 61
    +      
    # File 'lib/axlsx/drawing/series.rb', line 60
     
     def to_xml(xml)
       xml.send('c:ser') {
    @@ -737,7 +752,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/SeriesTitle.html b/doc/Axlsx/SeriesTitle.html
    index 8c6e2377..46224b97 100644
    --- a/doc/Axlsx/SeriesTitle.html
    +++ b/doc/Axlsx/SeriesTitle.html
    @@ -97,7 +97,8 @@
     

    Overview

    -A series title is a Title with a slightly different serialization +A series title is a Title with a slightly different serialization than +chart titles.

    @@ -280,7 +281,7 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/SimpleTypedList.html b/doc/Axlsx/SimpleTypedList.html index d28079f3..72ff9c07 100644 --- a/doc/Axlsx/SimpleTypedList.html +++ b/doc/Axlsx/SimpleTypedList.html @@ -107,7 +107,7 @@ methods from Array and supports basic xml serialization.
    @@ -231,6 +231,31 @@ Concat operator.

    + + + +
  • + + + - (Object) ==(v) + + + + + + + + + + + + +

    +override the equality method so that this object can be compared to a +simple array. +

    +
    +
  • @@ -643,7 +668,6 @@ the following methods are not allowed :drop_while :delete_if :clear - :concat
    @@ -677,23 +701,25 @@ method_mission override to pass allowed methods to the list.
     
     
    -127
    -128
    -129
    -130
     131
     132
     133
    -134
    +134 +135 +136 +137 +138 +139
    -
    # File 'lib/axlsx/util/simple_typed_list.rb', line 127
    +      
    # File 'lib/axlsx/util/simple_typed_list.rb', line 131
     
     def method_missing(meth, *args, &block)
    -  raise ArgumentError, "#{meth} not supported" if [:replace, :insert, :collect!, :map!, :pop, :delete_if, :reverse!, :shift, :shuffle!, :slice!, :sort!, :uniq!, :unshift, :zip, :flatten!, :fill, :drop, :drop_while, :delete_if, :clear, :concat].include? meth.to_sym        
    +  raise ArgumentError, "#{meth} not supported" if [:replace, :insert, :collect!, :map!, :pop, :delete_if, :reverse!, :shift, :shuffle!, :slice!, :sort!, :uniq!, :unshift, :zip, :flatten!, :fill, :drop, :drop_while, :delete_if, :clear].include? meth.to_sym        
       if @list.respond_to? meth
         @list.send(meth, *args, &block)      
       else
    +    puts "method:#{meth.inspect}"
         super
       end
     end
    @@ -990,6 +1016,49 @@ if the value being added is not one fo the allowed types
         
    +
    + +
    +

    + + - (Object) ==(v) + + + +

    +
    +

    +override the equality method so that this object can be compared to a +simple array. if this object’s list is equal to the specifiec array, +we return true. +

    + + +
    +
    +
    + + +
    + + + + +
    +
    +
    +
    +105
    +106
    +107
    +
    +
    # File 'lib/axlsx/util/simple_typed_list.rb', line 105
    +
    +def ==(v)
    +  v == @list
    +end
    +
    +
    @@ -1523,16 +1592,16 @@ The document builder instance this objects xml will be added to.
     
     
    -141
    -142
    -143
    -144
    -145
     146
    -147
    +147 +148 +149 +150 +151 +152
  • -
    # File 'lib/axlsx/util/simple_typed_list.rb', line 141
    +      
    # File 'lib/axlsx/util/simple_typed_list.rb', line 146
     
     def to_xml(xml)
       classname = @allowed_types[0].name.split('::').last
    @@ -1608,7 +1677,7 @@ Unlock the list
     
         
         
    diff --git a/doc/Axlsx/Styles.html b/doc/Axlsx/Styles.html
    index a11d4454..8044712f 100644
    --- a/doc/Axlsx/Styles.html
    +++ b/doc/Axlsx/Styles.html
    @@ -1745,7 +1745,7 @@ Serializes the styles document
     
         
         
    diff --git a/doc/Axlsx/TableStyle.html b/doc/Axlsx/TableStyle.html
    index 0bd012be..5318b1d7 100644
    --- a/doc/Axlsx/TableStyle.html
    +++ b/doc/Axlsx/TableStyle.html
    @@ -289,7 +289,7 @@ Serializes the table style.
       
       
       

    Methods inherited from SimpleTypedList

    -

    #<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    +

    #<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    Constructor Details

    @@ -701,7 +701,7 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/TableStyleElement.html b/doc/Axlsx/TableStyleElement.html index 4f2ed657..7616bef5 100644 --- a/doc/Axlsx/TableStyleElement.html +++ b/doc/Axlsx/TableStyleElement.html @@ -668,7 +668,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/TableStyles.html b/doc/Axlsx/TableStyles.html index be8a4c84..2458c69b 100644 --- a/doc/Axlsx/TableStyles.html +++ b/doc/Axlsx/TableStyles.html @@ -265,7 +265,7 @@ Serializes the table styles element.

    Methods inherited from SimpleTypedList

    -

    #<<, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    +

    #<<, #==, #[]=, #delete, #delete_at, #lock, #method_missing, #protected?, #push, #unlock

    Constructor Details

    @@ -590,7 +590,7 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/Title.html b/doc/Axlsx/Title.html index 9a97f09c..f66f1339 100644 --- a/doc/Axlsx/Title.html +++ b/doc/Axlsx/Title.html @@ -616,7 +616,7 @@ The document builder instance this objects xml will be added to. diff --git a/doc/Axlsx/TwoCellAnchor.html b/doc/Axlsx/TwoCellAnchor.html index fc8e86a3..20e6e8c8 100644 --- a/doc/Axlsx/TwoCellAnchor.html +++ b/doc/Axlsx/TwoCellAnchor.html @@ -277,30 +277,6 @@ A marker that returns the to cell anchor.
  • - - (Marker) end_at(x, y) - - - - - - - - - - - - -

    -This is a short cut method to set the end anchor position. -

    -
    - -
  • - - -
  • - - - (TwoCellAnchor) initialize(drawing, chart_type, options) @@ -317,31 +293,8 @@ This is a short cut method to set the end anchor position.

    -Creates a new TwoCellAnchor object. -

    -
    - -
  • - - -
  • - - - - (Marker) start_at(x, y) - - - - - - - - - - - - -

    -This is a short cut method to set the start anchor position. +Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame’s chart.

    @@ -388,7 +341,9 @@ Serializes the two cell anchor.

    -Creates a new TwoCellAnchor object +Creates a new TwoCellAnchor object and sets up a reference to the from and +to markers in the graphic_frame’s chart. That means that you can do +stuff like c = worksheet.add_chart Axlsx::Chart c.start_at 5, 9

    @@ -411,13 +366,20 @@ Creates a new TwoCellAnchor object
  • - chart + chart_type - (Chart) + (Class) + — +

    +This is passed to the graphic frame for instantiation. must be Chart or a +subclass of Chart +

    +
    +
  • @@ -455,7 +417,10 @@ a customizable set of options - + —

    +the col, row to start at +

    +
  • @@ -464,7 +429,10 @@ a customizable set of options - + —

    +the col, row to end at +

    +
  • @@ -477,37 +445,21 @@ a customizable set of options
     
     
    -31
    -32
    -33
     34
     35
     36
     37
     38
    -39
    -40
    -41
    -42
    -43
    -44
    +39
    -
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 31
    +      
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 34
     
     def initialize(drawing, chart_type, options)
       @drawing = drawing
       drawing.anchors << self      
    -
       @from, @to =  Marker.new, Marker.new(:col => 5, :row=>10)
       @graphic_frame = GraphicFrame.new(self, chart_type, options)
    -
    -  self.start_at(options[:start_at][0], options[:start_at][1]) if options[:start_at].is_a?(Array)
    -  self.end_at(options[:end_at][0], options[:end_at][1]) if options[:end_at].is_a?(Array)
    -  # passing a reference to our start and end markers for convenience
    -  # this lets us access the markers directly from the chart.
    -  @graphic_frame.chart.send(:start_at=, @from)
    -  @graphic_frame.chart.send(:end_at=, @to)
     end
     
    - - - - -
    -
    -
    -
    -65
    -66
    -67
    -68
    -69
    -
    -
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 65
    -
    -def end_at(x, y)
    -  @to.col = x
    -  @to.row = y
    -  @to
    -end
    -
    -
    - - -
    -

    - - - (Marker) start_at(x, y) - - - -

    -
    -

    -This is a short cut method to set the start anchor position -

    - - -
    -
    -
    -

    Parameters:

    -
      - -
    • - - x - - - (Integer) - - - - — -

      -The column -

      -
      - -
    • - -
    • - - y - - - (Integer) - - - - — -

      -The row -

      -
      - -
    • - -
    - -

    Returns:

    -
      - -
    • - - - (Marker) - - - -
    • - -
    - -
    - - - - -
    -
    -
    -
    -55
    -56
    -57
    -58
    -59
    -
    -
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 55
    -
    -def start_at(x, y)
    -  @from.col = x
    -  @from.row = y
    -  @from
    -end
    -
    -
    -
    - -
    -

    +

    - (String) to_xml(xml) @@ -1065,22 +825,22 @@ The document builder instance this objects xml will be added to.

     
     
    -74
    -75
    -76
    -77
    -78
    -79
    -80
    -81
    -82
    -83
    -84
    -85
    -86
    +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59
    -
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 74
    +      
    # File 'lib/axlsx/drawing/two_cell_anchor.rb', line 47
     
     def to_xml(xml)
       #build it for now, break it down later!
    @@ -1106,7 +866,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/ValAxis.html b/doc/Axlsx/ValAxis.html
    index f5101e70..6275d10b 100644
    --- a/doc/Axlsx/ValAxis.html
    +++ b/doc/Axlsx/ValAxis.html
    @@ -135,8 +135,7 @@ the ValAxis class defines a chart value axis.
     
       
         

    -This element specifies whether the value axis crosses the category axis -between categories. +This element specifies how the value axis crosses the category axis.

    @@ -320,7 +319,7 @@ a customizable set of options
  • - crosses + tickLblPos (Symbol) @@ -329,7 +328,7 @@ a customizable set of options
  • - tickLblPos + crosses (Symbol) @@ -365,7 +364,7 @@ a customizable set of options
    # File 'lib/axlsx/drawing/val_axis.rb', line 17
     
     def initialize(axId, crossAx, options={})
    -  @crossBetween = :between
    +  self.crossBetween = :between
       super(axId, crossAx, options)
     end
     
    @@ -392,8 +391,8 @@ a customizable set of options

    -This element specifies whether the value axis crosses the category axis -between categories. must be one of [:between, :midCat] +This element specifies how the value axis crosses the category axis. must +be one of [:between, :midCat]

    @@ -530,7 +529,7 @@ The document builder instance this objects xml will be added to.
    diff --git a/doc/Axlsx/ValAxisData.html b/doc/Axlsx/ValAxisData.html new file mode 100644 index 00000000..25145718 --- /dev/null +++ b/doc/Axlsx/ValAxisData.html @@ -0,0 +1,326 @@ + + + + + + Class: Axlsx::ValAxisData + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

    Class: Axlsx::ValAxisData + + + +

    + +
    + +
    Inherits:
    +
    + CatAxisData + + + show all + +
    + + + + + + + + + +
    Defined in:
    +
    lib/axlsx/drawing/val_axis_data.rb
    + +
    +
    + +

    Overview

    +
    +

    +The ValAxisData class manages the values for a chart value series. +

    + + +
    +
    +
    + + +
    + + + + + + + + + + + + + + + + + +

    Instance Attribute Summary

    + +

    Attributes inherited from SimpleTypedList

    +

    allowed_types, locked_at, serialize_as

    + + + +

    + Instance Method Summary + (collapse) +

    + + + + + + + + + + + + +

    Methods inherited from CatAxisData

    +

    #initialize

    + + + + + + + + +

    Methods inherited from SimpleTypedList

    +

    #<<, #==, #[]=, #delete, #delete_at, #initialize, #lock, #method_missing, #protected?, #push, #unlock

    +
    +

    Constructor Details

    + +

    This class inherits a constructor from Axlsx::CatAxisData

    + +
    +
    +

    Dynamic Method Handling

    +

    + This class handles dynamic methods through the method_missing method + + in the class Axlsx::SimpleTypedList + +

    + +
    + + +
    +

    Instance Method Details

    + + +
    +

    + + - (String) to_xml(xml) + + + +

    +
    +

    +Serializes the value axis data +

    + + +
    +
    +
    +

    Parameters:

    +
      + +
    • + + xml + + + (Nokogiri::XML::Builder) + + + + — +

      +The document builder instance this objects xml will be added to. +

      +
      + +
    • + +
    + +

    Returns:

    +
      + +
    • + + + (String) + + + +
    • + +
    + +
    + + + + +
    +
    +
    +
    +8
    +9
    +10
    +11
    +12
    +13
    +14
    +15
    +16
    +17
    +18
    +19
    +20
    +21
    +22
    +23
    +24
    +
    +
    # File 'lib/axlsx/drawing/val_axis_data.rb', line 8
    +
    +def to_xml(xml)
    +  xml.send('c:val') {
    +    xml.send('c:numRef') {
    +      xml.send('c:f', Axlsx::cell_range(@list))
    +      xml.send('c:numCache') {
    +        xml.send('c:formatCode', 'General')
    +        xml.send('c:ptCount', :val=>size)
    +        each_with_index do |item, index|
    +          v = item.is_a?(Cell) ? item.value : item
    +          xml.send('c:pt', :idx=>index) {
    +            xml.send('c:v', v) 
    +          }
    +        end
    +      }                        
    +    }
    +  }
    +end
    +
    +
    +
    + +
    + +
    + + + + + \ No newline at end of file diff --git a/doc/Axlsx/View3D.html b/doc/Axlsx/View3D.html index 73bfd8bf..cdc5599f 100644 --- a/doc/Axlsx/View3D.html +++ b/doc/Axlsx/View3D.html @@ -494,14 +494,14 @@ a customizable set of options
     
     
    -39
    -40
    -41
    -42
    -43
    +46 +47 +48 +49 +50
  • -
    # File 'lib/axlsx/drawing/view_3D.rb', line 39
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 46
     
     def initialize(options={})
       options.each do |o|
    @@ -560,12 +560,12 @@ depth or chart as % of chart width must be between 20% and 2000%
           
     
     
    -22
    -23
    -24
    +29 +30 +31
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 22
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 29
     
     def depthPercent
       @depthPercent
    @@ -617,12 +617,12 @@ height of chart as % of chart must be between 5% and 500%
           
     
     
    -12
    -13
    -14
    +19 +20 +21
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 12
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 19
     
     def hPercent
       @hPercent
    @@ -674,12 +674,12 @@ field of view angle
           
     
     
    -30
    -31
    -32
    +37 +38 +39
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 30
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 37
     
     def perspective
       @perspective
    @@ -731,12 +731,12 @@ Chart axis are at right angles
           
     
     
    -26
    -27
    -28
    +33 +34 +35
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 26
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 33
     
     def rAngAx
       @rAngAx
    @@ -788,12 +788,12 @@ x rotation for the chart must be between -90 and 90
           
     
     
    -7
    -8
    -9
    +14 +15 +16
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 7
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 14
     
     def rotX
       @rotX
    @@ -845,12 +845,12 @@ y rotation for the chart must be between 0 and 360
           
     
     
    -17
    -18
    -19
    +24 +25 +26
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 17
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 24
     
     def rotY
       @rotY
    @@ -927,19 +927,19 @@ The document builder instance this objects xml will be added to.
           
     
     
    -61
    -62
    -63
    -64
    -65
    -66
     67
     68
     69
    -70
    +70 +71 +72 +73 +74 +75 +76
    -
    # File 'lib/axlsx/drawing/view_3D.rb', line 61
    +      
    # File 'lib/axlsx/drawing/view_3D.rb', line 67
     
     def to_xml(xml)
       xml.send('c:view3D') {
    @@ -962,7 +962,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    diff --git a/doc/Axlsx/Workbook.html b/doc/Axlsx/Workbook.html
    index 134092c7..37e81c09 100644
    --- a/doc/Axlsx/Workbook.html
    +++ b/doc/Axlsx/Workbook.html
    @@ -1338,7 +1338,7 @@ Serializes the workbook document
     
         
         
    diff --git a/doc/Axlsx/Worksheet.html b/doc/Axlsx/Worksheet.html
    index f3131f16..93e90793 100644
    --- a/doc/Axlsx/Worksheet.html
    +++ b/doc/Axlsx/Worksheet.html
    @@ -1287,8 +1287,20 @@ The workbook that owns this worksheet
       
     

    -

    -Adds a chart to this worksheets drawing. + +

    + Note: +

    +each chart type also specifies additional options +

    +
    +
    + +

    +Adds a chart to this worksheets drawing. This is the recommended way to +create charts for your worksheet. This method wraps the complexity of +dealing with ooxml drawing, anchors, markers graphic frames chart objects +and all the other dirty details.

    @@ -1365,6 +1377,24 @@ a customizable set of options +
  • + show_legend + (Boolean) + + + + +
  • + +
  • + style + (Integer) + + + + +
  • + @@ -1382,20 +1412,35 @@ a customizable set of options +

    See Also:

    + +
     
     
    -108
    -109
    -110
    -111
    -112
    +116 +117 +118 +119 +120
    -
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 108
    +      
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 116
     
     def add_chart(chart_type, options={})
       chart = drawing.add_chart(chart_type, options)
    @@ -1615,19 +1660,19 @@ hash of auto_fit_data
           
     
     
    -182
    -183
    -184
    -185
    -186
    -187
    -188
    -189
     190
    -191
    +191 +192 +193 +194 +195 +196 +197 +198 +199
    -
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 182
    +      
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 190
     
     def auto_width(col)
       mdw = 6.0 # maximum digit with is always 6.0 in testable fonts so instead of beating RMagick every time, I am hardcoding it here.
    @@ -1683,14 +1728,6 @@ Serializes the worksheet document
           
     
     
    -116
    -117
    -118
    -119
    -120
    -121
    -122
    -123
     124
     125
     126
    @@ -1703,10 +1740,18 @@ Serializes the worksheet document
     133
     134
     135
    -136
    +136 +137 +138 +139 +140 +141 +142 +143 +144
    -
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 116
    +      
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 124
     
     def to_xml
       builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
    @@ -1802,14 +1847,6 @@ of Cell objects
           
     
     
    -154
    -155
    -156
    -157
    -158
    -159
    -160
    -161
     162
     163
     164
    @@ -1820,10 +1857,18 @@ of Cell objects
     169
     170
     171
    -172
    +172 +173 +174 +175 +176 +177 +178 +179 +180
    -
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 154
    +      
    # File 'lib/axlsx/workbook/worksheet/worksheet.rb', line 162
     
     def update_auto_fit_data(cells)
       styles = self.workbook.styles
    @@ -1855,7 +1900,7 @@ of Cell objects
     
         
         
    diff --git a/doc/Axlsx/Xf.html b/doc/Axlsx/Xf.html
    index 17c94f7f..f92867c7 100644
    --- a/doc/Axlsx/Xf.html
    +++ b/doc/Axlsx/Xf.html
    @@ -1672,7 +1672,7 @@ The document builder instance this objects xml will be added to.
     
         
         
    -- 
    cgit v1.2.3