我在c#中的图表列有问题,当我想更改文本图例以获取x值时,它在图例的位置向我显示了此(#VALX)。
这是我的代码 formLoad()
{
chart1.DataSource = Remplir("SELECT count(*) AS Expr1, Candidat.Sourcing FROM Sourcing INNER JOIN Candidat ON Sourcing.Sourcing=Candidat.Sourcing GROUP BY Candidat.Sourcing");
chart1.Series[0].XValueMember = "Sourcing";
chart1.Series[0].YValueMembers = "Expr1";
chart1.Series[0].IsVisibleInLegend = true;
}
您没有给出series
a Name
,查询也没有提供a。因此,您只需插入以下代码:
chart1.Series[0].Name = "Your Series Title";
显然,您只能在中显示一个文本Legend
,而不是所有X值!
如果要保留名称并独立设置Legend
文本,请使用属性: Series.LegendText
chart1.Series[0].LegendText = "Your Series Legend Text";
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句