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.
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.
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.