Hi,
I have a problem displaying the background image
if I display by Chart the first time, after I started my Tomcat, the background will not be displayed.
After i update my browser window, or start the application in a new browser, the background will be displayed correctly.
Have I made a mistake in displaying the chart ?
---- source -----
public JFreeChart createChart (){
...
JFreeChart chart = ChartFactory.createTimeSeriesChart("","Daimler Chrysler AG" ,"",subData1,false);
String chartbackground = "C:\Charttemplates\shorttermTS.gif";
Image backgroundImage = Toolkit.getDefaultToolkit().getImage(chartbackground);
chart.setBackgroundImage(backgroundImage);
chart.setBackgroundImageAlpha( (float) (1.0));
...
return chart;
}
public void doGet(...') {
JFreeChart chart = createChart();
OutputStream out = response.getOutputStream();
ChartUtilities.writeChartAsPNG(out, chart, width, height);
out.close();
}
Thanks
Joachim Schuler
problem displaying the background image
Re: problem displaying the background image
I usually use the ImageIcon class to load images, it tends to be easier. See this link for more info:
http://java.sun.com/docs/books/tutorial ... mages.html
Regards,
DG.
http://java.sun.com/docs/books/tutorial ... mages.html
Regards,
DG.
Re: problem displaying the background image
Thanks a lot,
this solved by problem.
now I use the mentioned ImageIcon class.
this solved by problem.
now I use the mentioned ImageIcon class.
Re: problem displaying the background image
To avoid a dependency on Swing one can also use the utility class util.ImageHelper from the Cewolf project which uses a loading mechanism equal to the one of the ImageIcon class.
Re: problem displaying the background image
Hi,
how exactly did you use the ImageIcon class. My problem is, that there only is a method setBackgroundImage(Image image), and i can not convert ImageIcon to Image.
Thanx, Chris.
how exactly did you use the ImageIcon class. My problem is, that there only is a method setBackgroundImage(Image image), and i can not convert ImageIcon to Image.
Thanx, Chris.