I have the code up till the current state shown in https://jsfiddle.net/sbLgktm2/6/
I want to only show one graph at a time Eg. After clicking dropdown item1, a barchart appears, if I click dropdown item2, I want to remove the bar chart plotted for item1 and only plot the bar chart for item2. However, console kept returning that "data is not defined" for line 36, javascript, of my jsfiddle code as shown below
var chartData = data[$(currentTarget).data('id')]
Hoping for someone who could share with me where the error is. There should not be any issue with assigning data to graph through my double arrays as the charts could be plotted before I added js lines 20, 31, 41-46.
Other Info: My dropdown list is dynamically generated. Both my x and y axis data does change for each event. Bootstrap 3 and chart.js v2 is used here.