Bonjour,
je développe un GuI et je voudrai afficher un JFreeChart (qui dessine une courbe sur mon graphe)
Donc comment peut t'on l'ajouter à un canevas, ou un Jpanel....
sinon que me suggerer vous. Je veux que ma courbe soit sur mon GUI
merci
Version imprimable
Bonjour,
je développe un GuI et je voudrai afficher un JFreeChart (qui dessine une courbe sur mon graphe)
Donc comment peut t'on l'ajouter à un canevas, ou un Jpanel....
sinon que me suggerer vous. Je veux que ma courbe soit sur mon GUI
merci
voici mon jfree chart
comment puis je l'insérer dans mon interface graphique à partir d'un panel d'un canvas ou tout autre chose?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
38 JTextField_DureeProjet_ContrainteMS.setText(dureeProjetOMS_string); //Object[][][] data = new Object[3][50][2]; final XYSeries s1 = new XYSeries("Series 1"); final XYSeries s2 = new XYSeries("Series 2"); final XYSeries s3 = new XYSeries("Series 3"); for (int i = 1; i <= 50; i++) { s1.add(i, 10 * Math.exp(i / 5.0)); s2.add(i, 20 * Math.exp(i / 5.0)); s3.add(i, 30 * Math.exp(i / 5.0)); } final XYSeriesCollection dataset = new XYSeriesCollection(); dataset.addSeries(s1); dataset.addSeries(s2); dataset.addSeries(s3); final JFreeChart chart = ChartFactory.createXYLineChart( "Log Axis Demo", // chart title "Category", // domain axis label "Value", // range axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, false ); final XYPlot plot = chart.getXYPlot(); final NumberAxis domainAxis = new NumberAxis("x"); final NumberAxis rangeAxis = new LogarithmicAxis("Log(y)"); plot.setDomainAxis(domainAxis); plot.setRangeAxis(rangeAxis); chart.setBackgroundPaint(Color.white); plot.setOutlinePaint(Color.black); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel);
Je suis ouvert à toute solution qui me permettrai d'avoir mes courbes sur mon GUI