Hi, is infragistics chart library able to draw chart like the one in the attached file? Thanks.
It looks like you alrady have a GanttChart. If it's a different GanttChart, you can use Infragistics GanttChart for that.
Hi, can you give some sample code to generate above chart?
The following link of our online documentation contains code snippets with details on how to create a chart. It provides edequate informatin to create a chart.
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Working_with_Gantt_Chart_Data.html
Let me know if you have any questions.
Hi, sorry for the late reply. But the type of Gantt chart I'm looking for is not standard kind of Gantt chart. The chart showed in the link is very different from the one I attached.
Our GanttChart may not look exactly the same as other charts; however; the top three rows in your image can be achieved from the following code snippet. I am not sure what the dots are on the last (4th) row, but that can be customized as well.
GanttSeries series1 = null; GanttSeries series2 = null;
private void Form1_Load(object sender, EventArgs e) { this.ultraChart1.ChartType = Infragistics.UltraChart.Shared.Styles.ChartType.GanttChart;
ultraChart1.GanttChart.Columns.SeriesLabelsColumnIndex = 0; ultraChart1.GanttChart.Columns.ItemLabelsColumnIndex = 1; // Start time of the planned task ultraChart1.GanttChart.Columns.StartTimeColumnIndex = 2; // End time of the planned task ultraChart1.GanttChart.Columns.EndTimeColumnIndex = 3; ultraChart1.GanttChart.Columns.IDColumnIndex = 4; // Link a task to another task using column index ultraChart1.GanttChart.Columns.LinkToColumnIndex = 5; ultraChart1.GanttChart.Columns.PercentCompleteColumnIndex = 6; ultraChart1.GanttChart.Columns.OwnerColumnIndex = 7;
GanttDataSource ganttDataSource = new GanttDataSource();
series1 = GetSeries1(); ganttDataSource.Series.Add(series1);
series2 = GetSeries2(); ganttDataSource.Series.Add(series2);
this.ultraChart1.DataSource = ganttDataSource; this.ultraChart1.Data.DataBind(); }
public GanttSeries GetSeries1() { GanttSeries series1 = new GanttSeries("Series 1"); GanttItem goal1 = series1.Items.Add("Goal 1"); goal1.Times.Add(DateTime.Parse("04/11/2006 11:00 PM"), DateTime.Parse("04/15/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("04/16/2006 11:00 PM"), DateTime.Parse("04/18/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("04/18/2006 11:00 PM"), DateTime.Parse("04/21/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("04/21/2006 11:00 PM"), DateTime.Parse("04/25/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("04/27/2006 11:00 PM"), DateTime.Parse("04/30/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("04/30/2006 11:00 PM"), DateTime.Parse("05/03/2006 08:00 PM")); goal1.Times.Add(DateTime.Parse("05/04/2006 11:00 PM"), DateTime.Parse("05/07/2006 08:00 PM")); return series1; }
public GanttSeries GetSeries2() { GanttSeries series2 = new GanttSeries("Series 2"); GanttItem goal2 = series1.Items.Add("Goal 2"); goal2.Times.Add(DateTime.Parse("04/11/2006 11:00 PM"), DateTime.Parse("04/12/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/13/2006 11:00 PM"), DateTime.Parse("04/15/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/15/2006 11:00 PM"), DateTime.Parse("04/18/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/19/2006 11:00 PM"), DateTime.Parse("04/20/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/21/2006 11:00 PM"), DateTime.Parse("04/25/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/25/2006 11:00 PM"), DateTime.Parse("04/27/2006 08:00 PM")); goal2.Times.Add(DateTime.Parse("04/28/2006 11:00 PM"), DateTime.Parse("05/02/2006 08:00 PM")); return series2; }
Hi Sam,
Thanks for the reply. That's pretty much what I need. I played around with the Gantt chart, and still have some doubts. Please help.
1> Zoom Feature: is the "Zoom By Area" (use left mouse to select zoom area) feature available already? I'm using 2008 vol 3.
2> Sometimes when there are too many Gantt/bar items, is it possible to control which Gantt items to display? i.e. to create a kind of mult-page effect.
3> I tried to use a custom control as tooltip by making use of ChartDataClick event. The problem of this implementation is that I don't know the mouse location. I tried to use MouseClick event to location but it seems that this event comes after ChartDataClick event. Is there any solution for this?
Thank you very much.
For the question 1) zooming, you can use scrollScale on X/Y axis.
this.ultraChart1.Axis.X.ScrollScale.Visible = true;
For the question 2) I am not sure what you mean by multi-page effect for Gantt/Bar items. I would need a little more information on that.
For the question 3) You can try MouseDown event for the clicked location depending on what you are trying to achive.