Page 1 of 1

how to add Domain Markers on X-axis (Day axis)?

Posted: Mon Jul 03, 2006 5:00 pm
by ahlvarun
hi
i am trying to add marker on domain axis i.e. x-axis , which is of type day in my case.

-- my snippet of code in chart processor--

XYPlot plot = (XYPlot) jfc.getPlot();
Day day = new Day(11,02,2006);
Marker m3 = new ValueMarker(day.getSerialIndex());
plot.addDomainMarker(m3);

But this does not give any marker on my chart.
Is there any marker where i can give day as input rather than a double??
Any clue??

Varun Ahluwalia.

Posted: Mon Jul 03, 2006 5:35 pm
by david.gilbert
The getSerialIndex() method in the Day class returns an integer that is almost the same as the value used to represent dates in spreadsheets like Excel and Lotus 1-2-3.

The ValueMarker constructor expects a value which, for a DateAxis, should be specified in milliseconds since 1-Jan-1970 (like java.util.Date).

So that is the problem...you are not creating your ValueMarker with the correct value.

Posted: Fri Jul 07, 2006 10:19 pm
by skunk
Have you tried this?

Code: Select all

(double)DateUtilities.createDate(2006, 2, 11).getTime();