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
85
Databinding in the code behind for XamChart
posted

I am trying to create a XamChart with the following code, but cannt seem to get it to work.

System.Data.DataTable dt;

dt = new System.Data.DataTable();

dt.Columns.Add("Series Label", typeof(string));

dt.Columns.Add("Segment A", typeof(int));

dt.Columns.Add("Segment B", typeof(int));

dt.Columns.Add("Segment C", typeof(int));

dt.Columns.Add("SegmentD", typeof(int));

dt.Rows.Add(new object[ { "Stack A", 1, 4, 5, 200 });

dt.Rows.Add(new object[ { "Stack B", 2, 140, 4, 2 });

dt.Rows.Add(new object[ { "Stack C", 5, 10, 9, 15 });

dt.Rows.Add(new object[ { "Stack D", 3, 5, 5, 7 });

xamChart1.Series.Clear();

Series c = new Infragistics.Windows.Chart.Series();c.ChartType = ChartType.Stacked100Bar;for (int i = 0; i < 4; i++)

{

c = new Infragistics.Windows.Chart.Series();

c.ChartType = ChartType.Stacked100Bar;

c.DataSource = dt.Rows[i];

xamChart1.Series.Add(c);

}

Please give me some pointers to where I am going wrong. Thank you. 

 

Parents Reply Children
No Data