Highcharts-ng
A simple Angularjs directive for Highcharts.
AngularJs, Highcharts
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<script src="http://code.angularjs.org/1.1.0/angular.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="https://rawgithub.com/pablojim/highcharts-ng/master/dist/highcharts-ng.js"></script>
<script src="http://code.highcharts.com/modules/drilldown.js"></script>
<div ng-app="myapp">
<div ng-controller="myctrl">
<highchart id="chart1" config="highchartsNG"></highchart>
<pm-error-rate-tooltip></pm-error-rate-tooltip>
</div>
</div>
JavaScript
var myapp = angular.module('myapp', ["highcharts-ng"]);
//datacompliance
angular.module('myapp').directive('pmErrorRateTooltip', function() {
return {
restrict: 'E',
template: '<b>Hello</b>'
};
});
myapp.controller('myctrl', function ($scope, $compile) {
$scope.highchartsNG = {
options: {
chart: {
type: 'column'
}
,
tooltip: {
useHTML: true,
formatter: function () {
return $compile("<pm-error-rate-tooltip></pm-error-rate-tooltip>")($scope).html();
}
}
},
title: {
text: 'Basic drilldown'
},
xAxis: {
type: 'category'
},
legend: {
enabled: false
},
plotOptions: {
series: {
borderWidth: 0,
dataLabels: {
enabled: true,
}
}
},
series: [{
name: 'Things',
colorByPoint: true,
data: [{
name: 'Animals',
y: 5,
drilldown: 'animals'
}, {
name: 'Fruits',
y: 2,
drilldown: 'fruits'
}, {
name: 'Cars',
y: 4,
drilldown: 'cars'
}]
}],
drilldown: {
series: [{
id: 'animals',
data: [
['Cats', 4],
['Dogs', 2],
['Cows', 1],
['Sheep', 2],
['Pigs', 1]
]
}, {
id: 'fruits',
data: [
['Apples', 4],
...