Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
235
Binding ADO and xamDataChart
posted

I'm sorry if my question too silly. I try to bind DataTable with xamDataChart. Here is my code. As a result I see rectangle and one line. Could you tell me where my mistake is?

MainDataSet.Tables.Add("ChartTable");

MainDataSet.Tables["ChartTable"].Columns.Add("XCoordinate");

MainDataSet.Tables["ChartTable"].Columns.Add("YCoordinate");

for (int i = 0; i < 5; i++)

{

DataRow NewRow1 = MainDataSet.Tables["ChartTable"].NewRow();

MainDataSet.Tables["ChartTable"].Rows.Add(NewRow1);

MainDataSet.Tables["ChartTable"].Rows[i]["XCoordinate"] = i;

MainDataSet.Tables["ChartTable"].Rows[i]["YCoordinate"] = 2*i;

}

xamChartMainPosition.DataContext = MainDataSet.Tables["ChartTable"];

 

<

 

 

 

ig:XamDataChart HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="xamChartMainPosition" VerticalAlignment="Stretch" >

  <ig:XamDataChart.Axes>

 

<ig:CategoryXAxis Name="XAxisChartMainPosition" ItemsSource="{Binding Path=XCoordinate}" Label="{Binding Path=XCoordinate}"> </ig:CategoryXAxis>

 

 

 

<ig:NumericYAxis Name="YAxisChartMainPosition"></ig:NumericYAxis>

 

 

 

</ig:XamDataChart.Axes>

 

 

 

 <ig:XamDataChart.Series>

 

 

 

 <ig:LineSeries Name="TestLine" Title="Test"  ItemsSource="{Binding}" ValueMemberPath="YCoordinate"  XAxis="{Binding ElementName=XAxisChartMainPosition}"  YAxis="{Binding ElementName=YAxisChartMainPosition}" ></ig:LineSeries>

 

 

 

 

 </ig:XamDataChart.Series>

 </ig:XamDataChart>