Javascript 如何手动刷新附加到作用域的对象

Javascript 如何手动刷新附加到作用域的对象,javascript,angularjs,charts,Javascript,Angularjs,Charts,我正在使用angular js和谷歌图表()的指令。我有我的谷歌图表显示在我的图形控制器 <div ng-controller="graphController"> <div class="row text-center"> <input type="button" value="All time" class="btn btn-default" ng-class="{ active: activeChart === 'alltime' }"

我正在使用angular js和谷歌图表()的指令。我有我的谷歌图表显示在我的图形控制器

<div ng-controller="graphController">
    <div class="row text-center">
        <input type="button" value="All time" class="btn btn-default" ng-class="{ active: activeChart === 'alltime' }" ng-click="changeChart('alltime')" />
        <input type="button" value="Today" class="btn btn-default" ng-class="{ active: activeChart === 'today' }" ng-click="changeChart('today')"/>
    </div>
    <div class="row text-center">
        <div google-chart chart="chart" />
    </div>            
</div>
此外,我正在通过一个服务更新此图表的值,我希望在单击“alltime”或“today”按钮时调用该服务

$scope.changeChart = function changeChart(chart) {

    $scope.activeChart = chart;

    $scope.chart = {};
    $scope.chart = activityDataService.createGraph(activityDataService.getActivityData());      
};

当我第一次单击“alltime”或“today”时,函数将运行并返回新图表的结果。第二次单击任一按钮时,我可以验证是否调用了服务函数,但是$scope上的图表对象没有更新。是否有手动方法刷新谷歌图表?(或者我这边的其他重构?

什么是activityDataService.createGraph?要刷新字符,只需将其分配给新数据。是否应该以某种方式使用图表参数来创建一个新的图形?您是否尝试过scope.$apply()?
$scope.changeChart = function changeChart(chart) {

    $scope.activeChart = chart;

    $scope.chart = {};
    $scope.chart = activityDataService.createGraph(activityDataService.getActivityData());      
};