aspx c# Chart..::.DataBindCrossTable 方法

來源:互聯網
上載者:User

http://msdn.microsoft.com/zh-cn/dd488514

DataBindCrossTable 方法 (IEnumerable, String, String, String, String)
.NET Framework 類庫
Chart..::.DataBindCrossTable 方法 (IEnumerable, String, String, String, String)

將圖表的資料繫結到表,並為給定列中的每個唯一值建立一個序列。

命名空間: System.Web.UI.DataVisualization.Charting
程式集: System.Web.DataVisualization(在 System.Web.DataVisualization.dll 中)
文法

Public Sub DataBindCrossTable ( _
    dataSource As IEnumerable, _
    seriesGroupByField As String, _
    xField As String, _
    yFields As String, _
    otherFields As String _
)

    public void DataBindCrossTable(
        IEnumerable dataSource,
        string seriesGroupByField,
        string xField,
        string yFields,
        string otherFields
    )

public:
void DataBindCrossTable(
    IEnumerable^ dataSource,
    String^ seriesGroupByField,
    String^ xField,
    String^ yFields,
    String^ otherFields
)

member DataBindCrossTable :
        dataSource:IEnumerable *
        seriesGroupByField:string *
        xField:string *
        yFields:string *
        otherFields:string -> unit

參數

dataSource
    類型:System.Collections..::.IEnumerable
    資料來源。

seriesGroupByField
    類型:System..::.String
    用於將資料分組成序列的欄位的名稱。

xField
    類型:System..::.String
    用於 X 值的欄位的名稱。

yFields
    類型:System..::.String
    一個逗號分隔列表,其中列出了 Y 值的欄位的名稱。

otherFields
    類型:System..::.String
    可以綁定的其他資料點屬性。

備忘

系列將被自動添加到圖表中,這取決於資料來源給定的 seriesGroupByField 列中唯一值的個數,換言之,系列的建立取決於列的分組。

資料來源可以是 OleDbDataReader、SqlDataReader 或 DataView 對象。 請注意,所有實現 IEnumerable 介面的集合都可供使用。

除 X 和 Y 值以外,還可以綁定其他資料點屬性。 格式是:PointProperty = 欄位[{格式}] [,PointProperty = 欄位[{格式}]]。 例如:“Tooltip=Price{C1},Href=WebSiteName”。

這些資料點屬性的列表如下所示:AxisLabel()()()ToolTip()()()、Url()()()、PostBackValue()()()、Label()()()、LegendText()()()、LegendToolTip()()() 和 CustomProperties()()(),它們都是自訂屬性的名稱。
--------------------------------------------------

        {
            //strSql = "select 小時, count(*) as lNum from (select str(DATEPART(hh,jgsj)) + '時' AS 小時  from epdb  where  " + strWhere + ") A group by 小時";
            strSql = "select 小時, count(*) as lNum from (select str(DATEPART(hh,jgsj)) + '時' AS 小時  from epdb a " + leftJoin + " where  " + strWhere + ") A group by 小時";

            //clq test
            strSql = "select 小時, 車道號, count(*) as lNum from (select str(DATEPART(hh,jgsj)) + '時' AS 小時, str(CLBH) + '車道' as 車道號  from epdb a " + leftJoin + " where  " + strWhere + ") A group by 小時,車道號";
            
            DataSet ds = WLCDB.MsSQL.DoAnySQLExecuteDataSet(strSql);
            DataView dv = new DataView(ds.Tables[0]);
            //Chart1.Series["login"].Points.DataBindXY(dv, "小時", dv, "lNum");

            //--------------------------------------------------
            //Chart1.DataBindTable(dv, "小時");
            Chart1.DataBindCrossTable(dv, "車道號", "小時", "lNum", "");
            
            //Chart1.Series.Add("t");
            //Chart1.Series["t"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line;
            //Chart1.Series["t"].Points.DataBindXY(dv, "小時", dv, "lNum");

            //Chart1.Series.Add("t2");
            //Chart1.Series["t2"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Spline;
            //Chart1.Series["t2"].Points.DataBindXY(dv, "小時", dv, "lNum");

            Chart1.Visible = true;
            Image1.Visible = false;
        }

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.