Creating a line chart
Line charts are useful to demonstrate changes in data over time. A typical use in Salesforce is to view the number of records with a particular characteristic over a period of time.
In this recipe, we will create a Visualforce page containing a line chart that displays the total number of closed cases per month for the previous 12 months.
Getting ready
This recipe makes use of a custom controller, so this will need to be created before the Visualforce page.
How to do it...
- First, create the custom controller by navigating 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
LineChartController.cls
Apex class from the code download into the
Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.