Legend

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

Legend

Post by Alex » Sat Jun 01, 2002 11:57 am

Your program is very good , but there are some questions ...
1) I can't change "standart legend " ("series 1, series 2 ,"series 3 ") ... how I can do it?

2) I can't change scale ( "0.25 , 0.5, 0,75 ,1 , 1.25 , 1.5, 1.75 , 2 ") to
("1 ,2 , ...") ... how I can do it ?

I haven't money to buy a documentation for this great program ... but I need to know how to do it ... I'll be very pleasure for any help from you ...

David Gilbert

Re: Legend

Post by David Gilbert » Sun Jun 02, 2002 6:22 am

Alex wrote:
> 1) I can't change "standart legend " ("series 1, series 2
> ,"series 3 ") ... how I can do it?

The series names come from the dataset, so the method to change them depends on which dataset class you are using. As an example, if you are using DefaultCategoryDataset, you need to use this method:

public void setSeriesNames(String[] seriesNames)

...which means you have to set all the series names at once (a new method has been added for the next release to set the name for one series at a time).

> 2) I can't change scale ( "0.25 , 0.5, 0,75 ,1 , 1.25 , 1.5,
> 1.75 , 2 ") to
> ("1 ,2 , ...") ... how I can do it ?

If you need the scale to show integer values only, you can try this (the exact code depends on what type of plot you are dealing with):

CategoryPlot plot = (CategoryPlot)chart.getPlot();
NumberAxis verticalAxis = (NumberAxis)plot.getRangeAxis();
verticalAxis.setStandardTickUnits(TickUnits.createIntegerTickUnits());

Regards,

DG.

Alex

Re: Legend

Post by Alex » Mon Jun 03, 2002 2:47 pm

thanks

Locked