generateChart = function(options) { var $chartDrawDiv = $(options.divSelector); console.log(JSON.stringify(options)); require(['https://www.gstatic.com/charts/loader.js'], function() { google.charts.load('current', {'packages' : ['orgchart', 'table']}); google.charts.setOnLoadCallback(function() { var processedData = processData(options.dataset.data); doDrawing(processedData, $chartDrawDiv, options.dataset.chart_information.height, options.dataset.chart_information.width, options.dataset.attributes.default_colours); }); }); }, processData = function(dataset) { var raw_data = response.getDataTable(); var data = new google.visualization.DataTable(); var num_rows = raw_data.getNumberOfRows(); var ds = [['Name', 'Role', 'Reports to']]; for (var i = 0; i < num_rows; i++) { var role = raw_data.getValue(i, 0); var reportsTo = raw_data.getValue(i,1); var name = raw_data.getValue(i,2) !== null ? raw_data.getValue(i,2) : ''; data.addRows([[ { v: role, f: name + "
" + role + "
" }, reportsTo, name]]); } var container = document.getElementById('orgchart_admin'); var chart = new google.visualization.OrgChart(container); chart.draw(data, {allowHtml:true, 'size': 'large'}); }