IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

Affichage de graphes


Sujet :

AWT/Swing Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2015
    Messages : 132
    Par défaut Affichage de graphes
    bonjour,
    j'ai travailler sur une l'interface graphique suivante.
    Nom : Capture 9.PNG
Affichages : 102
Taille : 14,1 Ko

    lorsque je sélectionne deux checkbox ou trois checkbox en meme temps(par exemple :status,disfonctionnement par fournisseurs, impact) ,seul la dernière s'affiche (dans l'exemple fentre de "impact").
    je veux afficher chaque graphe sur une fenetre indépendant .
    merci d'avance.

  2. #2
    Modérateur
    Avatar de wax78
    Homme Profil pro
    R&D - Palefrenier programmeur
    Inscrit en
    Août 2006
    Messages
    4 098
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : R&D - Palefrenier programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 4 098
    Par défaut
    C'est bien joli de nous montrer ton interface... mais sans aucun morceau de code (qui n'as pas besoin de reprendre tout le contenu inutile) personne ne va t'aider.
    (Les "ça ne marche pas", même écrits sans faute(s), vous porteront discrédit ad vitam æternam et malheur pendant 7 ans)

    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2015
    Messages : 132
    Par défaut
    merci pour votre réponse. j'ai oublié de vous montrer le code.
    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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
     
     
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
     
     
            if (jCheckBox1.isSelected()) {
                    try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql = "Select Status,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper(Status)";
     rs = statement.executeQuery(sql);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs.next()){      
          pieDataset.setValue( rs.getString("Status"),rs.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("Statuts",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl = new JPanel (new BorderLayout()); 
        setContentPane(pnl); 
        setVisible(true);
        setSize(500,500); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl.add(cPanel1);
        File fichier = new File("image.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        } 
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
     
            if (jCheckBox2.isSelected()) {
                    try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql1 = "Select vendor ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats1 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper(vendor) ";
     rs1 = statement.executeQuery(sql1);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs1.next()){      
          pieDataset.setValue( rs1.getString("vendor"),rs1.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("Disfonctionnement par fournisseurs",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl1 = new JPanel(new BorderLayout()); 
        setContentPane(pnl1); 
        setVisible(true);
        setSize(500, 500); 
    ChartPanel cPanel2 = new ChartPanel(chart);    
        pnl1.add(cPanel2);
        File fichier = new File("image1.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        } 
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
            if (jCheckBox3 .isSelected()) {
                try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql2 = "Select impact,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats2 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper(impact) ";
    rs2 = statement.executeQuery(sql2);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs2.next()){      
          pieDataset.setValue( rs2.getString("impact"),rs2.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("impact",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl2 = new JPanel(new BorderLayout()); 
        setContentPane(pnl2); 
        setVisible(true);
        setSize(500,500); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl2.add(cPanel1);
     
        File fichier = new File("image3.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        }  
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
             if (jCheckBox4.isSelected()) {
                                    try{
     
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql3 = "Select Affected_CI ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats3 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper(Affected_CI) ";
    rs3 = statement.executeQuery(sql3);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs3.next()){      
          pieDataset.setValue( rs3.getString("Affected_CI"),rs3.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("Affected_CI",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl3 = new JPanel(new BorderLayout()); 
        setContentPane(pnl3); 
        setVisible(true);
        setSize(1000,1000); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl3.add(cPanel1);
        File fichier = new File("image3.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        }  
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
                if (jCheckBox5.isSelected()) {
                                      try{
     
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql4 = "Select Affected_Service ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats4 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper (Affected_Service) ";
    rs4= statement.executeQuery(sql4);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs4.next()){      
          pieDataset.setValue( rs4.getString("Affected_Service"),rs4.getDouble(2));                        
                   }
    JFreeChart chart = ChartFactory.createPieChart3D("Affected_Service",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl4 = new JPanel(new BorderLayout()); 
        setContentPane(pnl4); 
        setVisible(true);
        setSize(1000, 1000); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl4.add(cPanel1);
     
        File fichier = new File("image4.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        } 
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
                if (jCheckBox6.isSelected()) {
                    try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql5 = "Select Assignment_Group ,(count(1) )*100/(Select count(id_incident) from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats4 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper (Assignment_Group)";
    rs5 = statement.executeQuery(sql5);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs5.next()){      
          pieDataset.setValue( rs5.getString("Assignment_Group"),rs5.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("Assignment_Group",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl5 = new JPanel(new BorderLayout()); 
        setContentPane(pnl5); 
        setVisible(true);
        setSize(1000, 1000); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl5.add(cPanel1);
     
        File fichier = new File("image4.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        }   
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
            if (jCheckBox7.isSelected()) {
                    try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql6 = "Select last_updated_by,(count(id_incident) )*100/(Select count(id_incident) from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats5 from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper (last_updated_by)";
    rs6 = statement.executeQuery(sql6);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs6.next()){      
          pieDataset.setValue( rs6.getString("last_updated_by"),rs6.getDouble(2));                        
    }
    JFreeChart chart = ChartFactory.createPieChart3D("Taux résolution par personne",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl6 = new JPanel(new BorderLayout()); 
        setContentPane(pnl6); 
        setVisible(true);
        setSize(1000, 1000); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl6.add(cPanel1);
     
        File fichier = new File("image5.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        }   
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
     
     
        }

  4. #4
    Modérateur
    Avatar de wax78
    Homme Profil pro
    R&D - Palefrenier programmeur
    Inscrit en
    Août 2006
    Messages
    4 098
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Belgique

    Informations professionnelles :
    Activité : R&D - Palefrenier programmeur
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2006
    Messages : 4 098
    Par défaut
    J'avais bien précisé : "aucun morceau de code (qui n'as pas besoin de reprendre tout le contenu inutile)", la tu as tout mis, je n'ai même pas envie d'y regarder. Sur ce bon weekend.
    (Les "ça ne marche pas", même écrits sans faute(s), vous porteront discrédit ad vitam æternam et malheur pendant 7 ans)

    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  5. #5
    Membre confirmé
    Homme Profil pro
    Étudiant
    Inscrit en
    Mars 2015
    Messages
    132
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 31
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Mars 2015
    Messages : 132
    Par défaut
    je m'excuse .plus précisement:
    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
    27
    28
    29
    30
    31
     
     if (jCheckBox1.isSelected()) {
                    try{
                        con = getConnection("jdbc:mysql://localhost:3306/base_rapport_tt","root","");
              Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
    String sql = "Select Status,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"') as Etats from incident  where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"'group by upper(Status)";
     rs = statement.executeQuery(sql);
     DefaultPieDataset pieDataset = new DefaultPieDataset(); 
    while(rs.next()){      
          pieDataset.setValue( rs.getString("Status"),rs.getDouble(2));                        
            }
    JFreeChart chart = ChartFactory.createPieChart3D("Statuts",  pieDataset, true, true, false); 
    PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
    piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
    pnl = new JPanel (new BorderLayout()); 
        setContentPane(pnl); 
        setVisible(true);
        setSize(500,500); 
    ChartPanel cPanel1 = new ChartPanel(chart);    
        pnl.add(cPanel1);
        File fichier = new File("image.png"); 
        try { 
          ChartUtilities.saveChartAsPNG(fichier, chart, 400, 250); 
        } catch (IOException e) { 
          e.printStackTrace(); 
        } 
                      }
                       catch (Exception e){  
                           JOptionPane.showMessageDialog(null,e );
                       }
            }
    merci.

  6. #6
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    Ben au lieu de mettre la panneau dans ta frame principale avec setContentPane, fait une nouvelle fenetre et met le panneau dedans, tout simplement.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème affichage des graphes
    Par jescob03 dans le forum iReport
    Réponses: 0
    Dernier message: 17/11/2008, 17h01
  2. Problème de dimension pour affichage sur graph
    Par Marc29 dans le forum LabVIEW
    Réponses: 4
    Dernier message: 17/06/2008, 10h55
  3. Problème d'affichage des graphes avec Tomcat
    Par _Janu_ dans le forum BIRT
    Réponses: 11
    Dernier message: 20/09/2006, 15h30
  4. [Artichow] Erreur lors de l'affichage du graph
    Par ouldfella dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 30/04/2006, 17h31
  5. Affichage de graphe
    Par pc.bertineau dans le forum MFC
    Réponses: 2
    Dernier message: 27/05/2005, 16h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo