A discussion forum for JFreeChart (a 2D chart library for the Java platform).
-
flembo
- Posts: 4
- Joined: Fri Nov 19, 2004 8:14 am
- Location: Denmark
Post
by flembo » Fri Nov 19, 2004 8:32 am
I have a chartapplet drawing both bars and lines. I'm using a XYBarRenderer for the bars and a StandardXYItemRenderer for the lines. I want to to display ItemLabels and to do this I use the following code:
Code: Select all
renderer.setLabelGenerator(new StandardXYLabelGenerator());
renderer.setItemLabelsVisible(true);
It works perfectly with the lines but I can't make it work with the bars!
Why not???
-
angel
- Posts: 899
- Joined: Thu Jan 15, 2004 12:07 am
- Location: Germany - Palatinate
Post
by angel » Fri Nov 19, 2004 9:20 am
In your code you set the labels only for one renderer. Because you are using two renderer you have forgotten this for the second?
-
Guest
Post
by Guest » Fri Nov 19, 2004 11:07 am
No I'm using the posted code for both renderes! The following method is invoked from a While loop:
Code: Select all
public AbstractXYItemRenderer createRenderer(){
AbstractXYItemRenderer r;
if(getKurveType().equals("bar")){
r = new XYBarRenderer(0.20000000000000001D);
}
else {
r = new StandardXYItemRenderer();
((StandardXYItemRenderer)r).setPlotShapes(true);
}
r.setToolTipGenerator(new StandardXYToolTipGenerator("{0}: ({1}, {2})", new SimpleDateFormat("d-MMM-yyyy"), new DecimalFormat("0.00")));
r.setLabelGenerator(new StandardXYLabelGenerator());
r.setItemLabelsVisible(true);
return r;
}
-
flembo
- Posts: 4
- Joined: Fri Nov 19, 2004 8:14 am
- Location: Denmark
Post
by flembo » Fri Nov 19, 2004 11:09 am
Sorry! Forgot to log in

Flembo
-
Alisha
Post
by Alisha » Sat Nov 27, 2004 9:00 am
in case of bar graph
u r making ur renderer a XYBarRenderer
which does not provide "setItemIsVisible(boolean)" Method
chk it again
-
flembo
- Posts: 4
- Joined: Fri Nov 19, 2004 8:14 am
- Location: Denmark
Post
by flembo » Thu Dec 02, 2004 11:25 am
There is nothing wrong with the code. It compiles and runs perfectly, the setItemLabelsVisible(boolean) method is implemented in the AbstractRenderer. The XYBarRenderer extends the AbstractXYItemRenderer which again extends the AbstractRenderer so the method is provided
Flembo