Class GraphObj
An abstract base class that represents a text object on the graph. A list of GraphObj objects is maintained by the GraphObjList collection class.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public abstract class GraphObj : ISerializable, ICloneable
Constructors
| Improve this Doc View SourceGraphObj()
Default constructor that sets all GraphObj properties to default values as defined in the GraphObj.Default class.
Declaration
public GraphObj()
GraphObj(Double, Double)
Constructor that sets all GraphObj properties to default values as defined in the GraphObj.Default class.
Declaration
public GraphObj(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position of the text. The units of this position are specified by the CoordinateFrame property. The text will be aligned to this position based on the AlignH property. |
Double | y | The y position of the text. The units of this position are specified by the CoordinateFrame property. The text will be aligned to this position based on the AlignV property. |
GraphObj(Double, Double, Double, Double)
Constructor that creates a GraphObj with the specified coordinates and all other properties to defaults as specified in the GraphObj.Default class..
Declaration
public GraphObj(double x, double y, double x2, double y2)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position of the item. |
Double | y | The y position of the item. |
Double | x2 | The x2 position of the item. |
Double | y2 | The x2 position of the item. |
Remarks
The four coordinates define the starting point and ending point for
ArrowObj's, or the topleft and bottomright points for
ImageObj's. For GraphObj's that only require
one point, the
GraphObj(Double, Double, Double, Double, CoordType, AlignH, AlignV)
Constructor that creates a GraphObj with the specified position, CoordType, AlignH, and AlignV. Other properties are set to default values as defined in the GraphObj.Default class.
Declaration
public GraphObj(double x, double y, double x2, double y2, CoordType coordType, AlignH alignH, AlignV alignV)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position of the item. |
Double | y | The y position of the item. |
Double | x2 | The x2 position of the item. |
Double | y2 | The x2 position of the item. |
CoordType | coordType | The CoordType enum value that indicates what type of coordinate system the x and y parameters are referenced to. |
AlignH | alignH | The AlignH enum that specifies the horizontal alignment of the object with respect to the (x,y) location |
AlignV | alignV | The AlignV enum that specifies the vertical alignment of the object with respect to the (x,y) location |
Remarks
The four coordinates define the starting point and ending point for
ArrowObj's, or the topleft and bottomright points for
ImageObj's. For GraphObj's that only require
one point, the
GraphObj(Double, Double, CoordType)
Constructor that creates a GraphObj with the specified position and CoordType. Other properties are set to default values as defined in the GraphObj.Default class.
Declaration
public GraphObj(double x, double y, CoordType coordType)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position of the item. The item will be aligned to this position based on the AlignH property. |
Double | y | The y position of the item. The item will be aligned to this position based on the AlignV property. |
CoordType | coordType | The CoordType enum value that indicates what type of coordinate system the x and y parameters are referenced to. |
Remarks
The two coordinates define the location point for the object. The units of the coordinates are specified by the CoordinateFrame property.
GraphObj(Double, Double, CoordType, AlignH, AlignV)
Constructor that creates a GraphObj with the specified position, CoordType, AlignH, and AlignV. Other properties are set to default values as defined in the GraphObj.Default class.
Declaration
public GraphObj(double x, double y, CoordType coordType, AlignH alignH, AlignV alignV)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The x position of the item. The item will be aligned to this position based on the AlignH property. |
Double | y | The y position of the text. The units of this position are specified by the CoordinateFrame property. The text will be aligned to this position based on the AlignV property. |
CoordType | coordType | The CoordType enum value that indicates what type of coordinate system the x and y parameters are referenced to. |
AlignH | alignH | The AlignH enum that specifies the horizontal alignment of the object with respect to the (x,y) location |
AlignV | alignV | The AlignV enum that specifies the vertical alignment of the object with respect to the (x,y) location |
Remarks
The two coordinates define the location point for the object. The units of the coordinates are specified by the CoordinateFrame property.
GraphObj(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected GraphObj(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 |
GraphObj(GraphObj)
The Copy Constructor
Declaration
public GraphObj(GraphObj rhs)
Parameters
Type | Name | Description |
---|---|---|
GraphObj | rhs | The GraphObj object from which to copy |
Fields
| Improve this Doc View Source_isClippedToChartRect
Protected field that determines whether or not the rendering of this GraphObj will be clipped to the ChartRect. Use the public property IsClippedToChartRect to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isClippedToChartRect
Field Value
Type | Description |
---|---|
Boolean |
_isVisible
Protected field that determines whether or not this GraphObj is visible in the graph. Use the public property IsVisible to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isVisible
Field Value
Type | Description |
---|---|
Boolean |
_location
Protected field that stores the location of this GraphObj. Use the public property Location to access this value.
Declaration
[CLSCompliant(false)]
protected Location _location
Field Value
Type | Description |
---|---|
Location |
schema
Current schema value that defines the version of the serialized file
Declaration
public const int schema = 10
Field Value
Type | Description |
---|---|
Int32 |
Remarks
schema changed to 2 when isClippedToChartRect was added.
Tag
A tag object for use by the user. This can be used to store additional information associated with the GraphObj. 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 SourceIsClippedToChartRect
Gets or sets a value that determines whether or not the rendering of this GraphObj will be clipped to the Rect.
Declaration
public bool IsClippedToChartRect { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to clip the GraphObj to the Rect bounds, false to leave it unclipped. |
IsInFrontOfData
Declaration
public bool IsInFrontOfData { get; }
Property Value
Type | Description |
---|---|
Boolean |
IsVisible
Gets or sets a value that determines if this GraphObj will be visible in the graph. true displays the item, false hides it.
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Link
Gets or sets the hyperlink information for this GraphObj.
Declaration
public Link Link { get; set; }
Property Value
Type | Description |
---|---|
Link |
Location
Declaration
public Location Location { get; set; }
Property Value
Type | Description |
---|---|
Location |
ZOrder
Gets or sets a value that determines the z-order "depth" of this item relative to other graphic objects.
Declaration
public ZOrder ZOrder { get; set; }
Property Value
Type | Description |
---|---|
ZOrder |
Remarks
Note that this controls the z-order with respect to other elements such as CurveItem's, Axis objects, etc. The order of GraphObj objects having the same ZOrder value is controlled by their order in the GraphObjList. The first GraphObj in the list is drawn in front of other GraphObj objects having the same ZOrder value.
Methods
| Improve this Doc View SourceDraw(Graphics, PaneBase, Single)
Declaration
public abstract 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 PaneBase 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 GraphObjList collection object.
GetCoords(PaneBase, Graphics, Single, out String, out String)
Determines the shape type and Coords values for this GraphObj
Declaration
public abstract void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords)
Parameters
Type | Name | Description |
---|---|---|
PaneBase | pane | |
Graphics | g | |
Single | scaleFactor | |
String | shape | |
String | coords |
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 |
PointInBox(PointF, PaneBase, Graphics, Single)
Determine if the specified screen point lies inside the bounding box of this GraphObj.
Declaration
public virtual bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor)
Parameters
Type | Name | Description |
---|---|---|
PointF | pt | The screen point, in pixels |
PaneBase | pane | A reference to the PaneBase 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. |
Single | scaleFactor | The scaling factor to be used for rendering objects. This is calculated and passed down by the parent PaneBase object using the CalcScaleFactor() method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. |
Returns
Type | Description |
---|---|
Boolean | true if the point lies in the bounding box, false otherwise |
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 |
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.