ShadowGenerator and Tooltips

A free public discussion forum for the JFreeChart class library.

ShadowGenerator and Tooltips

Postby matinh » Mon Oct 10, 2011 5:08 pm

Hi!

In revision 2207 a new feature was added to some plots: a shadow generator. Unfortunately with shadows turned on, tooltips are not rendered for the correct position (tested with XYPlot). The problem is, that in the draw() method a copy of g2 and dataArea is created, which is needed later on. However, most modifications to g2/dataArea are only executed on the copies and not on the originals, which leads to different images and thus, wrong positions for the tooltips.

The following patch fixes the behaviour for a simple XYPlot without annotations, markers, etc.
Code: Select all
Index: XYPlot.java
===================================================================
--- XYPlot.java   (revision 4790)
+++ XYPlot.java   (working copy)
@@ -3359,6 +3359,7 @@
             for (int i = 0; i < getDatasetCount(); i++) {
                 foundData = render(g2, dataArea, i, info, crosshairState)
                     || foundData;
+                render(savedG2, savedDataArea, i, info, crosshairState);
             }

             // draw foreground annotations
@@ -3393,6 +3394,7 @@
             for (int i = getDatasetCount() - 1; i >= 0; i--) {
                 foundData = render(g2, dataArea, i, info, crosshairState)
                     || foundData;
+                render(savedG2, savedDataArea, i, info, crosshairState);
             }

             // draw foreground annotations

The provided code is just a prove of concept to show where the bug exists. It is NOT a solution! So far I don't understand 100% of what the code does :(

David, you did commit this changes. Could you have a look or suggest some kind of solution for it?

hth,
- martin
matinh
 
Posts: 467
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: ShadowGenerator and Tooltips

Postby mkrauskopf » Mon Oct 10, 2011 10:21 pm

It is actually filed as a bug: https://sourceforge.net/tracker/?func=d ... tid=115494 which I've hit few months ago. So I it might be closed if/after the patch is applied.
mkrauskopf
 
Posts: 31
Joined: Thu May 27, 2010 4:23 pm

Re: ShadowGenerator and Tooltips

Postby matinh » Tue Oct 11, 2011 7:05 am

Ah, thanks. I hadn't seen this bug report before.

Which patch are you talking about? Is there already a fix for it? There is no patch attached to the bug report and I can't find any in your git repo.

- martin
matinh
 
Posts: 467
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: ShadowGenerator and Tooltips

Postby mkrauskopf » Tue Oct 11, 2011 7:09 am

...the patch...


I've talked about your patch :) Just wanted to point out the issue in the tracker. I do not have any patch for this issue.
mkrauskopf
 
Posts: 31
Joined: Thu May 27, 2010 4:23 pm

Re: ShadowGenerator and Tooltips

Postby matinh » Tue Oct 11, 2011 7:27 am

Oh... :)
I don't have a patch now. Maxbe later this day/week ;-)
matinh
 
Posts: 467
Joined: Fri Aug 11, 2006 10:08 am
Location: Austria

Re: ShadowGenerator and Tooltips

Postby david.gilbert » Fri Oct 14, 2011 6:05 am

I have it on my todo list to look at this bug as well, but I'm getting killed at work at the moment.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Ask your company to buy the JFreeChart Developer Guide
:idea: Check out other products sold by my company Object Refinery Limited
david.gilbert
JFreeChart Project Leader
 
Posts: 11358
Joined: Fri Mar 14, 2003 10:29 am


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 11 guests