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.
This recipe makes use of a custom controller, so this will need to be created before the Visualforce page.
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 Apex Class area.Click on the Save button.
Next, create the Visualforce page by navigating to the Visualforce setup page by clicking on Your Name | Setup | Develop | Pages.
Click on the New button.
Enter
LineChart
in the Label field.Accept the default LineChart...