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# |
Copy Code
|
---|---|
//Establish connection to database and fetch data 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# |
Copy Code
|
---|---|
//Bind the datatable to FlexPivot's C1PivotEngine var fpEngine = flexPivotPage.FlexPivotPanel.C1PivotEngine; fpEngine.DataSource = dt.DefaultView; |
To create a view, add row, column and value fields to the C1PivotEngine using RowFields, ColumnFields and ValueFields properties of the C1PivotEngine class, respectively, using the following code in the Window_Loaded event:
C# |
Copy Code
|
---|---|
fpEngine.BeginUpdate(); //Add Row, Column and Value fields to create a view fpEngine.RowFields.Add("Country"); fpEngine.ColumnFields.Add("Salesperson"); fpEngine.Fields["ExtendedPrice"].Caption = "Sales"; fpEngine.Fields["ExtendedPrice"].Format = "c0"; fpEngine.ValueFields.Add("ExtendedPrice"); fpEngine.EndUpdate(); |