Adds legends to bar charts
This centralizes the show legend code into a function that can be called easily for multiple charts. This adds legends for barcharts if showLegend: true
Adds an example for adding legends to bar charts