sun.dc.pr.PRException: endPath: bad path

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

sun.dc.pr.PRException: endPath: bad path

Post by AdamM111 » Fri May 07, 2004 9:18 pm

Hi,

I have seen (in the Google) that somebody already opened a Topic for sun.dc.pr.PRException: endPath: bad path, but I couldn't find that.

So once agian sun.dc.pr.PRException: endPath: bad path. ;) When I'm using the JFreeChart, XYBarRenderer on SUN, I get a sun.dc.pr.PRException: endPath: bad path exception when the rendrer draws the Bar ( Graphics2D.draw() or fill() ), even if I altered the code, to check if the Bar intersects with the DataArea ( with Shape.intersects(shape) ).

Does anyone know any solution for this?

Thanks,

Adam

Mimil
JFreeReport Staff Member
Posts: 69
Joined: Tue Mar 25, 2003 7:33 pm

Post by Mimil » Fri May 07, 2004 9:50 pm

Hello,

Here it is: (link to precedent opic)
http://www.jfree.org/phpBB2/viewtopic.php?t=8599

Here is too: (an other link)
http://www.jfree.org/phpBB2/viewtopic.php?t=6430

Bye;
Mimil

nikster
Posts: 46
Joined: Wed Nov 19, 2003 4:34 pm

Post by nikster » Mon May 10, 2004 2:33 pm

Sun thinks it's related to this (rather bad) bug:
http://developer.java.sun.com/developer ... 55500.html

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Aug 16, 2004 9:35 pm

You can trigger this exception by drawing shapes with "large" coordinates:

http://bugs.sun.com/bugdatabase/view_bu ... id=4696289

We could add our own clipping code to JFreeChart, but I haven't put much time into investigating that option.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

lcurrens
Posts: 3
Joined: Tue Mar 29, 2005 8:29 pm

PRException, bad path

Post by lcurrens » Tue Mar 29, 2005 8:42 pm

I run into this error when I am attempting to plot a line with fairly large data values, only when all the data values are *exactly the same*.

For farily large values, it seems it takes about 8 or 9 digits to trigger the problem. As soon as I add one data point with a value that is either *larger or smaller* than the others, the chart will display correctly.

I have noticed that when I plot a chart with smaller data values which are all the same value (so that the chart displays correctly), the value on the Y axis ends up showing 7 zeros after the decimal point. This seems to occur only when there is a single data point on the Y axis. When I have multiple data points, none of them show the decimal point with zeros after it, for example:

10000000.0000000

Now, adding a decimal point plus 7 zeros to a number which is already large makes for a lot of digits to display. I am wondering if that has something to do with this problem.

Does anyone know if there is a way to prevent the chart from showing the Y axis numbers as floating point, instead of integer (i.e. truncate the decimal point plus zeros)?

Also, I tried running with JRE 1.5.0_02, and although I did not get the exception anymore, the chart showed up as empty. So I'm not sure that JRE 1.5 is going to fix this problem.

prabhu
Posts: 5
Joined: Thu Mar 24, 2005 7:37 am

Post by prabhu » Wed Mar 30, 2005 6:05 am

Hi,

I've a similar kind of problem.
In my case, ChartEntity.getCoords() returns negative coordinates causing "sun.dc.pr.PRException: endPath: bad path" exception.

Here is the sample code. It creates a XYBar chart using TimeSeriesCollection data and stores the chart as 'verticalXYBar.png', 'verticalXYBar.html'.

When I open the html-file [ verticalXYBar.html] in a browser, tooltip appears in a wrong place due to the negative coordinates.

This seems to happen only when TimeSeries has only one item.
If I add more than one item to the TimeSeries (uncomment the LINE-1, LINE-2, LINE-3 in the code) and run this program this exception won't occur.

Code: Select all

/**
 *  Using JFreeChart v0.9.21, JCommon 0.9.6
 */

import java.io.*;
import org.jfree.chart.*;
import org.jfree.chart.entity.StandardEntityCollection;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.time.*;
import org.jfree.data.xy.IntervalXYDataset;

public class TimeSeriesProblem {

  public TimeSeriesProblem() {
  }

  public static void main(String args[]) {
    IntervalXYDataset data = createDataset();
    JFreeChart jfreechart = ChartFactory.createXYBarChart("title", "xAxisLabel", true,
        "yAxisLabel",
        (IntervalXYDataset) data,
        PlotOrientation.VERTICAL, true, true, false);

    saveChart(jfreechart);
  }

  private static IntervalXYDataset createDataset() {
    TimeSeriesCollection timeseriescollection = new TimeSeriesCollection();
    timeseriescollection.addSeries(createTimeSeries());
    return timeseriescollection;
  }

  private static TimeSeries createTimeSeries() {
    TimeSeries ts = new TimeSeries("Product Release Schedule", Month.class);
    ts.add(new Month(7, 2002), 0.1);
    
     //ts.add(new Month(8, 2002), 0.4); //------ LINE 1
    //ts.add(new Month(9, 2002), 0.9); //------ LINE 2
    //ts.add(new Month(10, 2002), 1.0);//-----  LINE 3

    return ts;
  }

  public static void saveChart(JFreeChart jfreechart) {
    try {
      ChartRenderingInfo chartrenderinginfo = new ChartRenderingInfo(new
          StandardEntityCollection());
      File file = new File("verticalXYBar.png");
      ChartUtilities.saveChartAsPNG(file, jfreechart, 600, 400,
                                    chartrenderinginfo);
      File file1 = new File("verticalXYBar.html");
      BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(new
          FileOutputStream(file1));
      PrintWriter printwriter = new PrintWriter(bufferedoutputstream);
      printwriter.println("<HTML>");
      printwriter.println(
          "<HEAD><TITLE>VerticalXYBar</TITLE></HEAD>");
      printwriter.println("<BODY>");
      ChartUtilities.writeImageMap(printwriter, "verticalXYBar", chartrenderinginfo);
      printwriter.println("<IMG SRC=\"verticalXYBar.png\" WIDTH=\"600\" HEIGHT=\"400\" BORDER=\"0\" USEMAP=\"#verticalXYBar\">");
      printwriter.println("</BODY>");
      printwriter.println("</HTML>");
      printwriter.close();
    }
    catch (IOException ioe) {
      System.out.println(ioe.toString());
    }

  }
}

uvoigt
Posts: 168
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany

Post by uvoigt » Fri Apr 29, 2005 11:37 am

Hi,

I ran into this problem if I inserted Double.NaN values into the dataset (JDK 1.4).
I didn't get any problem when using 1.5.

Ulrich

Guest

Post by Guest » Sun May 01, 2005 4:03 pm

I used to consistently get this error if I tried to update the chart on the wrong thread. Now that all my repainting happens on the event dispatch thread, everything works correctly.

Locked