ComponentOne Chart for .NET (2.0) Search HelpCentral 

Attaching the Chart Label by Data Coordinate

To attach a ChartLabel to a data coordinate on the chart, set the AttachMethod property to AttachMethodEnum.DataCoordinate, and then under the AttachMethodData object set the X and Y properties to the data coordinates at which the ChartLabel is to be attached. For example, the following attaches a ChartLabel to the data coordinate (1.1, 15.8):

·      Visual Basic

With C1Chart1.ChartLabels.LabelsCollection(0)

    .AttachMethod = AttachMethodEnum.DataCoordinate

    .AttachMethodData.X = 1.1

    .AttachMethodData.Y = 15.8

End With

·      C#

C1.Win.C1Chart.Label lab = C1Chart1.ChartLabels.LabelsCollection[0];

lab.AttachMethod = AttachMethodEnum.DataCoordinate;

lab.AttachMethodData.X = 1.1;

lab.AttachMethodData.Y = 15.8;

·      Delphi

var

  lab: C1.Win.C1Chart1.Label;

begin

  lab := C1Chart1.ChartLabels.LabelsCollection[0];

  lab.AttachMethod := AttachMethodEnum.DataCoordinate;

  lab.AttachMethodData.X := 1.1;

  lab.AttachMethodData.Y := 15.8;

end;

ChartLabels can only be attached to a data coordinate if the chart is an Area or XY-Plot. Any part of the ChartLabel that falls outside of the ChartArea is clipped.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.