Search Results for

    Show / Hide Table of Contents

    Class Axis

    The Axis class is an abstract base class that encompasses all properties and methods required to define a graph Axis.

    Inheritance
    Object
    Axis
    X2Axis
    XAxis
    Y2Axis
    YAxis
    Implements
    ISerializable
    ICloneable
    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 abstract class Axis : ISerializable, ICloneable
    Remarks

    This class is inherited by the XAxis, YAxis, and Y2Axis classes to define specific characteristics for those types.

    Constructors

    | Improve this Doc View Source

    Axis()

    Default constructor for Axis that sets all axis properties to default values as defined in the Axis.Default class.

    Declaration
    public Axis()
    | Improve this Doc View Source

    Axis(SerializationInfo, StreamingContext)

    Constructor for deserializing objects

    Declaration
    protected Axis(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

    Axis(String)

    Constructor for Axis that sets all axis properties to default values as defined in the Axis.Default class, except for the Title.

    Declaration
    public Axis(string title)
    Parameters
    Type Name Description
    String title

    A string containing the axis title

    | Improve this Doc View Source

    Axis(Axis)

    The Copy Constructor.

    Declaration
    public Axis(Axis rhs)
    Parameters
    Type Name Description
    Axis rhs

    The Axis object from which to copy

    Fields

    | Improve this Doc View Source

    _isAxisSegmentVisible

    Private fields for the Axis attributes. Use the public properties IsVisible, IsAxisSegmentVisible for access to these values.

    Declaration
    [CLSCompliant(false)]
    protected bool _isAxisSegmentVisible
    Field Value
    Type Description
    Boolean
    | Improve this Doc View Source

    _isVisible

    Private fields for the Axis attributes. Use the public properties IsVisible, IsAxisSegmentVisible for access to these values.

    Declaration
    [CLSCompliant(false)]
    protected bool _isVisible
    Field Value
    Type Description
    Boolean
    | Improve this Doc View Source

    _title

    Private field for the Axis title string. Use the public property Title for access to this value.

    Declaration
    [CLSCompliant(false)]
    protected AxisLabel _title
    Field Value
    Type Description
    AxisLabel
    | Improve this Doc View Source

    schema

    Current schema value that defines the version of the serialized file

    Declaration
    public const int schema = 10
    Field Value
    Type Description
    Int32
    | Improve this Doc View Source

    Tag

    A tag object for use by the user. This can be used to store additional information associated with the Axis. ZedGraph does not use this value for any purpose.

    Declaration
    public object Tag
    Field Value
    Type Description
    Object
    Remarks

    Note that, if you are going to Serialize ZedGraph data, then any type that you store in Tag must be a serializable type (or it will cause an exception).

    Properties

    | Improve this Doc View Source

    AxisGap

    The size of the gap between multiple axes (see YAxisList and Y2AxisList).

    Declaration
    public float AxisGap { get; set; }
    Property Value
    Type Description
    Single

    The axis gap is measured in points (1/72 inch)

    Remarks

    This size will be scaled according to the CalcScaleFactor() for the GraphPane

    See Also
    AxisGap
    | Improve this Doc View Source

    Color

    The color to use for drawing this Axis.

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

    The color is defined using the Color class

    Remarks

    This affects only the axis segment (see IsAxisSegmentVisible), since the Title, Scale, MajorTic, MinorTic, MajorGrid, and MinorGrid all have their own color specification.

    See Also
    Color
    IsVisible
    | Improve this Doc View Source

    Cross

    Gets or sets the scale value at which this axis should cross the "other" axis.

    Declaration
    public double Cross { get; set; }
    Property Value
    Type Description
    Double

    The value is defined in user scale units

    Remarks

    This property allows the axis to be shifted away from its default location. For example, for a graph with an X range from -100 to +100, the Y Axis can be located at the X=0 value rather than the left edge of the ChartRect. This value can be set automatically based on the state of CrossAuto. If this value is set manually, then CrossAuto will also be set to false. The "other" axis is the axis the handles the second dimension for the graph. For the XAxis, the "other" axis is the YAxis. For the YAxis or Y2Axis, the "other" axis is the XAxis.

    See Also
    Min
    Max
    MajorStep
    CrossAuto
    | Improve this Doc View Source

    CrossAuto

    Gets or sets a value that determines whether or not the Cross value is set automatically.

    Declaration
    public bool CrossAuto { get; set; }
    Property Value
    Type Description
    Boolean

    Set to true to have ZedGraph put the axis in the default location, or false to specify the axis location manually with a Cross value.

    See Also
    Min
    Max
    MajorStep
    Cross
    | Improve this Doc View Source

    IsAxisSegmentVisible

    Gets or sets a property that determines whether or not the axis segment (the line that represents the axis itself) is drawn.

    Declaration
    public bool IsAxisSegmentVisible { get; set; }
    Property Value
    Type Description
    Boolean
    Remarks

    Under normal circumstances, this value won't affect the appearance of the display because the Axis segment is overlain by the Axis border (see Border). However, when the border is not visible, or when CrossAuto is set to false, this value will make a difference.

    | Improve this Doc View Source

    IsVisible

    This property determines whether or not the Axis is shown.

    Declaration
    public bool IsVisible { get; set; }
    Property Value
    Type Description
    Boolean

    true to show the axis, false to disable all drawing of this axis

    Remarks

    Note that even if the axis is not visible, it can still be actively used to draw curves on a graph, it will just be invisible to the user

    See Also
    IsVisible
    IsVisible
    IsVisible
    IsVisible
    | Improve this Doc View Source

    MajorGrid

    Gets a reference to the MajorGrid class that contains the properties of the major grid.

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

    MajorTic

    Gets a reference to the MajorTic class instance for this Axis. This class stores all the major tic settings.

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

    MinorGrid

    Gets a reference to the MinorGrid class that contains the properties of the minor grid.

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

    MinorTic

    Gets a reference to the MinorTic class instance for this Axis. This class stores all the minor tic settings.

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

    MinSpace

    Gets or sets the minimum axis space allocation.

    Declaration
    public float MinSpace { get; set; }
    Property Value
    Type Description
    Single
    Remarks

    This term, expressed in points (1/72 inch) and scaled according to CalcScaleFactor() for the GraphPane, determines the minimum amount of space an axis must have between the Rect and the Rect. This minimum space applies whether IsVisible is true or false.

    | Improve this Doc View Source

    Scale

    Gets the Scale instance associated with this Axis.

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

    Title

    Gets or sets the Label class that contains the title of this Axis.

    Declaration
    public AxisLabel Title { get; set; }
    Property Value
    Type Description
    AxisLabel

    the title is a string value

    Remarks

    The title normally shows the basis and dimensions of the scale range, such as "Time (Years)". The title is only shown if the IsVisible property is set to true. If the Title text is empty, then no title is shown, and no space is "reserved" for the title on the graph.

    See Also
    IsOmitMag
    | Improve this Doc View Source

    Type

    Gets or sets the AxisType for this Axis.

    Declaration
    public AxisType Type { get; set; }
    Property Value
    Type Description
    AxisType
    Remarks

    The type can be either Linear, Log, Date, or Text.

    See Also
    IsLog
    IsText
    IsOrdinal
    IsDate
    IsReverse

    Methods

    | Improve this Doc View Source

    CalcSpace(Graphics, GraphPane, Single, out Single)

    Calculate the space required (pixels) for this Axis object.

    Declaration
    public float CalcSpace(Graphics g, GraphPane pane, float scaleFactor, out float fixedSpace)
    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.

    GraphPane pane

    A reference to the GraphPane 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.

    Single fixedSpace

    The amount of space (pixels) at the edge of the ChartRect that is always required for this axis, even if the axis is shifted by the Cross value.

    Returns
    Type Description
    Single

    Returns the space, in pixels, required for this axis (between the rect and ChartRect)

    Remarks

    This is the total space (vertical space for the X axis, horizontal space for the Y axes) required to contain the axis. If Cross is zero, then this space will be the space required between the Rect and the Rect. This method sets the internal values of ZedGraph.Axis._tmpSpace for use by the CalcChartRect(Graphics) method.

    | Improve this Doc View Source

    Draw(Graphics, GraphPane, Single, Single)

    Do all rendering associated with this Axis to the specified Graphics device.

    Declaration
    public void Draw(Graphics g, GraphPane pane, float scaleFactor, float shiftPos)
    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.

    GraphPane pane

    A reference to the GraphPane 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.

    Single shiftPos

    The number of pixels to shift to account for non-primary axis position (e.g., the second, third, fourth, etc. YAxis or Y2Axis.

    Remarks

    This method is normally only called by the Draw method of the parent GraphPane object.

    | Improve this Doc View Source

    DrawMinorTics(Graphics, GraphPane, Double, Single, Single, Single)

    Draw the minor tic marks as required for this Axis.

    Declaration
    public void DrawMinorTics(Graphics g, GraphPane pane, double baseVal, float shift, float scaleFactor, float topPix)
    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.

    GraphPane pane

    A reference to the GraphPane object that is the parent or owner of this object.

    Double baseVal

    The scale value for the first major tic position. This is the reference point for all other tic marks.

    Single shift

    The number of pixels to shift this axis, based on the value of Cross. A positive value is into the ChartRect relative to the default axis position.

    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.

    Single topPix

    The pixel location of the far side of the ChartRect from this axis. This value is the ChartRect.Height for the XAxis, or the ChartRect.Width for the YAxis and Y2Axis.

    | Improve this Doc View Source

    DrawTitle(Graphics, GraphPane, Single, Single)

    Draw the title for this Axis.

    Declaration
    public void DrawTitle(Graphics g, GraphPane pane, float shiftPos, 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.

    GraphPane pane

    A reference to the GraphPane object that is the parent or owner of this object.

    Single shiftPos

    The number of pixels to shift this axis, based on the value of Cross. A positive value is into the ChartRect relative to the default axis position.

    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

    On entry, it is assumed that the graphics transform has been configured so that the origin is at the left side of this axis, and the axis is aligned along the X coordinate direction.

    | Improve this Doc View Source

    GetCrossAxis(GraphPane)

    Gets the "Cross" axis that corresponds to this axis.

    Declaration
    public abstract Axis GetCrossAxis(GraphPane pane)
    Parameters
    Type Name Description
    GraphPane pane

    A reference to the GraphPane object that is the parent or owner of this object.

    Returns
    Type Description
    Axis
    Remarks

    The cross axis is the axis which determines the of this Axis when the Cross property is used. The cross axis for any XAxis or X2Axis is always the primary YAxis, and the cross axis for any YAxis or Y2Axis is always the primary XAxis.

    | 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

    | Improve this Doc View Source

    ResetAutoScale(GraphPane, Graphics)

    Restore the scale ranging to automatic mode, and recalculate the Axis scale ranges

    Declaration
    public void ResetAutoScale(GraphPane pane, Graphics g)
    Parameters
    Type Name Description
    GraphPane pane

    A reference to the GraphPane object that is the parent or owner of this object.

    Graphics g

    A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method.

    See Also
    MinAuto
    MaxAuto
    MajorStepAuto
    MagAuto
    FormatAuto
    | Improve this Doc View Source

    SetMinSpaceBuffer(Graphics, GraphPane, Single, Boolean)

    This method will set the MinSpace property for this Axis using the currently required space multiplied by a fraction ().

    Declaration
    public void SetMinSpaceBuffer(Graphics g, GraphPane pane, float bufferFraction, bool isGrowOnly)
    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.

    GraphPane pane

    A reference to the GraphPane object that is the parent or owner of this object.

    Single bufferFraction

    The amount of space to allocate for the axis, expressed as a fraction of the currently required space. For example, a value of 1.2 would allow for 20% extra above the currently required space.

    Boolean isGrowOnly

    If true, then this method will only modify the MinSpace property if the calculated result is more than the current value.

    Remarks

    The currently required space is calculated using CalcSpace(Graphics, GraphPane, Single, out Single), and is based on current data ranges, font sizes, etc. The "space" is actually the amount of space required to fit the tic marks, scale labels, and axis title.

    | Improve this Doc View Source

    SetTransformMatrix(Graphics, GraphPane, Single)

    Setup the Transform Matrix to handle drawing of this Axis

    Declaration
    public abstract void SetTransformMatrix(Graphics g, GraphPane 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.

    GraphPane pane

    A reference to the GraphPane 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.

    Events

    | Improve this Doc View Source

    ScaleFormatEvent

    Subscribe to this event to handle custom formatting of the scale labels.

    Declaration
    public event Axis.ScaleFormatHandler ScaleFormatEvent
    Event Type
    Type Description
    Axis.ScaleFormatHandler
    | Improve this Doc View Source

    ScaleTitleEvent

    Allow customization of the title when the scale is very large Subscribe to this event to handle custom formatting of the scale axis label.

    Declaration
    public event Axis.ScaleTitleEventHandler ScaleTitleEvent
    Event Type
    Type Description
    Axis.ScaleTitleEventHandler

    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

    Remarks

    Note that this method must be called with an explicit cast to ICloneable, and that it is inherently virtual. For example:

    ParentClass foo = new ChildClass();
    ChildClass bar = (ChildClass) ((ICloneable)foo).Clone();

    Assume that ChildClass is inherited from ParentClass. Even though foo is declared with ParentClass, it is actually an instance of ChildClass. Calling the ICloneable implementation of Clone() on foo actually calls ChildClass.Clone() as if it were a virtual function.

    Implements

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