Hi,David
The DateUnit has no effect in HorizontalDateAxis(eg horizontalDateAxis.setTickUnit(new DateUnit(2,2)) .
And sometimes it will throw exception below when not set the max and min date of the HorizontalDateAxis correctly.
sun.dc.pr.PRException: endPath: bad path
at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
at sun.java2d.pipe.DuctusShapeRenderer.draw(DuctusShapeRenderer.java:45)
at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2162)
at com.jrefinery.chart.StandardXYItemRenderer.drawItem(StandardXYItemRenderer.java:165)
at com.jrefinery.chart.XYPlot.draw(XYPlot.java:375)
at com.jrefinery.chart.JFreeChart.draw(JFreeChart.java:627)
at com.jrefinery.chart.JFreeChart.createBufferedImage(JFreeChart.java:642)
at com.jrefinery.chart.ChartUtilities.writeChartAsPNG(ChartUtilities.java:62)
at com.jrefinery.chart.ChartUtilities.saveChartAsPNG(ChartUtilities.java:81)
at com.jrefinery.chart.Test.createTimeChart(Test.java:474)
at com.jrefinery.chart.Test.main(Test.java:535)
sun.dc.pr.PRException: endPath: bad path
at sun.dc.pr.Rasterizer.endPath(Rasterizer.java:537)
at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(DuctusRenderer.java:374)
at sun.java2d.pipe.DuctusShapeRenderer.renderPath(DuctusShapeRenderer.java:57)
at sun.java2d.pipe.DuctusShapeRenderer.draw(DuctusShapeRenderer.java:45)
at sun.java2d.SunGraphics2D.draw(SunGraphics2D.java:2162)
at com.jrefinery.chart.StandardXYItemRenderer.drawItem(StandardXYItemRenderer.java:165)
at com.jrefinery.chart.XYPlot.draw(XYPlot.java:375)
.....................
.....................
DateUnit no effect in DateAxis
Re: DateUnit no effect in DateAxis
Hi,David
The following three
public final static int WEEK_OF_YEAR = 3;
public final static int WEEK_OF_MONTH = 4;
public final static int HOUR = 10;
of java.util.calendar can not be used in the new com.jrefinery.chart.DateUnit(int field,int count) as field.Maybe it's the reason of the above problem.
I have not try the value equal 0,6,7,8 of the field.
Regards,
The following three
public final static int WEEK_OF_YEAR = 3;
public final static int WEEK_OF_MONTH = 4;
public final static int HOUR = 10;
of java.util.calendar can not be used in the new com.jrefinery.chart.DateUnit(int field,int count) as field.Maybe it's the reason of the above problem.
I have not try the value equal 0,6,7,8 of the field.
Regards,
Re: DateUnit no effect in DateAxis
Thanks for the report.
I've entered this into the bug database on SourceForge (number 528885) so I don't lose track of it.
Regards,
DG.
I've entered this into the bug database on SourceForge (number 528885) so I don't lose track of it.
Regards,
DG.
Re: DateUnit no effect in DateAxis
I took a look at this, and...
There are 17 constants for the fields in java.util.Calendar, the ones that I would expect to work in the DateUnit class are:
Calendar.YEAR (=1)
Calendar.MONTH (=2)
Calendar.DATE or Calendar.DAY_OF_MONTH (=5)
Calendar.HOUR_OF_DAY (=11)
Calendar.MINUTE (=12)
Calendar.SECOND (=13)
Calendar.MILLISECOND (=14)
I'll update the Javadocs to reflect this. Let me know if any of the above values cause problems.
I plan to change the auto tick selection code for the DateAxis soon, and when I do that I will probably change this code to work with TimePeriod subclasses rather than java.util.Calendar.
Regards,
DG.
There are 17 constants for the fields in java.util.Calendar, the ones that I would expect to work in the DateUnit class are:
Calendar.YEAR (=1)
Calendar.MONTH (=2)
Calendar.DATE or Calendar.DAY_OF_MONTH (=5)
Calendar.HOUR_OF_DAY (=11)
Calendar.MINUTE (=12)
Calendar.SECOND (=13)
Calendar.MILLISECOND (=14)
I'll update the Javadocs to reflect this. Let me know if any of the above values cause problems.
I plan to change the auto tick selection code for the DateAxis soon, and when I do that I will probably change this code to work with TimePeriod subclasses rather than java.util.Calendar.
Regards,
DG.
Re: DateUnit no effect in DateAxis
Hi,David
I use the same constants of Calendar as yours in my project,and I use field=5 count=7 to substitute for one week.All of them work well.
Regards,
I use the same constants of Calendar as yours in my project,and I use field=5 count=7 to substitute for one week.All of them work well.
Regards,