我很难理解注解系统是如何工作的。例如,我可以使用鼠标获得的坐标绘制一条垂直线作为注释,但不能在两个不同的点之间绘制一条直线。
这是可行的:
HighLowRenderer hlr=(HighLowRenderer)plot.getRenderer();
XYLineAnnotation a1=new XYLineAnnotation(chartX, 0, chartX, dataArea.getHeight(), bs1, Color.black);
hlr.addAnnotation(a1);其中chartX是鼠标位置的计算值。
这不起作用:
HighLowRenderer hlr=(HighLowRenderer)plot.getRenderer();
XYLineAnnotation a2=new XYLineAnnotation(175, 67, 230, 167, bs1, Color.black);
hlr.addAnnotation(a2);发布于 2009-05-11 21:00:46
看看this example,它将XYLineAnnotations添加到XYPlot对象(在上面的代码中,您将其添加到渲染器中)。
我在使用注释时遇到了很多问题,不幸的是,我能提供的唯一真正的建议是查看http://www.java2s.com/上的示例
https://stackoverflow.com/questions/849797
复制相似问题