Skip to main content Skip to footer

FlexPivot: Data Binding to C1DataEngine or to a Data Source

FlexPivot gives you the flexibility of customizing your data source, and of choosing how you want to connect to accomplish data binding—with or without code. For very large data sets, you might want to try the C1DataEngine, which makes it easy to connect with FlexPivot and draw millions of records in little time.

Connecting to C1DataEngine

To connect to C1DataEngine, you'll need a little code. For this example, we used C#:

  1. Create a new Windows Forms application.
  2. Drag-and-drop the C1FlexPivotPage control from your Visual Studio Toolbox onto the form.
  3. Switch to code view.
  4. Initialize a C1DataEngine using the following code within the form's constructor.

    
    //initialize C1DataEngine  
    C1.DataEngine.Workspace.Init(dataPath);  
    
    

    This code initializes the dataPath folder where the C1DataEngine stores data in files. This folder is initially empty and fills with files automatically when data is added to the data engine.

  5. Add the following code to connect to the database using a standard ADO.NET command.

    
    //connecting to database using ADO.NET command  
    var command = new SqlCommand(sqlStatement, connection);  
    var connector = new C1.DataEngine.DbConnector(connection, command);  
    connector.GetData(tableName);   
    
    
  6. Connect the FlexPivotPage control to the data engine using the code given below.

    
    c1FlexPivotPage.FlexPivotPanel.ConnectDataEngine(tableName);  
    
    

You successfully connected FlexPivot to a C1DataEngine. To update your data, check out the documentation.

Connecting to a Data Source

You can get your FlexPivot application up and running using design-time settings without having to code. This gets you analyzing your data faster without using your valuable time coding.

  1. Create a new Windows Forms application.
  2. Double-click the C1FlexPivotPage control from your Visual Studio Toolbox.
  3. The C1FlexPivotPage control docks to fill the form in the designer as shown in the image below.

    TuesdayTips_FlexPivot_Binding1

  4. Bind the control to a data source to fetch some data to display. You can use the smart tag that appears in the upper-right corner of the control.
  5. Select the smart tag. From the smart tag, select Choose Data Source|Add Project Data Source to launch the Data Source Configuration Wizard. The Wizard will walk you through adding a data source to your project.
  6. Select a connection to the C1NWind database stored locally on your machine.
  7. From the Configuration Wizard, you'll be able to select the Invoices view for data binding as shown in the image below.

    TuesdayTips_FlexPivot_Binding2

  8. Select Finish to finish binding the NorthWind data set to your FlexPivot application.

Check out the FlexPivot documentation »
Find more information on
FlexPivot »

MESCIUS inc.

comments powered by Disqus