Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
95
Gantt Chart PE's Not Being Applied
posted

I have a Gantt chart that I am adding items to via looping through a dataset. Everything is going smoothly except that I need each GanttTimeEntry to have its own specific color assigned to it. I did this in the designer by assigning the color and stroke in the PE properties of each entry. The excerpt below outlines how I am trying to do the same thing but in the code behind. However, the PE properties are not being applied and whenever I load the chart. It appears a random color is being applied to each GanttItem because when I refresh, each item has a new color.

Any ideas as to where I am going wrong? Is there a property in the Series/ChartArea/Layer that I need to toggle?

GanttSeries series = new GanttSeries();
series.Label =
"GanttSeries";

GanttItem gi = new GanttItem("GanttItem1");

GanttTimeEntry gte1 = new GanttTimeEntry(Convert.ToDateTime("00:00:00"), Convert.ToDateTime("23:59:59"));
gte1.PE.Fill =
Color.Red;
gte1.PE.Stroke =
Color.Red;
gte1.PE.StrokeWidth = 1;

gi.Times.Add(gte1);
series.Items.Add(gi);

 

Parents
No Data
Reply
  • 95
    Verified Answer
    posted

    Problem solved, I forgot to establish the ElementType. Issue was fixed using the line below:

    gte1.PE.ElementType = PaintElementType.SolidFill;

     

     

Children
No Data