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
|
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 sql1 = "Select last_updated_by,(count(id_incident) )*100/(Select count(id_incident) from incident where Status like 'Closed' and open_time between '"+jTextField1.getText()+"' and '"+jTextField2.getText()+"')from incident where Status like 'Closed'and open_time between '"+jTextField1.getText()+"' and '"+jTextField2.getText()+"' group by last_updated_by";
rs1 = statement.executeQuery(sql1);
DefaultPieDataset pieDataset = new DefaultPieDataset();
while(rs1.next()){
pieDataset.setValue( rs1.getString("last_updated_by"),rs1.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}"));
fenetre fen1 = new fenetre();
pnl = new JPanel(new BorderLayout());
fen1.setContentPane(pnl);
fen1.setVisible(true);
setSize(700,700);
ChartPanel cPanel1 = new ChartPanel(chart);
pnl.add(cPanel1);
File fichier = new File("image1.png");
try {
ChartUtilities.writeChartAsPNG(fichier ,chart, 400,250);
Save.sauveIMG(String location, String name);
} catch (IOException e) {
e.printStackTrace();
}
}
catch (Exception e) {
JOptionPane.showMessageDialog(this,e);
}
} |
Partager