Class BarItem
Encapsulates a bar type that displays vertical or horizontal bars
Inherited Members
Namespace: ZedGraph
Assembly: ZedGraph.dll
Syntax
[Serializable]
public class BarItem : CurveItem, ICloneable, ISerializable
Remarks
The orientation of the bars depends on the state of Base, and the bars can be stacked or clustered, depending on the state of Type
Constructors
| Improve this Doc View SourceBarItem(SerializationInfo, StreamingContext)
Constructor for deserializing objects
Declaration
protected BarItem(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 |
BarItem(String)
Create a new BarItem, specifying only the legend label for the bar.
Declaration
public BarItem(string label)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label that will appear in the legend. |
BarItem(String, Double[], Double[], Color)
Create a new BarItem using the specified properties.
Declaration
public BarItem(string label, double[] x, double[] y, Color color)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label that will appear in the legend. |
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 |
Color | color | A Color value that will be applied to the Fill and Border properties. |
BarItem(String, IPointList, Color)
Create a new BarItem using the specified properties.
Declaration
public BarItem(string label, IPointList points, Color color)
Parameters
Type | Name | Description |
---|---|---|
String | label | The label that will appear in the legend. |
IPointList | points | A IPointList of double precision value pairs that define the X and Y values for this curve |
Color | color | A Color value that will be applied to the Fill and Border properties. |
BarItem(BarItem)
The Copy Constructor
Declaration
public BarItem(BarItem rhs)
Parameters
Type | Name | Description |
---|---|---|
BarItem | rhs | The BarItem object from which to copy |
Fields
| Improve this Doc View Source_bar
Private field that stores a reference to the Bar class defined for this BarItem. Use the public property Bar to access this value.
Declaration
[CLSCompliant(false)]
protected Bar _bar
Field Value
Type | Description |
---|---|
Bar |
schema2
Current schema value that defines the version of the serialized file
Declaration
public const int schema2 = 10
Field Value
Type | Description |
---|---|
Int32 |
Properties
| Improve this Doc View SourceBar
Declaration
public Bar Bar { get; }
Property Value
Type | Description |
---|---|
Bar |
Methods
| Improve this Doc View SourceClone()
Typesafe, deep-copy clone method.
Declaration
public BarItem Clone()
Returns
Type | Description |
---|---|
BarItem | A new, independent copy of this class |
CreateBarLabels(GraphPane, Boolean, String)
Declaration
public static void CreateBarLabels(GraphPane pane, bool isBarCenter, string valueFormat)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane in which to place the text labels. |
Boolean | isBarCenter | true to center the labels inside the bars, false to place the labels just above the top of the bar. |
String | valueFormat | The double.ToString string format to use for creating the labels. |
Remarks
This method will go through the bars, create a label that corresponds to the bar value, and place it on the graph depending on user preferences. This works for horizontal or vertical bars in clusters or stacks, but only for BarItem types. This method does not apply to ErrorBarItem or HiLowBarItem objects. Call this method only after calling AxisChange().
CreateBarLabels(GraphPane, Boolean, String, String, Single, Color, Boolean, Boolean, Boolean)
Declaration
public static void CreateBarLabels(GraphPane pane, bool isBarCenter, string valueFormat, string fontFamily, float fontSize, Color fontColor, bool isBold, bool isItalic, bool isUnderline)
Parameters
Type | Name | Description |
---|---|---|
GraphPane | pane | The GraphPane in which to place the text labels. |
Boolean | isBarCenter | true to center the labels inside the bars, false to place the labels just above the top of the bar. |
String | valueFormat | The double.ToString string format to use for creating the labels. |
String | fontFamily | The string name of the font family to use for the labels |
Single | fontSize | The floating point size of the font, in scaled points |
Color | fontColor | The color in which to draw the labels |
Boolean | isBold | true for a bold font type, false otherwise |
Boolean | isItalic | true for an italic font type, false otherwise |
Boolean | isUnderline | true for an underline font type, false otherwise |
Remarks
This method will go through the bars, create a label that corresponds to the bar value, and place it on the graph depending on user preferences. This works for horizontal or vertical bars in clusters or stacks, but only for BarItem types. This method does not apply to ErrorBarItem or HiLowBarItem objects. Call this method only after calling AxisChange().
Draw(Graphics, GraphPane, Int32, Single)
Do all rendering associated with this BarItem to the specified Graphics device. This method is normally only called by the Draw method of the parent CurveList collection object.
Declaration
public override 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. |
Overrides
| Improve this Doc View SourceDrawLegendKey(Graphics, GraphPane, RectangleF, Single)
Draw a legend key entry for this BarItem at the specified location
Declaration
public override 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. |
Overrides
| Improve this Doc View SourceGetCoords(GraphPane, Int32, out String)
Determine the coords for the rectangle associated with a specified point for this CurveItem
Declaration
public override 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 |
Overrides
| Improve this Doc View SourceGetObjectData(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 |