标题: [基础] JFreeChart 的用法
ljjk5
元帅
Rank: 1


荣誉会员奖章
UID 46706
精华 1
积分 99426
帖子 49690
威望 554
金币 48489
热心 505
阅读权限 100
注册 2007-2-25
状态 离线
JFreeChart 的用法

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;
   }
}

网友 ljjk5 签名 - 网友社区 ===
顶部
[广告] 免费域名(Free Subdomain) 免费空间(Free hosting) PR查询(Google Pagerank)



当前时区 GMT+8, 现在时间是 2008-10-13 10:31
信产部ICP备案:京ICP备05066424号 北京市公安局网监备案:1101050648号

Powered by Discuz! 5.5.0
清除 Cookies - 联系我们 - 网友俱乐部 - Archiver - WAP