# Collection of Values

## Content



You can use several methods for delivering data to the chart. One method is binding a collection of values using the [ValuesSource](/componentone/api/wpf/online-chart/dotnet-framework-api/C1.WPF.C1Chart.4.6.2/C1.WPF.C1Chart.DataSeries.ValuesSource.html) property.

Any collection of numerical values that support **IEnumerable** interface can be used as a data source for the data series. Each data series class has appropriate properties for data binding. For example, the [DataSeries](/componentone/api/wpf/online-chart/dotnet-framework-api/C1.WPF.C1Chart.4.6.2/C1.WPF.C1Chart.DataSeries.html) class uses the **ValuesSource** property for data binding.

To bind the collection of values to the **DataSeries** you can first specify the binding source as an array of double like the following:

```xml
<!—Binding Source -->
<x:Array xmlns:sys="clr-namespace:System;assembly=mscorlib"
       x:Key="array" Type="sys:Double">
       <sys:Double>1</sys:Double>
       <sys:Double>4</sys:Double>
       <sys:Double>9</sys:Double>
       <sys:Double>16</sys:Double>
</x:Array>
```

To pass the array to the data series use the following markup:

```xml
<!—Binding Target -->
<c1chart:C1Chart Name="chart">
  <c1chart:C1Chart.Data>
     <c1chart:ChartData ItemsSource="{Binding Source={StaticResource array}, Path=Items}">
       <c1chart:DataSeries ValuesSource="{Binding Source={StaticResource array},Path=Items}"/>
     </c1chart:ChartData>
   </c1chart:C1Chart.Data>
</c1chart:C1Chart>
```

It is possible to specify the data values as an attribute, the values should be separated with spaces, for example:

```xml
<c1chart:DataSeries Values="1 2 9 16"/>
```

The preceding markup declaratively binds the ValuesSource property of a DataSeries to the Items property of a DataSeries object which is given a value of "1 2 9 16".

## See Also

[Collection of Objects](/componentone/docs/wpf/online-chart/overview/ChartFeatures/DataBinding/CollectioofObjects)