Implement charts api v2

Addressed the review comments.