Info

There are objects that apply only to 3D charts. You can now adjust the fill color of Walls and a Floor.

In addition, each series in the 3D chart includes a few properties. These control how closely each column is drawn to the next column:

■ GapWidth—If this value is set to zero, then the individual columns in a series touch each other, making them appear as a series of stair steps. With a higher value, the gap between each column in a series grows, making the width of each column narrower. GapWidth must be applied to a new object called a ChartGroup. A single ChartGroup includes all series of the same chart type. Thus, if you had 2 series identified as 3DColumns and 1 series as Lines, the Column3DGroup object would control the GapWidth for all series formatted as 3DColumns.

■ GapDepth—Again, if this value is zero, the columns in one series touch the columns in the next series. With a higher value, the depth of each column lessens. Interestingly, although this is set in the Format Series dialog box, the GapDepth must be the same for all series, so this property applies to the Chart object.

■ ChartDepth—This controls how deep the floor of the chart appears to be. With a low ChartDepth of 20, the entire chart appears very flat, sort of like it was created by the people who used to make the Gumby and Pokey characters. With a large chart depth, you can see some floor between the two series. The DepthPercent property must be the same for all series, so it applies to the Chart object.

The following macro code adjusts all these values. The resulting chart is shown in Figure 10.17:

Sub Format3D()

Dim Cht As Chart

Set Cht = Worksheets("3d").ChartObjects(1).Chart With Cht

.Elevation = 30 .Perspective = 25 .Rotation = 30 .RightAngleAxes = False .HeightPercent = 150 .AutoScaling = True .DepthPercent = 280 .GapDepth = 160 End With

Cht.Column3DGroup.GapWidth = 0 With Cht.Walls.Fill

.TwoColorGradient Style:=msoGradientHorizontal, Variant:=1 .Visible = True .ForeColor.SchemeColor = 2 .BackColor.SchemeColor = 1 End With

With Cht.Floor.Fill

.PresetGradient Style:=msoGradientHorizontal, Variant:=1, _

PresetGradientType:=msoGradientCalmWater .Visible = True End With End Sub

0 0

Post a comment