GanttControl.ChartMappings Property
Provides access to settings specified based on data source field names: task captions, task start and finish dates, task progress, etc.
Namespace: DevExpress.XtraGantt
Assembly: DevExpress.XtraGantt.v19.2.dll
Declaration
[XtraSerializableProperty(XtraSerializationVisibility.Content, XtraSerializationFlags.DefaultValue)]
public GanttChartMappings ChartMappings { get; }
Property Value
Type | Description |
---|---|
GanttChartMappings | A GanttChartMappings object that contains mappings between data source fields and task properties. |
Example
The code below shows how to initialize tree list and chart mappings.
GanttControl ganttControl = new GanttControl();
ganttControl.TreeListMappings.KeyFieldName = "Id";
ganttControl.TreeListMappings.ParentFieldName = "ParentId";
ganttControl.ChartMappings.TextFieldName = "Name";
ganttControl.ChartMappings.StartDateFieldName = "StartTime";
ganttControl.ChartMappings.FinishDateFieldName = "EndTime";
ganttControl.ChartMappings.ProgressFieldName = "Progress";
ganttControl.ChartMappings.PredecessorsFieldName = "PredecessorIDs";
ganttControl.DataSource = Task.GetData();
public class Task {
public int Id { get; set; }
public int ParentId { get; set; }
//
public string Name { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public TimeSpan Duration { get; set; }
public double Progress { get; set; }
//
public IReadOnlyList<int> PredecessorIDs {
get; private set;
}
}
Note
Run the Gantt Code Examples demo to see the complete example.
See Also