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

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

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,122,298
Messages
5,595,310
Members
413,986
Latest member
Elizsk

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top