Hi,
We are using Infra version 6.3. We use GanttChart to display Day\Week\Month wise tasks with in a ASP.Net page.
Problem: Tasks within the chart is not exactly aligned to the corresponding Start and End days (in X2 axis). Tasks are overlapping the Days grid lines and sometimes tasks stop before reaching the End date Grid line.Also last grid line is not drawn.
Steps to reproduce the issue: 1. Create a DB table as required for Gantt Chart2. Drag a Ultra chart to the design and paste the below source in Code behind page to set the properties of the Chart Control.
Please look into the below Source and help me out of this issue.
Thanks,Anandhev
-------------------------------------------------------------------------------------- ----------
private void SetProperties()
{
UltraChart1.ChartType = ChartType.GanttChart;
//-- Show X2 axis and hide X axisUltraChart1.Axis.X.Visible = false;UltraChart1.Axis.X2.Visible = true;
//-- Show the Percentage of completion in ChartUltraChart1.GanttChart.ShowCompletePercentages = true;UltraChart1.Axis.Y.Extent = 130;UltraChart1.Axis.X.Extent = 110;
//-- Hide the Series label in Y axis UltraChart1.Axis.Y.Labels.SeriesLabels.Visible = false;
//-- Percentage of Completion ColorUltraChart1.GanttChart.CompletePercentagesPE.Fill = Color.Green;UltraChart1.GanttChart.CompletePercentagesPE.StrokeOpacity = 0;
UltraChart1.GanttChart.EmptyPercentagesPE.Fill = Color.Transparent; UltraChart1.GanttChart.EmptyPercentagesPE.StrokeOpacity = 0;
//-- Task ColorUltraChart1.Effects.Enabled = false;
//-- No Gradient or any effectsUltraChart1.ColorModel.AlphaLevel = 0;
//-- No ColorModel's Style effectUltraChart1.ColorModel.ModelStyle = ColorModels.CustomSkin;PaintElement pe = new PaintElement();pe.ElementType = PaintElementType.SolidFill;pe.Fill = Color.CornflowerBlue;pe.StrokeOpacity = 255;pe.StrokeWidth = 1;UltraChart1.ColorModel.Skin.PEs.Add(pe);
//-- Remove Grid lines of X2 and Y axisUltraChart1.Axis.X2.MajorGridLines.Visible = false;UltraChart1.Axis.X2.MinorGridLines.Visible = false;UltraChart1.Axis.Y.MajorGridLines.Visible = false;UltraChart1.Axis.Y.MinorGridLines.Visible = false;
//-- X2 axis label formatUltraChart1.Axis.X2.Labels.ItemFormat = AxisItemLabelFormat.Custom;UltraChart1.Axis.X2.Labels.ItemFormatString = "<ITEM_LABEL:ddd, dd-MMM-yy>";
//-- Tooltip formatUltraChart1.Tooltips.Font.Name = "Verdana";UltraChart1.Tooltips.Font.Size = FontUnit.Small;UltraChart1.Tooltips.Format = TooltipStyle.Custom;UltraChart1.Tooltips.FormatString = "<START_TIME:dd-MMM-yy>....<END_TIME:dd-MMM-yy>";
//-- Data Interval Type ==> Days/Weeks/MonthsUltraChart1.Axis.X2.TickmarkStyle = AxisTickStyle.DataInterval;UltraChart1.Axis.X2.TickmarkIntervalType = AxisIntervalType.Days;UltraChart1.Axis.X2.TickmarkInterval = 1;
UltraChart1.Axis.X2.Labels.HorizontalAlign = StringAlignment.Near;UltraChart1.Axis.X2.Labels.VerticalAlign = StringAlignment.Near;UltraChart1.Axis.X2.MajorGridLines.Visible = true;UltraChart1.Axis.X2.MinorGridLines.Visible = true;
UltraChart1.Width = 1500;
}
Unfortunately, GanttChart is aligned to the x-axis. If you want to align to x2-axis, you can try using composite chart.
Hi Teodor Taushanov,
Thanks for the reply.
I have changed the code specific to X axis, even after the last Grid line is not displayed.I could see the grid lines till one day before the last day.But label of the last day is displayed in its correct position only its corresponding Gridline is missing.
As shown below I have split the chart into Day wise interval
UltraChart1.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval;UltraChart1.Axis.X.TickmarkIntervalType = AxisIntervalType.Days;UltraChart1.Axis.X.TickmarkInterval = 1;
Please let me know how to get the last grid line at this point.
The last grid line is not displayed, because it is between 2 intervals. If you want to be sure that it will be showed every time, you can set it custom range with:
this.ultraChart1.Axis.X.RangeType = AxisRangeType.Custom;
this.ultraChart1.Axis.X.RangeMin = new DateTime(2008, 1, 1).Ticks;
this.ultraChart1.Axis.X.RangeMax = new DateTime(2008, 1, 20).Ticks;
You can also take a look at:
http://community.infragistics.com/forums/p/7253/30299.aspx#30299
Thanks for the reference.
Regards,
Anandhev
You can try looking:
http://help.infragistics.com/Help/NetAdvantage/NET/2008.2/CLR2.0/html/Chart_Creating_a_Composite_Chart.html
http://community.infragistics.com/blogs/sung_kim/archive/2008/09/05/chart-university-chart-101-and-some-201-301-401-stuff.aspx
Many Thanks for the timely response.
I have modified your code accordingly, RangeMax = MAX(GanttEndDate) + 1. This draws Gridline for the End date as expected and leaves without drawing for RangeMax - Tricky way :)
Using X axis there are NO overlap between Task and the Gridline, perfectly fits. But my requirement is to get the same in the X2 axis and As you said a note above to use Composite chart to achieve the same in X2 axis within Gantt Chart. It would be great if I get any detailed sample of Composite Chart specifically that should drive me to achieve X2 axis display instead of the current X axis within Gantt chart - [ Striving hard towards requirement :) ]