I try to create a gantt chart, which shoud show connected tasks.
It works fine except the connecting lines. They are not being shown.
Could you please help me.
Code: Select all
//tChart1.Series.Clear();
tChart1.Legend.Visible = false;
DataTable table = new DataTable();
table.Columns.Add("Label", typeof(string));
table.Columns.Add("Y", typeof(double));
table.Columns.Add("Start", typeof(DateTime));
table.Columns.Add("End", typeof(DateTime));
table.Columns.Add("NextTask", typeof(int));
for (int i = 0; i < 5; i++)
{
DataRow dRow = table.NewRow();
dRow["Label"] = i.ToString();
dRow["Y"] = i;
if (i != 4)
dRow["NextTask"] = i+1;
else
dRow["NextTask"] = -1;
dRow["Start"] = DateTime.Now.AddDays(i*2);
dRow["End"] = DateTime.Now.AddDays(i*2 + 1);
table.Rows.Add(dRow);
}
Gantt gannt = new Gantt();
gannt.Pointer.Brush.Color = System.Drawing.Color.Red;
//gannt.ColorEach = false;
gannt.DataSource = table;
gannt.EndValues.DataMember = "End";
gannt.EndValues.DateTime = true;
gannt.LabelMember = "Label";
gannt.StartValues.DataMember = "Start";
gannt.StartValues.DateTime = true;
gannt.XValues.DataMember = "Start";
gannt.XValues.DateTime = true;
gannt.YValues.DataMember = "Y";
gannt.NextTasks.DataMember = "NextTask";
tChart1.Series.Add(gannt);
gannt.LinePen.Visible = true;
gannt.LinePen.Width = 2;
gannt.CheckDataSource();
[/code]