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
 
 
package ui;
 
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.swing.ImageIcon;
import mapping.Produit;
import model.ProduitDao;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
 
/**
 *
 * @author ABDEL BEN ABUBAKAR
 */
public class DiagrammeBars extends javax.swing.JFrame {
 
    /**
     * Creates new form DiagrammeBars
     */
    public DiagrammeBars() {
        initComponents();
         final DefaultCategoryDataset bards =new DefaultCategoryDataset();
         IRegion rdao=new IRegion();
        List<Region> lst=new ArrayList<Region>();
        lst=rdao.ListeRegion();
 
        for(Regione:lst){
 
          String id = e.getId();
          String lib = e.getLibelle();
          int nb = e.geNbr_logement();
         bards.setValue(id,libelle ,nbr_logement );
        }
     final JFreeChart bardschart =ChartFactory.createBarChart("REGIONS","NOBRE LOGEMENTS"
                ,bards ,PlotOrientation.VERTICAL,false,true,false);
 
     BufferedImage biring = bardschart.createBufferedImage(727,427);
        diagramme.setIcon(new ImageIcon(biring));
        setLocationRelativeTo(null);
         setResizable(false);



Bonjour tous,
Si j'exécute ce programme, cela ne me signale aucune erreur mais ça n'affiche rien.