Added code that dynamically updates and generates bar charts