Show code in...     

  

 

Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


The 3DProperties Object (I3DProperties)

The 3DProperties object represents the set of properties specific to three-dimensional charts.

To create a 3DProperties object, use

set 3DProperties = chart.view3d

3DProperties Methods and Properties

3DProperties Methods and Properties
ChartDepth

Sets or retrieves the depth of a three-dimensional chart. The default value of ChartDepth is 100.


[VBScript]
Property ChartDepth As Integer (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Set the chart depth to 200
MyChart.View3D.ChartDepth = 200


Top

DistanceFromEyeToChart

Sets or retrieves a perspective value, from 0 to 100 degrees, that represents the ratio of the chart's front to its back. The
perspective value determines the appearance of chart depth. The default value of DistanceFromEyeToChart is 30.

Setting DistanceFromEyeToChart will have no effect unless you enable UsePerspectiveTransform.


[VBScript]
Property DistanceFromEyeToChart As Integer (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)


'--- Enable UsePerspectiveTransform
MyChart.View3D.UsePerspectiveTransform = True

'--- Set the distance to 80
MyChart.View3D.DistanceFromEyeToChart = 80


Top

ElevationAngle

Sets or retrieves the elevation angle of a chart. By default, ElevationAngle is set to 15, that is, the chart is elevated 15 degrees.


[VBScript]
Property ElevationAngle As Integer (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)


'--- Set elevation angle to 45 degrees
MyChart.View3D.ElevationAngle = 45


Top

PlotVolumeHeight

Sets or retrieves the height of a 3D chart, as a percentage of the chart's base length. By default, PlotVolumeHeight is 100, that is, 100% of the base length, or equal to the base length.

Setting PlotVolumeHeight will have no effect unless you disable UseAutoScaling.


[VBScript]
Property PlotVolumeHeight As Integer (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)


'--- Disable UseAutoScaling
MyChart.View3D.UseAutoScaling = False

'--- Set the chart height to 50% of the base length.
MyChart.View3D.PlotVolumeHeight = 50


Top

RotationAngle

Sets or retrieves the rotation angle of a three-dimensional chart. By default, RotationAngle is set to 20, that is, the chart is
rotated 20 degrees.


[VBScript]
Property RotationAngle As Integer (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)


'--- Set the rotation angle of a chart to 60 degrees.
MyChart.View3D.RotationAngle = 60


Top

SeriesGapDepth

Sets or retrieves the gap width between categories of series values. SeriesGapDepth values range from 0 to 500. The greater the value of SeriesGapDepth, the wider the gap. SeriesGapDepth is set to 150 by default.


[VBScript]
Property SeriesGapDepth As Integer(read/write)

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)


'--- Set the series gap depth to 200
MyChart.View3D.SeriesGapDepth = 200


Top

Show3D

When set to True, displays chart with three-dimensional effect. When set to False, displays two dimensions, even if the chart has a 3-D subtype. Show3D is set to True by default.


[VBScript]
Property Show3D As Boolean (read/write)


		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Display the 3D chart in 2D
MyChart.View3D.Show3D = False


Top

Stack3DColumns

When set to False, displays series categories from front to back of the chart, with a gap between the columns. When set to True, displays columns side by side.


[VBScript]
Property Stack3DColumns As Boolean (read/write)


		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Display columns side-by-side
MyChart.View3D.Stack3DColumns = True


Top

UseAutoScaling

When UseAutoScaling is enabled, Microsoft Excel will automatically scale a three-dimensional chart to be close to the size of its two-dimensional version. UseAutoScaling is set to 1, that is, enabled, by default. Disable UseAutoScaling to use PlotVolumeHeight.

The following example demonstrates disabling UseAutoScaling.


[VBScript]
Property UseAutoScaling As Boolean (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Disable auto scaling
MyChart.View3D.UseAutoScaling = False


Top

UsePerspectiveTransform

When enabled, allows you to control the appearance of chart depth, by setting the value of DistanceFromEyeToChart. UsePerspectiveTransform is disabled by default. When UsePerspectiveTransform is disabled, the chart's axes will be displayed at right angles, regardless of rotation and elevation values.

The following example demonstrates enabling UsePerspectiveTransform.


[VBScript]
Property UsePerspectiveTransform As Boolean (read/write)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Enable UsePerspectiveTransform
MyChart.View3D.UsePerspectiveTransform = True

'--- Set the distance to 80
MyChart.View3D.DistanceFromEyeToChart = 80


Top

ZAxis

Returns an Axis object, representing a three-dimensional chart's z-axis. The properties of ZAxis are, AxisLine, LabelFont, LabelPosition, MajorGridline, MajorIncrement, MajorTickType, MinorGridline, MinorIncrement, MinorTickType, Number, Title, and ValuesInReverseOrder.

The following example demonstrates setting a title for the z-axis.


[VBScript]
Property ZAxis As IAxis (read-only)

		

Example:



[VBScript]

'--- Create an instance of ExcelWriter and 
'--- add a 3D column chart to worksheet #1
Dim XlwApp, WrkSht, MyChart
Set XlwApp = Server.CreateObject("SoftArtisans.ExcelWriter")
Set WrkSht = XlwApp.Worksheets(1)
Set MyChart = WrkSht.Charts.Add(saxlsColumnChart, _
			6, 1, 1, 10, 10)

'--- Use ZAxis to get an IAxis interface to adjust properties of the Z axis
'--- Set the major tick type of the axis
Set AxisZ = MyChart.View3D.ZAxis
AxisZ.MajorTickType = saxlsOutsideLineTick 


Top



Object Model ExcelApplication Worksheets Worksheet Cells Cell Range
Charts Chart SeriesCollection Series 3DProperties Axis ChartFrame Line Area
PivotField PivotFields PivotTable PivotTables
Style Characters Font Pictures Picture DocumentProperties PageSetup


Copyright © 2005, SoftArtisans, Inc.