Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/287.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 图表控件。如何删除图例标签_C#_Asp.net_Charts - Fatal编程技术网

C# 图表控件。如何删除图例标签

C# 图表控件。如何删除图例标签,c#,asp.net,charts,C#,Asp.net,Charts,我从这个网站上得到了一个简单的代码: 现在,我想删除饼图中的所有标签,即“a”、“b”、“c”、“d” 我试着这样做: Chart1.Series[0].IsValueShownAsLabel = false; 但是它不起作用,请帮忙。我被卡住了请删除以下代码: Chart1.Legends.Add(new Legend("Alphabet")); Chart1.Legends["Alphabet"].Title = "Letters"; Chart1.Series[

我从这个网站上得到了一个简单的代码:

现在,我想删除饼图中的所有标签,即“a”、“b”、“c”、“d”

我试着这样做:

Chart1.Series[0].IsValueShownAsLabel = false;

但是它不起作用,请帮忙。我被卡住了

请删除以下代码:

    Chart1.Legends.Add(new Legend("Alphabet"));
    Chart1.Legends["Alphabet"].Title = "Letters";
    Chart1.Series[0].Legend = "Alphabet";
更新:和更改

string[] xValues = { "A", "B", "C", "D" };


IsValueShownAsLabel确定是否将数值(y val)用于标签而不是x值。
作为猜测,您可能需要手动将每个数据点的Label属性设置为空字符串。

您需要设置
PieLabelStyle
类似的内容

Chart1.Series[0]["PieLabelStyle"] = "Disabled";

在VB.Net中运行良好:

Chart1.Series(0).IsVisibleInLegend = False

我知道你不搜索VB.Net。但这可能对VB.net用户有所帮助。

我删除了它。但标签只是停留在饼图上
Chart1.Series(0).IsVisibleInLegend = False