XYImageAnnotation in JFreechart

P

Penn

I have a plot that is plotting correctly and I have been adding text
annotations to it successfully, but when I implement the following and
add it to my working chart... I see no image in the chart. Is there
something I should be doing additionally?

Thanks!!!

ImageIcon testStar = new ImageIcon("TestStar.png");

XYImageAnnotation testStar = new XYImageAnnotation(50, 50,
testStar.getImage());

plot.addAnnotation(testStar);
 
S

Steve W. Jackson

Penn said:
I have a plot that is plotting correctly and I have been adding text
annotations to it successfully, but when I implement the following and
add it to my working chart... I see no image in the chart. Is there
something I should be doing additionally?

Thanks!!!

ImageIcon testStar = new ImageIcon("TestStar.png");

XYImageAnnotation testStar = new XYImageAnnotation(50, 50,
testStar.getImage());

plot.addAnnotation(testStar);

The most obvious questions would seem to be two.

1. Are you quite certain that the PNG in question really does get
loaded when you ask for it?

2. Does your "plot" variable in fact refer to a class that has the
addAnnotation method? By which I mean that I've seen some products
where a deprecated method doesn't really do anything, and at least one
of the classes in JFreeChart where this method is listed is deprecated.
 
P

Penn

Thank you for the 'obvious questions', because obvious guidance was
needed here. My ImageIcon was not loading correctly... It is now and
JFreeChart is placing it appropriately!

Thank you and I really appreciate your time!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top