我有一个柱形图显示数据库中的数据并以%显示。它工作正常但是当它没有返回任何结果时.chart应显示0%但不是0%它显示NaN。想要显示为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";
答案 0 :(得分:0)
我不知道如何更改柱形图,但如果数据来自数据库,请调整查询以在该列为空时返回0.