关闭

asp.net+C#+vml实现饼图

标签: asp.netc#datasetimportbehaviorcolors
922人阅读 评论(2) 收藏 举报

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">
<!--[if !mso]>
<style>
v/:*     { behavior: url(#default#VML) }
o/:*     { behavior: url(#default#VML) }
.shape    { behavior: url(#default#VML) }
</style>
<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name='author' content='()'>
<meta name='description' content='描述'>
<meta name='keywords' content='打印报表'>
<script language="JavaScript" src="../source/type.js" type="text/JavaScript"></script>
<title>打印报表</title>

<style>
body {SCROLLBAR-FACE-COLOR: #DFB780; SCROLLBAR-HIGHLIGHT-COLOR: #FFDDAE; SCROLLBAR-SHADOW-COLOR: #FF9401; SCROLLBAR-3DLIGHT-COLOR: #000000; SCROLLBAR-ARROW-COLOR: #FFFFFF; SCROLLBAR-TRACK-COLOR: #DFDFDF; SCROLLBAR-DARKSHADOW-COLOR: #000000; }
TD { FONT-SIZE: 9pt}
.PIE_TEXT {
BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 2px; FONT-SIZE: 11px; BACKGROUND: #ffffee; OVERFLOW: hidden; BORDER-LEFT: #cccccc 1px solid; ; WIDTH: expression(this.w = ((this.innerText.length>20)?100:(''))); PADDING-TOP: 2px; BORDER-BOTTOM: #cccccc 1px solid; FONT-FAMILY: Arial; WHITE-SPACE: nowrap; LETTER-SPACING: 1px; POSITION: absolute; TEXT-OVERFLOW: ellipsis
</style>
</head>

<%@ Import Namespace="System " %>
<%@ Import Namespace="System.Web " %>
<%@ Import Namespace="System.Web.Security " %>
<%@ Import Namespace="System.Data " %>
<%@ Import Namespace="System.Data.SqlClient " %>
<%@ Import Namespace="System.Data.OleDb " %>
<%@ Register TagPrefix="WebReport" TagName="Chart" Src="../source/webreport.ascx"%>
<script language="C#" runat="server">
public void Page_Load(Object sender,EventArgs e)
{
   if(!IsPostBack)
  {
   const String strconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C://bak//test//GDI//Grades.mdb";
     OleDbConnection conn=new OleDbConnection(strconn);
     conn.Open();
     string sql="select month,temperature from test where city='广州'";
     OleDbCommand cmd=new OleDbCommand(sql,conn);
     DataSet ds=new DataSet();
     OleDbDataAdapter adapter1=new OleDbDataAdapter(cmd);
     adapter1.Fill(ds);
  int tbx,tby,allx,ally;
    // string sql1="select month,temperature from test where city='拉萨'";
    // OleDbCommand cmd1=new OleDbCommand(sql1,conn);
    // DataSet ds1=new DataSet();
    // OleDbDataAdapter adapter2=new OleDbDataAdapter(cmd1);
    // adapter2.Fill(ds1);
  ArrayList colors = new ArrayList();
     colors.Add("#426baa");
  colors.Add("#bcd48f");
  colors.Add("#ff9900");
  colors.Add("#bab6cb");
  colors.Add("#666699");
  colors.Add("#993300");
  colors.Add("#fdd14a");
  colors.Add("#e86bde");
  colors.Add("#5ec06d");
  colors.Add("#4970c6");
  colors.Add("#ac6b3f");
  colors.Add("#8676a5");
  tbx=200;
  tby=150;
  allx=180;
  ally=180;
  if(Request.QueryString["id"]=="1")  {
  Pie.DrawPie(ds,colors,tbx,tby,allx,ally);
  }
 }
  }
}

</script>
<body bgcolor='#ffffff'>
<WebReport:Chart id="Pie" runat="Server"/>

</body>
</html>

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1405563次
    • 积分:20196
    • 等级:
    • 排名:第413名
    • 原创:448篇
    • 转载:1067篇
    • 译文:4篇
    • 评论:143条
    文章存档
    最新评论