DateAxisを使用すると、正常に機能します。
// From: 2/5/13 02:00:00 PM (+1), To: 2/5/13 03:00:00 PM (+1)
// Configuring dataset
Timezone tz = new SimpleTimeZone(1, "Test");
TimeSeriesCollection dataset = new TimeSeriesCollection(tz);
TimeSeries timeSeries = new TimeSeries("Series1");
...
timeSeries.add(new Millisecond(new Date(timestamp1), tz, locale), value1);
timeSeries.add(new Millisecond(new Date(timestamp2), tz, locale), value2);
timeSeries.add(new Millisecond(new Date(timestamp3), tz, locale), value3);
...
// Setting axis timezone
((DateAxis) chart.getXYPlot().getDomainAxis()).setTimeZone(tz);
((DateAxis) chart.getXYPlot().getDomainAxis()).setRange(new DateRange(
from, to), true, true);
しかし、PeriodAxisで同じことを行おうとすると、間違ったタイムゾーンが表示されます。コンピューターからタイムゾーンを取得しているようです(-3)。
// From: 2/5/13 02:00:00 PM (+1), To: 2/5/13 03:00:00 PM (+1)
// Configuring dataset
Timezone tz = new SimpleTimeZone(1, "Test");
TimeSeriesCollection dataset = new TimeSeriesCollection(tz);
TimeSeries timeSeries = new TimeSeries("Series1");
...
timeSeries.add(new Millisecond(new Date(timestamp1), tz, locale), value1);
timeSeries.add(new Millisecond(new Date(timestamp2), tz, locale), value2);
timeSeries.add(new Millisecond(new Date(timestamp3), tz, locale), value3);
...
// Setting periodAxis
PeriodAxis periodaxis = new PeriodAxis("");
periodaxis.setFirst(new Millisecond(new Date(from), tz));
periodaxis.setLast(new Millisecond(new Date(to), tz));
periodaxis.setTimeZone(tz);
periodaxis.setRange(new DateRange(from, to), true, true);
periodaxis.setAutoRangeTimePeriodClass(Second.class);
PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[2];
aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(
org.jfree.data.time.Minute.class, new SimpleDateFormat("mm"));
aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(
org.jfree.data.time.Hour.class, new SimpleDateFormat("HH"));
periodaxis.setLabelInfo(aperiodaxislabelinfo);
chart.getXYPlot().setDomainAxis(periodaxis);