Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
475
UltraChart Gannt Chart sometimes doesn't draw points time period is too small
posted

Hi,

Is there a way to force a minimum line size so that all GanttTimeEntry are displayed.  Sometimes I am finding that  as we zoom out entries disappear from the chart.   Ideally we would like to specify that a line of 1 pixel thickness is drawn even if the Start/End period is very small.

How can we do this ?

Parents
  • 28496
    Verified Answer
    Offline posted

    You can achieve this by handling the FillSceneGraph event.  In the event handler, find all the Box primitives representing the Gantt Item Time Entries, find only those with a Width of zero, and then add Line primitives to the Scene using the positions of those zero-width boxes.

    private void Ch_FillSceneGraph(object sender, FillSceneGraphEventArgs e)
    {
    IEnumerable<Box> sceneBoxes = e.SceneGraph.OfType<Box>();
    IEnumerable<Box> zeroWidthGanttBoxes = sceneBoxes.Where((box) => box.Chart == ChartType.GanttChart && box.rect.Width == 0);
    IEnumerable<Line> linesToAdd = zeroWidthGanttBoxes.Select((box) => new Line(new Point(box.rect.Left, box.rect.Top), new Point(box.rect.Right, box.rect.Bottom)));
    e.SceneGraph.AddRange(linesToAdd.ToArray());
    }
    By the way, in case you haven't seen it already, Infragistics has a newer Gantt Control which offers a richer user experience:  http://es.infragistics.com/products/windows-forms/charts-gauges/gantt-view
    GanttWithMinWidth.zip
Reply Children
No Data