注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

老毛的日记本

 
 
 

日志

 
 

datatable 绑定到 ms chart 、gridview  

2011-10-20 15:06:07|  分类: 默认分类 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim dTable As New DataTable("表")
        Dim dtcolRQ, dtcolDQ, dtcolHQ, dtcolHJ As New DataColumn
        dtcolRQ = dTable.Columns.Add("日期")
        dtcolDQ = dTable.Columns.Add("D1")
        dtcolDQ = dTable.Columns.Add("D2")
        dtcolHQ = dTable.Columns.Add("D3")

        Dim dtRow As DataRow
        dtRow = dTable.NewRow()
        dtRow("日期") = "20111020"
        dtRow("D1") = 10000
        dtRow("D2") = 50000
        dtRow("D3") = 150000
        dTable.Rows.Add(dtRow)

        dtRow = dTable.NewRow()
        dtRow("日期") = "20111021"
        dtRow("D1") = 20000
        dtRow("D2") = 30000
        dtRow("D3") = 50000
        dTable.Rows.Add(dtRow)
        dtRow = dTable.NewRow()
        dtRow("日期") = "20111022"
        dtRow("D1") = 120000
        dtRow("D2") = 300000
        dtRow("D3") = 420000
        dTable.Rows.Add(dtRow)


        GridView1.DataSource = dTable
        GridView1.DataBind()
        Chart1.DataSource = dTable
        Chart1.DataBind()
      End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>
   
        <asp:Chart ID="Chart1" runat="server" style="margin-right: 0px" Width="375px">
            <Series>
                <asp:Series Name="Series1" XValueMember="日期" YValueMembers="D3"
                    ChartType="Spline">
                </asp:Series>

            </Series>
            <Series>
                <asp:Series Name="Series2" XValueMember="日期" YValueMembers="D1" ChartType="Spline">
                </asp:Series>
            </Series>
            <Series>
                <asp:Series Name="Series3" XValueMember="日期" YValueMembers="D2" ChartType="Spline">
                </asp:Series>
            </Series>
            <ChartAreas>
                <asp:ChartArea Name="ChartArea1">
                </asp:ChartArea>
            </ChartAreas>
        </asp:Chart>
       </div>
    </form>
</body>
</html>


end
  评论这张
 
阅读(1074)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017