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

    *

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


  • 相关阅读:
    CSS实现水平居中的5种思路
    html5遵循的5个设计原则
    HTML5标签嵌套规则
    动画animation的三个应用(漂浮的白云、旋转的星球、正方体合成)
    深入理解CSS动画animation
    深入理解CSS径向渐变radial-gradient
    深入理解CSS线性渐变linear-gradient
    动态更新语句,时间精度丢失
    反射类的构造数
    在ASP.NET MVC中使用Grid.mvc
  • 原文地址:https://www.cnblogs.com/qingmaple/p/6170750.html
Copyright © 2011-2022 走看看