JFreeChart XY图上的图标

时间:2009-02-09 16:24:05

标签: java jfreechart

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

1 个答案:

答案 0 :(得分:6)

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

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); 
相关问题