I want to create a chart control in asp.net3.5 which will bind dynamically from database,
i can add it but,i can not group it(Colunm,StackedColunm)
can anyone help,
Thank in advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
paul danielPosted Mar 8, 2010, 7:37 AM
http://weblogs.asp.net/ssnair/archive/2009/10/20/mschart-dynamic-chartarea-series-legends-etc.aspx
http://www.programminghelp.com/web-development/asp-net/install-and-use-microsoft-chart-controls-to-render-a-graph-from-data-table-in-c/
Sunita TajanpurePosted Mar 5, 2010, 7:10 AM
but im using MS Chart
Like this
Random random = new Random();
String sSeries ="";
Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Plant";
Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = false;
Chart1.ChartAreas["ChartArea1"].AxisX.Maximum = 2;
//Chart1.ChartAreas["ChartArea1"].AxisX.Minimum = 0;
Chart1.ChartAreas["ChartArea1"].AxisX.Interval = 2;
//Chart1.ChartAreas["ChartArea1"].Area3DStyle.PointGapDepth=25;
Chart1.Legends.Add("ChartArea1");
for (int j = 0; j < Chart1.Legends.Count; j++)
{
Chart1.Legends[j].BorderColor = Color.Black;
Chart1.Legends[j].BorderWidth = 1;
Chart1.Legends[j].BorderDashStyle = ChartDashStyle.Solid;
Chart1.Legends[j].ShadowOffset = 1;
Chart1.Legends[j].LegendStyle = LegendStyle.Table;
Chart1.Legends[j].TableStyle = LegendTableStyle.Auto;
Chart1.Legends[j].Docking = Docking.Bottom;
Chart1.Legends[j].Alignment = StringAlignment.Center;
Chart1.Legends[j].Enabled = true;
Chart1.Legends[j].Font = new System.Drawing.Font("Verdana", 8, System.Drawing.FontStyle.Bold);
Chart1.Legends[j].AutoFitMinFontSize = 5;
Chart1.Legends[j].HeaderSeparator = LegendSeparatorStyle.DoubleLine;
Chart1.Legends[j].HeaderSeparatorColor = Color.Gray;
}
//call method to get the dataset
DataSet ds = CreateDataSet();
LegendItem legendItem = new LegendItem();
foreach (DataRow DRRow in ds.Tables[0].Rows)
{
int rowIndex = ds.Tables[0].Rows.IndexOf(DRRow);
DataSet ObjDSCell = CreateCellDataSet(Convert.ToInt32(DRRow["kaizen2Q_plant_id"].ToString()));
foreach (DataRow DRCellRow in ObjDSCell.Tables[0].Rows)
{
if (DRCellRow["kaizen2Q_cell_Name"].ToString() != "")
{
sSeries = DRCellRow["kaizen2Q_cell_Name"].ToString();
if (Chart1.Series.FindByName(DRCellRow["kaizen2Q_cell_Name"].ToString()) == null)
{
Chart1.Series.Add(sSeries);
Chart1.ChartAreas["ChartArea1"].AxisX.IsMarginVisible = false;
Chart1.Series[sSeries].BorderWidth =1;
Chart1.Series[sSeries].ChartType = SeriesChartType.Column;
Chart1.Series[sSeries].IsValueShownAsLabel = true;
Chart1.Series[sSeries].Points.AddY(DRCellRow["Exp1"].ToString());
if (rowIndex == 1)
{
Chart1.Series[sSeries]["StackedGroupName"] = "Group1";
}
else if (rowIndex == 2)
{
Chart1.Series[sSeries]["StackedGroupName"] = "Group2";
}
else if (rowIndex == 3)
{
Chart1.Series[sSeries]["StackedGroupName"] = "Group1";
}
}
}
}
//if (rowIndex == 1)
//{
// break;
//}
}
Chart1.Series[sSeries].IsValueShownAsLabel = true;
i can not get the grouping beteen the series.........
Chart Should Show- kaizen count per cell for a perticuler plant
e.g. for plant id=1 there are 5 cells and cell 1-kaisen count is 100,cell 2 kaizen count is 20 and so on.............
kiran kumarPosted Mar 5, 2010, 6:27 AM
check this link
http://www.aspnettutorials.com/tutorials/controls/chart-compart-aspnet2-csharp.aspx
mark the answer if it helps you