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" id = '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, $compile) {

    $scope.closeDrillDown = function () {
        alert('function called');        
    };    
    
    $scope.chartConfig = {
        options: {
            chart: {
                type: 'bar',
                height: 200,
                backgroundColor: false
            },
            plotOptions: {
                series: {
                    point: {
                        events: {
                            click: function () {
                                
                                var content = '<div id = "postListPopUpContainer"><div id="postListPopUp"><div><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></div></div>';
                                
                                $('#myCtrl').append($compile(content)($scope));
                            }
                        }
                    },
                    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',
            align: 'right',
            verticalAlign: 'top',
            y: 60,
            x: -60
        },
  ...