plot background image

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

plot background image

Post by David » Mon Aug 26, 2002 8:53 pm

First off, thanks for this api. It's been a real timesaver.

I have no problem setting the background image of a JFreeChart, but I'm having trouble setting the background image of a plot.

They want the chart to have a solid color, and the plot area to have an image as the background.

Thanks in advance.



chart.setBackgroundPaint(getColor(7));

CategoryPlot plot = chart.getCategoryPlot();

plot.setRenderer ( new LineAndShapeRenderer (LineAndShapeRenderer.LINES ) );
plot.setBackgroundPaint(null);
plot.setBackgroundImage( icon.getImage() );
plot.setBackgroundAlpha( (float) (1.0) );
plot.setSeriesPaint( new Paint [] { Color.gray } );

ValueAxis valueaxis = plot.getRangeAxis();
VerticalNumberAxis vertnumaxis = (VerticalNumberAxis) plot.getRangeAxis();
vertnumaxis.setAutoRangeIncludesZero(false);

plot.setDataset(dataset);

David Gilbert

Re: plot background image

Post by David Gilbert » Tue Aug 27, 2002 10:13 pm

Do you see an image at all? The alpha value for the image is hard-coded at a low value, so it will appear a bit washed out. I've changed it to use the backgroundAlpha setting, which should give some more control.
I've modified TimeSeriesDemo4 to include a background plot image as an example, it will be in CVS very soon.

Regards,

DG.

David

Re: plot background image

Post by David » Wed Aug 28, 2002 5:06 am

Thanks for the reply.

No, I don't see an image with a CategoryPlot. However I am using a washed out image to begin with.

On page 96 of your documentation, I noticed you have a backgroundImageAlpha for a JFreeChart object. It sounds like you are going to modify backgroundAlpha to handle a similar role for Plot.

Look forward to seeing the new TimeSeriesDemo4.

Really appreciate you working on this.

Ralf Stark

Re: plot background image

Post by Ralf Stark » Mon Sep 23, 2002 9:54 am

Hi David,

I have a problem in setting the background image of a CategoryPlot (in XYPlot it works fine).

Is this maybe a bug, because if I simply add the line

chart.setBackgroundImage(JFreeChart.INFO.getLogo());

in the method createVerticalStacked3DBarChart (JFreeChartDemoBase.java) there is also no background image?

Thanks in advance,
Ralf

Locked