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

Set Backgroud color for StackedBar Chart

2 Answers 24 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Anwar Arakkal
Top achievements
Rank 1
Anwar Arakkal asked on 27 Oct 2010, 05:13 AM
Hi,

I would like to change the background color of stacked bar chart

Here is the code which I am using. But it does not work for me.

sbd =

new StackedBarSeriesDefinition();

 

sbd.ShowItemLabels =

true;

 

sbd.ShowItemToolTips =

true;

 

 

Style s = new Style(typeof(Telerik.Windows.Controls.Charting.StackedBar));

 

s.Setters.Add(

new Setter(BackgroundProperty, new SolidColorBrush(Colors.Black)));

 

sbd.SeriesStyle = s; 

 

 

dsTelerik.Definition = sbd;


Coud you please correct my code?

Thanks,
Anwar

2 Answers, 1 is accepted

Sort by
0
Sia
Telerik team
answered on 29 Oct 2010, 01:23 PM
Hello Anwar Arakkal,

You can use our Palette Brushes functionality as follows:
RadChart1.PaletteBrushes.Add(new SolidColorBrush(Colors.Black));
RadChart1.PaletteBrushesRepeat = false;

If you want all stacked bars to be black just remove the second line. You can add as many colors as you want.

If this does not fit in your scenario, just let me know.

Kind regards,
Sia
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
Anwar Arakkal
Top achievements
Rank 1
answered on 30 Oct 2010, 05:30 AM
Hi Sia,

Thanks for the reply. I am able to set the background color by using below code.

sbd =

new StackedBarSeriesDefinition();

 

if

 

(!string.IsNullOrEmpty(SeriesColor))

 

{

sbd.Appearance.Fill = GetColor(SeriesColor);

}

 

dsTelerik.Definition = sbd;



Thanks,
Anwar

Tags
Chart
Asked by
Anwar Arakkal
Top achievements
Rank 1
Answers by
Sia
Telerik team
Anwar Arakkal
Top achievements
Rank 1
Share this question
or