package Jfree;import javax.swing.JFrame;import javax.swing.JPanel;import org.jfree.chart.ChartPanel;import org.jfree.chart.JFreeChart;import org.jfree.chart.plot.SpiderWebPlot;import org.jfree.chart.title.LegendTitle;import org.jfree.chart.title.TextTitle;import org.jfree.data.category.DefaultCategoryDataset;import org.jfree.ui.RectangleEdge;public class MySpriderWebPlotTest { public static void main(String args[]) { JFrame jf = new JFrame(); jf.add(erstelleSpinnenDiagramm()); jf.pack(); jf.setVisible(true); } public static JPanel erstelleSpinnenDiagramm() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); String group1 = "apple "; dataset.addValue(5, group1, "w1"); dataset.addValue(6, group1, "w2"); dataset.addValue(4, group1, "w3"); dataset.addValue(2, group1, "w4"); dataset.addValue(5, group1, "w5"); dataset.addValue(5, group1, "w6"); dataset.addValue(5, group1, "w7"); dataset.addValue(8, group1, "w8"); SpiderWebPlot spiderwebplot = new SpiderWebPlot(dataset); JFreeChart jfreechart = new JFreeChart("Test", TextTitle.DEFAULT_FONT,spiderwebplot, false); LegendTitle legendtitle = new LegendTitle(spiderwebplot); legendtitle.setPosition(RectangleEdge.BOTTOM); jfreechart.addSubtitle(legendtitle); ChartPanel chartpanel = new ChartPanel(jfreechart); return chartpanel; }}这个代码只能在application生成图片,如何让它生成在JSP页面哇
添加回答
举报
0/150
提交
取消