ComponentOne FlexChart for WinForms
Quick Start
FlexPie > Quick Start

This quick start is intended to guide you through a step-by-step process of creating a simple FlexPie application and running the same in Visual Studio.

Complete the following steps to see how FlexPie appears on running the application:

Step 1: Adding FlexPie to the Application

  1. Create a Windows Forms Application in Visual Studio.
  2. Drag and drop the FlexPie control to the Form.
    The following dll is automatically added to the application:
    C1.Win.FlexChart.4.dll

Step 2: Binding FlexPie to a Data Source

Add the following code in the Form_Load event.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

    ' bind the field containing labels for pie slices and legend
    FlexPie1.BindingName = "Name"

    ' bind the field containing numeric values for pie slices
    FlexPie1.Binding = "Value"

    ' bind FlexPie to the data source
    FlexPie1.DataSource = New [Object]() {New With {
    Key .Value = 18,
    Key .Name = "US"
    }, New With {
    Key .Value = 16,
    Key .Name = "UK"
    }, New With {
    Key .Value = 18,
    Key .Name = "China"
    }, New With {
    Key .Value = 16,
    Key .Name = "France"
    }, New With {
    Key .Value = 17,
    Key .Name = "Germany"
    }, New With {
    Key .Value = 15,
    Key .Name = "Italy"
    }}

    ' set the Legend position
    FlexPie1.Legend.Position = C1.Chart.Position.Right
End Sub
// bind the field containing labels for pie slices and legend
flexPie1.BindingName = "Name";

// bind the field containing numeric values for pie slices
flexPie1.Binding = "Value";

// bind FlexPie to the data source
flexPie1.DataSource = new Object[]
    {
      new {Value=18, Name="US"},
      new {Value=16, Name="UK"},
      new {Value=18, Name="China"},
      new {Value=16, Name="France"},
      new {Value=17, Name="Germany"},
      new {Value=15, Name="Italy"}
    };

// set the Legend position
flexPie1.Legend.Position = C1.Chart.Position.Right;

Step 3: Running the Application

Press F5 to run the application and observe the following output.