March 18, 2013

Visualforce Pie (donut) Charting

Visualforce charting of type Pie and it has parameter donut (integer) :)

It helps to create highly controlled way of picturing the dashboard you need and query the data exactly you need to display than standard Salesforce.com Dashboards. It is recommended to use when standard Salesforce.com charting is not fulfilling your need and your page needs more details like some details record information, table and a chart.
It is just a simple quick play with reference of example provided in Force.com blogs.
Number of cases closed this year. Let have very simple example of Pie Chart.
This can be placed in Account page layout and queried only for that account level as well.
To include visual force page in page layout, simply specify Standard Controller = “Account” or that object name.  Then Visual force option will be available in page layout edit section to drag and drop!
I wanted to give some label for each donut slice to know what is what, without mouse hover over but I didn’t find any option for it!!

Page

    
        
        
    

Controller 
public class PieChartController {
public ListgetPieData2(){
return
[SELECT COUNT(CaseNumber) numCaseClosed,
CALENDAR_MONTH(Custom_Closed__c) theMonth
FROM Case
WHERE isClosed = True AND CALENDAR_YEAR(Custom_Closed__c) = 2012
GROUP BY CALENDAR_MONTH(Custom_Closed__c)
ORDER BY CALENDAR_MONTH(Custom_Closed__c)];
}
}



No comments: