SharpPlot Reference > SharpPlot Methods > SetKeyIndices Method

SharpPlot.SetKeyIndices Method

Makes an arbitrary selection from the currently defined key placeholders and associated legend texts.


sp.SetKeyIndices(new int[] {5,4,1});
sp.KeyStyle = KeyStyles.Vertical|KeyStyles.Boxed|KeyStyles.RightAlign|KeyStyles.MiddleAlign;



As elements are added to a complex chart, the legend definitions are accumulated in the order the charts are created. This order may not be how the legend should appear, or it may be necessary to select only some of the legend items. This setting may be used (as here) to control one or more calls to DrawKey, or simply to choose the entries flushed out by default when the chart is rendered.

Note that the legend text is given in the same sequence as the original (default) ordering – both the placeholders and legends are selected by this setting. If you request a Trend line and a Model fit with a Scatterplot, the legend items are added in the sequence (data, trend, model) for each series plotted.

See also ...

SharpPlot Members

Send comments on this topic
© Dyalog Ltd 2021