interval markers -- possible bug?
interval markers -- possible bug?
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 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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I've added this to the bug database at SourceForge. ID = 948310.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Fixed now in CVS (for 0.9.19).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: interval markers -- possible bug?
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.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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


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.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.
Thanks.
-
- Posts: 13
- Joined: Thu Apr 06, 2006 7:55 pm
From the code posted to fix the bug:
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.
Code: Select all
...
// don't let anyone draw outside the data area
...
Thank you.
-
- Posts: 2
- Joined: Wed Mar 14, 2007 4:30 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
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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
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
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


-
- Posts: 2
- Joined: Wed Mar 14, 2007 4:30 pm