我做了一个调查,想根据每一个调查的百分比绘出相应的图形,不知道该怎么做,如果谁能给我具体代码我就感激不尽了! 

解决方案 »

  1.   

    我试了,那个wide属性不能用语句修改。应该怎么做》》??
      

  2.   

    看看http://www.gdepb.gov.cn/Equality/QueryOneDay.aspx?Type=air
      

  3.   

    前台代码片段
    <asp:Repeater id="repimg" Runat="server">
    <ItemTemplate>
    <TD valign=bottom>
    <TABLE id="Table13" cellSpacing="1" cellPadding="1" border="0" width=100% >
    <TR>
    <TD><img src='../img/<%image();%>.jpg' height='<%# gets((DataBinder.Eval(Container.DataItem,"investigateCounts")).ToString())%>',width=20 ></TD>
    </TR>
    <TR>
    <TD><%# DataBinder.Eval(Container.DataItem,"investigateItem")%><br>
    票数:<%# DataBinder.Eval(Container.DataItem,"investigateCounts")%><br>
    百分比:<%# gets((DataBinder.Eval(Container.DataItem,"investigateCounts")).ToString())%>%</TD>
    </TR>
    </TABLE>
    </TD>
    </ItemTemplate>
    </asp:Repeater>
      

  4.   

    后台代码片段
    private void rep_history_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
    {

    Look.Visible=true;
    int InvMenuId=Convert.ToInt32(((Label)e.Item.FindControl("Label1")).Text);
    Session["bmpid"]=InvMenuId.ToString();
    SqlCommand SumCmd=new SqlCommand("select sum(investigateCounts) as invsum from investigate where InvMenuId="+InvMenuId,Conn);
    SqlDataReader invObj=SumCmd.ExecuteReader();
    invObj.Read();
    InvSum=Convert.ToInt32(invObj["invsum"].ToString());
    invObj.Close();
             
    Cmd.CommandText="select * from InvMenu where InvMenuId="+InvMenuId;
    Cmd.CommandType=CommandType.Text;
    LookInvMenu.DataSource=Cmd.ExecuteReader(CommandBehavior.CloseConnection);
    LookInvMenu.DataBind();
    Conn.Open();
        LabelCounts.Text="总票数:"+InvSum;
    SqlCommand investigateCmd=new SqlCommand("select * from investigate where InvMenuId="+InvMenuId,Conn);
                            repimg.DataSource=investigateCmd.ExecuteReader(CommandBehavior.CloseConnection);
            repimg.DataBind();  
     
    }
        int img=1;
    public void image()
    {
    Response.Write(img);
    if(img>7)
    {
     img=1;
    }
    img+=1;
    }

    public string gets(string  counts)
    {
      int coun=Convert.ToInt32(counts);
    return  (coun*100/InvSum).ToString();
    }
      

  5.   

    c#?我用的是vb.net做的,不知道你有没有vb 的代码。麻烦你了
      

  6.   

    ..............用两个TABLE.
    图示:
    ----------------------------------
    |                                |
    |  ----------------------------  |
    |  |                          |  |
    |  |                          |  |
    |  ----------------------------  |
    |                                |
    ----------------------------------
    外框内从左到右对齐,并设定外框的长度(比如100PX)
    内框的长度设为百分比(比如50%)
    这样1%相当于1PX使用上面的原理.在不同的情况下改变内框的长度的百分比(从1%~100%)
      

  7.   

    就是table套table设置里面的背景色和宽度就是了
      

  8.   

    <img src='../img/xxx.jpg' height='<%# imgHight %>',width=20>在后台中用程序处理, 给 imgHeight一个值,   这样可以吗?  我也初学, 还没用过.
      

  9.   

    可以的你把它作为服务器控TD2.Height="15";
    int val=int.Parse(this.TextBox1.Text);
    TD2.Width=val.ToString()+"%";
    TD2.BgColor="#FF0000";件运行