From 2d0ac967e94c5944ccccf9adad8da5a9d082df29 Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Sun, 20 Nov 2011 23:44:58 +0900 Subject: pushing docs --- doc/Axlsx/Drawing.html | 1154 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1154 insertions(+) create mode 100644 doc/Axlsx/Drawing.html (limited to 'doc/Axlsx/Drawing.html') diff --git a/doc/Axlsx/Drawing.html b/doc/Axlsx/Drawing.html new file mode 100644 index 00000000..bcaa7592 --- /dev/null +++ b/doc/Axlsx/Drawing.html @@ -0,0 +1,1154 @@ + + + + + + Class: Axlsx::Drawing + + — Documentation by YARD 0.7.3 + + + + + + + + + + + + + + + + + + + + + + +

Class: Axlsx::Drawing + + + +

+ +
+ +
Inherits:
+
+ Object + +
    +
  • Object
  • + + + +
+ show all + +
+ + + + + + + + + +
Defined in:
+
lib/axlsx/drawing/drawing.rb
+ +
+
+ +

Overview

+
+ +
+ Note: +

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

+
+
+ +

+A Drawing is a canvas for charts. Each worksheet has a single drawing that +can specify multiple anchors which reference charts. +

+ + +
+
+
+ + +

See Also:

+ + +
+ +

Instance Attribute Summary (collapse)

+ + + + + + +

+ Instance Method Summary + (collapse) +

+ + + + +
+

Constructor Details

+ +
+

+ + - (Drawing) initialize(worksheet) + + + +

+
+

+Creates a new Drawing object +

+ + +
+
+
+

Parameters:

+
    + +
  • + + worksheet + + + (Worksheet) + + + + — +

    +The worksheet that owns this drawing +

    +
    + +
  • + +
+ + +
+ + + + +
+
+
+
+63
+64
+65
+66
+67
+68
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 63
+
+def initialize(worksheet)
+  DataTypeValidator.validate "Drawing.worksheet", Worksheet, worksheet
+  @worksheet = worksheet
+  @worksheet.workbook.drawings << self
+  @anchors = SimpleTypedList.new TwoCellAnchor
+end
+
+
+
+ +
+ +
+

Instance Attribute Details

+ + + + +
+

+ + - (SimpleTypedList) anchors (readonly) + + + +

+
+

+A collection of anchors for this drawing +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+35
+36
+37
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 35
+
+def anchors
+  @anchors
+end
+
+
+
+ + + + +
+

+ + - (Array) charts (readonly) + + + +

+
+

+An array of charts that are associated with this drawing’s anchors +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Array) + + + +
  • + +
+ +
+ + + + +
+
+
+
+39
+40
+41
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 39
+
+def charts
+  @anchors.map { |a| a.graphic_frame.chart }
+end
+
+
+
+ + + + +
+

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

+
+

+The index of this drawing in the owning workbooks’s drawings +collection. +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (Integer) + + + +
  • + +
+ +
+ + + + +
+
+
+
+43
+44
+45
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 43
+
+def index
+  @worksheet.workbook.drawings.index(self)
+end
+
+
+
+ + + + +
+

+ + - (String) pn (readonly) + + + +

+
+

+The part name for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+51
+52
+53
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 51
+
+def pn
+  "#{DRAWING_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (Relationships) relationships (readonly) + + + +

+
+

+The drawing’s relationships. +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+59
+60
+61
+62
+63
+64
+65
+66
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 59
+
+def relationships
+  r = Relationships.new
+  @anchors.each do |anchor|
+    chart = anchor.graphic_frame.chart
+    r << Relationship.new(CHART_R, "../#{chart.pn}")
+  end
+  r
+end
+
+
+
+ + + + +
+

+ + - (String) rels_pn (readonly) + + + +

+
+

+The relational part name for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+55
+56
+57
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 55
+
+def rels_pn
+  "#{DRAWING_RELS_PN % (index+1)}"
+end
+
+
+
+ + + + +
+

+ + - (String) rId (readonly) + + + +

+
+

+The relation reference id for this drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+47
+48
+49
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 47
+
+def rId
+  "rId#{index+1}"
+end
+
+
+
+ + + + +
+

+ + - (Worksheet) worksheet (readonly) + + + +

+
+

+The worksheet that owns the drawing +

+ + +
+
+
+ +

Returns:

+ + +
+ + + + +
+
+
+
+30
+31
+32
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 30
+
+def worksheet
+  @worksheet
+end
+
+
+
+ +
+ + +
+

Instance Method Details

+ + +
+

+ + - (Object) add_chart(chart_type, options = {}) + + + +

+
+ +
+ Note: +

+The recommended way to manage charts is to use Worksheet.add_chart. +

+
+
+ +

+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: {}) + + +
  • + +
+ + +
+ + + + +
+
+
+
+75
+76
+77
+78
+79
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 75
+
+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
+
+
+
+ +
+

+ + - (String) to_xml + + + +

+
+

+Serializes the drawing +

+ + +
+
+
+ +

Returns:

+
    + +
  • + + + (String) + + + +
  • + +
+ +
+ + + + +
+
+
+
+112
+113
+114
+115
+116
+117
+118
+119
+
+
# File 'lib/axlsx/drawing/drawing.rb', line 112
+
+def to_xml
+  builder = Nokogiri::XML::Builder.new(:encoding => ENCODING) do |xml|
+    xml.send('xdr:wsDr', :'xmlns:xdr'=>XML_NS_XDR, :'xmlns:a'=>XML_NS_A) {
+      anchors.each {|anchor| anchor.to_xml(xml) }
+    }        
+  end
+  builder.to_xml
+end
+
+
+
+ +
+ +
+ + + + + \ No newline at end of file -- cgit v1.2.3