MindFusion.Charting for Silverlight Programmer's Guide
Data

Data Properties

Data for the chart is set with the data properties of the ChartSeries objects. For line and bar charts they are AxesSeries.XData and AxesSeries.YData. For pie charts it is PieSeries.Data. Radar series support Data property for the data and Angles property for the angles if you draw a polar chart.

Data Binding

If you want to set the data with data binding the properties are marked with 'Path' at the end - PieSeries.DataPath, AxesSeries.XDataPath, AxesSeries.YDataPath, RadarSeries.DataPath.

The follwoing example uses an observable collection as a data source for the Y-values of a bar chart. The X-values are numbers:

C#  Copy Code

barChart1.DataSource = sales;
BarSeries series = barChart1.Series[0] as BarSeries;
series.YDataPath = "Profit";
series.XData.Clear();
for (int i = 0; i < sales.Count; i++)
    series.XData.Add(i);

VB.NET  Copy Code

barChart1.DataSource = sales
Dim series As BarSeries = CType(barChart1.Series(0),BarSeries)
series.YDataPath = "Profit"
series.XData.Clear
Dim i As Integer = 0
Do While (i < sales.Count)
    series.XData.Add(i)
    i = (i + 1)
Loop

Second X-axis and Second Y-axis

The ChartSeries might be bound to the second X-axis or the second Y-axis or both. In this the AxesSeries.X2Data and AxesSeries.Y2Data properties set the data as numbers. If you prefer data binding the properties are AxesSeries.X2DataPath and AxesSeries.Y2DataPath.

Data Format

Data in each series is expected to be one dimensional IList which holds double-s or other that could be converted to double-s with the standard .NET converters and parsers.

DateTime Values

If you want to use DateTime values in your chart you must set the AxisSettings.ValueFormat property to ValueFormat.DateTime. Check the DateTime Values section of this reference for further details on how to use DateTime values.