add barchart function and testing script