【问题标题】:Microsoft Chart Control: Prevent Series from appearing in LegendMicrosoft 图表控件:防止系列出现在图例中
【发布时间】:2009-12-16 21:02:18
【问题描述】:

在 MS Chart 控件(他们从 Dundas 购买)中,我需要绘制三个系列。

系列中的两个应该在传奇中有条目,但第三个不应该。

我已经尝试了这些代码行,但没有任何工作:

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

如何防止系列出现在图例中?

【问题讨论】:

  • 不熟悉有问题的特定控件,但是否可以添加第二个图例,添加第三个系列,然后隐藏该图例?

标签: mschart


【解决方案1】:

用途:

s3.IsVisibleInLegend = false;

免责声明:仅在 (ASP).Net 4,VS 2010 中测试。您的里程可能会有所不同...

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-11
    • 2011-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多