Possible rendering anomaly when panning zoomed chart
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Possible rendering anomaly when panning zoomed chart
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).John Matthews wrote:Can anyone see an obvious flaw in the example?
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Possible rendering anomaly when panning zoomed chart
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Possible rendering anomaly when panning zoomed chart
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.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Possible rendering anomaly when panning zoomed chart
The fix has been committed in SVN for the upcoming 1.0.15 release. Thanks for reporting the issue.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program