generateChart = function(options) { console.log(JSON.stringify(options)); var $chartDrawDiv = $(options.divSelector); var processedData = processData(options.dataset.data); doDrawing(processedData, $chartDrawDiv, options.dataset.chart_information.height, options.dataset.chart_information.width); }, processData = function(dataset) { var barDs = { labels : [], datasets : [ { label : 'Camp Region', data : [], backgroundColor : ['red','green','purple','yellow','black'] } ] }; for (var i = 0; i < dataset.camp_region.length; i++) { barDs.labels.push(dataset.camp_region[i].formatted_data); barDs.datasets[0].data.push(dataset.camp_rating[i].raw_data); barDs.datasets[0].backgroundColor.push('#009EEC'); } return barDs; }, doDrawing = function(data, $chartDiv, height, width) { require(['js/chartingLibraries/chartjs/Chart.js'], function(chart) { var $canvas = $(''); $chartDiv.append($canvas); new Chart($canvas, { type: "polarArea", data: data, options : { responsive : false } }); }); }