怎么用jsp实现时间-人次统计的柱状图?

sjtsh 2004-05-02 10:48:20
请问各位大侠 应该用什么做??有源代码的贴一个参考一下
谢谢!!!!!
...全文
49 5 点赞 打赏 收藏 举报
写回复
5 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
gjd111686 2004-05-09
ShowImage.jsp

<%@ page contentType="text/html; charset=gb2312"%>
<%@ include file="/DataIni/DataOpen.jsp"%>
<%@ include file="/ScriptLib/Init.jsp"%>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>
<link rel="stylesheet" type="text/css" href="/StyleLib/Default_Style_Sheet.css">

</head>

<body>
<%@ include file="/TemplateLib/Head.jsp"%>
<br>
<img src="/Test/Image.jsp?ElementCount=<%=4%>&ShowType=<%=1%>&Data=">
<%@ include file="/TemplateLib/Tail.jsp"%>
<%@ include file="/DataIni/DataClose.jsp"%>
</body>

</html>
  • 打赏
  • 举报
回复
gjd111686 2004-05-09
Image.jsp
<%@ page import="java.io.*"%>
<%@ page import="java.util.*"%>
<%@ page import="com.sun.image.codec.jpeg.*"%>
<%@ page import="java.awt.*"%>
<%@ page import="java.awt.geom.*"%>
<%@ page import="java.awt.image.*"%>
<%
response.setHeader("Cache-Control","no-store");
response.setDateHeader("Expires",0);
response.setContentType("image/jpeg");
OutputStream outImage=response.getOutputStream();
Color color[]={Color.red,Color.black,Color.orange,Color.green};
BufferedImage bufImage=new BufferedImage(150,100,BufferedImage.TYPE_INT_RGB);
Graphics2D g=(Graphics2D)bufImage.getGraphics();
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
g.setColor(Color.white);
g.fillRect(0,0,150,100);
int iBaseAng=30;
int iElementCount,iShowType;
String strElementCount=request.getParameter("ElementCount");
String strShowType=request.getParameter("ShowType");
String strData=request.getParameter("Data");
if(strElementCount!=null)
{iElementCount=4;}
else
{iElementCount=4;}
if(strShowType!=null)
{iShowType=1;}
else
{iShowType=1;}
int[] Array_Ang=new int[iElementCount];
Array_Ang[0]=(int)(.35*360);
Array_Ang[1]=(int)(.15*360);
Array_Ang[2]=(int)(.25*360);
Array_Ang[3]=360-Array_Ang[0]-Array_Ang[1]-Array_Ang[2];
AffineTransform iAt=null;
Arc2D m_Arc=null;
int iFromAng=iBaseAng;
iAt=AffineTransform.getRotateInstance((-20*java.lang.Math.PI)/180,45,37);
g.setTransform(iAt);
switch(iShowType)
{
case 1:
int iR=6;
int iX=(int)(iR*java.lang.Math.cos((iBaseAng+Array_Ang[0])/2.0*java.lang.Math.PI/180));
int iY=(int)(iR*java.lang.Math.sin((iBaseAng+Array_Ang[0])/2.0*java.lang.Math.PI/180));
m_Arc=new Arc2D.Double(10+iX,24-iY,80,50,iFromAng,Array_Ang[0],Arc2D.PIE);
g.setColor(color[0]);
g.fill(m_Arc);
iFromAng+=Array_Ang[0];
for(int iIndex=1;iIndex<iElementCount;iIndex++)
{
g.setColor(color[iIndex]);
m_Arc=new Arc2D.Double(10,24,80,50,iFromAng,Array_Ang[iIndex],Arc2D.PIE);
g.fill(m_Arc);
iFromAng+=Array_Ang[iIndex];
if(iFromAng>360)
{
iFromAng-=360;
}
}
break;
case 2:
break;
default:
break;
}
iAt=AffineTransform.getRotateInstance(0,m_Arc.getCenterX(),m_Arc.getCenterY());
g.setTransform(iAt);
for(int jIndex=0;jIndex<iElementCount;jIndex++)
{
g.setColor(color[jIndex]);
g.fillRect(100,15*jIndex+20,10,10);
g.drawString("No."+jIndex,120,15*jIndex+20+8);
}
JPEGImageEncoder encoder=JPEGCodec.createJPEGEncoder(outImage);
encoder.encode(bufImage);
outImage.close();
%>
  • 打赏
  • 举报
