chart: cleanup chart code