Class: Axlsx::View3D

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

Overview

3D attributes for a chart.

Constant Summary collapse

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

Methods included from OptionsParser

#parse_options

Constructor Details

#initialize(options = {}) ⇒ View3D

Creates a new View3D for charts

Parameters:

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

    a customizable set of options

Options Hash (options):

  • rot_x (Integer)
  • h_percent (String)
  • rot_y (Integer)
  • depth_percent (String)
  • r_ang_ax (Boolean)
  • perspective (Integer)


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

def initialize(options = {})
  @rot_x, @h_percent, @rot_y, @depth_percent, @r_ang_ax, @perspective = nil, nil, nil, nil, nil, nil
  parse_options options
end

Instance Attribute Details

#depth_percentString Also known as: depthPercent

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

Returns:

  • (String)


45
46
47
# File 'lib/axlsx/drawing/view_3D.rb', line 45

def depth_percent
  @depth_percent
end

#h_percentString Also known as: hPercent

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

Returns:

  • (String)


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

def h_percent
  @h_percent
end

#perspectiveInteger

field of view angle

Returns:

  • (Integer)


55
56
57
# File 'lib/axlsx/drawing/view_3D.rb', line 55

def perspective
  @perspective
end

#r_ang_axBoolean Also known as: rAngAx

Chart axis are at right angles

Returns:

  • (Boolean)


50
51
52
# File 'lib/axlsx/drawing/view_3D.rb', line 50

def r_ang_ax
  @r_ang_ax
end

#rot_xInteger Also known as: rotX

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

Returns:

  • (Integer)


27
28
29
# File 'lib/axlsx/drawing/view_3D.rb', line 27

def rot_x
  @rot_x
end

#rot_yInteger Also known as: rotY

y rotation for the chart must be between 0 and 360

Returns:

  • (Integer)


39
40
41
# File 'lib/axlsx/drawing/view_3D.rb', line 39

def rot_y
  @rot_y
end

Instance Method Details

#to_xml_string(str = '') ⇒ String

Serializes the object

Parameters:

  • str (String) (defaults to: '')

Returns:

  • (String)


97
98
99
100
101
102
103
# File 'lib/axlsx/drawing/view_3D.rb', line 97

def to_xml_string(str = '')
  str << '<c:view3D>'
  %w(rot_x h_percent rot_y depth_percent r_ang_ax perspective).each do |key|
    str << element_for_attribute(key, 'c')
  end
  str << '</c:view3D>'
end