2D Chart for WinForms | ComponentOne
Charting Labels / Attaching and Positioning Chart Labels / Attaching the Chart Label by Pixel Coordinate
In This Topic
    Attaching the Chart Label by Pixel Coordinate
    In This Topic

    In a coordinate attachment the label can be attached anywhere on the chart. The number of pixels between the top-left corner of the chart to the ChartLabel can be specified.

    To attach a ChartLabel to a pixel coordinate, set the AttachMethod property to AttachMethodEnum.Coordinate, and then under the AttachMethodData object set the X and the Y properties to the coordinates at which the ChartLabel is to be attached. For example, the following attaches a ChartLabel to the coordinates specified:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    With C1Chart1.ChartLabels.LabelsCollection(0)
        .AttachMethod = AttachMethodEnum.Coordinate
        .AttachMethodData.X = 250
        .AttachMethodData.Y = 250
    End With
    

    To write code in C#

    C#
    Copy Code
    C1.Win.C1Chart.Label lab = c1Chart1.ChartLabels.LabelsCollection[0];
    lab.AttachMethod = AttachMethodEnum.Coordinate;
    lab.AttachMethodData.X = 250;
    lab.AttachMethodData.Y = 250;
    

    For more information on how to attach the chart label by pixel coordinate at design time see, Attach By Coordinate.

    See Also