| |
 |
Series Point Labels
This document describes how Series Points can be accompanied by text labels, how you can control the data they show and format their output. It describes ways in which you can resolve label overlapping if labels are too long and numerous. In addition, it explains how series labels can be accessed, and the ways in which you can adjust their appearance.
This document consists of the following sections.

Series Point Labels Overview
Each series point can be accompanied by a text label representing data related to the point. These are the series point labels (or simply Series Labels for short).

For series of different view types, points represent different kinds of data, hence the corresponding series labels can carry a point's value, argument, or both (How to: Change the Display Format for Series Labels of a Pie Chart). If required, you can also make a label display any custom information (How to: Make Series Labels Display Custom Information) or conditionally control its appearance (How to: Conditionally Hide Series Labels).
Note
Series point labels are hidden in the WinForms Chart control by default (the crosshair cursor is shown instead). If you wish to display point labels on a diagram, set the SeriesBase.LabelsVisibility property for a particular series to true (e.g., LineSeriesView.LabelsVisibility).
The following sections of this document highlight the most important aspects of series labels.

Access Series Labels
To access the settings that specify the contents, position and appearance of series labels at design time, do one of the following:
or
- select a series, and in the Properties window, expand the SeriesBase.Label property, which provides access to these settings.
To access series-specific label options (for the view type) at runtime, cast the SeriesBase.Label property value to a SeriesLabelBase class descendant, storing specific label settings. For example, the following code demonstrates how to obtain label settings specific for the bar series.
C# |
SideBySideBarSeriesLabel label = chart.Series[0].Label as SideBySideBarSeriesLabel;
if (label != null) {
label.Position = BarSeriesLabelPosition.Top;
}
|
VB |
Dim label As SideBySideBarSeriesLabel = TryCast(chart.Series(0).Label, SideBySideBarSeriesLabel)
If label IsNot Nothing Then
label.Position = BarSeriesLabelPosition.Top
End If
|
The series label options fall into the following two categories, described in their particular document sections.

Resolve Overlapping of Series Labels
The series labels may overlap in the following cases:
- when there are too many data points in a series;
- when series arguments or values are too long.
In these situations, you can use the overlap resolving algorithms provided by the WinForms Chart Control, which are different enough to meet specific requirements. This feature is available for both 2D and 3D series view types.
Note that the series labels are hidden by default. And a crosshair cursor is enabled to interact quickly with huge data. In addition, you can enable chart tooltips to appear when a series point is hovered with a mouse, using the ChartControl.ToolTipEnabled property without writing a single line of code. To learn more, see Tooltip.
To enable overlap resolution, set the SeriesLabelBase.ResolveOverlappingMode to a value other than None.
The following table demonstrates the availability of resolve overlapping modes for different series view types.
Mode |
Description |
Series View Type |
Default |
This algorithm re-positions labels randomly to avoid overlapping labels. This mode only changes the position of labels that are overlapped. |
All the view types, with respect to the view type's specifics. |
HideOverlapped |
In this mode, if two or more labels overlap, some of them are automatically hidden to avoid overlapping. |
All the view types, with the exception of the Pie and Doughnut and Funnel series. |
JustifyAroundPoint |
Only labels that are overlapping change their position. They are re-positioned in such a way, so they are moved around the corresponding point's center, but their indent from the point center is preserved. This mode only changes the position of labels that are overlapped. |
By definition, this mode is supported for series view types that visually represent a data point as a point. So, this encompasses all view types, with the exception of the Pie and Doughnut, Gantt, Bar and Column, Bubble, and Stock series. |
JustifyAllAroundPoint |
All labels (both overlapping and non-overlapping) change their position. They are re-positioned in such a way, so they are moved around the corresponding point's center, but their indent from the point center is preserved. |
By definition, this mode is supported for series view types that visually represent a data point as a point. So, this encompasses all view types, with the exception of the Pie and Doughnut, Gantt, Bar and Column, Bubble, and Stock series. |
After any overlapping mode is enabled, the SeriesLabelBase.ResolveOverlappingMinIndent property is in effect, which allows you to determine the minimum indent between two adjacent series point labels. Note that this property is synchronized for all series, so setting this property for one series will apply the changes for all series within a chart. This option isn't available for the Pie and Doughnut, Bubble and Stock series.
The following images demonstrate this property in action (with the SeriesLabelBase.ResolveOverlappingMode set to JustifyAroundPoint).
The property value |
The resulting image |
ResolveOverlappingMinIndent = -1 |
 |
ResolveOverlappingMinIndent = 5 |
 |

