forked from GAdevopsES/BostonCity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdrawChart.js
More file actions
21 lines (18 loc) · 689 Bytes
/
Copy pathdrawChart.js
File metadata and controls
21 lines (18 loc) · 689 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function drawChart(salaries) {
let row = []
salaries.forEach(item=>row.push([item[9],Number(item[18])]));
let shortRows = row.slice(0,20);
console.log(shortRows)
// Create the data table
let data = new google.visualization.DataTable();
data.addColumn('string', 'Job Title');
data.addColumn('number', 'Salary');
data.addRows(shortRows);
// Set chart options
var options = {'title':'Boston City Salaries:',
'width':800,
'height':500};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.BarChart(document.getElementById('chart'));
chart.draw(data, options);
}