contour (surface) chart and gradient series colors

ieJasonW

New Member
Joined
Mar 4, 2010
Messages
31
OK, complicated question. I'm trying to create a contour plot (one of the 2D surface charts) that shows a gradient of colors in the plot. As in, I want 100 different colors used in the plot area. BUT...

I only want 10 basic colors shown in the legend as a reference.

I got the 10 colors in the legend by adjusting the MaximumScale to 1 and the MajorUnit to 0.1. And the plot will differentiate between measurements (z-values) whose values change by only 0.01. The problem is the colors being assigned to the series.

How do I assign a gradient of color to values from 0.01 to 1.00 using VBA? Right now I'm assigning color to one series with the following code:

ActiveChart.SeriesCollection(i).Interior

I'd prefer to just transition the color from solid brown to white. Or from 100% color A and 0% color B if z-value=0.01 and 0% color A and 100% color B if z-value=0.99.

ieJasonw
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

ieJasonW

New Member
Joined
Mar 4, 2010
Messages
31
Right now this is what I've got:

for i=1 to ActiveChart.SeriesCollection.Count
With ActiveChart.SeriesCollection(i).Format.Fill.ForeColor
.RGB=RGB(197,217,241)
.TintAndShade=(-1+(2*(i-1)/10))
End With

ActiveChart.SeriesCollection(i).Name=i
Next i

The result, though, is 10 different series (which is correct) that are all a black color. If I comment out the TintAndShade line, all 10 turn light blue. I'd like a gradient from dark blue to white.
 
Last edited:

Watch MrExcel Video

Forum statistics

Threads
1,118,660
Messages
5,573,471
Members
412,531
Latest member
gkrishna788
Top