Im using below code to generate box plot chart. But depend on some values it show small circle without drawing the whisker. I need to show whisker not the small circle. Is it possible to hide circle and show the whisker?
private void createBoxPlotChart(OutputStream out, Object data)
throws Exception {
ChartRenderingInfo info = new ChartRenderingInfo();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] ptsImageBytes = null;
DefaultBoxAndWhiskerCategoryDataset boxAndWhiskerCategoryDS = createBoxAndWhiskerCategoryDataSet();
JFreeChart chart = ChartFactory.createBoxAndWhiskerChart(selectedFlight
+ " - Time on Hold", "Arrival Time (Days)",
"Hold Time (Mins)", boxAndWhiskerCategoryDS, true);
NumberAxis rangeAxis = (NumberAxis) chart.getCategoryPlot()
.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
rangeAxis.setAutoRangeIncludesZero(true);
CategoryAxis domainAxis = chart.getCategoryPlot().getDomainAxis();
BoxAndWhiskerRenderer renderer = (BoxAndWhiskerRenderer) chart.getCategoryPlot().getRenderer();
//renderer.setFillBox(false);
renderer.setMeanVisible(false);
renderer.setUseOutlinePaintForWhiskers(false);
renderer.setMedianVisible(false);
if(boxAndWhiskerCategoryDS.getRowCount()>8){
domainAxis.setCategoryLabelPositions(CategoryLabelPositions
.createUpRotationLabelPositions(Math.PI / 5.0));
}
chart.getCategoryPlot().setBackgroundPaint(Color.white);
chart.getCategoryPlot().setDomainGridlinePaint(Color.gray);
chart.getCategoryPlot().setRangeGridlinePaint(Color.gray);
chart.getCategoryPlot().setOutlineVisible(false);
BufferedImage pageImage = chart.createBufferedImage(CHART_WIDTH,
CHART_HEIGHT, BufferedImage.TYPE_INT_BGR, info);
ImageIO.write(pageImage, IMAGE_TYPE, baos);
baos.flush();
if (null != baos) {
ptsImageBytes = baos.toByteArray();
}
ImageIO.write(pageImage, IMAGE_TYPE, out);
}
private DefaultBoxAndWhiskerCategoryDataset createBoxAndWhiskerCategoryDataSet()
throws ParseException {
DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset();
for (String graph : graphList) {
final List<Double> list = new ArrayList<Double>();
for (ereportDto ereportDto : holdTimeRptList) {
if (ereportDto != null && ereportDto.getHoldTime() != 0
&& ereportDto.getGraphTime() != null
&& ereportDto.getGraphTime().equalsIgnoreCase(graph)) {
double medianVal=ereportDto.getGraphHoldEntry()+((ereportDto.getGraphHoldExit()-ereportDto.getGraphHoldEntry())/2);
list.add(new Double(ereportDto.getGraphTimeAt120NM()));
list.add(new Double(ereportDto.getGraphHoldEntry()));
list.add(new Double(medianVal));
list.add(new Double(ereportDto.getGraphHoldExit()));
list.add(new Double(ereportDto.getGraphLandedTime()));
}
}
dataset.add(list, graph, graph);
}
return dataset;
}
How to remove outliers(small circle) from Box and Whisker
-
- Posts: 3
- Joined: Fri Oct 23, 2015 7:29 pm
- antibot: No, of course not.
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How to remove outliers(small circle) from Box and Whiske
There is not a flag in the renderer to switch off the drawing of the outlier and farout indicators. It would not be so hard to add one to the BoxAndWhiskerRenderer class...just something along the same lines as the 'medianVisible' flag. I think this would be the most straightforward way to get the result you require.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: How to remove outliers(small circle) from Box and Whiske
Such a flag (to draw outliers as part of the whiskers) would be welcome for me too.
I am using box and whiskers for OptaPlanner metaheuristic benchmarks and the outliers are not considered ignorable,
instead they are considered very important because they represent risk/opportunity.
In case I want to take a stab at this myself:
Is JFreeChart 1.x on GitHub? If not, svn2git works really nicely
(I can't find a link to the sources from the project website, nor a "fork me on github" button.)
I am using box and whiskers for OptaPlanner metaheuristic benchmarks and the outliers are not considered ignorable,
instead they are considered very important because they represent risk/opportunity.
In case I want to take a stab at this myself:
Is JFreeChart 1.x on GitHub? If not, svn2git works really nicely

(I can't find a link to the sources from the project website, nor a "fork me on github" button.)
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: How to remove outliers(small circle) from Box and Whiske
Sources for 1.0.x are in SVN at Sourceforge still, I'll move that to GitHub sometime since I have all my other code there already:
http://sourceforge.net/p/jfreechart/cod ... .x-branch/
http://sourceforge.net/p/jfreechart/cod ... .x-branch/
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

