Our reporting format required that the width of the bar in the box and whisker charts was the same, regardless of how many items were in the report.  I made some changes to the BoxAndWhiskerRenderer class to support this, based on changes Tim Bardzil made to a previous release.  Diffs from 0.9.21 release of JFreeChart are below:

 

99a100,102

>

>     /** The maximum bar width. */

>     private double maxBarWidth;

131a135,152

>      * Returns the maximum bar width size

>      *

>      * @return maximum bar width size

>      */

>     public double getMaxBarWidth() {

>         return maxBarWidth;

>     }

>

>     /**

>      * Sets the maximum bar width.

>      *

>      * @param maxBarWidth  the width.

>      */

>     public void setMaxBarWidth(double maxBarWidth) {

>         this.maxBarWidth = maxBarWidth;

>     }

>

>     /**

216c237,245

<                 state.setBarWidth(used / (dataset.getColumnCount() * dataset.getRowCount()));

---

>                 double potentialBarWidth = used / (dataset.getColumnCount() * dataset.getRowCount());

>                 if (maxBarWidth > 0 && potentialBarWidth > maxBarWidth) {

>                     state.setBarWidth(this.maxBarWidth);

>                 } else {

>                     state.setBarWidth(potentialBarWidth);

>                 }

>

>             } else {

>                 state.setBarWidth(this.maxBarWidth);

218,220c247

<             else {

<                 state.setBarWidth(used);

<             }

 

The above change allows the following:

BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();

renderer.setMaxBarWidth(10);

return new CategoryPlot(dataset, null, numberaxis, renderer);

 

The chart will have boxes of the same width, regardless of how many boxes are displayed.  Note that the boxes will become smaller once a sufficient number of boxes are displayed.

 

While doing the above work, I found a declaration of BoxAndWhiskerRenderer was being used to directly access private variables.  My IDE would not allow me to compile until it was fixed.  Diffs are below:

 

>

694c721

<             if (!ObjectUtils.equal(r.artifactPaint, this.artifactPaint)) {

---

>             if (!ObjectUtils.equal(r.getArtifactPaint(), this.artifactPaint)) {

697c724

<             if (!(r.fillBox == this.fillBox)) {

---

>             if (!(r.getFillBox() == this.fillBox)) {

700c727

<             if (!(r.itemMargin == this.itemMargin)) {

---

>             if (!(r.getItemMargin() == this.itemMargin)) {

 

Ron

 

Ronald Rozensky

Avaya, Inc.

727-217-1680

rozensky@avaya.com