class Axlsx::View3D

3D attributes for a chart.

Constants

DEPTH_PERCENT_REGEX

validation for depthPercent

H_PERCENT_REGEX

Validation for hPercent

Attributes

depthPercent[R]

depth or chart as % of chart width must be between 20% and 2000% @return [String]

depth_percent[R]

depth or chart as % of chart width must be between 20% and 2000% @return [String]

hPercent[R]

height of chart as % of chart width must be between 5% and 500% @return [String]

h_percent[R]

height of chart as % of chart width must be between 5% and 500% @return [String]

perspective[R]

field of view angle @return [Integer]

rAngAx[R]

Chart axis are at right angles @return [Boolean]

r_ang_ax[R]

Chart axis are at right angles @return [Boolean]

rotX[R]

x rotation for the chart must be between -90 and 90 @return [Integer]

rotY[R]

y rotation for the chart must be between 0 and 360 @return [Integer]

rot_x[R]

x rotation for the chart must be between -90 and 90 @return [Integer]

rot_y[R]

y rotation for the chart must be between 0 and 360 @return [Integer]

Public Class Methods

new(options={}) click to toggle source

Creates a new View3D for charts @option options [Integer] rot_x @option options [String] h_percent @option options [Integer] rot_y @option options [String] depth_percent @option options [Boolean] r_ang_ax @option options [Integer] perspective

# 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

Public Instance Methods

depthPercent=(v)
Alias for: depth_percent=
depth_percent=(v) click to toggle source

@see depth_percent

# File lib/axlsx/drawing/view_3D.rb, line 81
def depth_percent=(v) RegexValidator.validate "#{self.class}.depth_percent", DEPTH_PERCENT_REGEX, v; @depth_percent = v; end
Also aliased as: depthPercent=
hPercent=(v)
Alias for: h_percent=
h_percent=(v) click to toggle source

@see h_percent

# File lib/axlsx/drawing/view_3D.rb, line 67
def h_percent=(v)
  RegexValidator.validate "#{self.class}.h_percent", H_PERCENT_REGEX, v
  @h_percent = v
end
Also aliased as: hPercent=
perspective=(v) click to toggle source

@see perspective

# File lib/axlsx/drawing/view_3D.rb, line 89
def perspective=(v) 
  RangeValidator.validate "View3D.perspective", 0, 240, v
  @perspective = v
end
rAngAx=(v)
Alias for: r_ang_ax=
r_ang_ax=(v) click to toggle source

@see r_ang_ax

# File lib/axlsx/drawing/view_3D.rb, line 85
def r_ang_ax=(v) Axlsx::validate_boolean(v); @r_ang_ax = v; end
Also aliased as: rAngAx=
rotX=(v)
Alias for: rot_x=
rotY=(v)
Alias for: rot_y=
rot_x=(v) click to toggle source

@see rot_x

# File lib/axlsx/drawing/view_3D.rb, line 60
def rot_x=(v)
  RangeValidator.validate "View3D.rot_x", -90, 90, v
  @rot_x = v
end
Also aliased as: rotX=
rot_y=(v) click to toggle source

@see rot_y

# File lib/axlsx/drawing/view_3D.rb, line 74
def rot_y=(v) 
  RangeValidator.validate "View3D.rot_y", 0, 360, v
  @rot_y = v
end
Also aliased as: rotY=
to_xml_string(str = '') click to toggle source

Serializes the object @param [String] str @return [String]

# File lib/axlsx/drawing/view_3D.rb, line 99
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

Private Instance Methods

element_for_attribute(name, namespace='') click to toggle source

Note: move this to Axlsx module if we find the smae pattern elsewhere.

# File lib/axlsx/drawing/view_3D.rb, line 109
def element_for_attribute(name, namespace='')
  val = instance_values[name]
  return "" if val == nil
  "<%s:%s val='%s'/>" % [namespace, Axlsx::camel(name, false), val]
end