jfreechart实例

package com.epro.jfreechart.example;

import java.io.FileOutputStream;
import java.io.IOException;

import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartFrame;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;

public class JfreechartExample {
public static void main(String[] args) throws IOException {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(100, "shanghai", "pengguo");
dataset.addValue(200, "shanghai", "lizi");
dataset.addValue(300, "nanchang", "putao");
dataset.addValue(400, "hainan", "xiangjiao");
dataset.addValue(500, "baijin", "lizhi");
dataset.addValue(-250, "shanghai", "lizhi");

JFreeChart chart = ChartFactory.createBarChart3D(
"shui guo chang liang tu", "shui guo", "chang liang", dataset,
PlotOrientation.VERTICAL, true, true, false);

ChartFrame frame = new ChartFrame("zhu zhuang tu", chart);

frame.pack();
frame.setVisible(true);
}
}

你可能感兴趣的:(java,jfreechart)