Bonjour à tous,
N'ayant pas trouvé de solution sur ce forum à mon problème, je m'en remet à vous car j'avoue que je bloque...
Je développe actuellement une Applet java me permettant d'afficher un graphique dans une page html, jusque là pas de problème...
Ce que je souhaite faire c'est de pouvoir changer le contenu de mon graphique suivant des paramètres passés de ma page html vers mon Applet et de regénérer mon graphique apèrs prise en compte des nouveaux paramètres...
Voici le code de mon Applet:
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
public class TestApplet extends JApplet {
 
    boolean isNewChart = false;
 
    public void init() {
        final IntervalCategoryDataset dataset;
        if(isNewChart != true){
            dataset = createDataset();
        }else{
            dataset = createDatasetTest();
        }
        final JFreeChart chart = createChart(dataset);
 
        // add the chart to a panel...
        final ChartPanel chartPanel = new ChartPanel(chart);
        chartPanel.setPreferredSize(new Dimension(900,600));
 
        chartPanel.setPopupMenu(null);
        //add the chartPanel to the container (getContentPane is inherited from JApplet which TestApplet extends).
        Container content = getContentPane();
        content.removeAll();
        //content.add(new JLabel("Test Applet : " + isNewChart));
        content.add(chartPanel);    
    }
 
    public static IntervalCategoryDataset createDataset() {
 
        final TaskSeries s1 = new TaskSeries("Scheduled");
...
 final TaskSeriesCollection collection = new TaskSeriesCollection();
        collection.add(s1);
 
        return collection;
    }
private JFreeChart createChart(final IntervalCategoryDataset dataset) {
        final JFreeChart chart = ChartFactory.createGanttChart(
            "Diagramme de Gantt",  // chart title
            "Task",              // domain axis label
            "Date",              // range axis label
            dataset,             // data
            true,                // include legend
            true,                // tooltips
            false                // urls
        );    
        // chart.getCategoryPlot().getDomainAxis().setMaxCategoryLabelWidthRatio(10.0f);
        return chart;    
    }
 public void testDate(String dateDebut, String dateFin) {
 
        isNewChart = true;
        init();
}
 
private JFreeChart createChartTest(final IntervalCategoryDataset datasetTest) {
        final JFreeChart chartTest = ChartFactory.createGanttChart(
            "Diagramme de Gantt",  // chart title
            "Task",              // domain axis label
            "Date",              // range axis label
            datasetTest,             // data
            true,                // include legend
            true,                // tooltips
            false                // urls
        );    
        // chart.getCategoryPlot().getDomainAxis().setMaxCategoryLabelWidthRatio(10.0f);
        return chartTest;    
    }
public static IntervalCategoryDataset createDatasetTest() {
 
        final TaskSeries s1Test = new TaskSeries("Scheduled");
...
final TaskSeriesCollection collectionTest = new TaskSeriesCollection();
        collectionTest.add(s1Test);
 
        return collectionTest;
Et voici maintenant le code de ma page HTML:
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
<html>
    <head>
        <title>Diagramme de Gantt</title>
    </head>
    <body>
		<form>
			<table>
				<tr>
					<td colspan="3" align="center">
						<b>Choix entre deux dates</b>
					</td>
				</tr>
				<tr>
					<td colspan="3">
						<b>Projet:&nbsp;</b>
						<select name="listeProjet">
							<option value="test">Projet Test
						</select>
					</td>
				</tr>				
				<tr>
					<td>
						<b>Date d&eacute;but:&nbsp;</b>
						<input type="text" name="dateDebut">
					</td>
					<td>
						<b>Date fin:&nbsp;</b>
						<input type="text" name="dateFin">
					</td>
				</tr>
			</table>
			<tr>
				<td colspan="3" align="center">
					<input type="button" value="Afficher" onclick="if(monApplet) {monApplet.testDate('this.form.dateDebut.value', 'this.form.dateFin.value');}">
				</td>
			</tr>
		</form>
		<APPLET
                CODE="TestApplet.class" NAME="monApplet" WIDTH=900 HEIGHT=600
                ARCHIVE="jcommon-1.0.13.jar, jfreechart-1.0.10.jar, testApplet.jar">
        </APPLET>
    </body> 
</html>
Soit rien ne se passe lorsque je clique sur mon bouton ou ma fonction ne fonctionne pas mais mon graphique reste inchangé...
Quelqu'un a-t-il une idée?
Merci d'avance.