• Kris Hollen 14
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 2
    Replies
I am coding a new visualforce chart and need help with the Controller... I am new to Apex so I appologize if the fix is something basic but I am unable to figure this out. Here is my code:
public class GaugeChartController {
    public String acctId {get;set;}

    public GaugeChartController(ApexPages.StandardController controller){
        acctId = controller.getRecord().Id;
    }

    public List<gaugeData> getData() {
                  
   AggregateResult SurveyResponses = [select Account__c, Count(Name), avg(Liklelihood_of_recommending_AECOM__c) npsscore
                                   from NPS_Survey_Response__c
                                   where Account__c =: acctId
                                   group by Account__c];

          List<gaugeData> data = new List<gaugeData>();
          data.add(new gaugeData(Integer.valueOf(SurveyResponses.get('npsscore'))));
           return data;
      }
    public class gaugeData {
        public String name { get; set; }
        public Integer size { get; set; }

        public gaugeData(String name, Integer data) {
            this.name = name;
            this.size = data;
        }
    }
}

I need to calculate the Average of a field from a related list I have off of the Account record. I would like to either A) take this fields from the existing roll up summary field i have on the Account, OR B) Use the Aggregate function to calculate based off of the related list... 

I am not sure which is easier but if anyone can help me with this I would greatly appreciate it- this would be for a gauge chart. In the above code I am getting an error stating the constructor in line 16 is not defined- Highlighted in Bold
I need to create some custom charts in Salesforce that are directly embedded on the Account record. I am very new to developing in apex and am not sure where to start or how to get this to work. Can anyone supply examples of Visualforce pages with charts and the associated controller classes? 

Thakns in advance,

Kris Hollen
I need to create some custom charts in Salesforce that are directly embedded on the Account record. I am very new to developing in apex and am not sure where to start or how to get this to work. Can anyone supply examples of Visualforce pages with charts and the associated controller classes? 

Thakns in advance,

Kris Hollen

I'm using VF charting to display a gauge on a page. I can't see anyway to set different colors for upper and lower bounds on the gauge face. For example, I want to have the gauge show a range or -100 to +100, and have the gauge face show up as green between +/- 20, Yellow between 20 and 40 and -20 and -40,  and red outside those limits. I know you can set color sections like this on the saleforce dashboard gauage, but can't see any way to do in VF. I can set two colors in the apex:gaugeSeries so that it shows one color left of the needle and another above the needle, but I need to have a static display with different colors on the gauge face itself. Appreciate if someone knows if this can or can't be done.