Chart Axis - Apex and Visualforce Controllers Exam | Salesforce

Chart Axis

Question

Defines an axis for a chart.

Use this to set the units, scale, labeling, and other visual options for the axis.

You can define up to four axes for a single chart, one for each edge.

Note: This component must be enclosed within an <apex:chart> component.

This component is only applicable to bar and line charts.

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

The correct answer is D. apex:axis.

The apex:axis component defines an axis for a chart. It is used to set the units, scale, labeling, and other visual options for the axis. This component can be used to define up to four axes for a single chart, one for each edge. It is important to note that this component must be enclosed within an apex:chart component and is only applicable to bar and line charts.

Here are some of the attributes that can be used with the apex:axis component:

  • type: The type of axis, such as numeric or category.
  • position: The position of the axis, such as top, bottom, left, or right.
  • title: The title of the axis.
  • gridLines: Whether or not to display grid lines.
  • labels: Whether or not to display axis labels.
  • labelRotation: The rotation of the axis labels.
  • maximum: The maximum value of the axis.
  • minimum: The minimum value of the axis.
  • interval: The interval between tick marks.

For example, here is a sample apex:chart component with two apex:axis components:

php
<apex:chart height="400" width="600" data="{!data}"> <apex:axis type="numeric" position="left" title="Sales Amount ($)" gridLines="true" labels="true" maximum="100" minimum="0" interval="20"/> <apex:axis type="category" position="bottom" title="Month" gridLines="false" labels="true" labelRotation="45"/> <apex:barSeries axis="left" xField="month" yField="sales"/> </apex:chart>

In this example, the apex:chart component defines a bar chart with two axes. The first apex:axis component defines a numeric axis on the left side of the chart with a title of "Sales Amount ($)", grid lines, and labels. It also sets the maximum value to 100, the minimum value to 0, and the interval between tick marks to 20. The second apex:axis component defines a category axis on the bottom of the chart with a title of "Month", labels, and a label rotation of 45 degrees. Finally, the apex:barSeries component is used to define the data to be displayed in the chart.