+ Start a Discussion
Umamageshwari PalanisamyUmamageshwari Palanisamy 

How to overcome the colour over-ridden issue in reports

How to overcome the colour over-ridden issue in bar chart?

  User-added image

 

I need to display the reports as mentioned above. But the green value gets over-ridden by the yellow value like below .I have  specified "stacked=true".

User-added image




Here is my code :

Controller :

public with sharing class Rfleet_DashboardcurrentYear{
public decimal Dvol{get;set;}
public decimal Dvol1{get;set;}
public decimal dElTarSum{get;set;}
public decimal tArRatioSum{get;set;}
public decimal dElComSum{get;set;}
public decimal cOmRatioSum{get;set;}
public decimal iKamForcastSum{get;set;}
 public String mOnthName{get;set;}
public decimal cUrntMonth{get;set;}
 public decimal cOunForcastSum{get;set;}
   public decimal cOunForCastRatio{get;set;}
   public decimal cUrntYear{get;set;}
   public String str{get;set;}
     public String s{get;set;}
    
    
   
 public Rfleet_DashboardcurrentYear(){
 
 //Global deliveries Realized
       Dvol1=0;
    
       List<AggregateResult> tAr=[select SUM(Countries_delivered_volume__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : tAr)  {
            Dvol=(decimal)ar.get('expr0');
           system.debug('<<<<<<<a value'+Dvol);
       }
 // Annual global deliveries target  
       AggregateResult[] tArRatio=[select SUM(Target_ratio__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : tArRatio)  {
            tArRatioSum=(decimal) ar.get('expr0');
            system.debug('<<<<<<<a value'+tArRatioSum);
        }
       
       AggregateResult[] dElTar=[select SUM(Annual_deliveries_target__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : dElTar)  {
            dElTarSum=(decimal) ar.get('expr0');
            system.debug('<<<<<<<a value'+dElTarSum);
        }
//Annual global deliveries Commitment
        AggregateResult[] cOmRatio=[select SUM(Commitment_Ratio__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : cOmRatio)  {
            cOmRatioSum=(decimal) ar.get('expr0');
            system.debug('<<<<<<<a value'+cOmRatioSum);
        }
        decimal intround=cOmRatioSum.setScale(0,System.Roundingmode.HALF_UP);  
         s = ' '+intround+'%';
      
        AggregateResult[] dElCom=[select SUM(Annual_global_deliveries_commitment__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : dElCom)  {
           dElComSum=(decimal) ar.get('expr0');
          system.debug('<<<<<<<a value'+dElComSum);
        }
 //Country Forecast
 
        AggregateResult[] cOunForcast=[select SUM(Countries_forecast__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : cOunForcast)  {
            cOunForcastSum=(decimal) ar.get('expr0');
            system.debug('<<<<<<<a value'+cOunForcastSum);
        }
       
        cOunForCastRatio=(Dvol/cOunForcastSum)*100;
       
       
  //Current year
       
       AggregateResult[] cUrntYr=[select CALENDAR_YEAR(Current_month__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ar : cUrntYr)  {
            cUrntYear=(Integer) ar.get('expr0');
            system.debug('<<<<<<<a value'+cUrntYear);
        }
       
       str=String.valueof(cUrntYear);
       
 //Current month
    
 AggregateResult[] cUrntMon=[select CALENDAR_MONTH(Current_month__c) from IKAM_Data__c where Current_month__c=this_year group by CALENDAR_MONTH(Current_month__c)];
        for (AggregateResult ar : cUrntMon)  {
            cUrntMonth=(Integer) ar.get('expr0');
            system.debug('<<<<<<<a value'+cUrntMonth);
        }
 
If(cUrntMonth==1){mOnthName='Jan';}
 else if(cUrntMonth==2){mOnthName='Feb';}
  else if(cUrntMonth==3){mOnthName='Feb';}
   else if(cUrntMonth==4){mOnthName='Apr';}
    else if(cUrntMonth==5){mOnthName='May';}
     else if(cUrntMonth==6){mOnthName='June';}
      else if(cUrntMonth==7){mOnthName='July';}
       else if(cUrntMonth==8){mOnthName='Aug';}
        else if(cUrntMonth==9){mOnthName='Sep';}
         else if(cUrntMonth==10){mOnthName='Oct';}
          else if(cUrntMonth==11){mOnthName='Nov';}
           else if(cUrntMonth==12){mOnthName='Dec';}
            else{}

     
       AggregateResult[] iKamForcast=[select SUM(IKAM_forecast__c) from Account where Current_month__c=this_year group by CALENDAR_YEAR(Current_month__c)];
        for (AggregateResult ard : iKamForcast)  {
           iKamForcastSum=(decimal) ard.get('expr0');
            system.debug('<<<<<<<a value'+iKamForcastSum);
        }       
 }  
}

VF Page Code:

<apex:page controller="Rfleet_DashboardcurrentYear" >
   <script>
 
 var dataArray = new Array();
       
         
           dataArray.push({'data1':{!Dvol1},'data2':{!Dvol},'name':'Deliveries volume\nrealized({!mOnthName} {!str})'});
           dataArray.push({'data1':{!tArRatioSum},'data2':{!dElTarSum}, 'name':'Annual global\ndeliveries\ntarget\n({!str})'});
             dataArray.push({'data1':{!cOmRatioSum},'data2':{!dElComSum}, 'name':'Annual global\ndeliveries\nCommitment\n({!str})'});
            dataArray.push({'data1':{!cOunForCastRatio},'data2':{!cOunForcastSum}, 'name':'Countries\nforecast({!str}\n {!mOnthName})'});
     
          </script>
 <apex:chart data="dataArray" height="400" width="500" colorSet="#FFB547,#9ACD32" >
  
<apex:axis type="Numeric" position="left"  grid="true" fields="data2"/>
<apex:axis type="Numeric" position="right"  fields="data1" minimum="0" maximum="100" steps="4"/>
<apex:axis type="Category" position="bottom" fields="name"/>


 
   <apex:barSeries orientation="vertical" axis="right" stacked="true" xField="name" yField="data1"  >
    <apex:chartLabel field="data1" display="insideEnd" orientation="horizontal"/>
      </apex:barSeries>
   
        
    <apex:barSeries orientation="vertical" axis="left" stacked="true" xField="name" yField="data2" >
     <apex:chartLabel field="data2" display="middle" orientation="horizontal"/>
    
              
         </apex:barSeries>
   
        
</apex:chart>
</apex:page>

Please provide me a solution for this . Thanks in advance !!!!
Andy BoettcherAndy Boettcher
Have you tried setting the "colorSet" attribute in each apex:barseries component?
Umamageshwari PalanisamyUmamageshwari Palanisamy
I have already tried this and the output was same. Could you provide some other solution