Class CurveItem
This class contains the data and methods for an individual curve within a graph pane. It carries the settings for the curve including the key and item names, colors, symbols and sizes, linetypes, etc.
Inheritance
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public abstract class CurveItem : ISerializable, ICloneable
Constructors
| Improve this Doc View SourceCurveItem()
Declaration
public CurveItem()
CurveItem(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected CurveItem(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 |
CurveItem(String)
CurveItem constructor that specifies the label of the CurveItem.
This is the same as CurveItem(label, null, null)
.
CurveItem(String, Double[], Double[])
Declaration
public CurveItem(string label)
Parameters
Type | Name | Description |
---|---|---|
String | label | A string label (legend entry) for this curve |
CurveItem(String, Double[], Double[])
CurveItem constructor the pre-specifies the curve label, the x and y data values as a IPointList, the curve type (Bar or Line/Symbol), the Color, and the SymbolType. Other properties of the curve are defaulted to the values in the GraphPane.Default class.
Declaration
public CurveItem(string label, double[] x, double[] y)
Parameters
Type | Name | Description |
---|---|---|
String | label | A string label (legend entry) for this curve |
Double[] | x | An array of double precision values that define the independent (X axis) values for this curve |
Double[] | y | An array of double precision values that define the dependent (Y axis) values for this curve |
CurveItem(String, IPointList)
CurveItem constructor the pre-specifies the curve label, the x and y data values as a IPointList, the curve type (Bar or Line/Symbol), the Color, and the SymbolType. Other properties of the curve are defaulted to the values in the GraphPane.Default class.
Declaration
public CurveItem(string label, IPointList points)
Parameters
Type | Name | Description |
---|---|---|
String | label | A string label (legend entry) for this curve |
IPointList | points | A IPointList of double precision value pairs that define the X and Y values for this curve |
CurveItem(CurveItem)
The Copy Constructor
Declaration
public CurveItem(CurveItem rhs)
Parameters
Type | Name | Description |
---|---|---|
CurveItem | rhs | The CurveItem object from which to copy |
Fields
| Improve this Doc View Source_isOverrideOrdinal
protected field that stores a boolean value which allows you to override the normal ordinal axis behavior. Use the public property IsOverrideOrdinal to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isOverrideOrdinal
Field Value
Type | Description |
---|---|
Boolean |
_isSelectable
Protected field that stores the boolean value that determines whether this CurveItem can be selected in the graph.
Declaration
[CLSCompliant(false)]
protected bool _isSelectable
Field Value
Type | Description |
---|---|
Boolean |
_isSelected
Protected field that stores the boolean value that determines whether this CurveItem is selected on the graph. Use the public property IsSelected to access this value. Note that this value changes the curve display color, but it does not affect the display of the legend entry. To hide the legend entry, you have to set IsVisible to false.
Declaration
[CLSCompliant(false)]
protected bool _isSelected
Field Value
Type | Description |
---|---|
Boolean |
_isVisible
protected field that stores the boolean value that determines whether this CurveItem is visible on the graph. Use the public property IsVisible to access this value. Note that this value turns the curve display on or off, but it does not affect the display of the legend entry. To hide the legend entry, you have to set IsVisible to false.
Declaration
[CLSCompliant(false)]
protected bool _isVisible
Field Value
Type | Description |
---|---|
Boolean |
_isX2Axis
protected field that stores the boolean value that determines whether this CurveItem is on the bottom X axis or the top X axis (X2). Use the public property IsX2Axis to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isX2Axis
Field Value
Type | Description |
---|---|
Boolean |
_isY2Axis
protected field that stores the boolean value that determines whether this CurveItem is on the left Y axis or the right Y axis (Y2). Use the public property IsY2Axis to access this value.
Declaration
[CLSCompliant(false)]
protected bool _isY2Axis
Field Value
Type | Description |
---|---|
Boolean |
_points
The IPointList of value sets that represent this CurveItem. The size of this list determines the number of points that are plotted. Note that values defined as System.Double.MaxValue are considered "missing" values (see Missing), and are not plotted. The curve will have a break at these points to indicate the values are missing.
Declaration
[CLSCompliant(false)]
protected IPointList _points
Field Value
Type | Description |
---|---|
IPointList |
_yAxisIndex
protected field that stores the index number of the Y Axis to which this CurveItem belongs. Use the public property YAxisIndex to access this value.
Declaration
[CLSCompliant(false)]
protected int _yAxisIndex
Field Value
Type | Description |
---|---|
Int32 |
schema
Current schema value that defines the version of the serialized file
Declaration
public const int schema = 11
Field Value
Type | Description |
---|---|
Int32 |
Tag
A tag object for use by the user. This can be used to store additional information associated with the CurveItem. 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 SourceColor
The Line/Symbol/Bar color (FillColor for the Bar). This is a common access to Color, Color, and Color properties for this curve.
Declaration
public Color Color { get; set; }
Property Value
Type | Description |
---|---|
Color |
IsBar
Declaration
public bool IsBar { get; }
Property Value
Type | Description |
---|---|
Boolean | true for a bar chart, or false for a line or pie graph |
IsLine
Declaration
public bool IsLine { get; }
Property Value
Type | Description |
---|---|
Boolean | true for a line chart, or false for a bar type |
IsOverrideOrdinal
Gets or sets a value which allows you to override the normal ordinal axis behavior.
Declaration
public bool IsOverrideOrdinal { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Normally for an ordinal axis type, the actual data values corresponding to the ordinal axis will be ignored (essentially they are replaced by ordinal values, e.g., 1, 2, 3, etc). If IsOverrideOrdinal is true, then the user data values will be used (even if they don't make sense). Fractional values are allowed, such that a value of 1.5 is between the first and second ordinal position, etc.
See Also
| Improve this Doc View SourceIsPie
Declaration
public bool IsPie { get; }
Property Value
Type | Description |
---|---|
Boolean | true for a pie chart, or false for a line or bar graph |
IsSelectable
Determines whether this CurveItem can be selected in the graph.
Declaration
public bool IsSelectable { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsSelected
Determines whether this CurveItem is selected on the graph. Note that this value changes the curve displayed color, but it does not affect the display of the legend entry. To hide the legend entry, you have to set IsVisible to false.
Declaration
public bool IsSelected { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsVisible
Determines whether this CurveItem is visible on the graph. Note that this value turns the curve display on or off, but it does not affect the display of the legend entry. To hide the legend entry, you have to set IsVisible to false.
Declaration
public bool IsVisible { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
IsX2Axis
Gets or sets a value that determines which X axis this CurveItem is assigned to.
Declaration
public bool IsX2Axis { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to assign the curve to the X2Axis, false to assign the curve to the XAxis |
Remarks
The XAxis is on the bottom side of the graph and the X2Axis is on the top side. Assignment to an axis determines the scale that is used to draw the curve on the graph.
IsY2Axis
Gets or sets a value that determines which Y axis this CurveItem is assigned to.
Declaration
public bool IsY2Axis { get; set; }
Property Value
Type | Description |
---|---|
Boolean | true to assign the curve to the Y2Axis, false to assign the curve to the YAxis |
Remarks
The YAxis is on the left side of the graph and the Y2Axis is on the right side. Assignment to an axis determines the scale that is used to draw the curve on the graph. Note that this value is used in combination with the YAxisIndex to determine which of the Y Axes (if there are multiples) this curve belongs to.
Item[Int32]
An accessor for the PointPair datum for this CurveItem. Index is the ordinal reference (zero based) of the point.
Declaration
public PointPair this[int index] { get; }
Parameters
Type | Name | Description |
---|---|---|
Int32 | index |
Property Value
Type | Description |
---|---|
PointPair |
Label
Declaration
public Label Label { get; set; }
Property Value
Type | Description |
---|---|
Label |
Link
Gets or sets the hyperlink information for this CurveItem.
Declaration
public Link Link { get; set; }
Property Value
Type | Description |
---|---|
Link |
NPts
Readonly property that gives the number of points that define this CurveItem object, which is the number of points in the Points data collection.
Declaration
public int NPts { get; }
Property Value
Type | Description |
---|---|
Int32 |
Points
The IPointList of X,Y point sets that represent this CurveItem.
Declaration
public IPointList Points { get; set; }
Property Value
Type | Description |
---|---|
IPointList |
YAxisIndex
Gets or sets the index number of the Y Axis to which this CurveItem belongs.
Declaration
public int YAxisIndex { get; set; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
This value is essentially an index number into the YAxisList or Y2AxisList, depending on the setting of IsY2Axis.
Methods
| Improve this Doc View SourceAddPoint(Double, Double)
Add a single x,y coordinate point to the end of the points collection for this curve.
Declaration
public void AddPoint(double x, double y)
Parameters
Type | Name | Description |
---|---|---|
Double | x | The X coordinate value |
Double | y | The Y coordinate value |
AddPoint(PointPair)
Add a PointPair object to the end of the points collection for this curve.
Declaration
public void AddPoint(PointPair point)
Parameters
Type | Name | Description |
---|---|---|
PointPair | point | A reference to the PointPair object to be added |
Remarks
This method will only work if the IPointList instance reference at Points supports the IPointListEdit interface. Otherwise, it does nothing.
BaseAxis(GraphPane)
Returns a reference to the Axis object that is the "base" (independent axis) from which the values are drawn.
Declaration
public virtual Axis BaseAxis(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane |
Returns
Type | Description |
---|---|
Axis |
Remarks
This property is determined by the value of Base for BarItem, ErrorBarItem, and HiLowBarItem types. It is always the X axis for regular LineItem types. Note that the Base setting can override the IsY2Axis and YAxisIndex settings for bar types (this is because all the bars that are clustered together must share the same base axis).
See Also
| Improve this Doc View SourceClear()
Clears the points from this CurveItem. This is the same
as CurveItem.Points.Clear()
.
Declaration
public void Clear()
Remarks
This method will only work if the IPointList instance reference at Points supports the IPointListEdit interface. Otherwise, it does nothing.
Draw(Graphics, GraphPane, Int32, Single)
Do all rendering associated with this CurveItem to the specified Graphics device. This method is normally only called by the Draw method of the parent CurveList collection object.
Declaration
public abstract void Draw(Graphics g, GraphPane pane, int pos, 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. |
Int32 | pos | The ordinal position of the current Bar 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. |
DrawLegendKey(Graphics, GraphPane, RectangleF, Single)
Draw a legend key entry for this CurveItem at the specified location. This abstract base method passes through to DrawLegendKey(Graphics, GraphPane, RectangleF, Single) or DrawLegendKey(Graphics, GraphPane, RectangleF, Single) to do the rendering.
Declaration
public abstract void DrawLegendKey(Graphics g, GraphPane pane, RectangleF rect, 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. |
RectangleF | rect | The RectangleF struct that specifies the location for the legend key |
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. |
GetBarWidth(GraphPane)
Calculate the width of each bar, depending on the actual bar type
Declaration
public float GetBarWidth(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane |
Returns
Type | Description |
---|---|
Single | The width for an individual bar, in pixel units |
GetCoords(GraphPane, Int32, out String)
Determine the coords for the rectangle associated with a specified point for this CurveItem
Declaration
public abstract bool GetCoords(GraphPane pane, int i, out string coords)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane to which this curve belongs |
Int32 | i | The index of the point of interest |
String | coords | A list of coordinates that represents the "rect" for this point (used in an html AREA tag) |
Returns
Type | Description |
---|---|
Boolean | true if it's a valid point, false otherwise |
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 |
GetRange(out Double, out Double, out Double, out Double, Boolean, Boolean, GraphPane)
Go through the list of PointPair data values for this CurveItem and determine the minimum and maximum values in the data.
Declaration
public virtual void GetRange(out double xMin, out double xMax, out double yMin, out double yMax, bool ignoreInitial, bool isBoundedRanges, GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
Double | xMin | The minimum X value in the range of data |
Double | xMax | The maximum X value in the range of data |
Double | yMin | The minimum Y value in the range of data |
Double | yMax | The maximum Y value in the range of data |
Boolean | ignoreInitial | ignoreInitial is a boolean value that affects the data range that is considered for the automatic scale ranging (see IsIgnoreInitial). If true, then initial data points where the Y value is zero are not included when automatically determining the scale Min, Max, and MajorStep size. All data after the first non-zero Y value are included. |
Boolean | isBoundedRanges | Determines if the auto-scaled axis ranges will subset the data points based on any manually set scale range values. |
GraphPane | pane | A reference to the GraphPane object that is the parent or owner of this object. |
See Also
| Improve this Doc View SourceGetXAxis(GraphPane)
Declaration
public Axis GetXAxis(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane object to which this curve belongs. |
Returns
Type | Description |
---|---|
Axis |
GetYAxis(GraphPane)
Declaration
public Axis GetYAxis(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane object to which this curve belongs. |
Returns
Type | Description |
---|---|
Axis |
Remarks
This method safely retrieves a Y Axis instance from either the YAxisList or the Y2AxisList using the values of YAxisIndex and IsY2Axis. If the value of YAxisIndex is out of bounds, the default YAxis or Y2Axis is used.
GetYAxisIndex(GraphPane)
Declaration
public int GetYAxisIndex(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane object to which this curve belongs. |
Returns
Type | Description |
---|---|
Int32 | An integer value indicating which index position in the list applies to this CurveItem |
Remarks
This method safely retrieves a Y Axis index into either the YAxisList or the Y2AxisList using the values of YAxisIndex and IsY2Axis. If the value of YAxisIndex is out of bounds, the default YAxis or Y2Axis is used, which is index zero.
MakeUnique()
Loads some pseudo unique colors/symbols into this CurveItem. This
is the same as MakeUnique(ColorSymbolRotator.StaticInstance)
.
StaticInstance
ColorSymbolRotator
MakeUnique(ColorSymbolRotator)
Declaration
public void MakeUnique()
MakeUnique(ColorSymbolRotator)
Loads some pseudo unique colors/symbols into this CurveItem. This is mainly useful for differentiating a set of new CurveItems without having to pick your own colors/symbols. MakeUnique(ColorSymbolRotator)
Declaration
public virtual void MakeUnique(ColorSymbolRotator rotator)
Parameters
Type | Name | Description |
---|---|---|
ColorSymbolRotator | rotator | The ColorSymbolRotator that is used to pick the color and symbol for this method call. |
RemovePoint(Int32)
Removes a single point from this CurveItem.
Declaration
public void RemovePoint(int index)
Parameters
Type | Name | Description |
---|---|---|
Int32 | index | The ordinal position of the point to be removed. |
Remarks
This method will only work if the IPointList instance reference at Points supports the IPointListEdit interface. Otherwise, it does nothing.
ValueAxis(GraphPane)
Returns a reference to the Axis object that is the "value" (dependent axis) from which the points are drawn.
Declaration
public virtual Axis ValueAxis(GraphPane pane)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane |
Returns
Type | Description |
---|---|
Axis |
Remarks
This property is determined by the value of Base for BarItem, ErrorBarItem, and HiLowBarItem types. It is always the Y axis for regular LineItem types.
See Also
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.