Bonjour à tous,

J'utilise jCharts pour afficher des graphiques dans un JPanel.
Le problème est que ce graphique n'est pas persistant (disparition dès qu'une fenêtre passe par dessus).

Ce panel est inclus dans un autre JPanel.
J'aimerai savoir à quel moment je dois appeler la méthode afficherGraphique et comment rendre l'affichage persistant.

Voilà le code du JPanel :
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
 
public class GraphiqueEmpilePanel extends JPanel{
 
    /**
     * This is the default constructor
     */
    public GraphiqueEmpilePanel() {
        super();
        initialize();
    }
 
    /**
     * This method initializes this
     * 
     * @return void
     */
    private void initialize() {
        this.setSize(700, 350);
        this.setPreferredSize(new java.awt.Dimension(700,350));
        addComponentListener(this);
    }
 
    public void afficherGraphique(){
        String[] lblAxeX = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23"};
        String[] lblAxeSeries = {"Appel Entrant","Appel Perdu"};
        double[][] donnees = {
                {3,4,12,6,25,12,30,36,42,100,52,68,120,150,123,42,41,38,52,63,21,19,12,3},
                {0,1,1,0,4,0,5,6,7,23,12,3,24,31,3,1,2,0,0,0,1,0,1,0}
        };
        Paint[] couleurs = {Color.BLACK, Color.BLUE};
        GraphBarreEmpile graphique;
        try {
            graphique = new GraphBarreEmpile(lblAxeX, lblAxeSeries, "Heure", "Nb Appel", "Stat Appel Entrant", donnees, 680, 340, couleurs);
            graphique.getGraphique().setGraphics2D((Graphics2D)getGraphics());
            graphique.getGraphique().render();
        }
        catch (ChartDataException e) {
            e.printStackTrace();
        }
        catch (PropertyException e) {
            e.printStackTrace();
        }
    } 
}