Class Line
A class representing all the characteristics of the Line segments that make up a curve on the graph.
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class Line : LineBase, ICloneable, ISerializable
Constructors
| Improve this Doc View SourceLine()
Default constructor that sets all Line properties to default values as defined in the Line.Default class.
Declaration
public Line()
Line(Color)
Constructor that sets the color property to the specified value, and sets the remaining Line properties to default values as defined in the Line.Default class.
Declaration
public Line(Color color)
Parameters
Type | Name | Description |
---|---|---|
Color | color | The color to assign to this new Line object |
Line(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected Line(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 |
Line(Line)
The Copy Constructor
Declaration
public Line(Line rhs)
Parameters
Type | Name | Description |
---|---|---|
Line | rhs | The Line 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 = 14
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceFill
Declaration
public Fill Fill { get; set; }
Property Value
Type | Description |
---|---|
Fill |
IsOptimizedDraw
Gets or sets a boolean value that determines if this Line will be drawn with optimizations enabled.
Declaration
public bool IsOptimizedDraw { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Normally, the optimizations can be used without a problem, especially if the data are sorted. The optimizations are particularly helpful with very large datasets. However, if the data are very discontinuous (for example, a curve that doubles back on itself), then the optimizations can cause drawing artifacts in the form of missing line segments. The default option for this mode is false, so you must explicitly enable it for each Line. Also note that, even if the optimizations are enabled explicitly, no actual optimization will be done for datasets of less than 1000 points.
IsSmooth
Gets or sets a property that determines if this Line will be drawn smooth. The "smoothness" is controlled by the SmoothTension property.
Declaration
public bool IsSmooth { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to smooth the line, false to just connect the dots with linear segments |
See Also
| Improve this Doc View SourceSmoothTension
Gets or sets a property that determines the smoothing tension for this Line. This property is only used if IsSmooth is true. A tension value 0.0 will just draw ordinary line segments like an unsmoothed line. A tension value of 1.0 will be smooth. Values greater than 1.0 will generally give odd results.
Declaration
public float SmoothTension { get; set; }
Property Value
Type | Description |
---|---|
Single | A floating point value indicating the level of smoothing. 0.0F for no smoothing, 1.0F for lots of smoothing, >1.0 for odd smoothing. |
See Also
| Improve this Doc View SourceStepType
Determines if the CurveItem will be drawn by directly connecting the
points from the Points data collection,
or if the curve will be a "stair-step" in which the points are
connected by a series of horizontal and vertical lines that
represent discrete, constant values. Note that the values can
be forward oriented ForwardStep
(StepType) or
rearward oriented RearwardStep
.
That is, the points are defined at the beginning or end
of the constant value for which they apply, respectively.
The StepType property is ignored for lines
that have IsSmooth set to true.
Declaration
public StepType StepType { get; set; }
Property Value
Type | Description |
---|---|
StepType | StepType enum value |
See Also
Methods
| Improve this Doc View SourceBuildLowPointsArray(GraphPane, CurveItem, out PointF[], out Int32)
Build an array of PointF values (pixel coordinates) that represents the low values for the current curve.
Declaration
public bool BuildLowPointsArray(GraphPane pane, CurveItem curve, out PointF[] arrPoints, out int count)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | A reference to the GraphPane object that is the parent or owner of this object. |
CurveItem | curve | A LineItem representing this curve. |
PointF[] | arrPoints | An array of PointF values in pixel coordinates representing the current curve. |
Int32 | count | The number of points contained in the "arrPoints" parameter. |
Returns
Type | Description |
---|---|
Boolean | true for a successful points array build, false for data problems |
Remarks
Note that this drawing routine ignores Missing values, but it does not "break" the line to indicate values are missing.
BuildPointsArray(GraphPane, CurveItem, out PointF[], out Int32)
Build an array of PointF values (pixel coordinates) that represents the current curve. Note that this drawing routine ignores Missing values, but it does not "break" the line to indicate values are missing.
Declaration
public bool BuildPointsArray(GraphPane pane, CurveItem curve, out PointF[] arrPoints, out int count)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | A reference to the GraphPane object that is the parent or owner of this object. |
CurveItem | curve | A LineItem representing this curve. |
PointF[] | arrPoints | An array of PointF values in pixel coordinates representing the current curve. |
Int32 | count | The number of points contained in the "arrPoints" parameter. |
Returns
Type | Description |
---|---|
Boolean | true for a successful points array build, false for data problems |
Clone()
Typesafe, deep-copy clone method.
Declaration
public Line Clone()
Returns
Type | Description |
---|---|
Line | A new, independent copy of this class |
CloseCurve(GraphPane, CurveItem, PointF[], Int32, Double, GraphicsPath)
Close off a GraphicsPath that defines a curve
Declaration
public void CloseCurve(GraphPane pane, CurveItem curve, PointF[] arrPoints, int count, double yMin, GraphicsPath path)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | A reference to the GraphPane object that is the parent or owner of this object. |
CurveItem | curve | A LineItem representing this curve. |
PointF[] | arrPoints | An array of PointF values in screen pixel coordinates representing the current curve. |
Int32 | count | The number of points contained in the "arrPoints" parameter. |
Double | yMin | The Y axis value location where the X axis crosses. |
GraphicsPath | path | The GraphicsPath class that represents the curve. |
Draw(Graphics, GraphPane, CurveItem, Single)
Do all rendering associated with this Line to the specified Graphics device. This method is normally only called by the Draw method of the parent LineItem object.
Declaration
public void Draw(Graphics g, GraphPane pane, CurveItem curve, 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. |
CurveItem | curve | A LineItem representing this curve. |
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. |
DrawCurve(Graphics, GraphPane, CurveItem, Single)
Draw the this CurveItem to the specified Graphics device. The format (stair-step or line) of the curve is defined by the StepType property. The routine only draws the line segments; the symbols are drawn by the Draw(Graphics, GraphPane, LineItem, Single, Boolean) method. This method is normally only called by the Draw method of the CurveItem object
Declaration
public void DrawCurve(Graphics g, GraphPane pane, CurveItem curve, 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. |
CurveItem | curve | A LineItem representing this curve. |
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. |
DrawCurveOriginal(Graphics, GraphPane, CurveItem, Single)
Draw the this CurveItem to the specified Graphics device. The format (stair-step or line) of the curve is defined by the StepType property. The routine only draws the line segments; the symbols are drawn by the Draw(Graphics, GraphPane, LineItem, Single, Boolean) method. This method is normally only called by the Draw method of the CurveItem object
Declaration
public void DrawCurveOriginal(Graphics g, GraphPane pane, CurveItem curve, 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. |
CurveItem | curve | A LineItem representing this curve. |
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. |
DrawSegment(Graphics, GraphPane, Single, Single, Single, Single, Single)
Declaration
public void DrawSegment(Graphics g, GraphPane pane, float x1, float y1, float x2, float y2, 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 | x1 | The x position of the starting point that defines the line segment in screen pixel units |
Single | y1 | The y position of the starting point that defines the line segment in screen pixel units |
Single | x2 | The x position of the ending point that defines the line segment in screen pixel units |
Single | y2 | The y position of the ending point that defines the line segment in screen pixel units |
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. |
DrawSmoothFilledCurve(Graphics, GraphPane, CurveItem, Single)
Draw the this CurveItem to the specified Graphics device using the specified smoothing property (SmoothTension). The routine draws the line segments and the area fill (if any, see FillType; the symbols are drawn by the Draw(Graphics, GraphPane, LineItem, Single, Boolean) method. This method is normally only called by the Draw method of the CurveItem object. Note that the StepType property is ignored for smooth lines (e.g., when IsSmooth is true).
Declaration
public void DrawSmoothFilledCurve(Graphics g, GraphPane pane, CurveItem curve, 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. |
CurveItem | curve | A LineItem representing this curve. |
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. |
DrawSticks(Graphics, GraphPane, CurveItem, Single)
Declaration
public void DrawSticks(Graphics g, GraphPane pane, CurveItem curve, 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. |
CurveItem | curve | A CurveItem representing this curve. |
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. |
GetObjectData(SerializationInfo, StreamingContext)
Populates a SerializationInfo instance with the data needed to serialize the target object
Declaration
[SecurityPermission(SecurityAction.Demand, SerializationFormatter = true)]
public override 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 |
Overrides
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 |