Data Labels

Labels that appear next to a plotted value on a Chart are called Data Labels. These labels are used to provide additional information about the single data values. By default a data label appear slightly offset from where the value is plotted. But using the DataLabelLocation and the DataLabelPosition enumerations the exact location of the data label can be manually controlled. Worth noting here is that the DataLabelLocation and DataLabelPosition enumerations are not used on the ScalarDataLabel class. Additionally, the data label can be rotated, using the Angle property, for even more control. There are four different types of data labels:

PercentageDataLabel
The 100% chart uses PercentageDataLabel to display details such as the XAxis value, the YAxis value, the name of the series and its value in percentage format.

The below code shows how to add PercentageDataLabel to a DateTime100PercentStackedLine series.

DateTime100PercentStackedLineSeriesElement seriesElement = new DateTime100PercentStackedLineSeriesElement("series name");
seriesElement.DataLabel = new PercentageDataLabel(true, true, true, true);        
Dim MyseriesElement As DateTime100PercentStackedLineSeriesElement = New DateTime100PercentStackedLineSeriesElement("Series name")
MyseriesElement.DataLabel = New PercentageDataLabel(True, True, True, True)      
XYScatterDataLabel
The XYScatter chart uses XYScatterDataLabel to display the XAxis value, the YAxis value and the series name.

The below code shows how to create and add XYScatterDataLabel to a XYScatter series.

XYScatterSeries xyScatterSeries = new XYScatterSeries("series name");
xyScatterSeries.DataLabel = new XYScatterDataLabel(true, true, true);        
Dim MyXYScatterSeries As XYScatterSeries = New XYScatterSeries("series name")
MyXYScatterSeries.DataLabel = New XYScatterDataLabel(True, True, True, True)         
ValuePositionDataLabel
All charts that have Numeric, DateTime or Indexed axis use ValuePositionDataLabel to display the XAxis value, the YAxis value and the series name.

The below code shows how to add ValuePositionDataLabel to a DateTimeLine series.

DateTimeLineSeries lineSeries = new DateTimeLineSeries("series name");
lineSeries.DataLabel = new ValuePositionDataLabel(true, true, true);        
Dim MyLineSeries As DateTimeLineSeries = New DateTimeLineSeries("series name")
MyLineSeriesAs.DataLabel = New ValuePositionDataLabel(True, True, True) 
ScalarDataLabel
The PieSeries uses ScalarDataLabel to display the PieSeries element value, PieSeries element name and PieSeries element value in percentage format. ScalarDataLabelPosition enumeration can be used to specify whether the ScalarDataLabel is added inside or outside the circle. By default it appears outside the circle.

The below code shows how to add ScalarDataLabel to a PieSeries.

PieSeries pieSeries = new PieSeries();
pieSeries.DataLabel= new ScalarDataLabel(true,true,true);       
Dim MyPieSeries As PieSeries = New PieSeries()
MyPieSeries.DataLabel = New ScalarDataLabel(True, True, True)

In this topic