`

[Jfreechart]中BoxAndWhiskerChart的自定义设置

阅读更多

BoxAndWhiskerChart可以利用

JFreeChart createBoxAndWhiskerChart(String title,
            String categoryAxisLabel, String valueAxisLabel,
            BoxAndWhiskerCategoryDataset dataset, boolean legend)

 其中定制BoxAndWhiskerChart的一些基本方法在上一篇日志中已经写出,还有一些特殊的设置比如对每个类别设置不同的颜色.需要使用

 setDrawingSupplier(DrawingSupplier supplier)

而DrawingSupplier的实现在Jfreechart中有DefaultDrawingSupplier这个类来实现,

而DefaultDrawingSupplier提供了无参的构造函数来设置了很多默认的Paint对象.

而DefaultDrawingSupplier没有提供相关参数的set方法所以如果想自己定义颜色信息,必须使用有参的构造函数

DefaultDrawingSupplier(Paint[] paintSequence,
            Paint[] fillPaintSequence, Paint[] outlinePaintSequence,
            Stroke[] strokeSequence, Stroke[] outlineStrokeSequence,
            Shape[] shapeSequence)
或者
 DefaultDrawingSupplier(Paint[] paintSequence,
                                  Paint[] outlinePaintSequence,
                                  Stroke[] strokeSequence,
                                  Stroke[] outlineStrokeSequence,
                                  Shape[] shapeSequence)

 来实现.其中 paintSequencethe就是填充每个图形的颜色Jfreechart也提供了默认的设置,会提供一个颜色的集合并返回

ChartColor.createDefaultPaintArray()

 shapeSequence是默认的图形在DefaultDrawingSupplier中也有提供

Shape[] createStandardSeriesShapes()

 而其他属性感觉不是那么重要,有需要的也可以自己进行设置.....

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics