如何将图标放在JFReechart Java的图表的一侧
我有以下图表:
图表是动态的,并且具有放大和缩小的功能。 我想放置一个创建的图标:
BufferedImage triangleIcon = null;
try {
triangleIcon = ImageIO.read(getClass().getClassLoader().getResource("Resources/Imagenes/triangulo.png"));
} catch (IOException e) {
}
可以将其放置在以下任何点:
xyannotation = new XYImageAnnotation(XValue, YValue, triangleIcon);
this.xyplot.addAnnotation(xyannotation);
我想将此图标放在任何y值,但始终在图表的左侧旁边,而无需考虑缩放。类似:
是否有可能?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我看起来您想注释“……图表的一侧,忽略 x 轴的值”。通常,这样的 data 空间中的坐标。一种方法是一种自定义注释,它扩展了抽象父母, AbstractXyAnnotation 。 Override
draw()
以将垂直 data 坐标转换为相应的屏幕坐标,同时固定水平屏幕坐标到图的dataarea
。锅和缩放以查看效果。示例代码:
I looks like you want to annotate "one side of the…chart, ignoring the value of the X axis". Ordinarily, such annotations specify both coordinates in data space. One approach is a custom annotation that extends the abstract parent,
AbstractXYAnnotation
. Overridedraw()
to transform the vertical data coordinate to the corresponding screen coordinate, while pinning the horizontal screen coordinate to thedataArea
of the plot. Pan and zoom to see the effect.Example code: