Legende with VerticalBarChart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Eldar Lyn

Legende with VerticalBarChart

Post by Eldar Lyn » Tue Jul 30, 2002 10:18 am

Hi,

i need to know if it's possible to change the horizontal legende and instead of having the value under the bar to have a text?

Thanks in advance

Harald Faber

Re: Legende with VerticalBarChart

Post by Harald Faber » Tue Jul 30, 2002 11:04 am

Do you mean the legend or the category axis?

Eldar Lyn

Re: Legende with VerticalBarChart

Post by Eldar Lyn » Tue Jul 30, 2002 11:43 am

Yes, i need to rename it in order to present this graph like an histogram, for example:

First Bar -> 0-10
2nd Bar -> 11-20
3th bar -> 21-30

Harald Faber

Re: Legende with VerticalBarChart

Post by Harald Faber » Tue Jul 30, 2002 1:19 pm

Assuming I understand you right, you just have to customize the CategoryDataset a bit. The categories are the "names" below the bars.
Create your own, e.g.:

public class GraphData extends AbstractSeriesDataset implements CategoryDataset

and implement some required functions, such as getCategories() which returns all the Strings or whatever you want to see below the bars.

Eldar Lyn

Re: Legende with VerticalBarChart

Post by Eldar Lyn » Tue Jul 30, 2002 3:40 pm

Thx, i succeed of doing that i want, but i'm now facing an other problem: my bar are not sorted correctly, example:

Table
-------
Value || Id
12 || 1
16 || 2
23 || 3
29 || 4
16 || 5
12 || 6

My sql query is:
Select Id, Value from Table order by Id;

With SQL Plus, i've no problem, but when i draw the graph, it's completly mixed, like an order 2 - 3 - 5 - 1 - 6 - 4

Any ideas?

Eldar Lyn

Re: Legende with VerticalBarChart

Post by Eldar Lyn » Wed Jul 31, 2002 8:26 am


Locked