Hello ,
need help
j'ai besoin d'une fonction pour dessiner des graphe car je dois afficher plusieurs graphes a la fois mai j'ai un probleme lors de l'appelle du fonction
voila mon code (essai) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public class FontionGraph {
    public Object dessin(int t[]){
       JPanel pnl = new JPanel();
       DefaultCategoryDataset data = new DefaultCategoryDataset();
       for ( int i=0; i<t.length ;i++){
          String a = "Porteuse"+i;
         data.addValue(t[i], a , a);
       }
     JFreeChart barChart = ChartFactory.createBarChart(
        "Meilleur Individu", "","", data, PlotOrientation.VERTICAL, true, true, false);
     ChartPanel cPanel = new ChartPanel(barChart);
     pnl.add(cPanel,BorderLayout.NORTH);
     return pnl;
     } 
 
    public static void main(String[] args) {
        int tab[] = {1,6,8,7};
        JFrame fenetre = new JFrame();
        fenetre.setTitle("Graphe");
        fenetre.setSize(500, 500);
        JPanel pane =dessin(tab);//j'ai un probleme dans cette ligne !!!
 
        fenetre.setVisible(true);
    }
 
}