Error using setPosition command on chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
ajgwin
Posts: 18
Joined: Mon Mar 17, 2003 4:53 pm

Error using setPosition command on chart

Post by ajgwin » Mon Mar 17, 2003 10:21 pm

When I try to run this command:

chart.getTitle(0).setPosition(TextTitle.RIGHT);

I get these errors:

Exception occurred during event dispatching:
java.lang.RuntimeException: TextTitle.draw(...) - invalid title position.
at com.jrefinery.chart.TextTitle.draw(Unknown Source)
at com.jrefinery.chart.JFreeChart.draw(Unknown Source)
at com.jrefinery.chart.ChartPanel.paintComponent(Unknown Source)

yet when I run:

chart.getTitle(0).setPosition(TextTitle.BOTTOM);

I don't get any errors except that the title appears on the top of the chart and not on the bottom. If I set it to TOP, it also appears on the TOP. If I set it to LEFT, I get the same error as setting it to the RIGHT. Any ideas? I really want to have sort of a list on the right hand side of my chart. I can do this:

TextTitle title1 = new TextTitle("Land");
TextTitle title2 = new TextTitle("Mountain");
TextTitle title3 = new TextTitle("Water");
TextTitle title4 = new TextTitle("Dense Trees");
TextTitle title5 = new TextTitle("Thin Trees");
TextTitle title6 = new TextTitle("Building");
TextTitle title7 = new TextTitle("Tower");
TextTitle title8 = new TextTitle("Pole");
TextTitle title9 = new TextTitle("Antenna");

chart.addTitle(title1);
chart.addTitle(title2);
chart.addTitle(title3);
chart.addTitle(title2);
chart.addTitle(title5);
chart.addTitle(title6);
chart.addTitle(title7);
chart.addTitle(title8);
chart.addTitle(title9);

So, what I really want is a list of all these values down the righthand side of the chart. Does anyone have any ideas on how to do this? Will this way work? Thanks.

Allyson

ajgwin
Posts: 18
Joined: Mon Mar 17, 2003 4:53 pm

Post by ajgwin » Fri Mar 21, 2003 4:21 pm

Does anyone know the answer to this? I really need some help on this today. I am desperate. Thanks.

Allyson

ajgwin
Posts: 18
Joined: Mon Mar 17, 2003 4:53 pm

Post by ajgwin » Mon Mar 24, 2003 5:40 pm

Anyone? Help.

Allyson

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Mar 24, 2003 8:44 pm

The TextTitle class can only be displayed at the top and bottom of the chart at present. Basically the code didn't get completely finished before I moved on to something else (that happens a lot!). It sounds like there could even be a bug for the BOTTOM setting...I'll check it out.

I think it won't be possible to get the text titles to display what you want, but why not implement your own TableTitle or GridTitle that does what you want. After all, a title is just some item that fills a rectangular region in the chart area...

Regards,

Dave Gilbert

P.S. I have your e-mail, I'll try to look at it after I've finished going through the forum posts.

Locked