I have a Visualforce page that houses some Visualforce charts.
- A link on the Account navigates the user to a Visualforce page that
has the charts and passes the AccountId parameter the URL. - I have 3 number fields on the Account object that I wish to summarize in a nice pie chart.
public List getAccountRollUpAggregate() { List data = new List(); for (Account a : [SELECT Name, of_Closed_Won_New_Business_Opps__c, of_Open_New_Business_Opps__c, of_Closed_Lost_New_Business_Opps__c FROM Account WHERE Id=:ApexPages.currentPage().getParameters().get('id')]) { data.add(new PieWedgeData(Integer.valueOf(a.get('of_Closed_Won_New_Business_Opps__c')), Integer.valueOf(a.get('of_Open_New_Business_Opps__c')), Integer.valueOf(a.get('of_Closed_Lost_New_Business_Opps__c')))); } return data; }
- A link on the Account navigates the user to a Visualforce page that
Where the wrapper class is:
// Wrapper class
public class PieWedgeData {
public String name { get; set; }
public Integer data { get; set; }
public Integer dataOpen {get; set;}
public Integer dataCWNB {get; set;}
public Integer dataCLNB {get; set;}
And the constructor is:
public PieWedgeData(Integer dataOpen, Integer dataCWNB, Integer dataCLNB) {
this.dataOpen = dataOpen;
this.dataCWNB = dataCWNB;
this.dataCLNB = dataCLNB;
}
}
The corresponding Visualforce I have so far is:
<apex:pageBlockSection columns="1" showHeader="true">
<apex:chart data="{!AccountRollUpAggregate}" width="900" height="400">
<apex:legend position="left"/>
<apex:pieSeries labelField="dataCWNB" dataField="dataCWNB" donut="50">
</apex:pieSeries>
</apex:chart>
</apex:pageBlockSection>
The piechart is displaying only 1 integer - and I am unclear how to simply get the three number fields from the account record and have them display in a pie chart.
In the other piecharts I have created using the structure before (wrapper class, constructor, some constructor methods etc), they are working as expected - they are returning a value for multiple records whereas for this simple piechart I want multiple values for but 1 record.
Any help would be much appreciated.
Thanks