Javatpoint Logo
Javatpoint Logo

<apex: chart> Component in Visualforce Page

The <apex: chart> component is another important component used to define the chart's general characteristics (size, data binding, etc.).

The <apex: chart> component has the following attributes:

1. animate

The animate is a Boolean-type attribute used for specifying whether to animate the chart when it is first rendered. The Boolean-value true is set as a default value.

Syntax:

2. background

The background is a string-type attribute used to specify the chart's background color. The value of this attribute is specified as an HTML-style color. By default, the chart's background color is set as white.

Syntax:

3. colorSet

The colorSet is a string-type attribute used for specifying a set of the color values used by each child's series. The value for this attribute is specified as a comma-separated HTML-style colors string.

Syntax:

4. data

The data is an Object-type attribute used for specifying the data binding for the chart. The controller method, JavaScript method, or JavaScript object is specified as a value. In all cases, the result must be an array of records, and every record must contain all fields referenced in child data series components.

Syntax:

5. floating

The floating is a Boolean-type attribute used for specifying whether to float the chart outside the regular HTML document flow using CSS absolute positioning.

Syntax:

6. height

The height is a string-type attribute used to specify the chart rectangle's height.

Syntax:

7. hidden

The hidden is a Boolean-type attribute used for specifying whether to show or hide the chart initially. When it is set to true, the chart renders but hides it when the page is first displayed.

Syntax:

8. 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:

9. legend

The legend is a Boolean-type attribute used for specifying whether to display the default chart legend. The Boolean value true is set as a default value.

Syntax:

10. name

The name is a string-type attribute used for specifying the name of the generated JavaScript object used to provide additional configuration or perform dynamic operations.

Syntax:

11. rendered

The rendered is a Boolean-type attribute used to specify whether the component is rendered on the page. The Boolean value true is set as a default value to this attribute.

Syntax:

12. renderTo

The renderTo is a string-type attribute used to specify the Id of the DOM element to render the chart.

Syntax:

13. resizable

The resizable is a Boolean-type attribute used for specifying whether the chart is resizable after rendering

Syntax:

14. theme

The theme is a string-type attribute used to specify the chart theme's name. These are the possible values for this attribute:

  1. Salesforce
  2. Green
  3. Purple
  4. Sky
  5. Blue
  6. Red
  7. Yellow
  8. Category1
  9. Category2
  10. Category3
  11. Category4
  12. Category5
  13. Category6

Syntax:

15. width

The width is a string-type attribute used for specifying the width of the chart rectangle in pixels.

Syntax:

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

ApexChartExample.vfp

ApexChartController.apxc

Output

apex: chart 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