Refactoring for less code dupplication in charts/stat
add a new stat + refactoring