NDalal Posted February 21, 2012 Report Share Posted February 21, 2012 Hello, I have a requirement where i need to display a horizontal chart with date to be displayed on y axis and number on x axis. With the chart2.data.x[int, int] i am not able to display the chart as required as both the param's are needed as int. Any help will be appreciated. Attached is the graph in excel as i need to display. Below is the code i have written but unable to map the datatable columns to the x axis and y axis of the chart. DataTable dttemp = new DataTable();<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> DataColumn dcCat = new DataColumn("Gates", Type.GetType("System.String")); dttemp.Columns.Add(dcCat); DataColumn dc = new DataColumn("Date", Type.GetType("System.DateTime")); dttemp.Columns.Add(dc); DataRow destRow = dttemp.NewRow(); destRow["Gates"] = "New"; destRow["Date"] = "1/30/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "0"; destRow["Date"] = "2/12/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "1"; destRow["Date"] = "3/15/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "2"; destRow["Date"] = "4/30/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "3"; destRow["Date"] = "5/15/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "4"; destRow["Date"] = "6/10/2012"; dttemp.Rows.Add(destRow); destRow = dttemp.NewRow(); destRow["Gates"] = "5"; destRow["Date"] = "7/17/2012"; dttemp.Rows.Add(destRow); Chart2.Gallery = Gallery.Bar; Chart2.AllSeries.Horizontal = true; Chart2.DataSource = dttemp; Thanks, ND Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.