Customizing Chart Elements > Customizing ContourStyles > Contour Styles and Distribution Levels |
Note that the nth contour line or zone in a chart is normally not associated with the nth contour style in the ContourStyles collection. The relationship between distribution levels (contour lines/zones) and the ContourStyles collection is as follows: if nstyles contour styles are provided, and the number of distribution levels is nlevels, the index of the contour style associated with the nth distribution level is the largest integer less than or equal to the following:
Fix((n-1) * (nstyles - 1) / nlevels + 0.5 ) + 1
For example, if 100 contour styles and 6 distribution levels are defined, the distribution levels use the 1st, 18th, 34th, 51st, 67th, and 84th elements of the ContourStyles collection, respectively. (The number of distribution levels is specified by the NumLevels property of the ContourLevels object.) Normally, you will not need to calculate the contour style index yourself, as the CalcIndex method (described below) calculates it for you.
To force a one-to-one matchup between contour styles and distribution levels, create an array of contour styles with the same number of elements as there are distribution levels. (If you have specified that zone regions are to be drawn, your array of contour styles must contain one more element than the number of zone regions. Zone regions are specified by setting the IsZoned property of the Contour object to True. The extra contour style is used to specify the last zone's fill color.)
The following image shows the relationship of both zone and contour line colors for a 6 level surface chart. Listed below the chart is a table matching ContourStyles properties with the colors shown in the chart.
ContourStyleIndex |
FillStyle Color |
LineStyle Color |
1 |
Gray |
Black |
18 |
Steel Blue |
Red |
34 |
Cyan |
Violet |
51 |
Green |
Blue |
67 |
Yellow |
Forest Green |
84 |
Coral |
Black |
Note that the 1st style is used for the floor of the above chart image, and each successive listed style is used for the next higher elevation contour and zone. |