Newer Version Available

This content describes an older version of this product. View Latest

analytics:reportChart

Use this component to add Salesforce report charts to a Visualforce page. You can filter chart data to show specific results. The component is available in API version 29.0 or later.

Before you add a report chart, check that the source report has a chart in Salesforce app.

Attributes

Attribute Name Attribute Type Description Required? API Version Access
cacheAge Long Use this attribute to control the length of time an embedded chart can cache data. 29.0 global
cacheResults Boolean Use this attribute to enable/disable cached results for the chart. This can help protect against usage limits. 29.0 global
developerName String The unique developer name of the report. You can get a report’s developer name from the report URL in Salesforce, or request it through the API. 29.0 global
filter String Filter a report chart by fields in addition to field filters already in the report to get specific data. Note that a report can have up to 20 field filters. A filter has these attributes in the form of a JSON string:
  • column: The API name of the field that you want to filter on.
  • operator:The API name of the condition you want to filter a field by. For example, to filter by "not equal to," use the API name "notEqual."
  • value: The filter criteria.

For example:

[{column:'STAGE_NAME', operator:'equals', value:'Prospecting'}, {column:'EXP_AMOUNT', operator:'greaterThan', value:'75000'}]

To get the API name of the field and the operator, make a describe request via the Analytics REST API or Analytics Apex Library as shown in these examples:

Analytics API

/services/data/v29.0/analytics/reports/00OD0000001ZbNHMA0/describe

Analytics Apex Library

  1. First, get report metadata from a describe request:

    Reports.ReportManager. describeReport(00OD0000001ZbNHMA0)
  2. Next, get operators based on the field’s data type using this method:

    Reports.ReportManager. getDatatypeFilterOperatorMap()
29.0 global
hideOnError Boolean Use the attribute to control whether users see a chart that has an error. When there’s an error and this attribute is not set, the chart will not show any data except the error.

An error can happen for many reasons, for example, when a user doesn’t have access to fields used by the chart or a chart has been removed from the report.

Set the attribute to true to hide the chart from a page.

29.0 global
rendered Boolean A Boolean value that specifies whether the component is rendered on the page. If not specified, this value defaults to true. 14.0 global
reportId String The unique ID of the report. You can get a report’s ID from the report URL in Salesforce, or request it through the API. 29.0 global
showRefreshButton Boolean Use this attribute to enable or disable a refresh button on the chart. 29.0 global
size String Specify a chart’s size with one of these values:
  • tiny
  • small
  • medium
  • large
  • huge
When not specified, the chart size is medium.
29.0 global