new LabelGraphics(options)
Draw label class
The location is defined by the Entity.

Example labels
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
optional
Object is an object that contains the following properties:
|
Members
-
backgroundColorProperty
-
Get or set the Color property to specify the label background color.
- Default Value: new Color(0.165, 0.165, 0.165, 0.8)
backgroundPaddingProperty
Get or set the Cartesian2 property, specifying the horizontal and vertical background padding distance of the label in pixels.
- Default Value: new Cartesian2(7, 5)
readonly definitionChangedEvent
Get events. This event is thrown when the value of a property or sub property is modified, or when the definition is modified.
disableDepthTestDistanceProperty
Get or set the distance between the label and the camera. When the distance between the label and the camera is less than this distance, turn off depth detection. For example, to prevent being cut off due to terrain obstruction. When the value is 0, always enable depth detection. The value is Number. POSITIVE.INFINITY, and depth detection is always turned off.
distanceDisplayConditionProperty
Get or set the DistanceDisplayCondition property, specifying how far away the label should be displayed from the camera.
eyeOffsetProperty
Get or set a Cartesian3 property that specifies the offset of the label in camera space. The camera space is a left-hand coordinate system space. The x-axis points to the right of the observer, the y-axis points to the top of the observer, and the z-axis points inside the screen.
EyeOffset is usually used to arrange multiple labels in the same position, such as placing one label on top of its corresponding model
The figure below shows a label placed at the center of the Earth.However, eyeOffset allows the label to always appear above the Earth, regardless of the observer's or Earth's orientation.
![]() |
![]() |
l.eyeOffset = new Cartesian3(0.0, 8000000.0, 0.0);- Default Value: Cartesian3.ZERO
fillColorProperty
Get or set the Color property to specify the fill color.
fontProperty
Get or set the string property, specify the font information of the label's text, in CSS syntax format.
heightReferenceProperty
Get or set the HeightReference property.
- Default Value: HeightReference.NONE
horizontalOriginProperty
Gets or sets the property of the specified HorizontalOrigin.
outlineColorProperty
Get or set the Color property to specify the color of the contour.
outlineWidthProperty
Get or set the number property to specify the contour width.
pixelOffsetProperty
Get or set the Cartesian2 property. Specify the pixel offset of the label from its origin in screen space. This is usually used to align multiple labels to the same position. The origin of screen space is the upper left corner of the canvas; The value of x increases from left to right, and the value of y increases from top to bottom.
default |
l.pixeloffset = new Cartesian2(25, 75); |
- Default Value: Cartesian2.ZERO
pixelOffsetScaleByDistanceProperty
Get or set the value of NearFarScalar. This attribute specifies the pixel offset of the label based on the distance between the label and the camera. When the distance between the camera and the label is between NearFarScalar # near and NearFarScalar # far, the pixel offset of the label will be interpolated between NearFarScalar # nearValue and NearFarScalar # farValue. When the distance between the camera and the label is outside of NearFarScalar # near and NearFarScalar # far, the pixel offset of the label will be the closest value.
scaleProperty
Get or set the number property to specify the scaling ratio of the label. A ratio greater than 1.0 will enlarge the cousin, while a ratio less than 1.0 will shrink the label.

The image above, from left to right, shows scale ratios of
0.5, 1.0,
and 2.0.
- Default Value: 1.0
scaleByDistanceProperty
Get or set the NearFarScalar property. This attribute specifies the scaling ratio of the label based on the distance between the label and the camera. When the distance between the camera and the label is between NearFarScalar # near and NearFarScalar # far, the scaling ratio of the label will be interpolated between NearFarScalar # nearValue and NearFarScalar # farValue. When the distance between the camera and the label is outside of NearFarScalar # near and NearFarScalar # far, the scaling ratio of the label will be the closest value. If this property is not defined, the scaleByDistance property will not work.
showProperty
Get or set boolean attribute to specify the visibility of the label.
showBackgroundProperty
Get or set boolean property to specify whether the label background should be displayed.
- Default Value: false
styleProperty
Get or set the LabelStyle property.
textProperty
Get or set the string property to specify the text of the label. Use '\ n' for line breaks.
translucencyByDistanceProperty
Get or set the value of NearFarScalar. This attribute specifies the transparency of the label based on the distance between the label and the camera. When the distance between the camera and the label is between NearFarScalar # near and NearFarScalar # far, the transparency of the label will be interpolated between NearFarScalar # nearValue and NearFarScalar # farValue. When the distance between the camera and the label is outside of NearFarScalar # near and NearFarScalar # far, the transparency of the label will be the closest value.
verticalOriginProperty
Gets or sets the property of the specified VerticalOrigin.
Methods
-
clone(result){LabelGraphics}
-
Copy instance
Name Type Description resultLabelGraphics optional The object that stores the copied results
Returns:
Type Description LabelGraphics If input parameters are provided, return the modified input parameter object. If no input parameters are provided, return a new instance. -
merge(source)
-
Assign the attribute values corresponding to the source object to all unspecified attributes of this instance.
Name Type Description sourceLabelGraphics An object that provides attribute values.

