Hi to all, I want to display custom time intervals along X axis according to tasks in gantt chart. I know giving range for whole X axis. Here is only sample about this.
testChart.Axis.X.RangeType = AxisRangeType.Custom; testChart.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval;testChart.Axis.X.TickmarkIntervalType = AxisIntervalType.Months; testChart.Axis.X.TickmarkInterval = 1;testChart.Axis.X.RangeMin = DateTime.Now.Ticks; testChart.Axis.X.RangeMax = DateTime.Now.AddDays(180).Ticks;
testChart.Axis.X.TickmarkStyle = AxisTickStyle.DataInterval;
testChart.Axis.X.TickmarkInterval = 1;
testChart.Axis.X.RangeMax = DateTime.Now.AddDays(180).Ticks;
BUT , I don't want to do this. I want to show time interval for each task. I'm sending what i want to do.
The main question is showing the START - END date per task. (for every task) START- END date have not definite format such as week, month, quarter or year. Every task has custom START - END dates.
Thanks for your help.
While there's no out-of-the-box way to accomplish this, you can use FillSceneGraph event to draw custom labels and lines on the chart. Here's a quick sample:
Line endLine = new Line(new Point(b.rect.Right, b.rect.Bottom), new Point(b.rect.Right, (int)yAxis.MapMinimum), new LineStyle(LineCapStyle.NoAnchor, LineCapStyle.NoAnchor, LineDrawStyle.Dash)); endLine.PE.Stroke = Color.Magenta; labels.Add(endLine); Text endLabel = new Text(); endLabel.SetTextString(dates[1].ToShortDateString()); endLabel.SetLabelStyle(labelStyle); labelSize = Platform.GetStringSizePixels(endLabel.GetTextString(), labelStyle.Font); endLabel.bounds = new Rectangle(b.rect.Right, (int)yAxis.MapMinimum, (int)labelSize.Height, (int)labelSize.Width); labels.Add(endLabel); } } }
foreach (Primitive p in labels) { e.SceneGraph.Add(p); }}
Hi Max, thanks for your helpful advice & interest. It is so useful. and really thing that I want.
also I found another thing that can be used.
ultraChart1.Axis.X.TimeAxisStyle.TimeAxisStyle =
RulerGenre.Discrete;
Again thanks Max. Good works !!