added functionality to update bar chart when nav