Need simple answer to a simple question

Thread is closed for posting
3 posts, 0 answers
  1. Eric Wallace
    Eric Wallace avatar
    17 posts
    Member since:
    Oct 2009

    Posted 10 Oct 2011 Link to this post

    How do you change the fill color on a pie chart? Nothing I do works. I've changed the series fill style to solid, set the main and second colors, but I still get blue and green.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Oct 2011 Link to this post

    Hello Eric,

    Please take a look into the following forum thread which discussed similar scenario.
    Radchart -Pie series.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric Wallace
    Eric Wallace avatar
    17 posts
    Member since:
    Oct 2009

    Posted 11 Oct 2011 Link to this post

    Hello, Shinu.

    Unfortunately that thread gave me very little to go on. As I said, I tried setting those properties already. The code snippet in that thread seems like a lazy response from support as well.

    For anyone else frustrated by this, set those properties on the Databound event and it will work.

    protected void Page_Load(object sender, EventArgs e)
        {
            if (((Telerik.Cms.Web.CmsPageBase)this.Page).PageMode != Telerik.Cms.Web.CmsPageMode.Live)
                return;
     
            DAL data = new DAL();
            DataTable table = data.Reports_Diskspace();
     
            if (table.Rows.Count == 0)
            {
                this.Visible = false;
                return;
            }
     
            chart.DataSource = table.;
            chart.DataBound += new EventHandler(chart_DataBound);
            chart.DataBind();       
            table.Dispose();
        }
     
        private void chart_DataBound(object sender, EventArgs e)
        {
            chart.Series[0].Items[0].Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
            chart.Series[0].Items[0].Appearance.FillStyle.MainColor = System.Drawing.Color.Blue;
     
            chart.Series[0].Items[1].Appearance.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
            chart.Series[0].Items[1].Appearance.FillStyle.MainColor = System.Drawing.Color.Fuchsia;
        }
Back to Top