Refacto function _formatChartData