+ Start a Discussion
Ketan Solanki29Ketan Solanki29 

Getting Error : Invalid type: GoogleViz in Apex Class

I am using google visualization api to draw column chart on apex page but, in controller i am getting error

 

public with sharing class GoogleColumnChartController {

public List<Account> accList { get; set; }

public GoogleColumnChartController(){
accList = [ SELECT Id,Name,Total_Sales__c,Total_Expense__c FROM Account ];

}

 

public String getSalesData(){
GoogleViz gv = new GoogleViz();

gv.cols = new list<GoogleViz.col> {
new GoogleViz.Col('col1','Year','Year'),
new GoogleViz.Col('col2', 'Salse','Sales'),
new GoogleViz.Col('col3','Expense','Expense')
};

for ( Account acc : accList ){

GoogleViz.row r = new GoogleViz.row();

r.cells.add ( new GoogleViz.cell(acc.Total_Sales__c) );
r.cells.add ( new GoogleViz.cell(acc.Total_Expense__c) );
}

return gv.toJsonString();
}

 

please , help me why error come at GoogleViz line i have see many examples on devloperforce using this class object.

but i am getting this error which decrease my interust to use the Visulization api.

 

anything need to use this GoogleViz in apex class if any then please assist me....

Best Answer chosen by Admin (Salesforce Developers) 
Abhay AroraAbhay Arora

http://wiki.developerforce.com/page/Google_Visualizations_Install_Instructions

 

Above is the link with step by step instructions for same

All Answers

bob_buzzardbob_buzzard

Do you have a custom class named GoogleViz?  If you have used the code share that class should be included.

Ketan Solanki29Ketan Solanki29

I haven't this class .

 

how this class i include in my Org ?.

 

i have read many google visulization examples but i didn't see this class.

 

Please help me ...

bob_buzzardbob_buzzard

You should install the google vizualisations code share from:

 

http://developer.force.com/codeshare/apex/projectpage?id=a06300000030w9LAAQ

Abhay AroraAbhay Arora

http://wiki.developerforce.com/page/Google_Visualizations_Install_Instructions

 

Above is the link with step by step instructions for same

This was selected as the best answer