A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
prassoon
- Posts: 14
- Joined: Fri May 23, 2008 1:57 am
Post
by prassoon » Wed Jun 25, 2008 1:14 am
Hi there
I have a timeseries chart with tooltips and on an applet the tooltip works only for those datapoints which are not within XYBoxAnnotation. It doesnt show the annotation tooltip too. I'm using XYLineAndShapeRenderer. On the PNG output annotation tooltips shows but not the tooltip of the datapoint within the boxannotation. If i switch off the annotation tooltip the PNG output of the chart generated shows the normal tooltips for the datapoints but on an applet it doesnt show that.
My explanation sounds confusing?

Precisely my question is
Are we not supposed to use both tooltips together?
Is there a way to see both tooltips?
If anyone knows please shed some light.
Thanks
hmm after digging more i found we can add that to the background.
Code: Select all
renderer.addAnnotation(annotation, Layer.BACKGROUND);
That solved the issue on the generated PNG but on the applet still it hides both the tooltips within the box-annotation...
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Wed Jun 25, 2008 9:46 pm
Can you post a small self-contained demo that shows the problem? Where there is an overlap, JFreeChart *should* display the tooltip for the item that is drawn last (i.e. foremost on the chart).
-
prassoon
- Posts: 14
- Joined: Fri May 23, 2008 1:57 am
Post
by prassoon » Wed Jun 25, 2008 10:24 pm
thanks for the reply david. I dont have a ready-to-run independant example for this, (have to make one). But since only the last one is supposed to show up i will need to switch one off.
-
david.gilbert
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
-
Contact:
Post
by david.gilbert » Thu Jun 26, 2008 3:04 pm
The thing is, if you put the annotation in the background layer, then the data item will be drawn *later* than the annotation, so it should get picked for the tooltip (except in parts of the chart where the annotation is not covered by a data item).
People have requested methods to return all chart entities at a given point, which would be helpful here because then we could prioritise the items for tooltips (e.g. data items should get higher priority than annotations). But I haven't had a chance to work on that.
-
prassoon
- Posts: 14
- Joined: Fri May 23, 2008 1:57 am
Post
by prassoon » Thu Jun 26, 2008 8:46 pm
I think it wouldnt be *impossible* to show both
Now since the PNG shows both tool tips we decided to keep that and to switch off all the tooltips in Applet mode. It would've been nice to have a method to do that in JFreeChart, (switch on/off tooltips) now it seems it can be done only at the time of instantiation.
-
prassoon
- Posts: 14
- Joined: Fri May 23, 2008 1:57 am
Post
by prassoon » Thu Jun 26, 2008 8:59 pm
I could manage with
Code: Select all
renderer.setBaseToolTipGenerator(null);