zoukankan      html  css  js  c++  java
  • JFreeChart 零散

    *

    主要是dynamicreports 和 jfreechart结合的时候,进行的一些配置:

    1,移除legend的黑色边框

    LegendTitle legend = chart.getLegend();
            //legend.setFrame(new BlockBorder(Color.green));
            if(legend!=null){
                legend.setFrame(BlockBorder.NONE);//去除legend的黑线框
            }

    2,图的方向调换,

    .setOrientation(Orientation.HORIZONTAL)

     3,在dynamic-reports中客制化jfreechart

    private class AxisLineCustomizer implements DRIChartCustomizer, Serializable {
            private static final long serialVersionUID = 1L;
    
            @Override
            public void customize(JFreeChart chart, ReportParameters reportParameters) {
                BarRenderer renderer = (BarRenderer) chart.getCategoryPlot().getRenderer();
                CategoryPlot categoryPlot=chart.getCategoryPlot();
                categoryPlot.setRangeGridlinesVisible(false);//数据区的网格线删除
                
                //chart.getLegend().setFrame(BlockBorder.NONE);//去除legend的黑边框
                LegendTitle legend = chart.getLegend();
                //legend.setFrame(new BlockBorder(Color.green));
                if(legend!=null){
                    legend.setFrame(BlockBorder.NONE);//去除legend的黑线框
                }
                
                CategoryAxis domainAxis = categoryPlot.getDomainAxis();
                categoryPlot.setRangeZeroBaselineVisible(true);//显示出0的线
                domainAxis.setAxisLineVisible(false);//不显示x轴的线
                domainAxis.setTickMarksVisible(false);//不显示x轴的标尺
                
                renderer.setNegativeItemLabelPosition(new ItemLabelPosition());
                ValueAxis valueAxis=(ValueAxis) chart.getCategoryPlot().getRangeAxis();
                categoryPlot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_LEFT);
                //domainAxis.setInverted(true);//数据轴倒过来
                //categoryPlot.setOrientation(PlotOrientation.VERTICAL);
            }
        }

    4,xy轴的标签

    //.setCategoryAxisFormat(cht.axisFormat().setLabel("一万个理由"))//x轴标签
    .setValueAxisFormat(cht.axisFormat().setLabel("(%)"))//y轴标签

     *5,.setUseSeriesAsCategory(true)

     *

    更多属性设置,参考 JFreeChart中文API

    *

    有问题在公众号【清汤袭人】找我,时常冒出各种傻问题,然一通百通,其乐无穷,一起探讨


  • 相关阅读:
    ubuntu git配置文件,配置颜色,同义词
    A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS
    Lucene索引文件解析之“域”
    模2运算的原理
    Ubuntu aptcache命令查找可用软件包
    crc循环校验原理和实现
    python操作MySQL数据库
    异常:MessageBox.Show 容量超出了最大容量。参数名: capacity
    JavaScript中的 Dictionary 的用法
    IIS设置允许下载.h264文件解决方法
  • 原文地址:https://www.cnblogs.com/qingmaple/p/6170750.html
Copyright © 2011-2022 走看看