get chart data from database