我有一个柱形图显示数据库中的数据并以 % 显示。它工作正常,但是当它不返回任何结果时,.chart 应该显示 0%,但它显示的是 NaN 而不是 0%。想要显示为 0% 想要在系列标签中显示 0%
if (platForms != null)
foreach (var platForm in platForms)
{
DataRow dr = dt.NewRow();
dr["Platform"] = platForm;
dr["Count"] = GetPlatformCount(temp, platForm);
dt.Rows.Add(dr);
}
chartWorkItemsPlatform.Series["Series1"].ChartType = SeriesChartType.Column;
chartWorkItemsPlatform.Series["Series1"].XValueMember = "Platform";
chartWorkItemsPlatform.Series["Series1"].YValueMembers = "Count";
chartWorkItemsPlatform.Series["Series1"]["DrawingStyle"] = "Emboss";
chartWorkItemsPlatform.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true;
chartWorkItemsPlatform.Series["Series1"].IsValueShownAsLabel = true;
chartWorkItemsPlatform.Series["Series1"].IsVisibleInLegend = true;
chartWorkItemsPlatform.Series["Series1"].IsXValueIndexed = true;
chartWorkItemsPlatform.Series["Series1"].Label = "#PERCENT";