Bug: BoxAndWhiskerRenderer ?

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
rlenard
Posts: 7
Joined: Thu Jun 10, 2004 4:37 am

Bug: BoxAndWhiskerRenderer ?

Post by rlenard » Wed Nov 10, 2004 10:34 pm

I have a chart with a large number of box & whiskers displayed and want to but in some "no data" rows.

So I created a "Null" BoxAndWhiskerItem (i.e. one with null for all the values - except the outliers values which have to be non-null), added it to a DefaultBoxAndWhiskerCategoryDataset. However when the chart is displayed this breaks because of what seems to be a bug in BoxAndWhiskerRenderer.

Code: Select all

java.lang.IllegalArgumentException: Null 'area' argument.
	at org.jfree.chart.entity.ChartEntity.<init>(ChartEntity.java:116)
	at org.jfree.chart.entity.CategoryItemEntity.<init>(CategoryItemEntity.java:88 )
	at org.jfree.chart.renderer.category.BoxAndWhiskerRenderer.drawHorizontalItem(BoxAndWhiskerRenderer.java:399)
	at org.jfree.chart.renderer.category.BoxAndWhiskerRenderer.drawItem(BoxAndWhiskerRenderer.java:258)
	at com.avaya.evat.reporting.charts.rtp.RtpSummaryChart$3.drawItem(RtpSummaryChart.java:584)
	at org.jfree.chart.plot.CategoryPlot.render(CategoryPlot.java:2066)
	at org.jfree.chart.plot.CategoryPlot.draw(CategoryPlot.java:1904)
	at org.jfree.chart.plot.CombinedDomainCategoryPlot.draw(CombinedDomainCategoryPlot.java:347)
Looking at the code for BoxAndWhiskerRenderer (0.9.21) for BoxAndWhiskerRenderer it's drawHorizontalItem method is broken for this case because the "box" variable is never set (thus when a tooltip is added we get an error creating the CategoryItemEntity).

Is there a way to do what I want without breaking the API or rewriting the class ? I presume the box should be set to be the full width of the cell..
Last edited by rlenard on Thu Nov 11, 2004 4:21 am, edited 1 time in total.

rlenard
Posts: 7
Joined: Thu Jun 10, 2004 4:37 am

Potential Fix ?

Post by rlenard » Wed Nov 10, 2004 11:07 pm

I added this code to the end of the if ( ) and it gets rid of the IllegalArgumentException

Code: Select all

if (xQ1 != null && xQ3 != null && xMax != null && xMin != null)
{

... 

}// <ADDED>
else {
    box = new Rectangle2D.Double(0, yy, 0, state.getBarWidth());
}
// </ADDED>

Locked