sorry if my question sounds stupid but i m new to jfreechart....
I m trying to generate a chart with DateTimeAxis :
Object[][][] array = ...
DefaultXYDataset ds = new DefaultXYDataset(array);
ds.setSeriesNames(new String[] {"..."});
DateAxis timeAxis = new HorizontalDateAxis(xAxisLabel);
timeAxis.setAutoTickValue(false);
timeAxis.setTickUnit(new DateUnit(Calendar.HOUR_OF_DAY, 3));
timeAxis.getTickLabelFormatter().applyPattern("H:mm z");
NumberAxis valueAxis = new VerticalNumberAxis(yAxisLabel);
valueAxis.setAutoRangeIncludesZero(false); // override default
XYPlot plot = new XYPlot(timeAxis, valueAxis);
plot.setXYItemRenderer(new StandardXYItemRenderer(StandardXYItemRenderer.LINES));
JFreeChart chart = new JFreeChart(ds, plot, /*title*/null, JFreeChart.DEFAULT_TITLE_FONT, true);
My Problem is with the formatting of the date.
i d like to be able to change the timezone used to display the date on the horizontal axis.
Is there a way to do that ?
thanks
rodolphe
with
Date and TimeZone
RE: Date and TimeZone
Hi Rodolphe,
If you use the full version of the constructor for DateAxis you can specify the SimpleDateFormat object to use. Unfortunately I didn't write accessor methods for it, so the only other way to change it is to modify the code directly.
I'm going to rewrite some of that code soon, so I'll try to think up a better scheme...
Regards,
DG.
If you use the full version of the constructor for DateAxis you can specify the SimpleDateFormat object to use. Unfortunately I didn't write accessor methods for it, so the only other way to change it is to modify the code directly.
I'm going to rewrite some of that code soon, so I'll try to think up a better scheme...
Regards,
DG.
RE: Date and TimeZone
well, i eventually found an easy way to do it :
(i was looking at SimpleDateFormat but the needed method was in DateFormat...)
DateAxis timeAxis = new HorizontalDateAxis(xAxisLabel);
timeAxis.getTickLabelFormatter().applyPattern("H:mm");
timeAxis.getTickLabelFormatter().setTimeZone(TimeZone.getTimeZone(timezone));
so it now works fine for me !!!!
great package really
(i was looking at SimpleDateFormat but the needed method was in DateFormat...)
DateAxis timeAxis = new HorizontalDateAxis(xAxisLabel);
timeAxis.getTickLabelFormatter().applyPattern("H:mm");
timeAxis.getTickLabelFormatter().setTimeZone(TimeZone.getTimeZone(timezone));
so it now works fine for me !!!!
great package really