Jump to content
Software FX Community

Chart fx 7 for webforms - Chart to be displayed with horizontal bar with date on x axis and number on y axis


NDalal
 Share

Recommended Posts

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 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...