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
90
Showing the current date on a gantt chart
posted

Is it possible to hilight the current date on a gantt chart by placing a vertical bar there?  It seems like that would be a common feature, but I can't seem to find a way to reliably do it.  Thanks

Parents
No Data
Reply
  • 26458
    Verified Answer
    Offline posted

    This can only be done by using a custom layer or by handling FillSceneGraph event (if you use version 7.3)

    Here's the FillSceneGraph version:

    void chart_FillSceneGraph(object sender, Infragistics.UltraChart.Shared.Events.FillSceneGraphEventArgs e)
    {
       IAdvanceAxis xAxis = (IAdvanceAxis)e.Grid["X"];
       IAdvanceAxis yAxis = (IAdvanceAxis)e.Grid["Y"];
       int x = Convert.ToInt32(xAxis.Map(DateTime.Now));
       int y1 = Convert.ToInt32(yAxis.MapMinimum);
       int y2 = Convert.ToInt32(yAxis.MapMaximum);

       Line l = new Line();
       l.p1 =
    new Point(x, y1);
       l.p2 =
    new Point(x, y2);
       l.PE.Fill =
    Color.Red;
       l.PE.StrokeWidth = 3;

       e.SceneGraph.Add(l);
    }

Children