Hi,
I have a few questions regarding the UltraChart as a GanttChart.
1. I want to display a GanttChart with multiple Series. My problem here is that the chart automatically fits to it's container and if I include mutliple series the items are too small. I don't want to have a scrollbar in the chart itself but I want the scrollbar in it's container panel. I don't want to set a fixed height of the UltraChart in code. So is it possible to prevent the Chart from fitting to it's Container automatically? Maybe it is possible to set a fixed item height etc.?
2. If I set the SeriesSpacing > 0 the GridLines are drawn though the spacing area. Is there a possibility to disable that behaviour?
3. Is it possible to show a boder line around one series? Or to set it's background color? I want to emphasize the start and end of each series in the chart.
Thanks in advance for your help.
Regards,
Jo
Hello Jo,
Thank you for your response.
JoJo said: 1. I want to display a GanttChart with multiple Series. My problem here is that the chart automatically fits to it's container and if I include mutliple series the items are too small. I don't want to have a scrollbar in the chart itself but I want the scrollbar in it's container panel. I don't want to set a fixed height of the UltraChart in code. So is it possible to prevent the Chart from fitting to it's Container automatically? Maybe it is possible to set a fixed item height etc.?
You can do this by setting the container's AutoScroll property to true and then manually setting the size of the chart to be larger than the container. I would also recommend setting the location of the chart to the extreme upper-left corner of the container.
Please note that the chart axes will move out of view when you scroll using this method.
JoJo said: 2. If I set the SeriesSpacing > 0 the GridLines are drawn though the spacing area. Is there a possibility to disable that behaviour?
If you're referring to the vertical lines, there is currently no way to do this.
JoJo said: 3. Is it possible to show a boder line around one series? Or to set it's background color? I want to emphasize the start and end of each series in the chart.
You can most likely achieve this using the chart's FillSceneGraph event.
Please let me know if you have any other questions about this.
Hi Dave,
thanks for your fast reply.
Thank you for your answers. Maybe it would be a nice feature if it would be possible to set the height of the GanttItems/GanttSeries as it is possible using other chart types.
Dave said:You can most likely achieve this using the chart's FillSceneGraph event.
Can you give me a hint how I can acess the series itself using the FillSceneGraph event? I tried to modify the line of code below (which I use to get all TimeElements located in the chart) to find the series primitive but I don't get it.
var boxes=e.SceneGraph.OfType<Infragistics.UltraChart.Core.Primitives.Box>().Where(b => b.Row != -1 && b.Column != -1)
Regards, Trin4ty
Hello Trin4ty,
I was able to get something similar to what I believe you're looking for using the code below.
if (e.SceneGraph.Count > 3) // FillSceneGraph is fired twice. We need to make sure all the primitives exist. { var boxes = from Primitive primitive in e.SceneGraph where primitive is Box && primitive.DataPoint != null && primitive.Series.Key == "Implement" select primitive; int x = 50000; int y = 50000; int maxX = 0; int maxY = 0; foreach (Box box in boxes) { if (box.rect.X < x) { x = box.rect.X; } if (box.rect.Right > maxX) { maxX = box.rect.Right; } if (box.rect.Y < y) { y = box.rect.Y; } if (box.rect.Bottom > maxY) { maxY = box.rect.Bottom; } } int width = maxX - x; int height = maxY - y; var seriesBox = new Box(new Rectangle(x, y, width, height)); seriesBox.PE.Stroke = Color.Red; seriesBox.PE.StrokeWidth = 3; seriesBox.PE.Fill = Color.Transparent; e.SceneGraph.Add(seriesBox); }
thanks for your Response.
I tried and modified your solution and it works fine! First, the primitives are scrolled out of the chart area but then I figured out that I had to add the clipbounds for the primitives to prevent them from scrolling out and now int works.
Thanks for your helpful solutions and replies!
Please let me know if I may be of further assistance.