Quick Start

The following quick-start guide will take you through the basics of FlexChart control.

This quick start will guide you through the steps of creating a simple line symbol chart using the FlexChart control. Follow the steps below to get started:

quickstart for creating a symbol chart

Set up the application

  1. Create a new Windows Forms app.
  2. Drag and drop the FlexChart control from the toolbox onto the form.
    Observe: A column type chart is drawn with a default data.

Bind the FlexChart control to a data source

  1. Create a data source.
    public List<Product> GetProductRevenue()
    {
        List<Product> _list = new List<Product>();
        _list.Add(new Product() { Name = "Desktop", Date = new DateTime(2018, 04, 07), Orders = 265, Revenue = 6625 });
        _list.Add(new Product() { Name = "Desktop", Date = new DateTime(2018, 05, 08), Orders = 107, Revenue = 2675 });
        _list.Add(new Product() { Name = "Mouse", Date = new DateTime(2018, 06, 02), Orders = 56, Revenue = 560 });
        _list.Add(new Product() { Name = "Mouse", Date = new DateTime(2018, 07, 06), Orders = 572, Revenue = 5720 });
        _list.Add(new Product() { Name = "Mouse", Date = new DateTime(2018, 08, 05), Orders = 468, Revenue = 4680 });
        _list.Add(new Product() { Name = "Printer", Date = new DateTime(2018, 09, 02), Orders = 154, Revenue = 2310 });
        _list.Add(new Product() { Name = "Desktop", Date = new DateTime(2018, 10, 03), Orders = 89, Revenue = 2225 });
        _list.Add(new Product() { Name = "Desktop", Date = new DateTime(2018, 11, 05), Orders = 347, Revenue = 8675 });
        _list.Add(new Product() { Name = "Printer", Date = new DateTime(2018, 12, 07), Orders = 204, Revenue = 3060 });
        _list.Add(new Product() { Name = "Printer", Date = new DateTime(2019, 01, 03), Orders = 34, Revenue = 510 });
        _list.Add(new Product() { Name = "Mouse", Date = new DateTime(2019, 02, 06), Orders = 223, Revenue = 2230 });
        _list.Add(new Product() { Name = "Desktop", Date = new DateTime(2019, 03, 08), Orders = 119, Revenue = 2975 });
        return _list;
    }
    
  2. Bind the FlexChart to this data source by setting the DataSource property.
    //Passing data to FlexChart
    this.flexChart1.DataSource = GetProductRevenue();
    

Configure the FlexChart control

  1. Clear the default series getting displayed in the chart.
  2. Add a new series using Add method and configure the X and Y axes by setting the BindingX and Binding property.
  3. Configure the chart by setting the ChartType and other required properties.
    flexChart1.Series.Clear();
    
    //Selecting chart's type 
    this.flexChart1.ChartType = C1.Chart.ChartType.LineSymbols;
    
    //Setting chart's Header and styling it
    this.flexChart1.Header.Content = "DateWise Revenue";
    
    //Adding a Series to chart and binding it (AxisY) to 'Revenue' field of DataCollection
    this.flexChart1.Series.Add(new C1.Win.Chart.Series
    {
        //Name property specifies the string to be displayed corresponding to this Series in Legend
        Name = "Sales",
        Binding = "Revenue"
    });
    
    //Binding chart's AxisX to 'Date' so Dates are shown in Horizontal axis
    this.flexChart1.BindingX = "Date";
    
See Also