jfreechart之折线图

14年前
import java.io.FileNotFoundException;  import java.io.FileOutputStream;  import java.io.IOException;  import org.jfree.chart.ChartFactory;  import org.jfree.chart.ChartUtilities;  import org.jfree.chart.JFreeChart;  import org.jfree.chart.plot.PlotOrientation;  import org.jfree.data.category.DefaultCategoryDataset;     /**   *    * @author 刘毅   * @date 2010-2-25   * @ClassName PolyLine.java   * @Email liu_yi126@163.com   * @param 折线图   * @param   */  public class PolyLine {   public static void createPolyLine(){           DefaultCategoryDataset dataset = new DefaultCategoryDataset();    dataset.addValue(100, "测2", "安全");    dataset.addValue(150, "测3", "流");    dataset.addValue(300, "测3", "结果");    dataset.addValue(100, "测4", "效益");    //三维折线图createLineChart3D    JFreeChart chart = ChartFactory.createLineChart(         "曲线图",                    // 标题         "曲线",                      // 横坐标         "值",                     // 纵坐标         dataset,                    // 数据         PlotOrientation.VERTICAL,   // 竖直图表         true,                       // 是否显示legend         false,                      // 是否显示tooltip         false                       // 是否使用url链接     );    //设置字体    JfreeChinese.setChineseForXY(chart);    FileOutputStream fos = null;    try {        fos = new FileOutputStream("src/poly.png");        ChartUtilities.writeChartAsPNG(fos, chart, 400, 300);    } catch (FileNotFoundException e) {     e.printStackTrace();    } catch (IOException e) {     e.printStackTrace();    } finally {        try {         if(fos != null){          fos.close();         }     } catch (IOException e) {      e.printStackTrace();     }    }   }      public static void main(String[] args) {    PolyLine.createPolyLine();   }    }