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
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

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:

Forum statistics

Threads
1,181,702
Messages
5,931,548
Members
436,792
Latest member
oriator

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