Code: Select all
chart = ChartFactory.createTimeSeriesChart(
this.getTitle(), // chart title
xLabel, // domain axis label
yLabel, // range axis label
dataset, // data
true, // include legend
true, // tooltips
false // urls
);
createChartPanel();
Code: Select all
public void saveChartToFile(File file) {
chart.createChart();
Logger.getLogger("bsdlog").warn("created chart");
try {
Logger.getLogger("bsdlog").warn("saving chart chart");
ChartUtilities.saveChartAsJPEG(file, chart.getChartPanel().getChart(), 1440, 900);
Logger.getLogger("bsdlog").warn("saved chart chart");
} catch (IOException e) {
e.printStackTrace();
}
}
however when I add:
Code: Select all
SegmentedTimeline timeline = SegmentedTimeline.newMondayThroughFridayTimeline();
((DateAxis) chart.getXYPlot().getDomainAxis()).setTimeline(timeline);
Code: Select all
ChartUtilities.saveChartAsJPEG(file, chart.getChartPanel().getChart(), 1440, 900);
Any ideas as to why this is happening? And what I can do to work around it.