2014-11-05 50 views
0

我正在使用谷歌圖表api和angularjs.I需要設置切片值通過變量。所有的例子,我看到他們硬編碼或使用foreach循環。如何設置選定的餅圖切片值通過變量。這裏是我的代碼?「selectedRow」變量是作爲一個字符串傳遞的,而不是一個變量。谷歌餅圖切片傳遞值通過變量爲偏移

 $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 
      }; 


     }; 

回答

0

試試這個:

 $scope.chartpie.options = { 
      "slices": {}, 
      "title": "Title is here", 
      "isStacked": "true",      
      "sliceVisibilityThreshold": 0, 
      "displayExactValues": true 
     }; 
     $scope.chartpie.options.slices[selectedRow] = {"offset": 0.4} 
+0

感謝you..its工作很好.. – 2014-11-06 11:30:31