1 pièce(s) jointe(s)
Affichage des informations des parties des graphes
bonjour,
j'ai utilisé un code dans le but d'afficher un graphe .
Code:
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
| if(jCheckBox3.isSelected()){
try{
con = getConnection("jdbc:mysql://localhost:3306/base_rapport","root","");
Statement statement = con.createStatement(rs.TYPE_FORWARD_ONLY,rs.CONCUR_READ_ONLY);
String sql3 = "Select Vendor, sum(Rate) as Rate from (select case Vendor when 'NSN' then 'Nokia' else Vendor end as Vendor, Rate from ( Select vendor ,(count(1) )*100/(Select count(id_incident)from incident where open_time between '"+jTextField1.getText()+"' and'"+jTextField2.getText()+"' and vendor !='') as Rate from incident where open_time between '"+jTextField1.getText()+"'and'"+jTextField2.getText()+"' and vendor !='' group by upper(vendor) ) as x ) as y group by vendor";
rs3= statement.executeQuery(sql3);
DefaultPieDataset pieDataset = new DefaultPieDataset();
while(rs3.next()){
pieDataset.setValue( rs3.getString("vendor"),rs3.getDouble(2));
}
JFreeChart chart = ChartFactory.createPieChart3D("Disfonctionnement par fournisseurs", pieDataset, true, true, true);
PiePlot3D piePlot3d = (PiePlot3D) chart.getPlot();
piePlot3d.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}={1}"));
fenetre fen3 = new fenetre();
JPanel pnl = new JPanel(new BorderLayout());
fen3.setContentPane(pnl);
fen3.setVisible(true);
fen3.setSize(500, 500);
ChartPanel cPanel1 = new ChartPanel(chart);
pnl.add(cPanel1);
File fichier = new File("C:\\Users\\alaeddine.zammeli.st\\Desktop\\résultat_application\\Répartition par fournisseur de '"+jTextField1.getText()+"' à '"+jTextField2.getText()+"'.png");
try {
ChartUtilities.saveChartAsPNG(fichier, chart, 500, 500);
} catch (IOException e) {
e.printStackTrace();
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(this,e);
}
} |
voila le graphe.
Pièce jointe 177603
je veux quand je clique sur une partie du graphe par exemple nokia ou alcatel... affiché une autre fenêtre qui affiche des informations (des détails) sur la partie cliqué.Est ce que c'est réalisable?
merci.