Class Legend
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class Legend : ICloneable, ISerializable
Constructors
| Improve this Doc View SourceLegend()
Default constructor that sets all Legend properties to default values as defined in the Legend.Default class.
Declaration
public Legend()
Legend(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected Legend(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
Legend(Legend)
The Copy Constructor
Declaration
public Legend(Legend rhs)
Parameters
Type | Name | Description |
---|---|---|
Legend | rhs | The XAxis object from which to copy |
Fields
| Improve this Doc View Sourceschema
Current schema value that defines the version of the serialized file
Declaration
public const int schema = 12
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceBorder
Declaration
public Border Border { get; set; }
Property Value
Type | Description |
---|---|
Border |
Fill
Declaration
public Fill Fill { get; set; }
Property Value
Type | Description |
---|---|
Fill |
FontSpec
Declaration
public FontSpec FontSpec { get; set; }
Property Value
Type | Description |
---|---|
FontSpec | A reference to a Legend object |
See Also
| Improve this Doc View SourceGap
Gets or sets the gap size between the legend and the Rect.
Declaration
public float Gap { get; set; }
Property Value
Type | Description |
---|---|
Single |
Remarks
This is expressed as a fraction of the largest scaled character height for any of the fonts used in the legend. Each CurveItem in the legend can optionally have its own FontSpec specification.
IsHStack
Sets or gets a property that allows the Legend items to stack horizontally in addition to the vertical stacking
Declaration
public bool IsHStack { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to allow horizontal stacking, false otherwise |
See Also
| Improve this Doc View SourceIsReverse
Gets or sets a value that determines if the legend entries are displayed in normal order (matching the order in the CurveList, or in reverse order.
Declaration
public bool IsReverse { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsShowLegendSymbols
Gets or sets a value that determines whether the line and symbol keys will be displayed in the legend.
Declaration
public bool IsShowLegendSymbols { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Note: If this value is set to false (so that only the curve label text is displayed with no legend keys), then the color of the font for the legend entry of each curve will automatically be set to match the Color setting for that curve. You can override this behavior by specifying a specific font to be used for each individual curve with the FontSpec property.
IsVisible
Gets or sets a property that shows or hides the Legend entirely
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to show the Legend, false to hide it |
See Also
| Improve this Doc View SourceLocation
Gets or sets the Location data for the Legend. This property is only applicable if Position is set to Float.
Declaration
public Location Location { get; set; }
Property Value
Type | Description |
---|---|
Location |
Position
Declaration
public LegendPos Position { get; set; }
Property Value
Type | Description |
---|---|
LegendPos |
See Also
| Improve this Doc View SourceRect
Get the bounding rectangle for the Legend in screen coordinates
Declaration
public RectangleF Rect { get; }
Property Value
Type | Description |
---|---|
RectangleF | A screen rectangle in pixel units |
Methods
| Improve this Doc View SourceCalcRect(Graphics, PaneBase, Single, ref RectangleF)
Calculate the Legend rectangle (Rect), taking into account the number of required legend entries, and the legend drawing preferences.
Declaration
public void CalcRect(Graphics g, PaneBase pane, float scaleFactor, ref RectangleF tChartRect)
Parameters
Type | Name | Description |
---|---|---|
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
PaneBase | pane | A reference to the PaneBase object that is the parent or owner of this object. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent GraphPane object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
RectangleF | tChartRect | The rectangle that contains the area bounded by the axes, in pixel units. Rect |
Remarks
Adjust the size of the Rect for the parent GraphPane to accomodate the space required by the legend.
Clone()
Typesafe, deep-copy clone method.
Declaration
public Legend Clone()
Returns
Type | Description |
---|---|
Legend | A new, independent copy of this class |
Draw(Graphics, PaneBase, Single)
Declaration
public void Draw(Graphics g, PaneBase pane, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
Graphics | g | A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. |
PaneBase | pane | A reference to the PaneBase object that is the parent or owner of this object. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent GraphPane object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
Remarks
This method is normally only called by the Draw method of the parent GraphPane object.
FindPoint(PointF, PaneBase, Single, out Int32)
Determine if a mouse point is within the legend, and if so, which legend entry (CurveItem) is nearest.
Declaration
public bool FindPoint(PointF mousePt, PaneBase pane, float scaleFactor, out int index)
Parameters
Type | Name | Description |
---|---|---|
PointF | mousePt | The screen point, in pixel coordinates. |
PaneBase | pane | A reference to the PaneBase object that is the parent or owner of this object. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent GraphPane object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
Int32 | index | The index number of the CurveItem legend entry that is under the mouse point. The CurveItem object is accessible via CurveList. |
Returns
Type | Description |
---|---|
Boolean | true if the mouse point is within the Legend bounding box, false otherwise. |
See Also
| Improve this Doc View SourceGetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo instance with the data needed to serialize the target object
Declaration
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
Type | Name | Description |
---|---|---|
SerializationInfo | info | A SerializationInfo instance that defines the serialized data |
StreamingContext | context | A StreamingContext instance that contains the serialized data |
Explicit Interface Implementations
| Improve this Doc View SourceICloneable.Clone()
Implement the ICloneable interface in a typesafe manner by just calling the typed version of Clone()
Declaration
object ICloneable.Clone()
Returns
Type | Description |
---|---|
Object | A deep copy of this object |