Hello
After much struggle and playing around with JFreeChart, i managed to draw a single chart of two TimeSeries'( or a verticalXYBarChart) getting periodically updated by threads.
But after some 2-3 minutes of correct plotting , i get an exception
sun.dc.pr.PRException :endPath :bad path
at sun.dc.pr.Rasterizer.endPath(Unknown Source)
at sun.java2d.pipe.DuctusRenderer.createShapeRasterizer(Unknown Source)
at sun.java2d.pipe.DuctusShapeRenderer.renderPath(Unknown Source)
at sun.java2d.pipe.DuctusShapeRenderer.draw(Unknown Source)
at sun.java2d.SunGraphics2D.draw(Unknown Source)
at com.jrefinery.chart.StandardXYItemRenderer.drawItem(Unknown Source)
at com.jrefinery.chart.XYPlot.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.draw(Unknown Source)
at com.jrefinery.chart.JFreeChartPanel.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintWithBuffer(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Could anyone please help me out with this, this is the last phase of my
project and i won't like to be stuck with this!!
I could post the source code of my work if it helps!!
Thanks in advance
Gaurav Kathotia
sun.dc.pr.PRexception while Plotting
Re: sun.dc.pr.PRexception while Plotting
This exception usually happens when a line or shape with very large coordinates is drawn using Java2D. It isn't clear in Java2D what range of values is supported - you can create a line using any double values as coordinates, but the range actually supported seems to vary by platform.
What is the range of data you are plotting (maximum and minimum on each axis)?
Regards,
DG.
What is the range of data you are plotting (maximum and minimum on each axis)?
Regards,
DG.
Re: sun.dc.pr.PRexception while Plotting
I am creating a JFreeChart panel with two graphs , laid by GridLayout manager.
The first chart is obtained by chartFactory.createTimeSeriesChart()
with setFixedAutoRange(60000) and setAxisRange(0.0,300.0)
The second chart is the same with setFixedAutorange(20000) and
setAxisRange(0.0,500.0).
Both the series' are updated periodically by threads( i:e series.add() )
Is there any other alternative to tackle the exception?
Thanks in advance
Gaurav Kathotia
The first chart is obtained by chartFactory.createTimeSeriesChart()
with setFixedAutoRange(60000) and setAxisRange(0.0,300.0)
The second chart is the same with setFixedAutorange(20000) and
setAxisRange(0.0,500.0).
Both the series' are updated periodically by threads( i:e series.add() )
Is there any other alternative to tackle the exception?
Thanks in advance
Gaurav Kathotia
Re: sun.dc.pr.PRexception while Plotting
Most likely the exception is coming from the dates/times that have "rolled off" the axis. I'm thinking that some extra code in the StandardXYItemRenderer to check whether the x-values are within the axis range before drawing the line might avoid the problem. If both x-values are less than the lower bound for the axis, then the line won't be visible so it doesn't need to be drawn.
Another related point...at the moment JFreeChart iterates through ALL the data when a chart is redrawn. This is OK for small datasets, but not so good for large datasets when the axis range is showing only a subset of the data. Work needs to be done to improve this...
Regards,
DG.
Another related point...at the moment JFreeChart iterates through ALL the data when a chart is redrawn. This is OK for small datasets, but not so good for large datasets when the axis range is showing only a subset of the data. Work needs to be done to improve this...
Regards,
DG.
Re: sun.dc.pr.PRexception while Plotting
I found a similar exception when one of the Number[] was Nan ( divided by 0). I fixed that and the exception went away
That was a stupid mistake, something like this
for (int i= 0; i < maxbars; i++)
{
s += ary.doublevalue();
avg = new Double(s/i); <==== i is 0 initially !!!! has to be (i+1)
}
so, better print out all the values if you have any div by 0s.
Hope it helps !
Thanks
Mudit

for (int i= 0; i < maxbars; i++)
{
s += ary.doublevalue();
avg = new Double(s/i); <==== i is 0 initially !!!! has to be (i+1)
}
so, better print out all the values if you have any div by 0s.
Hope it helps !
Thanks
Mudit