This question is locked. New answers and comments are not allowed.
I am creating RadBarChart in silverlight.
If I hardcode the Yvalue
and XCategory
values in the same class then the chart shows correct data.
Below is the method I am calling after Initializecomponent()
method in Sample.cs class.
public void FillSampleChartData()
{
DataSeries dataSeries = new DataSeries();
dataSeries.Definition = new BarSeriesDefinition();
dataSeries.Add(new DataPoint() { YValue = 1127.13, XCategory = "Victor" });
dataSeries.Add(new DataPoint() { YValue = 1123.80, XCategory = "Kishore" });
dataSeries.Add(new DataPoint() { YValue = 9948.94, XCategory = "Vincent" });
RadChartSales.DefaultView.ChartArea.DataSeries.Add(dataSeries);
}
I have doubt if I call same method from other class...barchart not showing any data. Let me know why chart is not displaying data.
//This is my original method
public void FillSampleChartData(IList collection)
{
int listcount = collection.Count;
int count = -1;
double[] myArray1 = new double[listcount];
string[] myArray2 = new string[listcount];
foreach (BizFramework.Web.Model.SalesBySalesPersonSummary_Result dtvws in collection)
{
count++;
myArray1[count] = Convert.ToDouble(dtvws.Amount);
myArray2[count] = dtvws.Salesperson;
}
DataSeries dataSeries = new DataSeries();
dataSeries.Definition = new BarSeriesDefinition();
if (myArray1.Count() > 0)
{
for (int i = 0; i < myArray1.Count(); i++)
{
dataSeries.Add(new DataPoint() { YValue = myArray1[i], XCategory = myArray2[i] });
}
RadChartSales.DefaultView.ChartArea.DataSeries.Add(dataSeries);
}
}