Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all, does anyone know how can I create different charts with different datatables inside dataset? Let's say I have 3 datatables inside dataset, I want to create 3 charts out with 1 chart=1datatable data. I tried different ways but could not get it work..

This is what I have done so far for my codes:
HTML
Chart Chart2 = new Chart();
                    Chart2.DataSource = ds;
                    Chart2.Width = 600;
                    Chart2.Height = 350;

                    Chart2.Series.Add(new Series());
                    Chart2.Series[0].ChartType = SeriesChartType.BoxPlot;
                    foreach (DataTable dt in ds.Tables)
                    {
                        List<object> lst2 = dt.AsEnumerable().ToList<object>();

                        foreach (DataRow row in dt.Rows)
                            Chart2.Series[0].Points.AddXY(row["DEPARTMENT"], new object[] { row["MAX"], row["MIN"], row["AVG"], row["PERCENTILE25"], row["PERCENTILE50"], row["PERCENTILE75"] });
                    }

                    Chart2.Series[0].Color = Color.White;
                    Chart2.Series[0].BorderColor = Color.MidnightBlue;
                    Chart2.Series[0].ChartType = SeriesChartType.BoxPlot;

                    //if (dt.Rows.Count > 0)
                    //{
                    //    string title2 = (tg2.Rows[0]["TITLE"].ToString());
                    //    Chart2.Titles.Add(title2);
                    //}
                    //create chartareas
                    ChartArea ca2 = new ChartArea();
                    //ca.Name = "ChartArea3";
                    ca2.AxisX = new Axis();
                    ca2.AxisY = new Axis();
                    Chart2.ChartAreas.Add(ca2);

                    //databind
                    Chart2.DataBind();
                    Chart2.Visible = true;

                    AjaxControlToolkit.TabPanel panel = new AjaxControlToolkit.TabPanel();
                    panel.HeaderText += item.Text;
                    container.Tabs.Add(panel);
                    //panel.Controls.Add(tabContent);
                    panel.Controls.Add(Chart2);


After creating the charts, I would like to add them to the tab panel.

Appreciate if someone can provide me guidance on this for me to continue. Thanks a lot!!
Posted

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900