有没有人有JFreeChart Developer Guide?

解决方案 »

  1.   

    http://prdownloads.sourceforge.net/jfreechart/处可以下载JFreeChart. 我们在自己的项目中使用了JFreeChart, 没有文档,它的例子很完备,再就是看相关的代码。用OptmizeIt帮助下,通过继承和重载改进了Second 和 ToolTip的生成机制,是为了改进动态报表的性能。原库直接链入,没做任何改动。值得信赖.另外它的文档是收费的,标价30余美元,相信没有中文版。请下载有源代码的pack.以jfreechart-0.9.11为例:
    解压缩后应该有个jfreechart-0.9.11-demo.jar
    运行: java -jar jfreechart-0.9.11-demo.jar 就可以启动实例的主程序另外在org.jfree.chart.demo 下有数十个例子,和主程序不重复,均以****Demo*.java命名,并且均可独立运行。
      

  2.   

    给你一个例子:
    package demo;import java.io.*;import org.jfree.data.*;
    import org.jfree.chart.*;
    import org.jfree.chart.plot.*;
    /**
     * 该类用于演示最简单的柱状图生成
     * @author Winter Lau
     */
    public class BarChartDemo
    {
    public static void createChart() throws IOException
    {
    CategoryDataset dataset = getDataSet2();
    /*
    public abstract class ChartFactory extends java.lang.Object

    A collection of utility methods for creating some standard charts with JFreeChart. 
    */
    JFreeChart chart = ChartFactory.createBarChart3D(
    "水果产量图", // 图表标题
    "水果",  // 目录轴的显示标签
    "产量",      // 数值轴的显示标签
    dataset,     // 数据集
    PlotOrientation.VERTICAL, // 图表方向:水平、垂直
    true,       // 是否显示图例(对于简单的柱状图必须是false)
    false,       // 是否生成工具
    false       // 是否生成URL链接
    );

    FileOutputStream fos_jpg = null;
    try {
    fos_jpg = new FileOutputStream("D:\\fruit.jpg");
    ChartUtilities.writeChartAsJPEG(fos_jpg,100,chart,400,300,null);
    /*public class ChartUtilities extends java.lang.Object

    Utility methods for JFreeChart. 
    包含JFreeChart的所有方法
    Includes methods for converting charts to image formats (PNG and JPEG) plus creating simple HTML image maps. 
    包括将图表转换成图像的方法,创建简单的HTML图像管理分析与规划系统
    */
    /*writeChartAsJPEG
    public static void writeChartAsJPEG(
    java.io.OutputStream out,//输出的字节流
    JFreeChart chart,        //图表
    int width,               //生成图片的宽度
    int height,              //生成图片的高度  
    ChartRenderingInfo info  //图表信息
    )
                                 throws java.io.IOException
    Writes the chart to the output stream in JPEG format.
    输出图表到图片格式的字节流
    This method allows you to pass in a ChartRenderingInfo object, to collect information about the chart dimensions/entities.
    这个方法允许你传递一个图表表现对象,收集图表的尺度实体信息
    You will need this info if you want to create an HTML image map. 
    你将需要这些信息创建一个HTML图像图 Parameters:
    out - the output stream.
      chart - the chart.
                      width - the image width.
                     height - the image height.
                       info - the chart rendering info. 
                    Throws:
      java.io.IOException - if there are any I/O errors. */
    }
    finally
    {
    try {
    fos_jpg.close();
    } catch (Exception e) {}
    }
    }
    private static CategoryDataset getDataSet2()
    {
    /*public interface CategoryDataset extends KeyedValues2D, Dataset The interface for a dataset with one or more series, and values associated with categories. 
    一个或多个系列的数据接口,数据值与某一种类关联
    The categories are represented by Comparable instance, with the category label being provided by the toString method. 
    */
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
        //创建一个新的dataset
    /*public interface Dataset
    The base interface for data sets.  All datasets are required to support the DatasetChangeEvent mechanism by allowing listeners to register and receive notification of any changes to the dataset. 
    所有数据设置必须支持数据变化事件机制被允许监听记录和接收所有变化数据的通知
    In addition, all datasets must belong to one (and only one) DatasetGroup. 
    用增加方法所有的设置必须一个只有一个数据组。
    The group object maintains a reader-writer lock which provides synchronised access to the datasets in multi-threaded code.
    这个组对象维持读与写的锁,规定同时数据设置的使用权的多线程代码
    */
    dataset.addValue(100, "北京", "苹果");
    dataset.addValue(100, "上海", "苹果");
    dataset.addValue(100, "广州", "苹果");
    dataset.addValue(200, "北京", "梨子");
    dataset.addValue(200, "上海", "梨子");
    dataset.addValue(200, "广州", "梨子");
    dataset.addValue(300, "北京", "葡萄");
    dataset.addValue(300, "上海", "葡萄");
    dataset.addValue(null, "广州", "葡萄");
    dataset.addValue(400, "北京", "香蕉");
    dataset.addValue(400, "上海", "香蕉");
    dataset.addValue(400, "广州", "香蕉");
    dataset.addValue(500, "北京", "荔枝");
    dataset.addValue(500, "上海", "荔枝");
    dataset.addValue(500, "广州", "荔枝");
    return dataset;
    }
    }上面的文件编译成BarChartDemo.class做成bean
    引用bean的JSP文件
    <%@ page contentType="text/html;charset=gb2312"%>
    <%@ page import="java.lang.*"%>
    <%@ page import="java.util.*"%>
    <jsp:useBean id="create" scope="page" class="demo.BarChartDemo"/>
    <html>
    <head><title>createChart</title>
    <body>
    <%
    create.createChart();
    %>
    <INPUT TYPE="image" SRC="D:\fruit.jpg">
    </body>
    </html>
      

  3.   

    http://blog.csdn.net/asdlcj/archive/2004/08/04/60598.aspx
      

  4.   

    demo反编译出来有错误,demo有没有源码啊?