Create chart code