1

My requirement is in that gauge chart we have to show different colors up to 5. for that i have created custom vf page, but in that i have to show only 2 different colors. Here i'm pasted my vf page and class..

vf page:

<apex:page controller="TestPageController">
  <html>

<apex:chart height="250" width="450" animate="true" legend="true" data="{!data}" >
    <apex:axis type="Gauge" position="left" margin="-10" 
       minimum="0" maximum="10000" steps="2000" />
    <apex:gaugeSeries dataField="score" highlight="true" tips="true" donut="60" 
        colorSet="#FF0000,#FACC2E,#31B404,#8A084B">

    </apex:gaugeSeries>    
</apex:chart>
</html>
</apex:page>

Controller is:

public class TestPageController {   

    public TestPageController(){

    }

    public List<gaugeData> getData() {
        double NPS_score = 0;
        Account score = [Select Id, Name, Amount_1__c, Amount_2__c,AnnualRevenue  From Account Where id='001i000000cxxM4' LIMIT 1];
         Account score1 = [Select Id, Name,  Amount_1__c From Account LIMIT 1];
        List<gaugeData> data = new List<gaugeData>();
        data.add(new gaugeData('AMT1', score.Amount_1__c));
        data.add(new gaugeData('AMT1', score.Amount_2__c));
        data.add(new gaugeData('AMT1', score.AnnualRevenue));



        return data;
    }
    public class gaugeData {
        public String name { get; set; }

        public decimal score { get; set; }



        public gaugeData(String name, decimal npsScore) {
            this.name = name;


            this.score = npsScore;

        }
    }
}

i have attached the screenshot also.. enter image description here

  • can you ellaborate more here .Your query is confusing to me .Write what you have achieved so far and what is not happening as expected – Mohith Shrivastava Sep 15 '14 at 7:51
  • Documentation such as Gauge Charts suggest that only a single value is supported. I presume the thinking is that the gauge style of presentation corresponds to see the speedometer of a car where there is only a single value. You could use a separate gauge per value. – Keith C Sep 15 '14 at 8:08
  • i want to show 4 colors like (red,green,yellow....)in gauge chart, but now it shows only 2 different colors.. How to show different colors in gauge chart???? – fsales572 Sep 15 '14 at 8:37
  • I value means only 2 colors: the color used to show the value and the color for the rest of the gauge. – Keith C Sep 15 '14 at 10:03
  • is there any other way to get the different colors in gauge chart???? – fsales572 Sep 15 '14 at 10:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.