OxyPlot legend items managing

Shadow2334 picture Shadow2334 · Oct 26, 2015 · Viewed 7.9k times · Source

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.

Thanks for your request.

Answer

Jose picture Jose · Nov 5, 2015

If you don't assign a title to the series(lineseries, etc), it won't be represented on the legend:

plotModel = new PlotModel();
plotModel.LegendTitle = "Legend";
plotModel.LegendPosition = LegendPosition.RightBottom;

plotModel.Series.Add(new LineSeries
{
    ItemsSource = someItemSource,
    Color = OxyColors.Red,
    //Title = "title" <- Title commented
});