Customizing Chart Elements > Customizing ContourStyles > Finding and Changing Contour Styles |
To find the ContourStyle object associated with a particular contour line or zone, use the CalcIndex method. For example, the following retrieves the ContourStyle object for the third contour line:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(3)
End With
You can use this approach to change the attributes of individual zones or contour lines. For example, to change the color for a particular zone, change the Color property of the FillStyle object. The following statements change the first zone color to green:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(1)
.Styles(Index).FillStyle.Color = RGB(0, 128, 0)
End With
To change the line width, color and pattern for a contour line, change the Width, Color and Pattern properties of the LineStyle object. For example, the following statements change the second contour line to a dotted green line which is 5 pixels wide:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(2)
With .Styles(Index).LineStyle
.Width = 5
.Color = RGB(0, 128, 0)
.Pattern = oc3dLineDotted
End With
End With
The customized contour style table resulting from these changes can be saved into a file using the Save method, and restored from a file using the Load method. This enables you to use the same contour styles in different charts.
To revert to the default contour style behavior, invoke the Reset method. All contour styles will be reset to their default values.