ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to set a gradient stop position (https://www.excelbanter.com/excel-programming/426339-how-set-gradient-stop-position.html)

Jeff Donkersgoed

How to set a gradient stop position
 
I would like to create a gradient in my chart that goes from red to yellow.
If I just do a gradient fill it ends up looking more like orange to yellow
unless I set the first stop position (red side) to around 20%. How can I do
this via code? I can't find any method anywhere that might affect this.
Below is how I create the gradient (using C#).

// Get the series I want to fill with a gradient
Excel.Series series =
((Excel.SeriesCollection)((Excel.ChartGroup)chart. ChartGroups(1)).SeriesCollection(Type.Missing)).It em(2);

//Stop 1 : red stop position @ 20%
// 2: yellow
series.Fill.TwoColorGradient(Microsoft.Office.Core .MsoGradientStyle.msoGradientVertical, 1);
series.Fill.ForeColor.SchemeColor = 3; // red--is there a better
way to do this?
series.Interior.PatternColor = 0x00ffff; // yellow


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com