function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
belabela 

Please help its urgent,I want to display piechart in repeat,and show batch classes status of particular batch of student

Hi,
I want to display batch classes status__c (status__C=In Progress,complete,cancelled.....) of particular batch__C of student in piechart,suppose if student has  4 batches,I have to display piechart for single batch and its status__C of batchclass object.but i am not able to repeat it,Instead I am getting all batches batchclasses status in single piechart.below is my code,can anyone helpme to solve it.

controller:
=========


public class facultydatadashboard {

public class facultydatadashboard {

public list<Faculty__c> faculty{set;get;}

public list<Batch__c> batchlist{set;get;}

public list<Batch_Class__c> batchclass{set;get;}
public list<Task__c> tasklist{set;get;}


public list<string> batchesId{set;get;}

public list<facultywrapper> facultywrapperpiechart{set;get;}
public list<facultywrapper> facultywrapperpiechart1{set;get;}
public list<facultywrapper> facultywrapperpieconstruct{set;get;}

public list<Batch_Class__c> bcllist{set;get;}

public map<id,Batch__c> batchmap{set;get;}

public facultydatadashboard(){

batchesId = new list<string>();
batchmap = new map<id,Batch__c>();

batchlist = [select id,name,Faculty__c,Faculty__r.name from Batch__c where Faculty__c='a06O000000aXV1k'];

    for(Batch__c b : batchlist){
        batchesId.add(b.id);
        batchmap.put(b.id,b);
        

       
       
    }
    
    batchclass = [select id,name,Status__c,Batch__c,Batch__r.name from Batch_Class__c where Batch__c = :batchesId];
    
    
tasklist = [select id,name,Faculty__c,Faculty__r.name,status__c from Task__c where Batch__c = :batchesId];
    




   
  
  
  

}

public list<batch__c> getbatch(){
    facultywrapperpiechart = new list<facultywrapper>();

batchlist = [select id,name,Faculty__c,Faculty__r.name from Batch__c where Faculty__c='a06O000000aXV1k'];

return batchlist ;
}

/*public list<facultywrapper> getbatchcla(){

return null;
}*/

public list<facultywrapper> getbatchclasschartofbatch(){

map<id,list<Batch_Class__c>> batchclasschart = new map<id,list<Batch_Class__c>>();
    facultywrapperpiechart1 = new list<facultywrapper>();


for(Batch_Class__c bbb : batchclass){

    if(batchclasschart.get(bbb.batch__c) == null){
         list<Batch_Class__c> b = new list<Batch_Class__c>(); 

     b.add(bbb);
     batchclasschart.put(bbb.batch__c,b);
    }
    else{
           list<Batch_Class__c> b1 = new list<Batch_Class__c>(); 
           b1=batchclasschart.get(bbb.batch__c);
           b1.add(bbb);
           batchclasschart.put(bbb.batch__c,b1);

    }
    
}

 set<id> b11 = new set<id>(); 
b11= batchclasschart.keyset();


for(Id batchid : b11){
system.debug('batchid '+batchid );



bcllist = batchclasschart.get(batchid);

system.debug('bcllist'+bcllist );

for(Batch_Class__c bcccl:bcllist ){
system.debug('bcccl'+bcccl);

        facultywrapperpiechart1.add(new facultywrapper(bcccl.status__c,batchclasschart.get(bcccl.batch__c).size(),bcccl.batch__r.name));
        }

}





 
 
return facultywrapperpiechart1;
}




public class facultywrapper{

public string name{set;get;}
public decimal data{set;get;}
public Batch_Class__c bc{set;get;}
public string batchname{set;get;}

//-------------



public facultywrapper(string n,decimal d,string bn){

this.name = n;
this.data= d;
this.batchname=bn;







 
 

}






}




-----------------------------

<apex:page controller="facultydatadashboard">
 
    
    batchclasschartofbatch
    <apex:repeat value="{!batchclasschartofbatch}">
        <apex:chart height="250" width="450" data="{!batchclasschartofbatch}" > 
            <apex:pieSeries tips="true" dataField="data" labelField="name"/> 

            <apex:legend position="bottom"/>
        </apex:chart>

</apex:repeat>
</apex:page>

 
Igor Androsov 22Igor Androsov 22
Look like you have single repeat that is good for single chart values. in this case you will need nested repeat outer repeat  to list all charts and inner repeat to display values in the pi chart
belabela
hi Androsov,
Thanks for reply,Actually for the repeat i wrote it is diplaying single chart 16 times as i have 16 batchclasses for 4 batches

Thanks,
B.Mahanandeesh