This is a migrated thread and some comments may be shown as answers.

Problems Changing Colours on Stacked Area 100% Graphs

2 Answers 24 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Craig
Top achievements
Rank 1
Craig asked on 26 Aug 2010, 12:14 PM

I've tried using the following code to change the colour of one of the series areas and it doesn't work.

ChartSeriesType

 

chartType = aPercentage ? ChartSeriesType.StackedArea100 : ChartSeriesType.Area;

ChartSeries

 

freeSeries = new ChartSeries("Series 1", chartType);

 

freeSeries.Appearance.LegendDisplayMode =

ChartSeriesLegendDisplayMode.SeriesName;

 

freeSeries.Appearance.FillStyle.MainColor =

Color.Green;

I've also tried doing the following, and this doesn't work either:

 

ChartSeriesItem

 

free = new ChartSeriesItem(cd.FreeEntry);

 

free.Label.Visible =

false;

 

free.Appearance.FillStyle.MainColor =

Color.Green;

 

freeSeries.AddItem(free);

Please could someone point me in the right direction.

Many thanks, Craig.

2 Answers, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 31 Aug 2010, 11:23 AM
Hi Craig,

The code you have supplied seems to work correctly for me. Indeed, the result is a bit weird as by default the FillStyle is gradient, so RadChart shows a gradient fill, composed by the green color (as set) and the default second color (some light blue). To fix this I added this line:

freeSeries.Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;

You can find my test page attached.

Best regards,
Ves
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Craig
Top achievements
Rank 1
answered on 31 Aug 2010, 11:27 AM
Hi,

thanks. I actually managed to resolve the issue using the following code:

ColorBlend

 

[] seriesColors =

 

 

new ColorBlend[] {

 

 

 

new ColorBlend(new Color[] { Color.Red, Color.DarkRed}),

 

 

 

new ColorBlend(new Color[] { Color.Orange, Color.OrangeRed}),

 

 

 

new ColorBlend(new Color[] { Color.Yellow, Color.LightYellow}),

 

 

 

new ColorBlend(new Color[] { Color.Green, Color.LimeGreen}),

 

 

 

new ColorBlend(new Color[] { Color.LightGreen, Color.White})};

 

 

 

 

Palette seriesPalette = new Palette("seriesPalette", seriesColors);

 

aChart.CustomPalettes.Add(seriesPalette);

aChart.SeriesPalette =

 

"seriesPalette";

 

 

Tags
Chart (Obsolete)
Asked by
Craig
Top achievements
Rank 1
Answers by
Ves
Telerik team
Craig
Top achievements
Rank 1
Share this question
or