Need to sort group data on an attribute and use pie chart to represnt

I have more than a thousand records coming from an external rest API and in a column same company name is repeated multiple times according to the transaction. I need to group the records on the basis of the company name. eg. if one company has 10 transactions then I need to show the company name once and then 10 records under the name. then need to create a pie chart for those company names and transaction total . can anyone suggest how to group this trasactions?  
1 answers

You can try sorting the list of records based on the company name and giving the list as a parameter of the page you are trying to display