WinUI | ComponentOne
Controls / FlexChart / Quick Start
In This Topic
    Quick Start
    In This Topic

    The following quick start guide is intended to get you up and running with the FlexChart control. In this quick start, you start by creating a new WinUI application, add the FlexChart control to it, and bind it with a datasource. The following image displays the FlexChart control showing the sales details of products.

    simple line chart

    Create a WinUI Application and Add References

    1. In Visual Studio, create a new WinUI App. For detailed steps, see Configure WinUI Application.
    2. In the Solution Explorer, right click Dependencies and select Manage NuGet Packages.
    3. In NuGet Package Manager, select nuget.org as the Package source.
    4. Search and select the following package and click Install.
      • C1.WinUI.Chart

    Back to Top

    Configure the FlexChart control

    1. Declare the namespace using the following code in XAML:
      XAML
      Copy Code
      xmlns:c1="using:C1.WinUI.Chart"
      

    2. Place the cursor between the <Grid></Grid> tag to add the FlexChart control using the following code:
      XAML
      Copy Code
      <c1:FlexChart x:Name="flexChart" BindingX="Date" ChartType="LineSymbols" Height="500">
          <c1:FlexChart.Series>
              <c1:Series SeriesName="Sales" Binding="Revenue"/>
          </c1:FlexChart.Series>
      </c1:FlexChart>
      

    3. Switch from XAML to C# code view and bind the FlexChart control to a datasource using the ItemsSource property. Here, we use the DataService class as a data source.
      C#
      Copy Code
      flexChart.ItemsSource = DataService.GetProductRevenue();
      

    Back to Top

    Build and Run the Project

    1. Click Build | Build Solution to build the project.
    2. Press F5 to run the project.

    Back to Top