Chart Series Legend Color not matching with series color

Thread is closed for posting
2 posts, 0 answers
  1. kevin yang
    kevin yang avatar
    15 posts
    Member since:
    Dec 2009

    Posted 06 Jan 2010 Link to this post


    In my chart ( type StackedBar ), I change my chart series filled color programmtically, the StackedBars colors display fine for each series, but somehow, the corresponding series Legend color is not displaying the same color.  Do I have to set the color for each series legend  or  anything I am missing..

    here is my code


    Chart chart = sender as Telerik.Reporting.Processing.Chart;



    Chart defChart = chart.ItemDefinition as Telerik.Reporting.Chart;


    defChart.SeriesPalette =




    int arrayPos = 0;



    foreach (string s in _reporterTypeList)




       ChartSeries serie = new ChartSeries();


       serie.Type =




       serie.Name = s;


       serie.Appearance.LegendDisplayMode = Telerik.Reporting.Charting.



       for (int year = 4; year >= 0; year--)




          // Define the items in the series


          serie.AddItem(_countByReporterTypeYearly[arrayPos, 4 - year]);


          serie.Items[serie.Items.Count - 1].Appearance.FillStyle.MainColor = _serieColors[arrayPos];








    Any help,


  2. Ves
    Ves avatar
    2926 posts

    Posted 08 Jan 2010 Link to this post

    Hello Kevin

    I can see that you set the color for each individual ChartSeriesItem. This color is not shown in the legend as it is possible that you set different colors for different items in the same series. However, it seems you use the same color for all the items within one ChartSeries. In this case, you may remove the line that sets the color for individual items and configure the chart series i.e. remove this line form the inner loop:

    serie.Items[serie.Items.Count - 1].Appearance.FillStyle.MainColor = _serieColors[arrayPos];

    and add this one to the outer loop:

    serie.Appearance.FillStyle.MainColor = _serieColors[arrayPos];

    Kind regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top