This quick start guide is intended to get you up and running with FlexPivot. In this section, you begin by connecting the FlexPivotPage control to C1NWind database. You also understand how to bind FlexPivotPage control to a local data source, and then continue exploring various features available in the control at runtime.
C# |
コードのコピー
|
---|---|
//データベースへの接続し、データを取得します OleDbConnection oconn = new OleDbConnection(); oconn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=..\..\Documents\ComponentOne Samples\Common\C1NWind.mdb"; var da = new OleDbDataAdapter("select * from invoices", oconn); var dt = new DataTable(); da.Fill(dt); |
C# |
コードのコピー
|
---|---|
//データテーブルをFlexPivotのFlexPivotEngineに連結します var fpEngine = flexPivotPage.FlexPivotPanel.FlexPivotEngine; fpEngine.DataSource = dt.DefaultView; |
To create a view, add row, column and value fields to the FlexPivotEngine using RowFields, ColumnFields and ValueFields properties of the FlexPivotEngine class, respectively, using the following code in the Window_Loaded event:
C# |
コードのコピー
|
---|---|
fpEngine.BeginUpdate(); //行、列、値の各フィールドを追加してビューを作成します fpEngine.RowFields.Add("Country"); fpEngine.ColumnFields.Add("Salesperson"); fpEngine.Fields["ExtendedPrice"].Caption = "Sales"; fpEngine.Fields["ExtendedPrice"].Format = "c0"; fpEngine.ValueFields.Add("ExtendedPrice"); fpEngine.EndUpdate(); |