HTML:
<div style="border: 1px solid #ccc; width: 620px; float: right"> <highchart id="chart1" config="chartConfig"></highchart> </div>
highcharts-ng配置:
var prices = [60.5,55.7]; // Static data works $scope.chartConfig = { options : { chart : { type : 'line' } },series : [ { data : prices } ],title : { text : 'Monthly Book Prices' },loading : false }
动态更新series数据:
$scope.chartConfig.series[0].data = $scope.book.prices 或者用下面这个方法: var prices = {data: [60.5,55.7]}; // Static data works $scope.chartConfig = { options : { chart : { type : 'line' } },series : [ prices ],loading : false } prices.data = [60.5,55.7]
Highcharts官网:https://www.highcharts.com/stock/demo/dynamic-update