adding image on TimeSeries Chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Aniket_kedari
Posts: 17
Joined: Tue Jun 24, 2008 3:03 am

adding image on TimeSeries Chart

Post by Aniket_kedari » Tue Jul 22, 2008 3:36 am

Hi all
I want to add images at particular points in Time Series chart.
In normal XYChart this can be achieved using annotation as below

XYPlot plot = chart.getXYPlot();
ImageIcon imageIcon = null;
imageIcon = new ImageIcon("D:/JFreeChartDemo/JFreeChartDemo/src/demo1/img2.png");
XYAnnotation xyannotation = null;
xyannotation = new XYImageAnnotation(10, 10, imageIcon.getImage());
plot.addAnnotation(xyannotation);

Above code will display image at co-ordinates (10,10).

I tried to do same thing for Time Seried chart but failed. I think I am not getting the co-ordinates right. As it is a Time Series chart X-axis represents time (in my case seconds) and I think I am giving wrong X-offset.

Thanks in advance

Locked