var app = angular.module('ngApp', ['highcharts-ng']);
app.controller('ngCtrl', function($scope) {
$scope.loadChart = function() {
var rnd = [];
for (var i = 0; i < 10; i++) {
rnd.push(Math.floor(Math.random() * 20) + 1)
}
$scope.highchartsConfig.series = [{
data: rnd
}];
}
$scope.highchartsConfig = {
options: {
chart: {
type: 'bar'
}
},
series: [{
data: [10, 15, 12, 8, 7]
}],
loading: false
};
});
<!DOCTYPE html>
<html ng-app="ngApp">
<head>
<meta charset="utf-8" />
<title>AngularJS HighCharts</title>
<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />
<link rel="stylesheet" href="style.css" />
<script data-require="angular.js@1.4.x" src="https://code.angularjs.org/1.4.8/angular.js" data-semver="1.4.8"></script>
<!-- HighCharts -->
<script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
<script type="text/javascript" src="https://rawgithub.com/pablojim/highcharts-ng/master/dist/highcharts-ng.js"></script>
<!-- // HighCharts -->
<script src="app.js"></script>
</head>
<body ng-controller="ngCtrl">
<h1>HighCharts - angularModule</h1>
<highchart config="highchartsConfig"></highchart>
<span class="pull-right"><button class="btn btn-primary" ng-click="loadChart()">ReLoad</button></span>
</body>
</html>
/* Put your css in here */