Class Legend
- Namespace
- ScottPlot
- Assembly
- ScottPlot.dll
public class Legend : IPlottable, IHasOutline, IHasBackground, IHasShadow
- Inheritance
-
Legend
- Implements
- Inherited Members
- Extension Methods
Constructors
Legend(Plot)
public Legend(Plot plot)
Parameters
plot
Plot
Properties
Alignment
Position of the legend relative to the data area
public Alignment Alignment { get; set; }
Property Value
AllowMultiline
[Obsolete("Multiline is now enabled by default.", true)]
public bool AllowMultiline { get; set; }
Property Value
Axes
This object performs coordinate/pixel translation at render time based on the latest data area. It stores the axes to use for this plottable and also the data area (in pixels) updated just before each render. If this object is null it will be constructed using the default X and Y axes at render time.
public IAxes Axes { get; set; }
Property Value
BackgroundColor
public Color BackgroundColor { get; set; }
Property Value
BackgroundFill
[Obsolete("Assign BackgroundColor or interact with BackgroundFillStyle")]
public FillStyle BackgroundFill { get; set; }
Property Value
BackgroundFillStyle
public FillStyle BackgroundFillStyle { get; }
Property Value
BackgroundHatch
public IHatch? BackgroundHatch { get; set; }
Property Value
BackgroundHatchColor
public Color BackgroundHatchColor { get; set; }
Property Value
DisplayPlottableLegendItems
public bool DisplayPlottableLegendItems { get; set; }
Property Value
Font
[Obsolete("Assign FontSize, FontName, or FontColor to control appearance of all legend items", true)]
public FillStyle Font { get; set; }
Property Value
FontColor
If set, this overrides the value in the LegendItem's FontStyle
public Color? FontColor { get; set; }
Property Value
FontName
If set, this overrides the value in the LegendItem's FontStyle
public string? FontName { get; set; }
Property Value
FontSize
If set, this overrides the value in the LegendItem's FontStyle
public float? FontSize { get; set; }
Property Value
HiddenItemOpacity
This property controls how visible legend items are when their parent control's visibility is disabled. This property is only used when ShowItemsFromHiddenPlottables is enabled.
public double HiddenItemOpacity { get; set; }
Property Value
InterItemPadding
Space separating legend items
public PixelPadding InterItemPadding { get; set; }
Property Value
IsVisible
Toggles whether this plottable is shown and contributes to the automatic axis limit detection. The calling method will check this variable (it does not need to be checked inside the Render method).
public bool IsVisible { get; set; }
Property Value
LastRenderSize
public PixelSize LastRenderSize { get; }
Property Value
Layout
public ILegendLayout Layout { get; set; }
Property Value
LegendItems
Items which will appear in the legend
public IEnumerable<LegendItem> LegendItems { get; }
Property Value
Location
Position of the legend relative to the data area
[Obsolete("use Alignment")]
public Alignment Location { get; set; }
Property Value
ManualItems
Items in this list will always be displayed in the legend
public List<LegendItem> ManualItems { get; set; }
Property Value
Margin
Distance from the edge of the data area to the edge of the legend
public PixelPadding Margin { get; set; }
Property Value
Orientation
Stack items in the legend according to this preferred orientation
public Orientation Orientation { get; set; }
Property Value
OutlineColor
public Color OutlineColor { get; set; }
Property Value
OutlinePattern
public LinePattern OutlinePattern { get; set; }
Property Value
OutlineStyle
public LineStyle OutlineStyle { get; set; }
Property Value
OutlineWidth
public float OutlineWidth { get; set; }
Property Value
Padding
Distance between the legend frame and the items within it
public PixelPadding Padding { get; set; }
Property Value
Plot
public Plot Plot { get; }
Property Value
SetBestFontOnEachRender
Enabling this allows multi-language text in the figure legend, but may slow down the render loop.
public bool SetBestFontOnEachRender { get; set; }
Property Value
ShadowAlignment
public Alignment ShadowAlignment { get; set; }
Property Value
ShadowColor
public Color ShadowColor { get; set; }
Property Value
ShadowFill
[Obsolete("Assign ShadowColor or interact with ShadowFillStyle")]
public FillStyle ShadowFill { get; set; }
Property Value
ShadowFillStyle
public FillStyle ShadowFillStyle { get; }
Property Value
ShadowOffset
public PixelOffset ShadowOffset { get; set; }
Property Value
ShowItemRectangles_DEBUG
public bool ShowItemRectangles_DEBUG { get; set; }
Property Value
ShowItemsFromHiddenPlottables
If enabled, the legend will include items from hidden plottables. They will be partially painted over using the background color to simulate semitransparency.
public bool ShowItemsFromHiddenPlottables { get; set; }
Property Value
SymbolPadding
Padding between a symbol and label within a legend item
public float SymbolPadding { get; set; }
Property Value
SymbolWidth
Width of the symbol in a legend item
public float SymbolWidth { get; set; }
Property Value
TightHorizontalWrapping
If enabled, items in horizontal oriented legends will not be aligned in columns but instead resized tightly to fit their contents
public bool TightHorizontalWrapping { get; set; }
Property Value
Methods
GetAxisLimits()
Return the 2D area (in coordinate space) occupied by the data contained in this plottable
public AxisLimits GetAxisLimits()
Returns
GetImage()
Return an Image containing just the legend
public Image GetImage()
Returns
GetItems()
public virtual LegendItem[] GetItems()
Returns
GetLayout(PixelSize)
public LegendLayout GetLayout(PixelSize size)
Parameters
size
PixelSize
Returns
GetSvgXml()
Return contents of a SVG image containing just the legend
public string GetSvgXml()
Returns
Render(RenderPack)
This is called automatically by the render manager
public virtual void Render(RenderPack rp)
Parameters
rp
RenderPack
Render(SKCanvas, PixelRect, Alignment)
public void Render(SKCanvas canvs, PixelRect rect, Alignment alignment)