Hi,
Am working in asp.net4.5 and facing problem piechart rendering.
Here is the code:
<div>
<asp:Chart ID="WebChart1" runat="server">
<%--<Series>
<asp:Series Name="Series1" ChartType="Pie"></asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea1"></asp:ChartArea>
</ChartAreas>--%>
<Titles>
<asp:Title ShadowOffset="3" Name="Items" />
</Titles>
<Legends>
<asp:Legend Alignment="Center" Docking="Bottom" IsTextAutoFit="False" Name="Default" LegendStyle="Row" />
</Legends>
</asp:Chart>
</div>
c#
protected void Page_Load(object sender, EventArgs e)
{
//double[] yValues = { 10, 27.5, 7, 12, 45.5 };
//string[] xNames = { "Mike", "John", "William", "George", "Alex" };
//WebWebChart1.Series[0].Points.DataBindXY(xNames, yValues);
WebChart1.ChartAreas.Clear();
WebChart1.Series.Clear();
ChartArea area = new ChartArea("AREA");
WebChart1.ChartAreas.Add(area);
Series series = new Series("SERIES");
WebChart1.Series.Add(series);
series.IsValueShownAsLabel = true;
series.ChartType = SeriesChartType.Pie;
series.IsValueShownAsLabel = true;
//Add data to the series.
//See Alex Gorev's blog or the Samples Environment for different data binding methods.
string[] xValues = {
"Good Score",
"Poor Score",
"Average Score",
"Good Score",
"Average Score"
};
double[] yValues = {
100,
24,
47,
77,
55
};
series.Points.DataBindXY(xValues,yValues);
foreach (DataPoint dp in series.Points)
{
dp["Exploded"] = "True";
dp["PieLabelStyle"] = "Inside";
if (dp.YValues[0] <= 39)
{
dp.LegendText = ">=39";
dp.Color = System.Drawing.Color.Red;
}
if (dp.YValues[0] > 39 && dp.YValues[0] < 70)
{
dp.LegendText = "40 to 69";
dp.Color = System.Drawing.Color.Yellow;
}
if (dp.YValues[0] > 69)
{
dp.LegendText = "> 70";
dp.Color = System.Drawing.Color.FromArgb(121, 167, 118);
}
//dp.Label = "#PERCENT";
//dp["PieLineColor"] = "Red";
}
WebChart1.ChartAreas["AREA"].Area3DStyle.Enable3D = true;
//WebChart1.ChartAreas["AREA"].Area3DStyle.Inclination = -25;
WebChart1.Legends[0].Enabled = true;
//WebChart1.Series[0].Label = "#VALX (#PERCENT{P0})";
WebChart1.Series[0].Label = "#PERCENT{P0}";
}

when i run this am able to see two yello color and two green color and one red color datapoint in my piechart. how to i club the datapoint to show one green color, one yello color and one redcolor datapoint. because i should have only three colors with three area of plotting. can anyone please help me to club the plotted area of the same color as one