The use of the setBackgroundPaint function from the ArcDialFrame class does not seem to have any effect.
Here is a sample code:
DialPlot plot = new DialPlot();
ArcDialFrame arcdialframe = new ArcDialFrame(-120, -300);
arcdialframe.setForegroundPaint(Color.GREEN);
arcdialframe.setBackgroundPaint(Color.RED);
plot.setDialFrame(arcdialframe);
The DialFrame is always dispayed without a background regardless of setBackgroundPaint.
Logged In: YES
user_id=1959397
Originator: NO
Hi,
i don't know how to submit patches.
I think the error is in
- org.jfree.chart.plot.dial.ArcDialFrame
- method draw(...)
- replace line 393 (in revision 665)
g2.setPaint(Color.lightGray);
with
g2.setPaint(this.backgroundPaint);
May be one should also change the comments for the properties 'backgroundPaint' and 'foregroundPaint' ...
I hope I'm right :)
Hi
To overcome this I just subclassed ArcDialFrame - here is my code:
import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.Area;
import java.awt.geom.Rectangle2D;
import org.jfree.chart.plot.dial.ArcDialFrame;
import org.jfree.chart.plot.dial.DialPlot;
/*
* The supplied one doesn't use the background color where drawing - fix it here
* rather than recompile source code of library.
*/
public class ArcDialFrameCustom extends ArcDialFrame {
Shape outerWindow = getOuterWindow(frame);
Area area1 = new Area(outerWindow);
Area area2 = new Area(window);
area1.subtract(area2);
g2.setPaint(this.getBackgroundPaint());
g2.fill(area1);
g2.setStroke(this.getStroke());
g2.setPaint(this.getForegroundPaint());
g2.draw(window);
g2.draw(outerWindow);
}
}