Labels are normal texts that are always displayed over the 3D scene. They usually contain descriptive information about the image generated by the control. Labels are represented by the ChartLabel object. The ChartLabelCollection object of the control contains the labels displayed by the chart.
Label Position
The ChartLabel object allows you to position the label at an arbitrary position in the control window. You specify the position (or origin point) of the label object in as a percentage of the control window's dimensions, using the HorizontalMargin and VerticalMargin properties. The following code creates a new label at the top left corner of the control:
VB.NET | |
---|---|
|
C# | |
---|---|
ChartLabel label = new ChartLabel(); label.Text = "Hello world"; ChartControl.Labels.Add(label); |
Label Text
The text displayed by the label is controlled by the Text property of the ChartLabel object. The ChartText object associated with the label allows you to control text properties such as font, color, and orientation, and can be accessed via the TextProps property of the label.
Miscellaneous
All labels have an associated Interactivity object, which allows them to display custom tooltips or react to mouse actions the user performs on them. These features are discussed in detail in the Interactivity book in the Users Guide.
Related Examples
Windows Forms: Labels\General
Web Forms: Labels\General