Insertion of a clickable image ... ???
Insertion of a clickable image ... ???
I've never used JFreeChart before, it looks quite interesting and useful. I was using another plotting library and I decided to switch because it didn't meet my needs. I would like to know if it is possible to insert a clickable image with JFreeChart, from a PNG, JPG or GIF file, into the plot, relative to the graph's coordinate system. My idea is to mark and represent a specific behaviour of the graph, so the image (a small icon) would go under the x axis, between the axis itself and the numbers in the scale (the plot is a line graph). When the user clicks it, a small dialog (window) shows up with some info about that part of the graph. Anyone knows if it is possible, and more or less how?
-
- Posts: 844
- Joined: Fri Oct 13, 2006 9:29 pm
- Location: Sunnyvale, CA
Re: Insertion of a clickable image ... ???
Depending upon how flexible you want to be and how much work you wish to invest, you can achieve various levels of your end goal. Creating the icon and adding it to the plot is quite simple if you use a XYImageAnnotation. For a first pass, simply add the annotation at y=0. This would place it on the axis instead of below it, but it is easier than modifying the axis rendering. The annotation also allows you to add tooltips and urls.swperman wrote:I would like to know if it is possible to insert a clickable image with JFreeChart, from a PNG, JPG or GIF file, into the plot, relative to the graph's coordinate system. My idea is to mark and represent a specific behaviour of the graph, so the image (a small icon) would go under the x axis, between the axis itself and the numbers in the scale (the plot is a line graph). When the user clicks it, a small dialog (window) shows up with some info about that part of the graph. Anyone knows if it is possible, and more or less how?
Making the annotation open a dialog box requires more investment. You will need to modify how the plot handles mouse events. I would suggest looking over the source code before attempting this.
Richard West
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA
Design Engineer II
Advanced Micro Devices
Sunnyvale, CA