JFreeChart的用法[Java编程]
本文“JFreeChart的用法[Java编程]”是由七道奇为您精心收集,来源于网络转载,文章版权归文章作者所有,本站不对其观点以及内容做任何评价,请读者自行判断,以下是其具体内容:
一个简单的用法
在jsp 页面中可以封装为一标签
public class xxxxChartTag extends TagSupport
{
private static final long serialVersionUID = 1L;
private int width; //图表宽度
private int height; //图表高度
private String type; //图表范例
private DataVO datavo; //图表数据对象
private static final int EVAL_PAGE = 6;
private String attrbuteName; //request对象名字
private String chartType; //图表显示方法2D或3D
/**
*
* <p>Discription:[构造器办法描写]</p>
* @coustructor 办法.
*/
public NtasChartTag()
{
super();
width = 790;
height = 460;
attrbuteName = NtasConst.REQUEST_DATAVO_KEY;
chartType="2D";
}
public int doStartTag() throws JspException
{
StringBuffer stringbuffer = new StringBuffer();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpSession session = request.getSession(true);
datavo = (DataVO) request.getAttribute(attrbuteName);
NTASChartFactory NChartFactory = new NTASChartFactory(datavo, session);
NChartFactory.setPicWidth(width);
NChartFactory.setPicHeight(height);
NChartFactory.setChartstyle(chartType);
try
{
NChartFactory.createNTASChart(type);
}
catch (Exception e1)
{
e1.printStackTrace();
}
String picFileName = NChartFactory.getFileName();
String getPicURL = NChartFactory.getPicURL();
stringbuffer.append( NChartFactory.getChartMapHtml());
stringbuffer.append("<img border="0" width="" + width + "" height="" + height + "" src="" + request.getContextPath()+getPicURL + "" useMap="#" + picFileName + ""/>");
JspWriter out = pageContext.getOut();
try
{
out.println(stringbuffer.toString());
}
catch (IOException e)
{
e.printStackTrace();
}
return EVAL_PAGE;
}
public int getHeight()
{
return height;
}
public String getType()
{
return type;
}
public int getWidth()
{
return width;
}
/ public void setHeight(int i)
{
height = i;
}
public void setType(String string)
{
type = string;
}
public void setWidth(int i)
{
width = i;
}
public String getAttrbuteName()
{
return attrbuteName;
}
public void setAttrbuteName(String string)
{
attrbuteName = string;
}
public String getChartType()
{
return chartType;
}
public void setChartType(String string)
{
this.chartType = string;
}
}
以上是“JFreeChart的用法[Java编程]”的内容,如果你对以上该文章内容感兴趣,你可以看看七道奇为您推荐以下文章:
本文地址: | 与您的QQ/BBS好友分享! |