Javascript 如何刷新通过$http.get获得的json,而无需反复绘制highchart

Javascript 如何刷新通过$http.get获得的json,而无需反复绘制highchart,javascript,angularjs,json,highcharts,Javascript,Angularjs,Json,Highcharts,正如您在我的代码中看到的,我在$http.get内部调用我的Highcharts函数,并将JSON作为参数传递,因为如果在$http.get外部使用,我的变量将变得未定义。现在我想每30秒刷新一次数据,但由于我使用了向下搜索,我不希望每次都重新绘制图表 var getChartData = function() { return $http.get("./AlertsJsonCreation").success(function(response) { $scope.js

正如您在我的代码中看到的,我在$http.get内部调用我的Highcharts函数,并将JSON作为参数传递,因为如果在$http.get外部使用,我的变量将变得未定义。现在我想每30秒刷新一次数据,但由于我使用了向下搜索,我不希望每次都重新绘制图表

var getChartData = function() {
    return $http.get("./AlertsJsonCreation").success(function(response) {
        $scope.jsonChart = response;                                
        console.log("Inside refresh", $scope.jsonChart);
    });
};

$interval(function() {
    getChartData();
}, 5000);

getChartData().then(function(response){
    console.log("Refresh then", $scope.jsonChart);
    DealerChart($scope.jsonChart.dealer, $scope.jsonChart.dealerDrilldown);
});

function DealerChart(dealer, drilldown) {
    ...
    series: [{
        name: 'Regions',
        colorByPoint: true,
        data: dealer
    }],    
    drilldown: {
        series: drilldown
    },
    ....
}

尝试在HighChart中使用.refresh()和.reflow()。如果您给出一个示例说明如何使用它。。你可以查看文件。如果您只想更新序列数据,可以使用highcharts series.update()。您可以使用动态方法添加数据,如series.setData()、series.addPoint()-请参阅演示,在highchartsCan中使用实时数据try to use.refresh()和.reflow()。您可以给出一个示例说明如何使用它。。你可以查看文件。如果您只想更新序列数据,可以使用highcharts series.update()。您可以使用动态方法添加数据,如series.setData()、series.addPoint()-请参阅实时数据演示