0

我有一个柱形图显示数据库中的数据并以 % 显示。它工作正常,但是当它不返回任何结果时,.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";
4

1 回答 1

0

我不知道如何更改柱形图,但是如果数据来自数据库,请调整查询以在该列为空时返回 0。

于 2013-07-24T12:44:58.577 回答