possible bug in savechartasPNG

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

possible bug in savechartasPNG

Postby 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


Elsewhere I have:

Code: Select all
public void saveChartToFile(File file) {
        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) {

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.
Posts: 2
Joined: Mon Jun 25, 2012 7:58 am

Re: possible bug in savechartasPNG

Postby 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
Paul B
Posts: 1
Joined: Fri Feb 02, 2018 11:14 pm

Return to JFreeChart

Who is online

Users browsing this forum: Google [Bot] and 8 guests