Skip to main content

Labels

  • 3 minutes to read

ASPxGaugeControl supports two types of labels:

  • Custom labels that can display only static text, and do not display a scale value automatically.
  • Scale value labels (supported only by circular and linear gauges), which show current scale values and can also display custom text.

Custom Labels

All types of gauges support custom labels. Custom labels allow you to do the following:

  • Display labels above or below other gauge elements.

    To specify the label’s position along the Z axis, use the label’s ZOrder property.

  • Format label text with HTML tags.

    You can use specific HTML tags to format the label’s text. See the following property description to learn more: Label.Text.

Do the following to add a custom label to a web form at design time:

  • Click the Gauge control’s smart tag and select Customize Gauge Control…

    Labels-Invoke Customize Gauge tag

  • In the invoked Visual Gauge Control Designer, click the gauge’s smart tag and choose Add Label.

    Invoke Add Label tag

A custom gauge label appears in the gauge designer that you can edit.

For this, select the label on the gauge and invoke its designer from the label’s smart tag as shown below.

Labels - Run label designer

Then, in the invoked designer, you can customize label appearance, geometry and text.

CustomLabelDesigner

Custom labels are instances of the LabelComponent class.

The gauge’s BaseGaugeWin.Labels collection stores all labels regardless of where you add them - in code or at design time.

Scale Value Labels

Circular and linear gauges support scale value labels. The labels can display default or custom text. The features of scale labels include:

  • The ability to display a scale’s value along with custom text.

    Value labels belong to a scale. They automatically receive notifications when the scale’s value changes, and update view information accordingly. You do not need to write additional code to synchronize a value label and the scale’s value.

  • Support for HTML tags in label text.

    You can use HTML tags to format the label’s text.

  • A scale label belongs to a scale, so it’s displayed at the same level as the scale.

Run the scale label collection editor to add a scale value label at design time as follows:

  • Run Visual Gauge Control Designer as you did in the previous section;

  • Click the scale’s smart tag and select Run Designer.

    Run Scale Designer

  • In the invoked Scales - Element Designer, click the Labels… button, as shown below.

    ClickScaleLabelEditor

The collection editor allows you to add one or more labels and customize their settings:

ValueLabel_CollectionEditor

For instance, the FormatString property enables you to include the scale’s current value in the label’s text. Note that placeholder {0} is the value of the label’s Text property, and placeholder {1} is the scale’s current value.

In the image below, the label belongs to the upper scale, so it shows a value of 25.

Scale label on web form

See Also