Customize the Displaying Format of Series Labels
Since series labels represent data of their corresponding series points, you can apply formatting to this data using the SeriesLabelBase.TextPattern property. This property defines a pattern for displaying text by series labels. Various placeholders enclosed in braces correspond to the available display patterns.
A full list of available placeholders is detailed below.
Pattern |
Description |
{S} |
Displays the name of the series. |
{A} |
Displays a series point argument. |
{V} |
Displays series point values. |
|
Pie (Donut) series specific placeholders |
{VP} |
Displays series point values as percentages. |
{TV} |
Displays a total group value. |
|
Stacked series specific placeholders |
{VP} |
Displays series point values as percentages. |
{G} |
Displays the name of a stacked group. |
{TV} |
Displays a total group value. |
|
Bubble series specific placeholders |
{W} |
Displays the weight. |
|
Range series specific placeholders |
{V1} |
Displays the first value. |
{V2} |
Displays the second value. |
{VD} |
Displays the duration between the first and second data point values formatted using a common time format (e.g. HH:MM:SS for date time values and #.## for numeric values). |
{VDTD} |
Displays the duration between the first and second date-time data point values in days. |
{VDTH} |
Displays the duration between the first and second date-time data point values in hours. |
{VDTM} |
Displays the duration between the first and second date-time data point values in minutes. |
{VDTS} |
Displays the duration between the first and second date-time data point values in seconds. |
{VDTMS} |
Displays the duration between the first and second date-time data point values in milliseconds. |
|
Financial series specific placeholders |
{OV} |
Displays the open value. |
{HV} |
Displays the high value. |
{LV} |
Displays the low value. |
{CV} |
Displays the close value. |
Note
Make sure before using the {S} placeholder that the Series.Name property is specified.
You can also use standard and custom format specifiers, together with the placeholders and data field values (e.g., {V:F1}).
When the chart control or a series is bound to data, the text pattern may contain data field values in addition to default placeholders. For example, the data source contains the Discount field and the text pattern may looks like: {S}: {V:F2} (Discount: {Discount:P0}).
You can use standard and custom format specifiers, together with the placeholders to format numeric and date/time values (e.g., "{A}: {V:f1}") .
The result is shown below.

To learn more, see the Format Specifiers topic.
In addition, you can specify a pattern using the Pattern Editor. The editor contains numerous predefined chart placeholders together with the date-time, numeric, percent, currency, and special formats allowing you to create a text pattern.
To invoke the editor, click the ellipsis button of the SeriesLabelBase.TextPattern property in the Properties window.
You can also customize the text pattern in the "Text Pattern" tab, which is located in the "Point Labels" Chart Wizard section.
The image below shows the Pattern Editor invoked for the SeriesLabelBase.TextPattern property.


Customize the Layout of Series Labels
For series of different types, various settings of series labels are available. At the same time, the common point label layout settings are stored by the SeriesLabelBase class.
-
The SeriesLabelBase.TextOrientation property of this class specifies the direction of text in the series labels.
The property value |
The resulting image |
TextOrientation = Horizontal |
 |
TextOrientation = TopToBottom |
 |
TextOrientation = BottomToTop |
 |
-
The SeriesLabelBase.TextPattern property, which specifies the pattern for series labels to display a point's Argument, Value or both. The following image demonstrates the labels with the {A}: {VP:P} text pattern.

The list below specifies the main groups of series point labels.
Point Series Label
The settings of series point labels represented as a marker are stored by the PointSeriesLabel class. This class introduces the following settings.
-
The PointSeriesLabel.Position property allows you to specify the position of the label. The possible point label positions are demonstrated in the following table.
The property value |
The resulting image |
Position = Center |
 |
Position = Outside |
 |
-
The PointSeriesLabel.Angle property allows you to define the angle value of series point labels, relative to the corresponding data points. The angle is measured from the upward x-axis direction to the upward y-axis.
The property value
|
The resulting image
|
---|
Angle = 45
(Default value)
|

|
Angle = 0
|

|
Angle = -60
|

|
For the Bubble series, the following layout options are available.
Bar Series Label
The following layout options are available for labels of the Bar and Column series view types using the BarSeriesLabel class.
PieSeriesLabel
For the Pie and Doughnut series, the PieSeriesLabel.Position property allows you to organize series labels, as represented in the following table.
The property value |
The resulting image |
Position = Inside |
 |
Position = Outside |
 |
Position = TwoColumns |
 |
Position = Radial |
 |
Position = Tangent |
 |
In addition, the PieSeriesLabel.ColumnIndent property allows you to specify the distance between the edge of a pie segment and the segment's label. On the following image, this property is set to 25.

Range Series Label
Range bar series point label settings are stored using the RangeBarSeriesLabel class. This class provides the RangeBarSeriesLabel.Position, RangeBarSeriesLabel.Kind and RangeBarSeriesLabel.Indent properties specifying the layout of the range bar series point label.
Concurrently, the RangeAreaSeriesLabel class contains settings specifying the layout of the range area series point label. The common properties of this view's point labels are RangeAreaSeriesLabel.Kind, RangeAreaSeriesLabel.MinValueAngle and RangeAreaSeriesLabel.MaxValueAngle.

Customize the Appearance of Series Labels
The set of appearance options available for series labels varies, depending on the view type of the series. The most common options are listed below.

See Also
Is this topic helpful?
Additional Feedback
Close
|