Change colour & line width of an Annotation in JFreeChart

假如想象 提交于 2019-12-11 07:55:23

问题


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);

回答1:


You're using this constructor:

public XYShapeAnnotation(java.awt.Shape shape)

You may want to use one of these constructors that specify additional parameters:

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)



回答2:


You can find related examples using XYShapeAnnotation here and here.



来源:https://stackoverflow.com/questions/11748533/change-colour-line-width-of-an-annotation-in-jfreechart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!