Highcharts-ng
A simple Angularjs directive for Highcharts.
AngularJs, Highcharts
HTML
<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/src/highcharts-ng.js"></script>
<div ng-app="myapp">
<div ng-controller="myctrl">
<div class="row">
<highchart config="chartConfig"></highchart>
</div>
</div>
</div>
JavaScript
//See: https://github.com/pablojim/highcharts-ng
var myapp = angular.module('myapp', ["highcharts-ng"]);
myapp.controller('myctrl', function ($scope) {
$scope.closeDrillDown = function() {
alert('function works');
};
$scope.chartConfig = {
options: {
chart: {
type: 'bar',
height: 200,
backgroundColor: false
},
plotOptions: {
series: {
point: {
events: {
click: function () {
var containerDiv = document.createElement('div');
containerDiv.setAttribute('id', 'postListPopUpContainer');
var contentDiv = document.createElement('div');
contentDiv.setAttribute('id', 'postListPopUp');
contentDiv.innerHTML = '<div ng-controller="SentimentChartController"><button ng-click="closeDrillDown()">Close</button><h2>' +
this.category + ' ' + this.series.name + '</h2>' +
'<p class="drillDownInfo"><strong>' + this.y + '%</strong> of posts where we can determine a sentiment are ' + this.category + '</p></div>';
document.body.appendChild(containerDiv);
containerDiv.appendChild(contentDiv);
}
}
},
dataLabels: {
enabled: true,
format: '{y} %'
}
}
}
},
title: {
text: false
},
xAxis: {
categories: ['Positive', 'Negative', 'Neutral']
},
yAxis: {
gridLineWidth: 0,
title: {
text: 'Sentiment Percentage'
},
labels:
{
enabled: false
}
},
legend: {
layout: 'vertical',
floating: true,
backgroundColor: '#FFFFFF',
...