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)/.freeze
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)/.freeze

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)


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

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)


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

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)


35
36
37
# File 'lib/axlsx/drawing/view_3D.rb', line 35

def h_percent
  @h_percent
end

#perspectiveInteger

field of view angle

Returns:

  • (Integer)


57
58
59
# File 'lib/axlsx/drawing/view_3D.rb', line 57

def perspective
  @perspective
end

#r_ang_axBoolean Also known as: rAngAx

Chart axis are at right angles

Returns:

  • (Boolean)


52
53
54
# File 'lib/axlsx/drawing/view_3D.rb', line 52

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)


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

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)


41
42
43
# File 'lib/axlsx/drawing/view_3D.rb', line 41

def rot_y
  @rot_y
end

Instance Method Details

#to_xml_string(str = +'')) ⇒ String

Serializes the object

Parameters:

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

Returns:

  • (String)


105
106
107
108
109
110
111
# File 'lib/axlsx/drawing/view_3D.rb', line 105

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