我在我的应用程序中使用有角度的谷歌图表,它可以正常使用静态数据 - 。
var chart1 = {};
chart1.type = "GeoChart";
chart1.data = [
['Locale', 'Count'],
['Germany', 22],
['United States', 34],
['Brazil', 42],
['Canada', 57],
['France', 6],
['RU', 72]
];
chart1.options = {
width: 600,
height: 300,
chartArea: {left:10,top:10,bottom:0,height:"100%"},
colorAxis: {colors: ['#aec7e8', '#1f77b4']},
displayMode: 'regions'
};
chart1.formatters = {
number : [{
columnNum: 1,
pattern: "$ #,##0.00"
}]
};
$scope.chart = chart1;
但我从服务器获取数据 -
$http.get("http://someurl")
.success(function(response) {
$scope.data = response;});
});
现在我如何将response data
推送到chart1.data
以使其正常运行。
答案 0 :(得分:0)
我假设成功响应回调函数与chart
define在同一个控制器中。
$http.get("http://someurl")
.success(function(response) {
$scope.chart.data = response;
});
});