Interval markers don't paint

A free public discussion forum for the JFreeChart class library.

Interval markers don't paint

Postby joef » Fri Jan 26, 2007 7:30 pm

Hello, I have an interval marker:

Code: Select all
categoryPlot.addRangeMarker(new IntervalMarker(max.doubleValue(), Double.MAX_VALUE, maxColor, new BasicStroke(), null, null, 1f),
    Layer.BACKGROUND);


When drawing the IntervalMarker in AbstractCategoryItemRenderer.drawRangeMarker(), the code uses NumberAxis.valueToJava2D(double, Rectangle2D, RectangleEdge) to convert to the Graphic's coordinate space. The problem is that when "value" is Double.MAX_VALUE or even Integer.MAX_VALUE I get "-Infinity" or a very large negative # (calculated by:

Code: Select all
min + ((value - axisMin) / (axisMax - axisMin)) * (max - min)
)

and the interval doesn't draw, probably because the "rect" calculated in AbstractCategoryItemRenderer.drawRangeMarker() is wrong (Math.abs(end2d - start2d) probably doesn't help) or being thrown out by Swing 2D.

My question is: do you think it's appropriate to "clip" the "start2d" and "end2d" to the "dataArea"'s bounds before calculating the rect and painting it? I'm not sure if that would not give you what you want if the Paint for the interval was a GradientPaint...or maybe there is another solution?

Right now I just avoid all this by passing Short.MAX_VALUE instead. But I figured you'd want it to know about this. BTW, this worked before JFreeChart 1.0.3.

Thanks,
joe
joef
 
Posts: 6
Joined: Thu Jul 13, 2006 3:06 pm

Postby david.gilbert » Mon Jan 29, 2007 5:57 pm

Thanks for the report. I've added this to the bug tracker so I don't forget about it, and will take a look when I get a chance:

https://sourceforge.net/tracker/index.p ... tid=115494
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 joef » Fri Mar 09, 2007 5:52 pm

Hey just wanted to say Sergei's patch works and to thank you for merging it into head. I replaced the 2 files and recompiled 1.0.4 since I'm guessing 1.0.5 will be out some time in May.

Thanks again,
joe
joef
 
Posts: 6
Joined: Thu Jul 13, 2006 3:06 pm

Postby david.gilbert » Fri Mar 09, 2007 6:19 pm

joef wrote:I'm guessing 1.0.5 will be out some time in May.


Hopefully sooner, perhaps even by the end of March.
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


Return to JFreeChart - General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 1 guest

cron