I'm getting this same error, when I use a Bar Chart and it is bound to a Collection derived from CollectionBase.
Here's my code:
public
class ChartDataValue
{
public string origData;
public int barHeight;public decimal origDataConverted;public ChartDataValue(string _origData, decimal _origDataConverted)
{
origData = _origData;
origDataConverted = _origDataConverted;
barHeight = 0;
}
}
/// <summary>
/// Custom collection
/// </summary>
public class ChartData : CollectionBase
{
/// <summary>
/// Add a new item to the collection
/// </summary>public virtual void Add(ChartDataValue toAdd)
{
this.List.Add(toAdd);
}
/// <summary>
/// Gets or sets the element at the specified index.
/// </summary>public ChartDataValue this[int index]
{
get
{
return this.List[index] as ChartDataValue;
}
}
}
public
partial class _Default : System.Web.UI.Page
{
private ChartData BarData;protected void Page_Load(object sender, EventArgs e)
{
BarData = dl.LoadData(selectedItem);
}
protected void BindingtoClassesDerivedfromCollectionBase_Load(object sender, System.EventArgs e)
{
this.UltraChart1.Data.DataSource = BarData;
UltraChart1.Data.DataBind();
}
}
(from DataLayer)
public ChartData LoadData(string practiceID)
{
// sql stuff intentionally removed here
ChartData cd = new ChartData();
string tempStr;for (int i = 0; i < 12; i++)
{
cd.Add(new ChartDataValue(GenerateMonthName(i), ParseDataValue(tempStr)));
}
return cd;
}
I have checked this with a breakpoint at runtime, and just before the call to DataBind(), my ChartData Collection contains 12 items, each of class ChartDataValue. Inside each ChartDataValue, as expected, the MonthName appears in the origData, and the decimal value is in origDataConverted.
All requirements in the documentation seem to be fulfilled, however it still just draws the red error message saying:
You must have at least one row and one numeric column