I'm having real trouble getting labels displayed on a Gantt Chart (WinChart), I have two (or more) times on a Gantt Item each with a different label but I cannot seem to get these labels displayed on the chart (ideally in the middle of the item bar).
eg:
GanttItem gi = new GanttItem("Item 1");
int
iPos = gi.Times.Add(dr.GetDateTime(3), dr.GetDateTime(4)); gi.Times[iPos].ID = 0; gi.Times[iPos].Label =
gi.Times[iPos].ID = 0;
gi.Times[iPos].Label =
"Label " + iPos;
iPos = gi.Times.Add(dr.GetDateTime(3), dr.GetDateTime(4)); gi.Times[iPos].ID = 1; gi.Times[iPos].Label = "Label " + iPos; Should show two bars on the same line on the GanttChart with a label in each bar ("Label 0" in the first, "Label 1" in the second). No label is displayed at all, I've tried to do this with BoxAnnotations but have just ended up with the same annotation on both bars. Any help gratefully received. Cheers Dave
gi.Times[iPos].ID = 1;
gi.Times[iPos].Label = "Label " + iPos;
Should show two bars on the same line on the GanttChart with a label in each bar ("Label 0" in the first, "Label 1" in the second).
No label is displayed at all, I've tried to do this with BoxAnnotations but have just ended up with the same annotation on both bars.
Any help gratefully received.
Cheers
Dave
Hello Dave,
Would you be able to create and attach a sample project that reproduces the issue? You can attach a file on the Options tab when you're typing your post.
Hi
I've recreated it in the attached zip file, basically I want a different label on each of the two bars.
Thanks
Try setting the Owner property of each GanttTimeEntry object instead of the Label property and then set GanttChart.ShowOwners to true.
You might also want to look at the WinGanttView control to see if it suits your needs better.
That did the trick.
Many Thanks