JFreeChart XY图上的图标 [英] Icon on a JFreeChart XY Plot

查看:299
本文介绍了JFreeChart XY图上的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个位置的XY图,并希望最新的点是一个图标。这可能在JFreeChart中吗?

I have an XY plot of positions and want the newest point to be an icon. Is this possible in JFreeChart?

推荐答案

在xy图上,您需要跟踪最后添加的xy点,然后使用以下内容添加它:

On an xy plot you would need to keep track of the last xy point added and then add it using something like the following:

double x = 150;
double y = 300;
XYPlot plot = chart.getXYPlot();
ImageIcon imageIcon = new ImageIcon("/path/to/your/icon.png");
XYAnnotation xyannotation = new XYImageAnnotation(x, y, imageIcon.getImage());
plot.addAnnotation(xyannotation); 

这篇关于JFreeChart XY图上的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