Probleme with jfreechart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
marouene_
Posts: 15
Joined: Fri Apr 01, 2011 3:32 pm
antibot: No, of course not.

Probleme with jfreechart

Post by marouene_ » Wed Apr 13, 2011 3:21 pm

Good morning,
i have a little probleme :

i used timeseries to show my graphe , this is my code :

Code: Select all

public JFreeChart tracercourbe (String Hour, String debit, String table ,String title,String ordonné,String where) throws SQLException, IOException {
    	connexionBD con = new connexionBD();
        TimeSeries series = con.dessiner(Hour,debit,table,where);
        final TimeSeriesCollection dataset = new TimeSeriesCollection(series);
        dataset.addSeries(series);
        dataset.setDomainIsPointsInTime(true);
        final String chartTitle = ""+title+"";
        final JFreeChart chart = ChartFactory.createTimeSeriesChart(
            chartTitle,
            "Time", 
            ""+ordonné+"",
            dataset,
            true,
            true,
            false
        );


But when i loot into my graph i have in the legend two colors (blue and red) , i don't know how can i delete the red one

this is my picture

Image

mkivinie
Posts: 51
Joined: Wed Jul 06, 2005 8:35 am

Re: Probleme with jfreechart

Post by mkivinie » Thu Apr 14, 2011 11:42 am

You are adding the series twice into the dataset.

First in the constructor:

Code: Select all

        final TimeSeriesCollection dataset = new TimeSeriesCollection(series);
and immediately again:

Code: Select all

        dataset.addSeries(series);
Remove the second entry and you should be fine.

marouene_
Posts: 15
Joined: Fri Apr 01, 2011 3:32 pm
antibot: No, of course not.

Re: Probleme with jfreechart

Post by marouene_ » Thu Apr 14, 2011 4:28 pm

ty it work :)
ty :)

have you an idea about the relation between jfreechart and sql ? i have a problem :)

Locked