如何在ASP图表控件中的图表中显示错误消息 [英] How to display Error message into chart in asp chart controls
本文介绍了如何在ASP图表控件中的图表中显示错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个图表,当rows.count == 0时,我必须将消息显示为无数据" 其他是条形图.
I have a chart where I have to display message as "No Data Present",when rows.count == 0 else the bar chart as usually.
我可以知道如何显示该消息吗?
May i know how to display that message.
谢谢.
推荐答案
尝试一下:
protected void ChartExample_DataBound(object sender, EventArgs e)
{
// If there is no data in the series, show a text annotation
if(ChartExample.Series[0].Points.Count == 0)
{
System.Web.UI.DataVisualization.Charting.TextAnnotation annotation =
new System.Web.UI.DataVisualization.Charting.TextAnnotation();
annotation.Text = "No data for this period";
annotation.X = 5;
annotation.Y = 5;
annotation.Font = new System.Drawing.Font("Arial", 12);
annotation.ForeColor = System.Drawing.Color.Red;
ChartExample.Annotations.Add(annotation);
}
}
谢谢
这篇关于如何在ASP图表控件中的图表中显示错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文