rewrite statistics chart  by using sqlite getting data