本文介绍了更改颜色JFreeChart中注释的线宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为绘图添加注释,但是我不知道如何更改其颜色或线宽(描边).我已经尽力阅读了文档,但是我没有主意.有人可以帮忙吗?

I am adding an annotation to my plot, but I can't work out how to change the colour or line width (stroke) of this. I've read through the documentation as best as I can but I'm out of ideas. Can anyone help?

Shape shape = new Ellipse2D.Double(circleXValue - radius, circleYValue - radius, radius + radius, radius + radius);
XYShapeAnnotation annotation = new XYShapeAnnotation(shape);
// ??
plot.addAnnotation(annotation);

推荐答案

您正在使用此构造函数:

public XYShapeAnnotation(java.awt.Shape shape)

您可能要使用这些用于指定其他参数的构造函数:

public XYShapeAnnotation(
    java.awt.Shape shape,
    java.awt.Stroke stroke,
    java.awt.Paint outlinePaint)

public XYShapeAnnotation(
    java.awt.Shape shape,
    java.awt.Stroke stroke,
    java.awt.Paint outlinePaint,
    java.awt.Paint fillPaint)

这篇关于更改颜色JFreeChart中注释的线宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-09 10:16