Hi,
Is it possible to combine a Gantt Chart and a Line Chart? I want to have a set of data that will be displayed in the Gantt and another set of data in the Line.
I'm just trying to put together a sample data set where this can be displayed. I want to do this programmatically from scratch.
Thanks,
Andez
Thanks. But I started that new thread and got my answers.
Thanks again.
no, but it looks like you got an answer here: https://ko.infragistics.com/community/forums/f/ultimate-ui-for-windows-forms/42797/multiple-y-axis-for-a-gantt-chart-drawn-in-a-composite-chart/237924#237924
do you still need a response?
Is this thread closed?
I am working on a similar issue. I want to display two charts vertically having different Y Axis but sharing the same X- Axis. I have been able to divide the whole chart into 2 chart separate charts by making it a composite chart. The bottom one is a line chart and the top one needs to be a Gantt chart.
I can display a line or a column chart on top but some how can't display the Gantt chart. I am sure the GantDataSource I am using is correct as it works on a separate individual chart properly. But when I try to add the same in a composite chart it shows an empty Gantt Chart but a proper line chart.
Here is my code
this.graph.ChartType = ChartType.Composite; // main chart
// For the Line Chart
ChartArea LineArea = new ChartArea();
LineArea.Border.CornerRadius = 33;
LineArea.Border.Raised = true;
LineArea.Bounds = new Rectangle(1, 55, 98, 25);
LineArea.BoundsMeasureType = Infragistics.UltraChart.Shared.Styles.MeasureType.Percentage;
LineArea.Key = "Bottom Area";
// For the Gantt Chart
ChartArea GanttArea = new ChartArea();
GanttArea.Border.CornerRadius = 33;
GanttArea.Border.Raised = true;
GanttArea.Bounds = new Rectangle(1, 2, 98, 50);
GanttArea.BoundsMeasureType = Infragistics.UltraChart.Shared.Styles.MeasureType.Percentage;
GanttArea.Key = "Top Area";
this.graph.CompositeChart.ChartAreas.Add(GanttArea);
//Create Axis Item
AxisItem axisX = new AxisItem();
axisX.OrientationType = AxisNumber.X_Axis;
axisX.DataType = AxisDataType.String;
axisX.SetLabelAxisType = SetLabelAxisType.GroupBySeries;
axisX.Labels.ItemFormatString = "<ITEM_LABEL>";
axisX.Labels.Orientation = TextOrientation.VerticalLeftFacing;
AxisItem axisY = new AxisItem();
axisY.OrientationType = AxisNumber.Y_Axis;
axisY.DataType = AxisDataType.Numeric;
axisY.Labels.ItemFormatString = "<DATA_VALUE:0.#>";
GanttArea.Axes.Add(axisX);
GanttArea.Axes.Add(axisY);
NumericSeries seriesA = new NumericSeries();
seriesA.Data.DataSource = dao.GetGanttDataTable();
seriesA.DataBind();
this.graph.CompositeChart.Series.Add(seriesA);
ChartLayerAppearance myGanttLayer = new ChartLayerAppearance();
myGanttLayer .ChartType = ChartType.GanttChart;
myGanttLayer .ChartArea = GanttArea;
myGanttLayer .AxisX = axisX;
myGanttLayer .AxisY = axisY;
myGanttLayer .Series.Add(seriesA);
this.graph.CompositeChart.ChartLayers.Add(myGanttLayer );
There is something going wrong in me binding the data or specifying the access. If I have to reproduce a Gantt Chart only then all I did was
this.GanttGraph.Data.DataSource = dao.GetGanttDataTable();
this.GanttGraph.DataBind();
GanttGraph.GanttChart.ShowOwners = true;
GanttGraph.Axis.X.Visible = false;
Here is a sample of the GantDataSource
GanttDataSource gantt_data = new GanttDataSource();
GanttSeries seriesA = gantt_data.Series.Add("");
GanttItem task1 = seriesA.Items.Add("");
task1.Times.Add(DateTime.Parse("04/04/2010 12:00 PM"), DateTime.Parse("05/04/2010 12:00 PM"));
task1.Times.Add(DateTime.Parse("05/10/2010 12:00 PM"), DateTime.Parse("06/04/2010 12:00 PM"));
task1.Times[0].PercentComplete = 100;
task1.Times[0].Owner = "Ketaki";
task1.Times[1].Owner = "Ketaki";
Thanks in advnace.
Ketaki
yes, they can share an x axis.
you are very close, all you have to do now is set cla2.AxisY = axisY2_1. you don't need to set the AxisY2 property for a line chart layer.