processing data for stacked bar chart