回复
aobao 2004-05-09
我不明白他们是怎么弄的!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns:v = "urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office"><HEAD><TITLE>人员管理</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<!--[if !mso]>
<STYLE>v\:* {
BEHAVIOR: url(#default#VML)
}
o\:* {
BEHAVIOR: url(#default#VML)
}
.shape {
BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]-->
<LINK href="../inc/List.css" rel=stylesheet>
<META content="MSHTML 6.00.2800.1141" name=GENERATOR></HEAD>
<BODY topMargin=10 scroll=auto>
<DIV align=center>
<!--[if gte vml 1]><v:oval id=_x0000_s1028
style="Z-INDEX: 1; LEFT: 60pt; WIDTH: 280pt; POSITION: absolute; TOP: 43.3pt; HEIGHT: 198.8pt"
coordsize = "21600,21600" fillcolor = "#fc0"><v:fill rotate = "t" type =
"gradient" color2 = "yellow" angle = "-135" focus = "100%"></v:fill><o:extrusion
v:ext="view" on = "t" type = "perspective" skewangle = "0" skewamt = "0%"
viewpointorigin = "0,0" viewpoint = "0,0" rotationangle = "45" lightposition =
"-50000,-50000" lightposition2 = "50000"></o:extrusion></v:oval><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 60pt; WIDTH: 140pt; POSITION: absolute; TOP: 108.855pt; HEIGHT: 41.144pt"
coordsize = "187,110" fillcolor = "#ffb" strokecolor = "#ffb" path =
" m0,109 hd c186,109,186,109,186,109,186,109,186,109,34,-1,18,23,11,44,9,52 hh c6,59,-1,80,0,109 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "yellow" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 86.737pt; WIDTH: 113.262pt; POSITION: absolute; TOP: 80pt; HEIGHT: 70pt"
coordsize = "151,187" fillcolor = "#d1ffd1" strokecolor = "#d1ffd1" path =
" m0,76 hd c151,186,151,186,151,186,151,186,151,186,151,-1,108,0,79,13,66,20 hh c52,27,24,42,0,76 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "lime" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 200pt; WIDTH: 82.289pt; POSITION: absolute; TOP: 80pt; HEIGHT: 70pt"
coordsize = "110,187" fillcolor = "#fbb" strokecolor = "#fbb" path =
" m0,0 hd c0,186,0,186,0,186,0,186,0,186,109,34,86,18,65,11,57,9 hh c50,6,28,0,0,0 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "red" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 200pt; WIDTH: 140pt; POSITION: absolute; TOP: 93.368pt; HEIGHT: 123.205pt"
coordsize = "187,329" fillcolor = "#ffe3bb" strokecolor = "#ffe3bb" path =
" m109,0 hd c0,151,0,151,0,151,0,151,0,151,57,328,136,302,174,241,184,180 hh c194,118,176,48,109,0 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "#f90" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 156.737pt; WIDTH: 86.524pt; POSITION: absolute; TOP: 150pt; HEIGHT: 70pt"
coordsize = "115,187" fillcolor = "#cff4f3" strokecolor = "#cff4f3" path =
" m115,177 hd c57,0,57,0,57,0,57,0,57,0,-1,177,27,186,49,186,57,186 hh c65,186,87,186,115,177 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "#3cc" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 86.737pt; WIDTH: 113.262pt; POSITION: absolute; TOP: 150pt; HEIGHT: 66.573pt"
coordsize = "151,178" fillcolor = "#d9d9e5" strokecolor = "#d9d9e5" path =
" m93,177 hd c151,0,151,0,151,0,151,0,151,0,-1,109,16,133,34,146,41,151 hh c47,155,65,168,93,177 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "#669" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 86.737pt; WIDTH: 113.262pt; POSITION: absolute; TOP: 150pt; HEIGHT: 41.144pt"
coordsize = "151,110" fillcolor = "#ffc7ab" strokecolor = "#ffc7ab" path =
" m0,109 hd c151,0,151,0,151,0,151,0,151,0,-1,109,0,109,0,109,0,109 hh c0,109,0,109,0,109 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "#930" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]--><!--[if gte vml 1]><v:shape
id=_x0000_s1026
style="Z-INDEX: 1; LEFT: 66.852pt; WIDTH: 133.147pt; POSITION: absolute; TOP: 150pt; HEIGHT: 41.144pt"
coordsize = "178,110" fillcolor = "#ecffb7" strokecolor = "#ecffb7" path =
" m26,109 hd c177,0,177,0,177,0,177,0,177,0,-1,57,4,71,9,82,11,84 hh c12,87,17,97,26,109 hd x e"><v:fill
rotate = "t" type = "gradient" color2 = "#9c0" focus = "100%"></v:fill><v:path
arrowok = "t"></v:path></v:shape><![endif]-->
</DIV>
<DIV align=left>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height=10
cellSpacing=0 cellPadding=2 width=290 border=0>
<TBODY>
<TR height=18>
<TD align=right width=70>博士后</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffff00 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>10%</TD>
<TD align=right width=70>博士</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#00ff00 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>15%</TD></TR>
<TR height=18>
<TD align=right width=70>双硕士</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#ff0000 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>10%</TD>
<TD align=right width=70>硕士</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#ff9900 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>35%</TD></TR>
<TR height=18>
<TD align=right width=70>本科</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#33cccc border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>10%</TD>
<TD align=right width=70>大专</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#666699 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>10%</TD></TR>
<TR height=18>
<TD align=right width=70>中专</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#993300 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>0%</TD>
<TD align=right width=70>高中</TD>
<TD width=*>
<TABLE style="BORDER-COLLAPSE: collapse" borderColor=#111111 height="100%"
cellSpacing=0 cellPadding=0 width="100%" bgColor=#99cc00 border=1>
<TBODY>
<TR>
<TD></TD></TR></TBODY></TABLE></TD>
<TD align=right width=40>5%</TD></TR></TBODY></TABLE></DIV></BODY></HTML>
  • 打赏
  • 举报
回复
jdk150 2004-05-08
客户端实现:
1.js
2.OWC 控件
服务器端:
3.Jfreechart
  • 打赏
  • 举报
回复
LCKKING 2004-05-06
用Jfreechart组件可以自动生成图表~去网上搜索一下吧~
  • 打赏
  • 举报
回复
相关推荐
发帖
XML/XSL
加入

8854

社区成员

XML/XSL相关问题讨论专区
申请成为版主
帖子事件
创建了帖子
2004-05-02 10:48
社区公告
暂无公告