豆果第五天

#JFreeChart 自定义饼状图扇区颜色
```
 private static void setPieColor(PiePlot plot,  DefaultPieDataset dataset){

            String[] colorValues = { "#93A9D0", "#4573A7", "#89A54E", "#71588F", "#4298AF", "#DB843D" ,"#AA4644",
                                      "#FFC8B4", "#99FF99", "#9900FF", "#008888", "#D2B48C", "#A9A9A9" ,"#E0FFFF",
                                       "#483D8B", "#00BFFF", "#FFA07A", "#FFB6C1", "#A52A2A", "#4400CC" ,"#990099"};

            //设置颜色

            Paint[] colors = new Paint[colorValues.length];
            for (int i = 0; i < colorValues.length; i++) {
                colors[i] = Color.decode(colorValues[i]);
            }

            //将颜色分配到每一块上
            for (int i = 0; i <dataset.getKeys().size(); i++) {
                plot.setSectionPaint(dataset.getKey(i), colors[i % colors.length]);
            }
    }
```
#JFreeChart去掉默认灰色背景颜色
```
 //设置背景颜色
        pieChart.setBackgroundPaint(Color.WHITE);//大背景颜色
        piePlot.setBackgroundPaint(Color.WHITE);//圆形背景颜色
        piePlot.setLabelBackgroundPaint(Color.WHITE);//提示字体背景颜色
```
![输入图片说明](https://static.oschina.net/uploads/img/201708/12102657_Ac8g.png "在这里输入图片标题")
赞 (0) 评论 分享 ()