Code for generating chart component