小编Mil*_*nga的帖子

如何从jfreechart中的Box和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 = …
Run Code Online (Sandbox Code Playgroud)

java jfreechart

5
推荐指数
1
解决办法
487
查看次数

标签 统计

java ×1

jfreechart ×1