Hello,
I am creating a pie chart with three items
Responded/ Responded with comments/ Not responded
DataTable dt = GetDataTable();
PieSeries chartData = new PieSeries();
PieChart1.ChartTitle.Text = "Title";
chartData.StartAngle = 90;
chartData.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.PieAndDonutLabelsPosition.Center;
SeriesItem item = new SeriesItem();
SeriesItem item1 = new SeriesItem();
SeriesItem item2 = new SeriesItem();
foreach (DataRow row in dt.Rows)
{
if (row["Responded"] != null && Convert.ToBoolean(row["Responded"]))
{
i++;
}
else if (row["Respondedwithcomments"] != null && Convert.ToBoolean(row["Respondedwithcomments"]))
{
j++;
}
else if(row["Responded"] == null)
{
k++;
}
}
chartData.LabelsAppearance.DataFormatString = "{0}";
chartData.TooltipsAppearance.DataFormatString = "{0} ";
item.Name = "Responded";
item.YValue = i;
item.BackgroundColor = System.Drawing.Color.YellowGreen;
item1.Name = "Responded with comments";
item1.YValue = j;
item1.BackgroundColor = System.Drawing.Color.PaleVioletRed;
item2.Name = "Not Responded";
item2.YValue = k;
item2.BackgroundColor = System.Drawing.Color.LightYellow;
chartData.Items.Add(item);
chartData.Items.Add(item1);
chartData.Items.Add(item2);
PieChart1.PlotArea.Series.Add(chartData);
Each time the chart refreshes to get the new data , the series name adds up so and I am also not sure that I am doing it the right way , please help!