Hi All,
I want to add an image as background in the plot area of a combined chart(timeseries chart, vertical bar chart). How can I add it? Which java I need to modify? Thx!
Regards,
Gloria
how to add background image
Re: how to add background image
Use the setBackgroundImage(...) method in the plot class. I don't think I've ever checked that it works for combined plots...it should, as long as you add the image to the relevant subplot.
Regards,
Dave Gilbert
Regards,
Dave Gilbert
Re: how to add background image
Hi Dave,
I have checked the plot class, but I don't know how should I modify it to add my own background image...
public void setBackgroundImage(Image image) {
this.backgroundImage = image;
notifyListeners(new PlotChangeEvent(this));
}
Is that to change the variable image?
Thx!
Gloria
I have checked the plot class, but I don't know how should I modify it to add my own background image...
public void setBackgroundImage(Image image) {
this.backgroundImage = image;
notifyListeners(new PlotChangeEvent(this));
}
Is that to change the variable image?
Thx!
Gloria
Re: how to add background image
You don't need to modify the plot class. Just use that method to pass in a reference to your image, and the plot will display it for you.
Regards,
Dave
Regards,
Dave
Re: how to add background image
Hi Dave,
I've added these in my servlet, but it can't work, I can't see any image
Image image = Toolkit.getDefaultToolkit().getImage("D:/wallpaper/wallpaper1.jpg");
// make a combined plot...
CombinedXYPlot plot = new CombinedXYPlot(new HorizontalDateAxis("Date"), CombinedXYPlot.VERTICAL);
plot.add(subplot1, 3); // a weight of 3 (75%)
plot.add(subplot2, 1); // a weight of 1 (25%)
plot.setBackgroundImage(image);
Anything wrong in my code?
Thx
Regards,
Gloria
I've added these in my servlet, but it can't work, I can't see any image
Image image = Toolkit.getDefaultToolkit().getImage("D:/wallpaper/wallpaper1.jpg");
// make a combined plot...
CombinedXYPlot plot = new CombinedXYPlot(new HorizontalDateAxis("Date"), CombinedXYPlot.VERTICAL);
plot.add(subplot1, 3); // a weight of 3 (75%)
plot.add(subplot2, 1); // a weight of 1 (25%)
plot.setBackgroundImage(image);
Anything wrong in my code?
Thx
Regards,
Gloria
Re: how to add background image
Hi Dave,
I can add the image finally, I found that I need to add the image to each subplot seperately. Thx!
Regards,
Gloria
I can add the image finally, I found that I need to add the image to each subplot seperately. Thx!
Regards,
Gloria