Search Results for

    Show / Hide Table of Contents

    Class Legend

    This class encapsulates the chart Legend that is displayed in the GraphPane

    Inheritance
    Object
    Legend
    Implements
    ICloneable
    ISerializable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: ZedGraph
    Assembly: ZedGraph.dll
    Syntax
    [Serializable]
    public class Legend : ICloneable, ISerializable

    Constructors

    | Improve this Doc View Source

    Legend()

    Default constructor that sets all Legend properties to default values as defined in the Legend.Default class.

    Declaration
    public Legend()
    | Improve this Doc View Source

    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

    | Improve this Doc View Source

    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 Source

    schema

    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 Source

    Border

    The Border class used to draw the border border around this Legend.

    Declaration
    public Border Border { get; set; }
    Property Value
    Type Description
    Border
    | Improve this Doc View Source

    Fill

    Gets or sets the Fill data for this Legend background.

    Declaration
    public Fill Fill { get; set; }
    Property Value
    Type Description
    Fill
    | Improve this Doc View Source

    FontSpec

    Access to the FontSpec class used to render the Legend entries

    Declaration
    public FontSpec FontSpec { get; set; }
    Property Value
    Type Description
    FontSpec

    A reference to a Legend object

    See Also
    FontColor
    FontBold
    FontItalic
    FontUnderline
    FontFamily
    FontSize
    | Improve this Doc View Source

    Gap

    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.

    | Improve this Doc View Source

    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
    IsHStack
    | Improve this Doc View Source

    IsReverse

    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
    | Improve this Doc View Source

    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.

    | Improve this Doc View Source

    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
    IsVisible
    | Improve this Doc View Source

    Location

    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
    | Improve this Doc View Source

    Position

    Sets or gets the location of the Legend on the GraphPane using the LegendPos enum type

    Declaration
    public LegendPos Position { get; set; }
    Property Value
    Type Description
    LegendPos
    See Also
    Position
    | Improve this Doc View Source

    Rect

    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 Source

    CalcRect(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.

    | Improve this Doc View Source

    Clone()

    Typesafe, deep-copy clone method.

    Declaration
    public Legend Clone()
    Returns
    Type Description
    Legend

    A new, independent copy of this class

    | Improve this Doc View Source

    Draw(Graphics, PaneBase, Single)

    Render the Legend to the specified Graphics device.

    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.

    | Improve this Doc View Source

    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
    FindNearestObject(PointF, Graphics, out Object, out Int32)
    | Improve this Doc View Source

    GetObjectData(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 Source

    ICloneable.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

    Implements

    System.ICloneable
    System.Runtime.Serialization.ISerializable
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX