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
1790
Gantt chart imposed with the current date line
posted

Usually, when a chart is viewed, the current date is highlighted with a super imposed date line in a different color so as to highlight the current date in relevance to the date range.  I need to have a bolded or colored date line which indicates the current date in the chart.  I cannot find anything on this.  Could you please advise?

Parents Reply Children
  • 10685
    Offline posted in reply to Natalie

    Hello nbizub,

    Thank you for posting in our community and for the attachments!

    I believe this functionality is still not implemented out of the box for the Infragistics ASP.NET Gantt chart, and yet it could be achieved using a custom handling of the FillSceneGraph event. Here is a code snippet:

    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);
    }

    Please let me know how this approach works for you!