Search
Data Series and Binding

SeriesRenderer classes used to draw chart graphics read data through the Series interface. You could implement this interface in your own model classes to avoid duplicating data. Alternatively, if a model class is sealed but provides API to access its data, you could implement the interface in an adapter class.

The library includes several pre-defined series classes that let you specify data via IList or array objects. For example, BarSeries lets you specify lists of values, inner labels and top labels, and PointSeries lets you specify data as a list of points.

The DataBoundSeries class can take a data-source object such as a list of CLR objects, and read their values using reflection on fields specified via properties such as XDataField and InnerLabelsDataField. Setting the DataSource property of a Chart control will automatically create DataBoundSeries for all fields listed in the chart's *Fields properties such as XDataFields. You can freely mix explicitly created Series objects with ones generated automatically from DataSource.

XmlSeries automatically loads data from an XDocument, where node values to read are specified via their names through properties such as XDataName and InnerLabelsName. The Chart control creates XmlSeries automatically if you assign an XDocument to its DataSource property. In that case, the values from chart's *Fields properties are treated as element names and assigned to respective properties of the XmlSeries class.