Icon on a JFreeChart XY Plot

旧时模样 提交于 2019-12-07 08:28:54

问题


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


回答1:


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); 


来源:https://stackoverflow.com/questions/528827/icon-on-a-jfreechart-xy-plot

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!