Background-color of the image

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

Background-color of the image

Post by quelisan » Thu Jul 15, 2004 7:28 am

I´ve seen in some examples that it is possible to change the color of the background of the png image. It´s not concerned with the background of the graph (space between the X-axis and the Y-axis): I want to change the color of the rest of the image.

(Sorry for my English, I hope you can understand what I mean)

nicky
Posts: 44
Joined: Mon Apr 05, 2004 1:45 am
Location: Brisbane, Australia

Post by nicky » Thu Jul 15, 2004 10:40 pm

I think this is what you want.

Code: Select all

public static final Color DEFAULT_COLOR_BACKGROUND =
		new Color(236,233,216);

JFreeChart chart = new JFreeChart("title", "font", plot, false);
chart.setBackgroundPaint(DEFAULT_COLOR_BACKGROUND);
Nicky

quelisan

Post by quelisan » Fri Jul 16, 2004 9:34 am

Thank you. I´m already using this property, but I´m using it with a plot-object instead a chart-object. I couldn´t do it with a chart-object because of an error in compilation...

Otherwise, I´m using:

plot.setBackgroundPaint(new Color(243, 249, 255));

but I can only see in black the background of my graph (between the X-axis and the Y-axis): the rest of the picture is white!!!! (the space between the axis and the border of the png image)

BigWillyStyle42
Posts: 58
Joined: Wed Jun 02, 2004 1:37 pm

Post by BigWillyStyle42 » Fri Jul 16, 2004 3:41 pm

The color you've specified above is close to white, that's what you're seeing. Black is either Color.black or new Color(0,0,0).

Locked