Is there a way to display a “default” message on a MS Chart Control if there is no data to chart?
I have a chart, with some controls that allow the user to pick various date ranges. If there is no data to be charted in that date range, it currently just displays nothing (or at least it shows the legend, and background, but that’s it.)
I want there to be a message saying “no data for this period” or something instead.
Thanks,
Ben
Building on Chris’s response, here’s a more complete example:
In the ASPX code, add the OnDataBound handler to the chart tag. This assumes you are using a SqlDataSource for the data source.
In the code-behind, the handler checks if the first series has any data, and if it doesn’t, inserts the annotation in red.