I am creating dynamically chartarea,series and data points in One chart Control.
My problem is that When I take the chart type pie and enabled 3D TRUE.then its data point color overlapping chart area color.But whenver I make 3D enable false everything is working fine.yes problem with only circle type chart.And 3D working fine with rest of the types of chart
What I have tried:
here is my code :
con.Open();
dr = cmd.ExecuteReader();
while (dr.Read())
{
if (!dr["Machine_Id"].Equals(0))
{
nm = dr[0].ToString();
Chart1.ChartAreas.Add(nm.ToString());
Chart1.Series.Add(nm); Chart1.Series[nm].Points.AddXY(100, dr["Macine_Percentage"]);
Chart1.Series[nm].Points.AddXY(100, 78);
Chart1.Series[nm].ChartArea = nm;
Chart1.Series[nm].Points[0].Color = System.Drawing.Color.Pink;
Chart1.Series[nm].Points[1].Color = System.Drawing.Color.Silver;
Chart1.Series[nm].Points[0].Label = dr["Macine_Percentage"] + "%";
Chart1.Series[nm].Points[0].LabelForeColor = System.Drawing.Color.White;
Chart1.Series[nm].Points[0].Font = new Font("Arial", 15, FontStyle.Bold);
Chart1.Series[nm].CustomProperties = "PieStartAngle = 270";
Chart1.Series[nm].BorderWidth = 500;
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.Aquamarine;
Chart1.ChartAreas[nm].BorderDashStyle = ChartDashStyle.Solid;
Chart1.ChartAreas[nm].BorderWidth = 2; System.Web.UI.DataVisualization.Charting.Title mid = new System.Web.UI.DataVisualization.Charting.Title();
mid.Name = nm.ToString();
mid.DockedToChartArea = nm.ToString();
mid.Text = dr["Machine_Id"].ToString();;
Chart1.Titles.Add(mid);
System.Web.UI.DataVisualization.Charting.Title mcn_nm = new System.Web.UI.DataVisualization.Charting.Title();
mcn_nm.Name = nm.ToString() + "Mnm";
mcn_nm.Text = dr["Macine_Name"].ToString();
if (dr["Status"].Equals("Stopped"))
{
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.FromArgb(253, 135, 125);
Chart1.ChartAreas[nm].Area3DStyle.Enable3D = true;
Chart1.Series[nm].ChartType = SeriesChartType.Pyramid;
}
else if (dr["Status"].Equals("Running"))
{
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.FromArgb(196, 248, 167);
Chart1.ChartAreas[nm].Area3DStyle.Enable3D = true;
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.White;
Chart1.Series[nm].ChartType = SeriesChartType.Pie;
}
else if (dr["Status"].Equals("Under Setting"))
{
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.FromArgb(252, 199, 208);
Chart1.ChartAreas[nm].Area3DStyle.Enable3D = true;
Chart1.Series[nm].ChartType = SeriesChartType.FastPoint;
}
if (dr["Status"].Equals("Ok"))
{
Chart1.ChartAreas[nm].BackColor = System.Drawing.Color.FromArgb(255, 255, 192);
Chart1.ChartAreas[nm].Area3DStyle.Enable3D = true;
Chart1.Series[nm].ChartType = SeriesChartType.Doughnut;
}