Javatpoint Logo
Javatpoint Logo

<apex: chartLabel> Component in Visualforce Page

The <apex: chartLabel> is another important component to define how labels are displayed. The <apex: chartLabel> component allows us to affect the display of labels(data series, axes, and pie chart segment). The <apex: chartLable> component is always used as a child component of any data series component or an <apex: axis> component.

The <apex: chartLabel> component has the following attributes on the Visualforce page:

1. color

The color is a string-type attribute used to specify the text's color. We specify its value as an HTML-style color(hexadecimal). By default, #000 is set as a default color.

Syntax:

2. display

The display is a string-type attribute used for specifying the position of labels. These are the possible values for this attribute:

  1. rotate
  2. middle
  3. insideStart
  4. insideEnd
  5. none
  6. under
  7. over
  8. outside

The middle is set as a default value for this attribute.

Syntax:

3. field

The field is a string-type attribute used for specifying the field from which the label of the data point in the series is retrieved. The "name" is set as a default value for this attribute.

Syntax:

4. font

The font is a string-type attribute used to specify the font(as a CSS rule) for the label text. By default, its value is set to "11px Helvetica, sans-serif"

Syntax:

5. id

The id is a string-type attribute, i.e., a unique identifier that allows this component to be referenced by other components on the page.

Syntax:

6. minMargin

The minMargin is an integer-type attribute used for specifying the minimum distance from a label to the origin of the visualization in pixels. By default, its value is set to 50.

Syntax:

7. orientation

The orientation is a string-type attribute used for displaying the label text characters normally or stacked vertically. These are the two possible values for this attribute:

  1. horizontal
  2. vertical

By default, its value is set to "horizontal".

Syntax:

8. rendered

The rendered is a Boolean-type attribute used to specify whether the label is rendered with the chart. The Boolean value true is set as a default value.

Syntax:

9. rendererFn

The rendererFn is a string-type attribute used for specifying the name of the JavaScript function that augments or overrides label rendering for axis or series labels.

Syntax:

10. rotate

The rotate is an integer-type attribute that specifies the degree to rotate the label text. By default, its value is set to 0.

Syntax:

Let's take an example to understand how we can use this component on the Visualforce page:

ApexChartLabelExample.vfp

ApexChartLabelController.apxc

Output

apex: chartLabel Component in Visualforce Page





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA