Custom Tooltips for Salesforce Data Series

Custom Tooltips Component

Question

Defines tooltips which appear on mouse over of data series elements.

This component offers more configuration options than the default tooltips displayed by setting the tips attribute of a data series component to true.

Note: This component must be enclosed by a data series component (<apex:barSeries>, <apex:lineSeries>, or <apex:pieSeries>).

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

D.

The correct answer is D. apex:chartTips.

The apex:chartTips component is used to define tooltips that appear when a user hovers over data series elements in a chart. It offers more configuration options than the default tooltips displayed by setting the tips attribute of a data series component to true.

The apex:chartTips component must be enclosed by a data series component such as apex:barSeries, apex:lineSeries, or apex:pieSeries. When defining the apex:chartTips component, you can specify the content of the tooltip using HTML, as well as configure the tooltip's position and appearance.

Here is an example of how to use apex:chartTips in a bar chart:

php
<apex:chart height="400" width="600" data="{!data}"> <apex:axis type="Numeric" position="left" fields="data1" title="Axis Title"/> <apex:axis type="Category" position="bottom" fields="name" title="Axis Title"/> <apex:barSeries axis="left" xField="name" yField="data1" tips="true"> <apex:chartTips height="50" width="120"> <apex:outputText value="{name}: {data1}"/> </apex:chartTips> </apex:barSeries> </apex:chart>

In this example, the apex:barSeries component includes the tips attribute set to true, indicating that tooltips should be displayed when a user hovers over a data series element. The apex:chartTips component is enclosed within the apex:barSeries component, and its height and width attributes are set to define the size of the tooltip. The content of the tooltip is defined by the apex:outputText component, which displays the name and data1 values of the data series element being hovered over.