new features : background image, icons

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Fabien D.

new features : background image, icons

Post by Fabien D. » Wed Nov 29, 2000 9:33 am

Hi,
it would be great if we can add background image and icons to a chart.

Ron

RE: new features : background image, icons

Post by Ron » Wed Nov 29, 2000 3:20 pm

Better yet, I would like the capability of setting a JFreeChartPanel component opaque so that an existing background image shows behind a chart.

David Gilbert

RE: new features : background image, icons

Post by David Gilbert » Thu Nov 30, 2000 1:48 pm

There's a couple of approaches to adding a background image.

(1) If you just want the image to appear on screen, then JFreeChartPanel can be modified to draw an image just before it draws the chart. You'd have to decide whether you want the image scaled or not, but otherwise I can't think of any problems. Just add the code in the paintComponent(...) method.

(2) If you want the image to appear anywhere that the chart is drawn (screen, printer, BufferedImage or arbitrary Graphics2D) then it needs to be part of the JFreeChart class and added in the draw() method. Again, you need to decide whether the image needs scaling. Images won't always look good on the printer, so you'd want to be able to disable the image temporarily (a simple flag).

Option 2 is more general, so probably is better. Anyone else have any thoughts (or time to write the code?)

DG.

Locked