JFreechart在图表上绘制圆弧
我有 2 个问题
1)我试图使用形状注释在 XY 图上绘制圆弧。我使用 XYLine 注释来绘制一条线,并且希望弧线从该线结束的地方开始。我在参数方面遇到一些问题。我希望弧的高度为 17,宽度为 44,并从绘图的点 (3.0, 17) 开始(这是线条结束的地方)。但下面的代码不起作用。有人可以告诉我代码有什么问题吗?
Arc2D.Double arc = new Arc2D.Double(3.0,
16.9,
44.0,
17.04,
180.0,
180.0,
Arc2D.OPEN
);
plot.addAnnotation(new XYShapeAnnotation(arc,
new BasicStroke(2.0f), Color.white));
XYLineAnnotation a1 = new XYLineAnnotation(3.0, 0.0, 3.0,
16.9, new BasicStroke(2.0f), Color.white);
2)如何在极坐标图上画出类似的图形?
谢谢
I have 2 questions
1)I am trying to draw an arc on an XYplot using the shape annotation. I used the XYLine annotation to draw a line and I want the arc to start where the line ends. I am having some issues with the parameters.I want the arc to have a height of 17, width 44, and start at the point(3.0, 17) of the plot(this is where the line ends). But the code below does not work. Can someone please tell me what is wrong with the code?
Arc2D.Double arc = new Arc2D.Double(3.0,
16.9,
44.0,
17.04,
180.0,
180.0,
Arc2D.OPEN
);
plot.addAnnotation(new XYShapeAnnotation(arc,
new BasicStroke(2.0f), Color.white));
XYLineAnnotation a1 = new XYLineAnnotation(3.0, 0.0, 3.0,
16.9, new BasicStroke(2.0f), Color.white);
2)How can I draw a similar figure on a polar plot?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Arc2D 的关键是边界矩形。要使半弧
H
单位高,边界必须为2 * H
单位高。据我所知,
PolarPlot
不支持注释。The critical thing about
Arc2D
is the bounding rectangle. To make the half-arcH
units high, the bounds must be2 * H
units high.AFAIK,
PolarPlot
does not support annotations.