This is a migrated thread and some comments may be shown as answers.

Help using the Telerik chart control

1 Answer 66 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 16 Jan 2012, 09:10 PM
Hi, I'm using the Telerik chart control to create a Gantt chart. I have managed to produce something close to what I need using sample code I found on these forums, but I have a couple questions.

I need milestones and tasks to be on separate lines, like they are in a Microsoft Project Gantt chart. I have one series for milestones and one for tasks, so that I can the milestones to show up as symbols, and the tasks to show up as bars. However, in order to have this work properly, I needed to do a workaround where my datasource is a list of all milestones and tasks combined into 1 table, and if the start date and end date are the same, I assume that it is a milestone. Is this the correct way to accomplish this? It does not seem correct to me, because I have to create a "fake" column in the database to hold Milestone information, just so that symbols are drawn only on the correct lines. Here is my code that creates the data table. I then bind my chart to this data table.

DataTable table = new DataTable();
table.Columns.Add("Name", typeof(string));
table.Columns.Add("From", typeof(double));
table.Columns.Add("Milestone", typeof(double));
table.Columns.Add("To", typeof(double));
  
for (int i = 0; i < names.Count; i++)
{
    DataRow row = table.NewRow();
    row["Name"] = names[i];
    row["From"] = startDates[i].ToOADate();
    row["To"] = endDates[i].ToOADate();
    if (startDates[i] == endDates[i])
        row["Milestone"] = startDates[i].ToOADate();
    table.Rows.Add(row);
}
  
return table;

Also, is there a way that I can draw dependency lines between tasks, to show if a task is dependent upon other tasks? Thank you.

1 Answer, 1 is accepted

Sort by
0
Hadib Ahmabi
Top achievements
Rank 1
answered on 17 Jan 2012, 02:52 PM
If it works, it isn't wrong.
About the second question, I haven't seen anything like this.
Tags
General Discussions
Asked by
Robert
Top achievements
Rank 1
Answers by
Hadib Ahmabi
Top achievements
Rank 1
Share this question
or