﻿ ErrorBars and other SubValues
 .netCHARTING v8.4 Documentation Send comments on this topic. ErrorBars and other SubValues
 Getting Started > General Tutorials > Chart Type Anatomy 101 > ErrorBars and other SubValues

Glossary Item Box

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 andblow the element's yValue. FromPlusMinusPercent (hPercent,lPercent) Relative Range Creates a range sub value from specified percentages aboveand below the element's yValue. FromPlusMinusPercent (percent) Relative Range Creates a range sub value from the specified percentageabove and below the element's yValue. FromOffset(o) Relative Single Value Creates a subValue from the specified offset. (-2) will bebelow 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.

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#]
```
```[Visual Basic]
```

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.Markersv.Marker.Type = ElementMarkerType.Circlesv.Marker.Color = Color.RedDim sv2 As SubValue = SubValue.FromOffset(5)sv2.Type = SubValueType.Linesv2.Line.Color = Color.Blacksv2.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#]
```
```[Visual Basic]
```[C#]
```[Visual Basic]