How to set a gradient stop position

  • Thread starter Jeff Donkersgoed
  • Start date
J

Jeff Donkersgoed

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)).Item(2);

//Stop 1 : red stop position @ 20%
// 2: yello
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top