如何设置更改饼图部分的标签以显示字段Count
的值,使其看起来像这样?
这是我用来绘制图表的代码:
private void UpdateEvaluation(SqlCommand cmdGraph)
{
chPie.DataSource = db.GetTable(cmdGraph);
chPie.Series["Series1"].XValueMember = "Value";
chPie.Series["Series1"].YValueMembers = "Count";
chPie.DataBind();
}
这就是它被调用的方式:
UpdateEvaluation(new SqlCommand("SELECT Value, Count(*) as Count " +
"FROM DV.dbo.tbDefender " +
"WHERE Class LIKE 'Operating System' " +
"AND Type LIKE 'Caption' " +
"GROUP BY Value " +
"ORDER BY Count DESC "));
答案 0 :(得分:0)
我自己发现了:
chPie.Series["Series1"].IsValueShownAsLabel = true;
必须设置值IsValueShownAsLabel
。以编程方式或通过Designer(在Chart Series 下的属性中,然后在Label下查找 IsValueShownAsLabel )