possible bug in savechartasPNG

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
robthewolf
Posts: 2
Joined: Mon Jun 25, 2012 7:58 am
antibot: No, of course not.

possible bug in savechartasPNG

Post by robthewolf » Mon Jun 25, 2012 8:17 am

I have a TimeSeriesChart which I create:

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();
Elsewhere I have:

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();
        }
    }
This works fine!

however when I add:

Code: Select all

SegmentedTimeline timeline = SegmentedTimeline.newMondayThroughFridayTimeline();
((DateAxis) chart.getXYPlot().getDomainAxis()).setTimeline(timeline);
it gets stuck at the line:

Code: Select all

ChartUtilities.saveChartAsJPEG(file, chart.getChartPanel().getChart(), 1440, 900);
no crash, no error message no nothing.

Any ideas as to why this is happening? And what I can do to work around it.

Paul B
Posts: 1
Joined: Fri Feb 02, 2018 11:14 pm
antibot: No, of course not.

Re: possible bug in savechartasPNG

Post by Paul B » Fri Feb 02, 2018 11:21 pm

Did you ever figure this out?
I am having the same problem.
Seemed to happen when I switched to java 1.8

Locked