Can I display a message if MS Chart Control has no data?

前端 未结 3 1906
情深已故
情深已故 2021-02-20 18:00

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 variou

3条回答
  •  别那么骄傲
    2021-02-20 18:15

    You should be able to add an annotation to the chart if there is no data.

    TextAnnotation annotation = new TextAnnotation();
    annotation.X = 50;
    annotation.Y = 50;
    annotation.Text = "No Data";
    chart1.Annotations.Add(annotation);
    

提交回复
热议问题