I'm using jfree Chart to draw some points for positioning.
The problem is that the diagram is drawn on a grey surface instead on my floor plan. So I tried to use the background image, but this put the image in the background and is not usable as I would need it.
I would like to replace the the grey background by an image. How can I do this?
I use a ChartPanel to draw the chart on it. The problem is that this allows only colors as background an no images. I tried to set a picture to the chart as can be seen in the code below, but this set only background image and draw the chart in the foreground on a grey area.
JFreeChart chart = ChartFactory.createScatterPlot("XY Chart", // Title
"x-axis", // x-axis Label
"y-axis", // y-axis Label
dataset, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
false, // Show Legend
false, // Use tooltips
false // Configure chart to generate URLs?
);
BufferedImage image = null;
try {
File url = new File(System.getProperty("user.dir").toString()+"\\1.jpg");
image = ImageIO.read(url);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
chart.setBackgroundImage(image);