interval markers -- possible bug?

A free public discussion forum for the JFreeChart class library.

interval markers -- possible bug?

Postby Guest » Thu Apr 29, 2004 9:11 pm

David,

It seems as if there might be a bug with the new interval markers. When the marker is configured for a range that goes beyond the range of the axis it draws itself beyond the plot.

For example say you have a marker configured for 0-100 but the axis is only showing 0-50. In this case there marker will continue to draw past the end of the axis and plot.

I've noticed this with a category plots but I'm assuming the same thing might happen with xy plots.

I guess I can think of 2 possible solutions -

1) Have the marker affect the autorange of the axis so that it is always completly visible

2) Only draw the portion of the marker that is visible based on the current axis range.

It seems that 2) should be of higher priority because you can always control the axis range manually and therefore take steps to achieve 1) within your own code.

Tim
Guest
 

Postby david.gilbert » Wed May 05, 2004 9:47 am

I've added this to the bug database at SourceForge. ID = 948310.
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: 11383
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Wed May 05, 2004 5:33 pm

Fixed now in CVS (for 0.9.19).
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: 11383
Joined: Fri Mar 14, 2003 10:29 am

Re: interval markers -- possible bug?

Postby arkadye » Wed Nov 29, 2006 1:03 am

Anonymous wrote:David,

It seems as if there might be a bug with the new interval markers. When the marker is configured for a range that goes beyond the range of the axis it draws itself beyond the plot.

For example say you have a marker configured for 0-100 but the axis is only showing 0-50. In this case there marker will continue to draw past the end of the axis and plot.

I've noticed this with a category plots but I'm assuming the same thing might happen with xy plots.

I guess I can think of 2 possible solutions -

1) Have the marker affect the autorange of the axis so that it is always completly visible

2) Only draw the portion of the marker that is visible based on the current axis range.

It seems that 2) should be of higher priority because you can always control the axis range manually and therefore take steps to achieve 1) within your own code.

Tim


It seems like this bug with interval markers is back in version 1.0.3. I had version 1.0.1 before and it worked fine both for category renderer and XY renderer. Now I've upgraded to 1.0.3 and it doesn't work anymore.
arkadye
 
Posts: 9
Joined: Fri May 19, 2006 7:02 pm

Postby david.gilbert » Wed Nov 29, 2006 1:11 pm

Thanks for the report - I can reproduce the problem, so finding a fix shouldn't be too hard. I only see the problem with the CategoryPlot, not the XYPlot.
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: 11383
Joined: Fri Mar 14, 2003 10:29 am

Postby david.gilbert » Wed Nov 29, 2006 1:33 pm

Here's the fix I've committed to CVS for the next release (1.0.4):

Code: Select all
Index: source/org/jfree/chart/plot/CategoryPlot.java
===================================================================
RCS file: /cvsroot/jfreechart/jfreechart/source/org/jfree/chart/plot/CategoryPlot.java,v
retrieving revision 1.23.2.12
diff -u -r1.23.2.12 CategoryPlot.java
--- source/org/jfree/chart/plot/CategoryPlot.java   22 Nov 2006 11:36:12 -0000   1.23.2.12
+++ source/org/jfree/chart/plot/CategoryPlot.java   29 Nov 2006 12:30:58 -0000
@@ -140,6 +140,8 @@
  *               getCategoriesForAxis() methods (DG);
  * 22-Nov-2006 : Fire PlotChangeEvent from setColumnRenderingOrder() and
  *               setRowRenderingOrder() (DG);
+ * 29-Nov-2006 : Fix for bug 1605207 (IntervalMarker exceeds bounds of data
+ *               area) (DG);
  *
  */

@@ -2364,6 +2366,10 @@
       
         Map axisStateMap = drawAxes(g2, area, dataArea, state);

+        // don't let anyone draw outside the data area
+        Shape savedClip = g2.getClip();
+        g2.clip(dataArea);
+
         drawDomainGridlines(g2, dataArea);

         AxisState rangeAxisState = (AxisState) axisStateMap.get(getRangeAxis());
@@ -2387,8 +2393,7 @@

         // now render data items...
         boolean foundData = false;
-        Shape savedClip = g2.getClip();
-        g2.clip(dataArea);
+
         // set up the alpha-transparency...
         Composite originalComposite = g2.getComposite();
         g2.setComposite(AlphaComposite.getInstance(
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: 11383
Joined: Fri Mar 14, 2003 10:29 am

Postby arkadye » Wed Nov 29, 2006 9:22 pm

david.gilbert wrote:Thanks for the report - I can reproduce the problem, so finding a fix shouldn't be too hard. I only see the problem with the CategoryPlot, not the XYPlot.


The problem with XYPlot is different. The marker doesn't go outside of the plot but the marker label, which is set to be in the center of the marker, doesn't show up, probably because it's calculated to be outside of the plot. In CategoryPlot both marker went outside of the plot and label didn't show up.

Thanks.
arkadye
 
Posts: 9
Joined: Fri May 19, 2006 7:02 pm

Postby SomeOtherUser » Wed Dec 06, 2006 12:30 am

From the code posted to fix the bug:
Code: Select all
...
// don't let anyone draw outside the data area
...


What if you do want to draw outside the data area? In my case, I'd like to draw markers as arrows on the outer edge of the plot instead of as lines across it. If I change the clip, they draw fine. Is there another way to do it? What is the correct way?

Thank you.
SomeOtherUser
 
Posts: 13
Joined: Thu Apr 06, 2006 7:55 pm

Postby EricPascual » Wed Mar 14, 2007 4:41 pm

Hello,

It seems that the problem is always here in 1.0.4.

I'm using Gantt chart and add a semi-opaque interval marker every two days to help viewing day limits. When zooming the plot with the mouse and time axis ends are not at the limit between two days, the marker is painted over the category axis (or the right part of the window) too. In other words, it seems that markers painting is not clipped by the data area of the plot.

You can find a snapshot to illustrate this here :
http: //evfpas.chez-alice.fr/gannt-marker-bug.png

(remove the blank betwwen http: and the slashes : I have been forced to insert it because my post was rejected if not, since URLs are not allowed to new users)

Best regards
EricPascual
 
Posts: 2
Joined: Wed Mar 14, 2007 4:30 pm

Postby david.gilbert » Wed Mar 14, 2007 6:27 pm

I'm pretty sure this is fixed in CVS (on the STABLE_1-0-0 branch), just in the last day or two. I'm out of time for today, but I'll try to double check tomorrow that this really is fixed.
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: 11383
Joined: Fri Mar 14, 2003 10:29 am

Postby EricPascual » Thu Mar 15, 2007 11:17 am

david.gilbert wrote:I'm pretty sure this is fixed in CVS (on the STABLE_1-0-0 branch), just in the last day or two. I'm out of time for today, but I'll try to double check tomorrow that this really is fixed.


Thanks for the quick feedback David.
EricPascual
 
Posts: 2
Joined: Wed Mar 14, 2007 4:30 pm

Postby uvoigt » Wed Mar 21, 2007 10:44 am

Thanx for the fix. I am desperatly waiting for 1.0.5 :)
uvoigt
 
Posts: 166
Joined: Mon Aug 23, 2004 10:50 am
Location: Germany


Return to JFreeChart - General

Who is online

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