Proper implementation of highcharts data preparation