Is there any way to draw a border around the whole chart?
Thanks.
draw border of the chart
june -
I posted the same question a while back.. I never did get it resolved
If you get a solution, can you email it to me (tomMazzotta@yahoo.com).
Thanks in advance.. I'll do the same
I posted the same question a while back.. I never did get it resolved
If you get a solution, can you email it to me (tomMazzotta@yahoo.com).
Thanks in advance.. I'll do the same
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
It's not a feature that is supported yet, although it is easy to add. Put the following code in the draw method of the JFreeChart class to draw a red border around a chart:
Of course, it needs to be generalised, but you get the idea.
Code: Select all
// draw the chart background...
if (backgroundPaint != null) {
g2.setPaint(backgroundPaint);
g2.fill(chartArea);
// new code below...
Rectangle2D borderArea = new Rectangle2D.Double(chartArea.getX(), chartArea.getY(),
chartArea.getWidth() - 1.0, chartArea.getHeight() - 1.0);
g2.setPaint(Color.red);
g2.setStroke(new BasicStroke(1.0f));
g2.draw(borderArea);
}
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:
I've since generalised the code and you will find this feature supported in 0.9.10.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader

