6

MS Chart コントロール (Dundas から購入したもの) には、プロットする必要がある 3 つの系列があります。

シリーズのうちの 2 つはレジェンドにエントリーする必要がありますが、3 つ目はすべきではありません。

これらのコード行を試しましたが、どれも機能しません:

Chart c = new Chart();
ChartArea ca = c.ChartAreas.Add("main");
Legend lg = c.Legends.Add("mainLegend");
Series s1 = c.Series.Add("s1");
Series s2 = c.Series.Add("s2");
Series s3 = c.Series.Add("s3");

// ... populate the 3 series with data...

s1.Legend = "mainLegend";
s2.Legend = "mainLegend";

// I've tried these:
s3.Legend = ""; // gives an error about a nonexistent legend named ''
s3.LegendText = ""; // just shows "s3" in the legend

シリーズが凡例に表示されないようにするにはどうすればよいですか?

4

1 に答える 1

11

使用する:

s3.IsVisibleInLegend = false;

免責事項: (ASP).Net 4、VS 2010 でのみテストされています。マイレージは異なる場合があります...

于 2010-02-03T22:15:06.243 に答える