FlexChart | ComponentOne
FlexChart / Working with FlexChart / FlexChart Elements / FlexChart Series / Creating and Adding Series
In This Topic
    Creating and Adding Series
    In This Topic

    By default, FlexChart for WPF displays three series containing dummy data at design-time as well as run-time. However, you can provide your own data and display the series with that data. For information on how to provide data to FlexChart, refer to Providing Data.

    FlexChart enables you to create and add a series at design-time as well as run-time. So if you want to add more series, you can do so by performing any of the methods mentioned below.

    At Design-Time

    Perform the following steps to create and add a series in FlexChart at design-time:

    1. In the Properties window, click the Miscellaneous drop down.
    2. Navigate to the Series field.
    3. Click the Ellipsis button next to the Series field.
      Series Collection Editor: Series appears.
      By default, FlexChart contains three series added in the Series collection. Thus, Series Collection Editor appears with the pre-added series.
    4. Click the Add button to add an additional series in the Series collection.
    5. Repeat step 3 to add the required number of series.
    6. Click the OK button.

    At Run-Time

    At run-time, you first need to create a series by using the Series object. And then, you need to add the series to the FlexChart Series collection using the Add method in the FlexChart.Series collection property.

    The following code shows how to create and add a series in FlexChart at run-time.

    <c1:Series AxisX="{x:Null}" 
               AxisY="{x:Null}" 
               Binding="Y" 
               BindingX="X" 
               Chart="{x:Null}" 
               SeriesName="Series 4">
        <c1:Series.ItemsSource>
            <PointCollection>1,16 2,19 3,15 4,22 5,18</PointCollection>
        </c1:Series.ItemsSource>
    </c1:Series>
    
    C#
    Copy Code
    C1.WPF.Chart.Series series4 = new C1.WPF.Chart.Series();
    flexChart.Series.Add(series4);