Reference > Structures > KeyDefinition Struct

KeyDefinition Struct

Definition structure for data-placeholder in chart keys. Mostly used internally, but may be defined by the calling application to customise legend placeholders.

public struct KeyDefinition

Public Constructors

Create a custom key placeholder (type 1 = line/marker, type 2 = block key for surface or bar, type 3 = stepped line).

Block key uses type=2 and requires colour, and optional FillStyle (solid fill is the default):

public KeyDefinition(
   int type,
   Color color, 
   FillStyle pattern
);

Line/marker key is always type=1 and requires Colour,LineStyle and PenWidth. If MarkerSyle is omitted, no markers are drawn.

public KeyDefinition(
   int type,
   Color color, 
   LineStyle line
   double penwidth
   Marker marker
);

You may also use this constructor to make a Stepped line key (type=3) suitable for Stepcharts.

Example

// Make 2 custom legend placeholders
 key1 = new KeyDefinition(1,Color.Red,LineStyle.Solid,0.8,Marker.SmallBullet);
 key2 = new KeyDefinition(1,Color.Navy,LineStyle.Solid,0.8,Marker.Ring);
// Use them in a hand-made legend block 
 sp.DrawKey(2,10,new KeyDefinition[]{key1,key2});

This creates two placeholders suitable for a chart with lines and markers.

Requirements

Namespace: Causeway

Assembly: SharpPlot (in sharpplot.dll)

See also ...

SharpPlot Members | DrawKey Method


Send comments on this topic
© Dyalog Ltd 2013