ComponentOne FlexChart for WinForms
Adding and Positioning Data Labels
FlexChart > Working with FlexChart > FlexChart Elements > Data Labels > Adding and Positioning Data Labels

When added to data points in the chart, data labels make it easier to understand the chart data because they display details about individual data points. These labels quickly highlight data that is both relevant and important.

There is a simple method to add data labels to data points while working with FlexChart. You just need to configure the Content property as per the type of entry you want to display in data labels. And you need to set the position of data labels using the Position property to display the data labels in the chart.

The table below lists the pre-defined parameters applicable for data label content customization.

Parameter Description
x Shows the X value of the data point.
y Shows the Y value of the data point.
value Shows the Y value of the data point.
name Shows the X value of the data point.
seriesName Shows the name of the series.
pointIndex Shows the index of the data point.
P Shows the percentage share with respect to the parent slice in Sunburst.
p Shows the percentage share with respect to the whole chart in Sunburst.

See the following code snippet for reference.

// configure Content property
flexChart1.DataLabel.Content = "{value}";

// set the position of data labels
flexChart1.DataLabel.Position = C1.Chart.LabelPosition.Top;

 

Depending upon the chart type, you can select from different positioning options to position data labels perfectly in the chart. The Position property accepts the following values from the LabelPosition enumeration:

Property Description
Auto Sets the label position automatically.
Top Sets the labels above the data points.
Bottom Sets the labels below the data points.
Left Sets the labels to the left of the data points.
Right Sets the labels to the right of the data points.
Center Sets the labels centered on the data points.
None Hides the labels.

Using the Content property, you can customize the content of the data labels to further include series names, index values, or names of data points.

Note: You can set the position of data labels at the series level. To set the data labels position at series level, navigate to Series in the Properties window. Click the ellipsis button and open Series Collection Editor. Then, navigate to the Position property, and select the position you want to set for each series.

The following code shows how to set the Content property to include series names and data point values in data labels.

// set the Content property
flexChart1.DataLabel.Content = "{seriesName}\n{Days}\n{value}";