abstract all chart js into one function