Skip to content

Make the LegendItems property of a legend public #1578

@BambOoxX

Description

@BambOoxX

Features Suggestion

Currently, if one wants to get the bitmap to a legend with e.g

var legend = FormsPlot.Plot.Legend();
var picture = legend.GetBitmap();

This call returns an error if no plot has a label.
However, there is no way to actually know the number of items in the legend as this property is private.

private LegendItem[] LegendItems;

One could think of two solutions :

  • Either not return an error in case the legend is empty but return a null or an equivalent
  • Or make the LegendItems list public so that one can check its length prior GetLegendBitmap()

Side note : Wouldn't it be relevant to switch from an LegendItem[] array to a List<LegendItem> as there is intrinsically variable amount of plots in a ScottPlot ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions