created function wrapper for barchart example