Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 1621

Summary: Gantt series fails to bind to a List<T> as DataSource
Product: .NET TeeChart Reporter: christopher ireland <chris>
Component: SeriesAssignee: Steema Issue Manager <issuemanager>
Status: RESOLVED FIXED    
Severity: normal    
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description christopher ireland 2016-09-06 12:29:11 EDT
Code to reproduce:

  public class GanttData
  {
    public DateTime Start { get; set; }
    public DateTime End { get; set; }
    public double Y { get; set; }
    public string Label { get; set; }
    public Color Color { get; set; }
  }

    private void InitializeChart()
    {
      List<GanttData> lstData = new List<GanttData>();

      GanttData data1;
      DateTime today = DateTime.Today;
      DateTime tmp;

      data1 = new GanttData();
      data1.Color = Color.Red;
      data1.Start = today;
      tmp = today.AddDays(3);
      data1.End = tmp;
      data1.Label = "Un";
      data1.Y = 1;
      lstData.Add(data1);

      data1 = new GanttData();
      data1.Color = Color.Green;
      tmp = today.AddDays(1);
      data1.Start = tmp;
      tmp = tmp.AddDays(1);
      data1.End = tmp;
      data1.Label = "Deux";
      data1.Y = 2;
      lstData.Add(data1);

      tChart1.Aspect.View3D = false;
      tChart1.Header.Text = "Gantt MultipleNextTasks";
      tChart1.Legend.Visible = false;

      Gantt gantt = new Gantt(tChart1.Chart);
      gantt.ConnectingPen.Visible = false;
      gantt.LabelMember = "Label";
      gantt.ColorMember = "Color";
      gantt.StartValues.DataMember = "Start";
      gantt.EndValues.DataMember = "End";
      gantt.YValues.DataMember = "Y";
      gantt.DataSource = lstData;
    }