How to count the number of votes for each star in fivestar? I'm using Drupal 7, Voting API and Fivestar.

I try to count the number of votes for each star, and display the percentage, like :

 

It is at present possible to have only the number of total vote. 

How can I achieve this?
With Voting API (hook_votingapi_results_alter) or Views ?

For information, i'm using comments for rating nodes.
Once i tried to find some function that could do it. But i found just
 fivestar_get_votes($entity_type, $id, $tag = 'vote', $uid = NULL). It returns full voting score.

You can get some info here or on other sites.

I think it is possible with some sql queries EG:

   $query = db_select('votingapi_vote', 'vote');
   $query-&gt;condition('vote.entity_type', 'node');
   $query-&gt;condition('vote.entity_id', $nid);
   $query-&gt;condition('vote.tag', 'vote');
   $query-&gt;condition('vote.value', '60');
   $query-&gt;addField('vote', 'uid');
   $three_stars = $query-&gt;countQuery()-&gt;execute()-&gt;fetchField();


Here $nid is your your node's nid and 60 means three stars (20 - 1 star, 40 - 2 stars etc), vote.tag is tag that you assigned for your votes.