charts in asp.net
Please tell me can I make charts and graphs using values in database and how can I do the same?
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.
Wim SturkenboomPosted Sep 28, 2014, 11:55 AM
Drag a chart control into your form.
In code behind, bind it using something like below
ChartBW.Series.Add("test");
ChartBW.Series["test"].XValueMember = "Timestamp";
ChartBW.Series["test"].YValueMembers = "Bandwidth_kbps";
ChartBW.Series["test"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
ChartBW.Series["test"].Color = System.Drawing.Color.Blue;
ChartBW.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false;
ChartBW.ChartAreas["ChartArea1"].AxisX.LabelStyle.Format = "yyyyMMdd\nHHmm";
ChartBW.ChartAreas["ChartArea1"].AxisX.Title = "Timestamp";
ChartBW.ChartAreas["ChartArea1"].AxisY.Title = "BandWidth (kbps)";
ChartBW.Titles.Add(ddlDecoders.SelectedItem.ToString());
ChartBW.DataSource = tbl;
ChartBW.DataBind();