Skip to main content

Visualforce reportChart Component

About Us
Published by admin
27 January 2017
20

This component is used to add Salesforce report charts to a Visualforce page. There is an option for data filtering in case you want to see 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.

First of all, you need to enter reportId (The unique ID of the report) or developerName (The unique developer name of the report), to set report for your reportChart.

Then you can set some filters to show only necessary information, using attribute filter. 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'}].

Attribute body is the body of the component. In markup, this is everything in the body of the tag.
It is a good idea to set hideOnError=”true”, if you don’t want users to see errors related to the chart. If an error occurs, the chart will not be displayed.
Attribute rendered can be used to show or to hide your chart. You can use a formula here.
Attribute size specifies a chart’s size with one of these values: tiny, small, medium, large, huge.
Attribute showRefreshButton is a Boolean indicating whether to add a refresh button to the chart. It is true by default.
If you want to enable cache, you should set cacheResults=”true”. When the attribute is set to true, data is cached for 24 hours, but you can modify the length of time with the cacheAge (in milliseconds) attribute. The maximum length of time is 24 hours. If the attribute is set to false, the report is run every time the page is refreshed.

Using component on Visualforce page might look like this: <analytics:reportChart reportId="00O28000001BC2N" showRefreshButton="true" size="tiny" hideOnError="true"/>.

And here is a result:

 result

We can use some filters: <analytics:reportChart reportId="00O28000001BC2N" showRefreshButton="true" size="tiny" hideOnError="true" filter="[{column:'AMOUNT', operator:'equals', value:'15000'}]"/>.

And here is a result:

And here is a result:


Question to the expert
Related Articles
All articles
Save the dates! Upcoming Salesforce events are here!
Training is an essential part of the person’s growth as a professional. Especially it’s important to learn something new for developers on an ongoing basis because they are the ones who meet unique business issues and create the best solutions that bring to life any client's wishes. Salesforce has always tried to provide all the partners with opportunities to learn and develop. We present you a useful list of upcoming events from Salesforce that can be an interesting and valuable pastime.
08 April 2021
Augmented Reality for Business. FieldXR Project part 3
In the previous articles, the JET BI project, Structure Sensor SDK, and the problem of identifying the scanned object were described. Also, we considered the calculating algorithm of the found 3D model position for displaying in the scanned object coordinates. Today we perform the process of developing the JET BI FieldXR project.
29 March 2021
How to work with the identified 3D objects. FieldXR project part 2
This post is the second article in the series that covers FieldXR app, an extension for Salesforce Field Service with deep visualization functionality.  We have already raised the issue of collecting 3D information about the real world required for the app’s correct operation. In this article, we will highlight the next two pain points: identifying the scanned object and calculating the position of the found 3D model for displaying in the scanned object’s coordinates.
25 March 2021