JFreechart 绘制闭合曲线

在网上搜了不少,但实现总是感觉有点难受,无奈还是要看API

 

private static XYDataset createDataset(List<DataModel> data) {
		XYSeriesCollection xyseriescollection = new XYSeriesCollection(); // 再用XYSeriesCollection添加入XYSeries
		for (DataModel d : data) {
			XYSeries xyseries = new XYSeries(d.getLabel(),false); // 先产生XYSeries 对象
			for (Point point : d.getDataList()) {
				xyseries.add(point.getX(), point.getY());
			}
			if(d.getDataList().size()>0){
				Point point = d.getDataList().get(0);
				xyseries.add(point.getX(), point.getY());
			}
			xyseries.setNotify(false);
			System.out.println(xyseries.getAutoSort());
			xyseriescollection.addSeries(xyseries);
		}
		return xyseriescollection;
	}
主要为 XYSeries的构造函数,第二个参数为是否自动排序,设为false 万事大吉。

你可能感兴趣的:(jfreechart)