How can I detect if a chart will have no data?


QUESTION

How can I detect if a chart will have no data?

ANSWER

First you have to use the dataEngine to get a populated series collection. See: Q10392

Then, you can see if the series collection has series and if the series have elements.

[C#]

SeriesCollection sc = myDataEngine.GetSeries();
bool hasData = false;
if(sc.Count > 0)
{
    foreach(Series s in sc)
        if(s.Elements.Count != 0)
            hasData = true;
}
 

You may also control the 'no data' label by using:
Chart.NoDataLabel.Text = "..";


Posted Wednesday, December 1, 2004 by Support
https://www.dotnetcharting.com/kb/KnowledgebaseArticle10621.aspx