HI Tous:
J'utilise ce qui suit pour illustrer le graphique linéaire. quand je cours le code ci-dessous, j'obtiens la fenêtre mais elle est vide et n'affiche pas le graphique. S'il vous plaît aidez-moi et dites-moi comment afficher le graphique linéaire en page html en utilisant le code ci-dessous.
Comment afficher un graphique linéaire en utilisant JFreeChart dans jsp?
import org.jfree.chart.*;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.xy.*;
public class xyLine {
public static void main(String arg[]) {
XYSeries series = new XYSeries("Average Weight");
series.add(20.0, 20.0);
series.add(40.0, 25.0);
series.add(55.0, 50.0);
series.add(70.0, 65.0);
XYDataset xyDataset = new XYSeriesCollection(series);
JFreeChart chart = ChartFactory.createXYLineChart(
"XYLine Chart using JFreeChart", "Age", "Weight",
xyDataset, PlotOrientation.VERTICAL, true, true, false);
ChartFrame frame1 = new ChartFrame("XYLine Chart", chart);
frame1.setVisible(true);
frame1.setSize(300, 300);
}
}
Code reformaté; s'il vous plaît revenir si incorrect. – trashgod