legend and diplay series name in the legend

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

legend and diplay series name in the legend

Post by mario » Fri Mar 22, 2002 3:18 pm

MY PROBLEM IS THAT I SEE ONLY ONE SERIES NAME IN THE LEGEND EVEN IF THIS WORK FINE

seriesNameList.add("Mario");
seriesNameList.add("Anna");
seriesNameList.add("Federica");


thanks to every one could help me !!

David Gilbert

Re: legend and diplay series name in the legend

Post by David Gilbert » Mon Mar 25, 2002 9:41 am

You'll have to supply a little more information about where seriesNameList comes from.

Regards,

DG.

mario

Re: legend and diplay series name in the legend

Post by mario » Mon Mar 25, 2002 9:57 am

/**
* A utility method that returns a list of series names ("Series 1", "Series 2" etc.). The
* number of series matches the size of the data array. String objects are used to
* represent the series names. This method is called by constructors that do not specify
* series names.
*/


public static List seriesNameListFromDataArray(Number[][] data) {

int seriesCount = data.length;
List seriesNameList = new ArrayList( ) ;


seriesNameList.add("Daniele "+"Anna");
seriesNameList.add("Mario "+"Anna");
return seriesNameList ;


}



this is the code in Class DefaultCategoryDataSource

thanks a lot

David Gilbert

Re: legend and diplay series name in the legend

Post by David Gilbert » Mon Mar 25, 2002 10:15 am

OK...it looks as though I've dropped that method from the latest version, though I don't remember working on it...that's a worry!

Anyway, I'd recommend that you use this method to set all the series names at once:

public void setSeriesNames(String[] seriesNames)

I should probably add a new method for the next version:

public void setSeriesName(int series, String name)

Hope that helps,

Regards,

Dave Gilbert.

mario

Re: legend and diplay series name in the legend

Post by mario » Mon Mar 25, 2002 10:51 am

this work very well :



String [] seriesName1 = {"Alfa","Beta" , "Gamma"} ;

DefaultCategoryDataSource test = new DefaultCategoryDataSource( data ) ;



test.setSeriesNames( seriesName1 ) ;


but I have the visualization problem in the legend at the right of the graph : i see only the first element of the series " Alfa"

David Gilbert

Re: legend and diplay series name in the legend

Post by David Gilbert » Mon Mar 25, 2002 11:01 am

Can you e-mail me a screen copy showing the problem?

Regards,

DG.

Locked