change stacked barchart data format and fix bugs