Set Backgroud color for StackedBar Chart

3 posts, 0 answers
  1. Anwar Arakkal
    Anwar Arakkal avatar
    21 posts
    Member since:
    Nov 2007

    Posted 27 Oct 2010 Link to this post

    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. Sia
    Admin
    Sia avatar
    745 posts

    Posted 29 Oct 2010 Link to this post

    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
  3. Anwar Arakkal
    Anwar Arakkal avatar
    21 posts
    Member since:
    Nov 2007

    Posted 30 Oct 2010 Link to this post

    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

Back to Top