Передать переменную в callback функцию javascript
Подскажите пожалуйста с такой проблемой, с js вообще не разбираюсь, есть код:
result = $.parseJSON(response);
output = result.data;
google.charts.load('current', {
callback: function() {
var data = new google.visualization.DataTable({
cols: [{
label: 'time',
type: 'string'
},
{
label: 'x1',
type: 'number'
},
{
label: 'x2',
type: 'number'
},
{
label: 'x3',
type: 'number'
}
],
rows: [
output
]
});
var container = document.getElementById('chart');
var options = {
displayAnnotations: true
}
var chart = new google.visualization.LineChart(container);
chart.draw(data, {
height: 600,
series: {
1: {
targetAxisIndex: 1,
},
2: {
targetAxisIndex: 1,
}
},
theme: 'material',
vAxes: {
0: {
title: 'x1'
},
1: {
title: 'x2, x3'
}
}
});
},
packages: ['corechart']
});
Мне нужно подставить значение output в
rows: [
output
]
вместо output. Как мне сделать такое?