SharpPlot Reference > SharpPlot Properties > KeyStyle Property

SharpPlot.KeyStyle Property

Set the Key style to any combination of flags.

public KeyStyles KeyStyle {get; set;}


sp.KeyStyle = KeyStyles.Vertical;

Markers are normally included in keys if they are shown on each line – they can be omitted with style ‘plain’. When you use sp.DrawKey to place the key explicitly, the keys are normally positioned relative to the current (x,y) axes (style ‘Relative’) but you can choose to use absolute coordinates here, in which case you give the position of the key in Points from the chart origin (where the Axes would normally cross).

Any of the key layouts may be used with the autofit style. This starts with the type-size you specify and progressively reduces the font until the entire key fits into the available key frame. This may be a useful option if you are generating the key text from descriptions on a database, and hence do not know in advance how much space to allow for the key.

You would often want the ‘reversed’ ordering for stacked barcharts or surface charts. In this case the ‘reversed,vertical’ style means that the boxes in the key match the ordering of the bars or surfaces.

The ‘inline’ style is only used for LineGraphs. It writes the key text immediately to the right of the last point on the line, so is appropriate for timeseries data with well-separated lines. It may be necessary to increase the space in the right margin to make room for long series names.


AbsolutePosition is interpreted in points
AutofitTextShrink text to fit within given frame
BaselineBaselined legend (on first line of text)
BottomAlignVertically bottom aligned key frame
BoxedBoxed key
BoxFrameBox given frame instead of text
CenterAlignHorizontally center aligned key frame
InlineWithDataLegends are written inline with data
LeftAlignHorizontally left aligned key frame
MiddleAlignVertically middle aligned key frame
NoKeyNo key (always omit key)
NoWrapKey text is not wrapped to margin
PercentagePosition is interpreted in percentage of axes
PlainPlain (no markers) key
ReversedReversed order of legend items
RightAlignHorizontally right aligned key frame
RoundedRounded key box
ShadowedShadowed key box
TopAlignVertically top aligned key frame
VerticalVertically arranged legend

See also ...

SharpPlot Members | SharpPlot.DrawKey Method | SharpPlot.SetKeyFrame Method

Send comments on this topic
© Dyalog Ltd 2016