I have been attempting to create a chart using Google Charts by passing some parameters to the function. I am trying to use these parameters to populate the data, but it doesn't seem to be working as expected. Is it possible to include parameters in this function since I am not familiar with what occurs inside the google.charts.setOnCallback() method?
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart(scoreForEachSkill, skillList) {
var data = new google.visualization.DataTable();
data.addColumn('string','Skill');
data.addColumn('number','Score');
for(var i=0;i< scoreForEachSkill.length;i++)
{
data.addRow(skillList[i],scoreForEachSkill[i]);
}
var options = {'title':'Skills', 'width':610, 'height':390};
var chart = new
google.visualization.PieChart(document.getElementById('pieChart'));
chart.draw(data, options);
}
The HTML and CSS section:
<div id="pieChart" style="margin-left:-10px;margin-right:-10px;"></div>