How to change Category Label?

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

How to change Category Label?

Post by Jason » Wed Mar 13, 2002 1:40 am

Dear Sir,

Can anyone tell me how to change category label? I want to change from category1, category2...to Number1...number2.....I did search the doc before...something about Default....(String[],Object[][], data) constructor. However, I can't find this class?? Therefore, I hope someone give a hand, please...thanx a lot

David Gilbert

Re: How to change Category Label?

Post by David Gilbert » Wed Mar 13, 2002 10:24 am

Hi Jason,

Take a look through the methods in the DefaultCategoryDataset class. It's in the JCommon class library, which you can download from:

http://www.object-refinery.com/jcommon/index.html

JFreeChart includes the JCommon runtime jar file, but not the source code.

There's a method setCategories(...) in that dataset, to which you pass an array of Objects (make sure it is the same number of objects as categories). Or you can specify the categories in the constructor. The toString() method is used to convert each category object to a label on the chart.

Regards,

Dave Gilbert

Locked