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

Need simple answer to a simple question

2 Answers 24 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Eric Wallace
Top achievements
Rank 1
Eric Wallace asked on 10 Oct 2011, 10:38 PM
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 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Oct 2011, 08:41 AM
Hello Eric,

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

Thanks,
Shinu.
0
Eric Wallace
Top achievements
Rank 1
answered on 11 Oct 2011, 03:01 PM
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;
    }
Tags
Chart (Obsolete)
Asked by
Eric Wallace
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Eric Wallace
Top achievements
Rank 1
Share this question
or