2012-12-27 2 views
1

내가 "현재 데이터 없음", 다른 rows.count == 0 일반적으로 막대 차트로 내가 메시지를 표시 할 차트를 제어합니다.

해당 메시지를 표시하는 방법을 알고있을 수 있습니다.

미리 감사드립니다.

+0

지금까지 무슨 짓을 한거야? –

+0

제가 사용된다면 ... –

+0

경우 (myTbl.Rows.Count == 0) { Chart1의 이와 같은 상태. ??? = "이 기간 동안 데이터 없음"; } else { // 내 차트 –

답변

3

이 시도 :

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); 
    } 
} 

감사