wpf OxyPlot 图例项目管理
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33340708/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
OxyPlot legend items managing
提问by Shadow2334
is there any way to manage items in legend? I mean e.q. remove some items from legend but not from whole plot? I know that each serie in plot is linked with one item in legend, but i want to break this rule and put to legend only selected series.
有没有办法管理图例中的项目?我的意思是 eq 从图例中删除一些项目而不是从整个情节中删除?我知道情节中的每个系列都与图例中的一个项目相关联,但我想打破这个规则,只将选定的系列放到图例中。
Thanks for your request.
感谢您的请求。
回答by Jose
If you don't assign a title to the series(lineseries, etc), it won't be represented on the legend:
如果您不为系列(lineseries 等)分配标题,则图例上将不会显示该标题:
plotModel = new PlotModel();
plotModel.LegendTitle = "Legend";
plotModel.LegendPosition = LegendPosition.RightBottom;
plotModel.Series.Add(new LineSeries
{
ItemsSource = someItemSource,
Color = OxyColors.Red,
//Title = "title" <- Title commented
});

