Bar charts allow easy comparison of groups of data. A typical use in Salesforce is to view performance on a month-by-month basis; for example, to identify the effectiveness of a process improvement.
In this recipe, we will create a Visualforce page containing a bar chart that displays the total value of won opportunities per month for the previous 12 months. This allows a sales manager to view at a glance whether sales are increasing or decreasing, and to identify any problem months that require further analysis.
This recipe makes use of a custom controller, so this must be created before the Visualforce page.
Navigate to the Apex Classes setup page by clicking on Your Name | Setup | Develop | Apex Classes.
Click on the New button.
Paste the contents of the
BarChartController.cls
Apex class from the code download into the Apex Class area.Click on the Save button.
Next, create the Visualforce page by navigating to the Visualforce setup page by clicking...