How to show today's line in Gantt chart?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
prasad_ki
Posts: 1
Joined: Wed Jul 02, 2008 11:11 am

How to show today's line in Gantt chart?

Post by prasad_ki » Wed Jul 02, 2008 11:20 am

I am able to display gantt charts (with/without progress) but I want to draw today's line inbetween the graph. How do I do it?

Ex: In MS Project, when you see the gantt chart, you can see axis drawn which represents today's date. By looking at it, you are able to understand the graph more clearly.

Please revert back to me in case of more explanation.

Thanks in advance.

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Wed Jul 02, 2008 7:42 pm

Use the addRangeMarker() method to add a ValueMarker to the plot. The value for the marker should be the milliseconds since 1-Jan-1970 for "right now" (e.g. new java.util.Date().getTimeInMillis()).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

wbrett
Posts: 1
Joined: Mon Jul 09, 2012 1:48 am
antibot: No, of course not.

Re: How to show today's line in Gantt chart?

Post by wbrett » Mon Jul 09, 2012 1:54 am

Dave,
Do you mean use addDomainMarker or have I missed something?
Thanks
Brett

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: How to show today's line in Gantt chart?

Post by John Matthews » Mon Jul 09, 2012 4:32 am

The ChartFactory.createGanttChart() method specifies a CategoryAxis for the domain and a DateAxis for the range, so a range marker seems appropriate. PlotOrientation.HORIZONTAL may be the missing piece.

Code: Select all

 CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, dateAxis, renderer);
 plot.setOrientation(PlotOrientation.HORIZONTAL);

Locked