pie chart color should change for each and every series

Thread is closed for posting
2 posts, 1 answers
  1. Gokul
    Gokul avatar
    11 posts
    Member since:
    Apr 2013

    Posted 14 May 2013 Link to this post

    Hi,
      I'm Having Pie Chart by using stored procedure i will bind the values in chart for that chart series i want to change color (i have 5 series)
       for every series the color should vary.
    Thanks
  2. Answer
    Rosko
    Admin
    Rosko avatar
    137 posts

    Posted 17 May 2013 Link to this post

    Hi Gokul,

    I hope I understand this right -- for each pie series you want to have different set of colors. What you need to do is to iterate through each item in each series.

    ChartSeries series1 = new ChartSeries();
     
    series1.Type = ChartSeriesType.Pie;
    series1.AddItem(120, "Internet");
    series1.AddItem(140, "Retail");
    series1.AddItem(35, "Wholesale");
     
    Color[] colors = (new Color[3]
        {
            Color.Red,
            Color.Green,
            Color.Blue,
        });
     
    for (int i = 0; i < series1.Items.Count; i++)
    {
        series1.Items[i].Appearance.FillStyle.MainColor = colors[i];
    }


    Greetings,
    Rosko
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top