Class: Axlsx::View3D

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

Overview

3D attributes for a chart.

Constant Summary

H_PERCENT_REGEX =

Validation for hPercent

/0*(([5-9])|([1-9][0-9])|([1-4][0-9][0-9])|500)%/
DEPTH_PERCENT_REGEX =

validation for depthPercent

/0*(([2-9][0-9])|([1-9][0-9][0-9])|(1[0-9][0-9][0-9])|2000)%/

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (View3D) initialize(options = {})

Creates a new View3D for charts

Parameters:

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

    a customizable set of options

Options Hash (options):

  • rotX (Integer)
  • hPercent (String)
  • rotY (Integer)
  • depthPercent (String)
  • rAngAx (Boolean)
  • perspective (Integer)


46
47
48
49
50
# File 'lib/axlsx/drawing/view_3D.rb', line 46

def initialize(options={})
  options.each do |o|
    self.send("#{o[0]}=", o[1]) if self.respond_to? "#{o[0]}="
  end    
end

Instance Attribute Details

- (String) depthPercent

depth or chart as % of chart width must be between 20% and 2000%

Returns:

  • (String)


29
30
31
# File 'lib/axlsx/drawing/view_3D.rb', line 29

def depthPercent
  @depthPercent
end

- (String) hPercent

height of chart as % of chart must be between 5% and 500%

Returns:

  • (String)


19
20
21
# File 'lib/axlsx/drawing/view_3D.rb', line 19

def hPercent
  @hPercent
end

- (Integer) perspective

field of view angle

Returns:

  • (Integer)


37
38
39
# File 'lib/axlsx/drawing/view_3D.rb', line 37

def perspective
  @perspective
end

- (Boolean) rAngAx

Chart axis are at right angles

Returns:

  • (Boolean)


33
34
35
# File 'lib/axlsx/drawing/view_3D.rb', line 33

def rAngAx
  @rAngAx
end

- (Integer) rotX

x rotation for the chart must be between -90 and 90

Returns:

  • (Integer)


14
15
16
# File 'lib/axlsx/drawing/view_3D.rb', line 14

def rotX
  @rotX
end

- (Integer) rotY

y rotation for the chart must be between 0 and 360

Returns:

  • (Integer)


24
25
26
# File 'lib/axlsx/drawing/view_3D.rb', line 24

def rotY
  @rotY
end

Instance Method Details

- (String) to_xml(xml)

Serializes the view3D properties

Parameters:

  • xml (Nokogiri::XML::Builder)

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

Returns:

  • (String)


67
68
69
70
71
72
73
74
75
76
# File 'lib/axlsx/drawing/view_3D.rb', line 67

def to_xml(xml)
  xml.send('c:view3D') {
    xml.send('c:rotX', :val=>@rotX) unless @rotX.nil?
    xml.send('c:hPercent', :val=>@hPercent) unless @hPercent.nil?
    xml.send('c:rotY', :val=>@rotY) unless @rotY.nil?
    xml.send('c:depthPercent', :val=>@depthPercent) unless @depthPercent.nil?
    xml.send('c:rAngAx', :val=>@rAngAx) unless @rAngAx.nil?
    xml.send('c:perspective', :val=>@perspective) unless @perspective.nil?
  }
end