
The following change to drawHorizontalItem() seems to correct the rendering.
Code: Select all
$ diff -c OldBoxAndWhiskerRenderer.java source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java
*** OldBoxAndWhiskerRenderer.java 2016-07-15 23:42:35.000000000 -0400
--- source/org/jfree/chart/renderer/category/BoxAndWhiskerRenderer.java 2016-07-15 23:42:41.000000000 -0400
***************
*** 704,710 ****
// draw the lower shadow...
g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid));
g2.draw(new Line2D.Double(xxMin, yymid - halfW, xxMin,
! yy + halfW));
g2.setStroke(getItemOutlineStroke(row, column));
g2.setPaint(outlinePaint);
--- 704,710 ----
// draw the lower shadow...
g2.draw(new Line2D.Double(xxMin, yymid, xxQ1, yymid));
g2.draw(new Line2D.Double(xxMin, yymid - halfW, xxMin,
! yymid + halfW));
g2.setStroke(getItemOutlineStroke(row, column));
g2.setPaint(outlinePaint);

SSCCE:
Code: Select all
import java.awt.Dimension;
import java.awt.EventQueue;
import java.util.Arrays;
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.statistics.DefaultBoxAndWhiskerCategoryDataset;
/**
* @see http://stackoverflow.com/a/38407595/230513
*/
public class BoxPlot {
private void display() {
JFrame f = new JFrame("BoxPlot");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
DefaultBoxAndWhiskerCategoryDataset data = new DefaultBoxAndWhiskerCategoryDataset();
data.add(Arrays.asList(30, 36, 46, 55, 65, 76, 81, 80, 71, 59, 44, 34), "Planet", "Endor");
JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(
"Box and Whisker Chart", "Planet", "Temperature", data, false);
CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setOrientation(PlotOrientation.HORIZONTAL);
f.add(new ChartPanel(chart) {
@Override
public Dimension getPreferredSize() {
return new Dimension(500, 300);
}
});
f.pack();
f.setLocationRelativeTo(null);
f.setVisible(true);
}
public static void main(String[] args) {
EventQueue.invokeLater(new BoxPlot()::display);
}
}