Xceed Chart for WinForms v4.4 Documentation
HighLow Series

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > XY Scatter Series > HighLow Series

High-Low charts are created with the HighLowSeries class. It is derived from the XYScatterSeries base class and inherits all its functionality. The following figure represents a typical high-low area chart. 

figure 1.

Creating the High-Low Series

An instance of the HighLowSeries class can be obtained from the SeriesCollection.Add method. The method will add the newly created series to the series collection and return a reference to it. If the user wants to save the reference for further use, it must be explicitly cast to the HighLowSeries type. The following code will create a HighLowSeries object in the series collection and save the returned reference:

VB.NET  

' there is one chart created by default

Dim chart As Chart = CType(chartControl1.Charts(0), Chart)

 

' add a HighLow series to it

Dim hilow As HighLowSeries = CType(Chart.Series.Add(SeriesType.HighLow), HighLowSeries)

C#  
// there is one chart created by default
Chart chart = (Chart)chartControl1.Charts[0];
// add a HighLow series to it
HighLowSeries hilow = (HighLowSeries)Chart.Series.Add(SeriesType.HighLow);

Passing Data to the High-Low Series

Once the high-low series is created, you can add data to it. High-Low series use the Values data series of its base class for the high values. The user can use the helper methods provided by the Series and XYScatterSeries classes to insert values into the data series to be used. 

In addition to the standard Values and XValues data series, the High-Low series also adds another data series of type Double, which holds the low values of the area segments. It is accessible through the LowValues property of HighLowSeries object. 

In addition to the standard helper methods for feeding data inherited from the Series class (see the One Value Series Functionality topic) and the XYScatterSeries class (see the XY Scatter Series Functionality topic), the HighLowSeries class implements the following routines.

void AddHighLow(double high, double low) - Adds a highlow data point with high and low values.

void AddHighLow(double high, double low, double x) - Adds a highlow data point with high and low values and custom X position.

void AddHighLow(double high, double low, double x, string label) - Adds a highlow data point with high and low values and custom X position and assigned data point label. 

For example: 

Simple high-low chart

VB.NET  

hilow.AddHighLow(12, 14) ' a low area segment (high < low)

hilow.AddHighLow(24, 16) ' a high area segment (low < high)

C#  
hilow.AddHighLow(12, 14); // a low area segment (high < low)
hilow.AddHighLow(24, 16); // a high area segment (low < high)

Date-Time high-low chart

VB.NET  

hilow.AddHighLow(12, 14, new DateTime(2003, 3, 24).ToOADate()) ' a low area segment (high < low)

hilow.AddHighLow(24, 16, new DateTime(2003, 4, 14).ToOADate()) ' a high area segment (low < high)

 

// instruct the chart to use the custom x date time positions

hilow.UseXValues = true;

chart.Axis(StandardAxis.PrimaryY).ScaleMode = AxisScaleMode.DateTime;

 

// and format the ticks as dates

chart.Axis(StandardAxis.PrimaryX).ValueFormat.Format = ValueFormat.Date;

C#  

hilow.AddHighLow(12, 14, new DateTime(2003, 3, 24).ToOADate()); // a low area segment (high < low)

hilow.AddHighLow(24, 16, new DateTime(2003, 4, 14).ToOADate()); // a high area segment (low < high)

 

// instruct the chart to use the custom x date time positions

hilow.UseXValues = true;

chart.Axis(StandardAxis.PrimaryY).ScaleMode = AxisScaleMode.DateTime;<

 

// and format the ticks as dates

chart.Axis(StandardAxis.PrimaryX).ValueFormat.Format = ValueFormat.Date;

Controlling the Depth of the High-Low Area

The depth of the high-low area is specified as a percentage of the grid-cell depth it occupies. The DepthPercent property controls this percentage. By default it is set to 50. The following code will increase the depth of the high-low area:

VB.NET  
hilow.DepthPercent = 70
C#  
hilow.DepthPercent = 70;

Drop Lines and High-Low Series

Drop lines are lines separating the high-low area segments. The user controls their visibility with the help of the DropLines property. By default it is set to false. The following code will display drop lines:

VB.NET  
hilow.DropLines = True
C#  
hilow.DropLines = true;

Controlling the Appearance of the High-Low Series

The appearance of the high areas (areas for which the high values are greater than the low values) is controlled by the HighFillEffect and HighBorder properties (giving you access to the attached fill effect and line properties applied on the high areas). The appearance of the low areas (areas for which the high values are smaller than the low values) is controlled by the LowFillEffect and LowBorder properties (giving you access to the attached fill effect and line properties applied to the low areas). The following code example will display the high areas in red and the low areas in blue.

VB.NET  

hilow.HighFillEffect.SetSolidColor(Color.Red)

hilow.LowFillEffect.SetSolidColor(Color.Blue)

C#  
hilow.HighFillEffect.SetSolidColor(Color.Red);
hilow.LowFillEffect.SetSolidColor(Color.Blue);

High-Low Series Formatting Commands

The HighLowSeries class extends the formatting command set inherited from the Series base class with the following formatting commands:

<high_value> - The current data point high value (extracted from the Values data series).
<low_value> - The current data point low value (extracted from the LowValues data series).
<high_label> - Replaced with the HighLabel string if the data point is with up orientation or with empty string if not.
<low_label> - Replaced with the LowLabel string if the data point is with down orientation or with empty string if not.

Labeling High and Low Area Segments

In specific cases it is required to apply common labels on the high and low segments of the High-Low series. The label text applied on high area segments is specified with the help of the HighLabel property. Alternatively, the label text for the low segments is specified by the LowLabel property. The user can easily display these labels in the legend and the data points. The following code demonstrates this.

VB.NET  

' specify the texts

hilow.HighLabel = "up"

hilow.LowLabel = "down"

 

' display them in the data labels - note that the labels are without spacing

' this is because the component renders only one of the label strings. If there was a space

' between the format commands the string for high areas will have an extra trailing space,

' while the string for low labels will have an extra leading space

hilow.DataLabels.Format = "<high_label><low_label>"

 

' configure the legend - HighLow series use the logic series mode to display high and

' low filling with the specified high and low

labels.hilow.Legend.Mode = SeriesLegendMode.SeriesLogic

C#  

// specify the texts

hilow.HighLabel = "up";

hilow.LowLabel = "down";

 

// display them in the data labels - note that the labels are without spacing

// this is because the component renders only one of the label strings. If there was a space

// between the format commands the string for high areas will have an extra trailing space,

// while the string for low labels will have an extra leading space

hilow.DataLabels.Format = "<high_label><low_label>";

 

// configure the legend - HighLow series use the logic series mode to display high and

// low filling with the specified high and low

labels.hilow.Legend.Mode = SeriesLegendMode.SeriesLogic;

 

figure 2.

Related Examples

Windows Forms: Series\High Low\Standard High Low
Windows Forms: Series\High Low\Advanced High Low

See Also

HighLowSeries