Introduction
.netCHARTING has an advanced system for handing error bars and other sub value types that are used in many statistics charts. Element and series classes have properties that quickly set sub values, however, there is a more powerful system underneath that controls and helps manage these sub elements.
SubValue Class Constructors
Each sub value is represented by a class that is instantiated by a number of sub value constructors that define its value.
SubValue offsets and percent values will be based on the element's yValue. |
Constructor | Type | Description |
FromHighLowValue(highValue,lowValue) | Range | Creates a range sub value from specified high and low values. |
FromPlusMinusOffset(plusOffset,minusOffset) | Relative Range | Creates a range sub value from specified high and low offsets. |
FromPlusMinusOffset (o) | Relative Range | Creates a range sub value from specified offset above and blow the element's yValue. |
FromPlusMinusPercent (hPercent,lPercent) | Relative Range | Creates a range sub value from specified percentages above and below the element's yValue. |
FromPlusMinusPercent (percent) | Relative Range | Creates a range sub value from the specified percentage above and below the element's yValue. |
FromOffset(o) | Relative Single Value | Creates a subValue from the specified offset. (-2) will be below the element's yValue and (2) will be above. |
FromPercent(p) | Relative Single Value | Creates a subValue from the specified percentage. (-50) will be below the element's yValue and (50) will be above. |
FromValue(v) | Single Value | Creates a subValue from the specified value. |
Adding SubValues
Each element contains a SubValueCollection under the Element.SubValues property. Adding a sub value can be done simply be adding it to that collection.
[C#]
Element e = new Element();
e.SubValues.Add(SubValue.FromOffset(5));
[Visual Basic]
Dim e As new Element()
e.SubValues.Add(SubValue.FromOffset(5))
The element e now contains a subValue which is equivalent to e.YValue + 5.
SubValues Appearance
There are a few options available that determine how a subVlaue will be drawn with an element. These options are specified with the SubValueType enumeration.
- SubValueType.ErrorBar
A traditional error bar stemming from the top of an element.
NOTE: An idential error bar drawn on top and bottom of the element is achieved when the element values specify a range (YValue and YValueStart is set).
- SubValueType.Marker
A marker or two markers for range sub values. - SubValueType.Line
Similar to error bars but without the vertical line.
This code snippet demonstrates how the appearance properties can be used.
[C#]
SubValue sv = SubValue.FromOffset(5);
sv.Type = SubValueType.Marker;
sv.Marker.Type = ElementMarkerType.Circle;
sv.Marker.Color = Color.Red;
SubValue sv2 = SubValue.FromOffset(5);
sv2.Type = SubValueType.Line;
sv2.Line.Color = Color.Black;
sv2.Line.DashStyle = DashStyle.Dash;
[Visual Basic]
Dim sv As SubValue = SubValue.FromOffset(5)
sv.Type = SubValueType.Marker
sv.Marker.Type = ElementMarkerType.Circle
sv.Marker.Color = Color.Red
Dim sv2 As SubValue = SubValue.FromOffset(5)
sv2.Type = SubValueType.Line
sv2.Line.Color = Color.Black
sv2.Line.DashStyle = DashStyle.Dash
Default Settings
SubValues can be quickly added and manipulated for all elements within a series or series collection. When a SubValue is added to a series' default element it is also added to all subsequent elements automatically.
This code snippet automatically adds a subValue to all elements on the chart.
[C#]
Chart.DefaultSeries.DefaultElement.SubValues.Add(SubValue.FromOffset(5));
[Visual Basic]
Chart.DefaultSeries.DefaultElement.SubValues.Add(SubValue.FromOffset(5))
SubValues default appearance can also be specified quickly by using the element's DefaultSubValue properties.
[C#]
Chart.DefaultSeries.DefaultElement.DefaultSubValue.Line.DashStyle = DashStyle.Dash;
[Visual Basic]
Chart.DefaultSeries.DefaultElement.DefaultSubValue.Line.DashStyle = DashStyle.Dash
Limitations
|