Take a look at this article it demonstrates similar functionality but using Opportunity and Campaigns. You should be able to use this example to accomplish what you are looking for.
http://crmchartguy.wordpress.com/2013/08/08/advanced-campaign-performance-chart-in-ms-crm/