关于jfreechart、sytle Report,jsp画图表的工具包? 用过jfreechart,凑合,虽然免费,但文档是收费的。要自己研究。一般简单。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 除了一些柱状图、曲线图,还有报表,jfreechart能满足需求??? jfreechart还可以,我已经试了,不过没能生成平滑的曲线图(像搜狐财经频道哪种) 做过的朋友来看看吧。给些资料什么的,thanks. jFreechart的文档是收费的,谁有例子的代码,发给我一份!不胜感激!!谢谢!!! /** * <p>走势图生成程序 </p> * <p>Description:本走势图生成程序可以生成二维坐标的走势曲线图 </p> * @author 于秉超 * @version 1.0 *//**************************************modifiy:小熊**E_mail:[email protected]**QQ:56758409**2003-12-26************************************/package chart;import java.awt.Color;import java.awt.GradientPaint;import java.io.OutputStream;import java.io.IOException;import java.util.Date;import java.util.Calendar;import java.util.GregorianCalendar;import org.jfree.data.*;import org.jfree.chart.*;import org.jfree.chart.plot.*;import java.io.File;public class CreatPriceChart { public CreatPriceChart(double[][] XYData,int width,int height,String filename,String title,String xstring,String ystring) { this.setXYData(XYData); this.setWidth(width); this.setHeight(height); this.setFilename(filename); this.setTitle(title); this.setXstring(xstring); this.setYstring(ystring); } /** * 将走势图保存为JPG文件 * @throws IOException */ public void saveChart()throws IOException{ File file = new File(filename) ;//将走势图保存为文件 ChartUtilities.saveChartAsJPEG(file, createChart(), width, height); } /** * 将XYData数组的数据转换为程序识别的坐标数据 * @return * @throws SQLException * @throws Exception */ public XYSeriesCollection createXYSeriesCollection() throws java.sql.SQLException ,Exception{ //声明坐标搜集类 XYSeriesCollection collection = new XYSeriesCollection(); //声明保存坐标类 XYSeries t1 = new XYSeries(""); try { //将坐标添加到类中 for(int j=0;j<XYData[0].length;j++){ t1.add(XYData[0][j],XYData[1][j]); } }catch (Exception e) { System.err.println(e.getMessage()); } //将数据搜集起来 collection.addSeries(t1); return collection; } /** * 根据坐标数据生成走势图曲线 * @return */ public JFreeChart createChart() { JFreeChart chart;//定义一个图表 try { //将图表转换为可用的数据 XYDataset xyData1 = createXYSeriesCollection(); //生成图表 chart = ChartFactory.createLineXYChart( title, // 图表标题 xstring, // 横坐标的显示标签 ystring, // 纵坐标的显示标签 xyData1, // 数据集 PlotOrientation.VERTICAL, // 图表方向:水平、垂直 false, // 是否显示图例 true, // 是否生成工具 false // 是否生成URL链接 ); //定义图表背景图案 chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1200, 0, Color.blue)); return chart; }catch (Exception e) { return null; } } public void setXYData(double[][] XYData) { this.XYData = XYData; } public double[][] getXYData(){ return XYData; } public void setWidth(int width) { this.width = width; } public int getWidth() { return width; } public void setHeight(int height) { this.height = height; } public int getHeight() { return height; } public void setFilename(String filename) { this.filename = filename; } public String getFilename() { return filename; } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public void setXstring(String xstring) { this.xstring = xstring; } public String getXstring() { return xstring; } public void setYstring(String ystring) { this.ystring = ystring; } public String getYstring() { return ystring; } private double[][] XYData;//走势图所需的X轴和Y轴的数据 private int width;//走势图宽度 private int height;//走势图高度 private String filename;//保存的文件名,含全路径 private String title;//图表标题 private String xstring; //横坐标标签 private String ystring; //纵坐标标签} 非常感谢,我正在研究,多交流。我发现jfreechart不同版本一些的调用参数很不一样。使用中..... 如果你的数据的值是没什么规律的话,直接用jfreechart没法让他平滑。只能自己找数学模型,写程序模拟一条平滑曲线。你可以去算法与数据结构版看看! 如何在一个图中显示两条曲线?jfreechart的dateset谁能介绍一下?谢谢! 怎么取得一个s:property的值 乱码问题 lianjiechi tomcat 问题 poi 导入大量数据到excel内存溢出,在线等 JDBC和Servlet 表单提交问题 怎样通过hibernate修改某个字段的值呢? JSP原代码的网站谁给写个? 关于jsp的好几个问题````(1) jakarta-tomcat-4.1.12-LE-jdk14 manager 和Admin 的预设密码. TOMCAT不能在2003下运行? 一个“\”输出问题
给些资料什么的,thanks.
* <p>走势图生成程序 </p>
* <p>Description:本走势图生成程序可以生成二维坐标的走势曲线图 </p>
* @author 于秉超
* @version 1.0
*/
/************************************
**modifiy:小熊
**E_mail:[email protected]
**QQ:56758409
**2003-12-26
************************************/package chart;import java.awt.Color;
import java.awt.GradientPaint;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.jfree.data.*;
import org.jfree.chart.*;
import org.jfree.chart.plot.*;
import java.io.File;public class CreatPriceChart { public CreatPriceChart(double[][] XYData,int width,int height,String filename,String title,String xstring,String ystring) {
this.setXYData(XYData);
this.setWidth(width);
this.setHeight(height);
this.setFilename(filename);
this.setTitle(title);
this.setXstring(xstring);
this.setYstring(ystring);
}
/**
* 将走势图保存为JPG文件
* @throws IOException
*/
public void saveChart()throws IOException{
File file = new File(filename) ;
//将走势图保存为文件
ChartUtilities.saveChartAsJPEG(file, createChart(), width, height);
}
/**
* 将XYData数组的数据转换为程序识别的坐标数据
* @return
* @throws SQLException
* @throws Exception
*/
public XYSeriesCollection createXYSeriesCollection()
throws java.sql.SQLException ,Exception{
//声明坐标搜集类
XYSeriesCollection collection = new XYSeriesCollection();
//声明保存坐标类
XYSeries t1 = new XYSeries("");
try {
//将坐标添加到类中
for(int j=0;j<XYData[0].length;j++){
t1.add(XYData[0][j],XYData[1][j]);
}
}catch (Exception e) {
System.err.println(e.getMessage());
}
//将数据搜集起来
collection.addSeries(t1);
return collection;
}
/**
* 根据坐标数据生成走势图曲线
* @return
*/
public JFreeChart createChart() {
JFreeChart chart;//定义一个图表
try {
//将图表转换为可用的数据
XYDataset xyData1 = createXYSeriesCollection();
//生成图表
chart = ChartFactory.createLineXYChart(
title, // 图表标题
xstring, // 横坐标的显示标签
ystring, // 纵坐标的显示标签
xyData1, // 数据集
PlotOrientation.VERTICAL, // 图表方向:水平、垂直
false, // 是否显示图例
true, // 是否生成工具
false // 是否生成URL链接
);
//定义图表背景图案
chart.setBackgroundPaint(new GradientPaint(0, 0, Color.white, 1200, 0, Color.blue));
return chart;
}catch (Exception e) {
return null;
}
}
public void setXYData(double[][] XYData) {
this.XYData = XYData;
}
public double[][] getXYData(){
return XYData;
}
public void setWidth(int width) {
this.width = width;
}
public int getWidth() {
return width;
}
public void setHeight(int height) {
this.height = height;
}
public int getHeight() {
return height;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getFilename() {
return filename;
}
public void setTitle(String title) {
this.title = title;
}
public String getTitle() {
return title;
}
public void setXstring(String xstring) {
this.xstring = xstring;
}
public String getXstring() {
return xstring;
}
public void setYstring(String ystring) {
this.ystring = ystring;
}
public String getYstring() {
return ystring;
} private double[][] XYData;//走势图所需的X轴和Y轴的数据
private int width;//走势图宽度
private int height;//走势图高度
private String filename;//保存的文件名,含全路径
private String title;//图表标题
private String xstring; //横坐标标签
private String ystring; //纵坐标标签
}
只能自己找数学模型,写程序模拟一条平滑曲线。
你可以去算法与数据结构版看看!