Possible rendering anomaly when panning zoomed chart

A free public discussion forum for the JFreeChart class library.

Possible rendering anomaly when panning zoomed chart

Postby John Matthews » Wed Aug 22, 2012 8:57 pm

I noticed this report of a possible rendering anomaly when panning a zoomed time series chart. The effect can be reproduced using this example and the release JARs for jfreechart-1.0.14 & jcommon-1.0.17. Can anyone see an obvious flaw in the example?
John Matthews
 
Posts: 207
Joined: Wed Sep 12, 2007 3:18 pm

Re: Possible rendering anomaly when panning zoomed chart

Postby david.gilbert » Wed Aug 22, 2012 10:59 pm

John Matthews wrote:Can anyone see an obvious flaw in the example?


No, the example is fine - and excellent for reproducing the defect (just be sure to right-click on the chart and select 'Zoom In' > 'Domain Axis' before panning around).

I've spent some time debugging, and the issue is in the RendererUtilities.findLiveItems() method, which is trying to exclude data items that cannot appear on the chart. For the case where the dataset has no guaranteed x-value ordering, and all the x-values are outside the axis range (at least one lower than the lower bound, and at least one higher than the upper bound), the method is not returning the correct item indices. I'm trying to find a good fix for this.
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: 11381
Joined: Fri Mar 14, 2003 10:29 am

Re: Possible rendering anomaly when panning zoomed chart

Postby david.gilbert » Wed Aug 22, 2012 11:04 pm

I don't have more time to look at this tonight, but this patch probably solves the issue:

Code: Select all
Index: RendererUtilities.java
--- RendererUtilities.java Remotely Modified (Based On HEAD)
+++ RendererUtilities.java Locally Modified (Based On LOCAL)
@@ -138,7 +138,7 @@
             int index = 0;
             // skip any items that don't need including...
             double x = dataset.getXValue(series, index);
-            while (index < itemCount && (x < xLow || x > xHigh)) {
+            while (index < itemCount && x < xLow) {
                 index++;
                 if (index < itemCount) {
                     x = dataset.getXValue(series, index);
@@ -232,7 +232,7 @@
             int index = itemCount - 1;
             // skip any items that don't need including...
             double x = dataset.getXValue(series, index);
-            while (index >= 0 && (x < xLow || x > xHigh)) {
+            while (index >= 0 && x > xHigh) {
                 index--;
                 if (index >= 0) {
                     x = dataset.getXValue(series, index);
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: 11381
Joined: Fri Mar 14, 2003 10:29 am

Re: Possible rendering anomaly when panning zoomed chart

Postby John Matthews » Thu Aug 23, 2012 5:54 am

Thank you for looking at this! I've cited a link to this thread. Please let me know if I should do anything else, e.g. file a bug report.
John Matthews
 
Posts: 207
Joined: Wed Sep 12, 2007 3:18 pm

Re: Possible rendering anomaly when panning zoomed chart

Postby david.gilbert » Thu Aug 23, 2012 8:43 pm

The fix has been committed in SVN for the upcoming 1.0.15 release. Thanks for reporting the issue.
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: 11381
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 14 guests