Angularjs 谷歌饼图切片通过偏移量的变量传递值
我正在使用google图表api和angularjs。我需要通过变量设置切片值。我看到的所有示例都是硬编码或使用foreach循环。如何通过变量设置选定的饼图切片值。这是我的代码?“selectedRow”变量是作为字符串传递的,而不是作为变量传递的Angularjs 谷歌饼图切片通过偏移量的变量传递值,angularjs,google-visualization,Angularjs,Google Visualization,我正在使用google图表api和angularjs。我需要通过变量设置切片值。我看到的所有示例都是硬编码或使用foreach循环。如何通过变量设置选定的饼图切片值。这是我的代码?“selectedRow”变量是作为字符串传递的,而不是作为变量传递的 $scope.onSelectRowFunction = function(selectedItem) { var selectedRow = parseInt(selectedItem.r
$scope.onSelectRowFunction = function(selectedItem)
{
var selectedRow = parseInt(selectedItem.row);
$scope.chartpie.options = {
"slices": {selectedRow : {"offset": 0.4}},
"title": "Title is here",
"isStacked": "true",
"sliceVisibilityThreshold": 0,
"displayExactValues": true
};
};
试试这个:
$scope.chartpie.options = {
"slices": {},
"title": "Title is here",
"isStacked": "true",
"sliceVisibilityThreshold": 0,
"displayExactValues": true
};
$scope.chartpie.options.slices[selectedRow] = {"offset": 0.4}