Hi,
I see there is an ImageBar to set an image for the bar chart. But is it possible to set a different image for each point?
I tried to create 3 ImageBar series but then I had the case that these were stacked side-to-side. I wanted to overlay, but I just got this side-to-site resulting in squashed images.
Anyway around that to change the point image or have the multiple ImageBar Series overlapping and not side-to-side??
Many Thanks,
Steven.
Different Image for each Chart Point
-
- Newbie
- Posts: 21
- Joined: Tue Nov 15, 2011 12:00 am
Re: Different Image for each Chart Point
Hi Steven,
You can use the BarStyleResolver to change the series' Image associated each time the event is called (before each bar drawing) as follows:
You can use the BarStyleResolver to change the series' Image associated each time the event is called (before each bar drawing) as follows:
Code: Select all
series.setBarStyleResolver(new CustomBar.BarStyleResolver() {
@Override
public BarStyle getStyle(ISeries series, int valueIndex, BarStyle style) {
String imStr = (valueIndex % 2 == 0) ? "images/barimage1.jpg" : "images/barimage2.jpg";
((ImageBar)series).setImage(ImageUtils.toImage((new ImageIcon(ChartSamplePanel.class.getResource(imStr))).getImage()));
return style;
}
});
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |