Highcharts API图例不会出现

时间:2015-04-30 09:21:57

标签: angularjs highcharts

我想写一个传奇,但我不知道为什么它没有出现。另外,我想将数据库放在饼图的片段中。

myapp.controller('myctrl', function ($scope) { 
    var data = [
                    ['APP Android',   45.0],
                    ['APP Ios',       26.8],                       
                ]    
    $scope.highchartsNG = {
        options: {
            chart: { type: 'pie'}
        },
        legend: {
            enabled: true 
        },
        series: [ {  
                name: 'Avisos',
                innerSize: '50%'
        },
        {  
                name: 'Plataforma',   
                size: '80%',
                innerSize: '65%',
                showInLegend: false,
                data: data
        }],
        loading: false
    }

});

此示例在http://jsfiddle.net/Cp73s/2038/

中公开

1 个答案:

答案 0 :(得分:1)

检查出来

var myapp = angular.module('myapp', ["highcharts-ng"]);

myapp.controller('myctrl', function($scope) {
    var data = [
        ['APP Android', 45.0],
        ['APP Ios', 26.8],
        ['Widget Web', 12.8],
        ['MTC BAckoffice', 8.5],
        ['Correo electrónico', 6.2],
        ['Facebook', 6.2],
        ['Twitter', 6.2],
        ['Teléfono', 6.2],
        ['Presencial', 6.2],
    ]
    $scope.highchartsNG = {
        options: {
            chart: {
                type: 'pie'
            },
            plotOptions: {
                pie: {
                    dataLabels: {
                        distance: -25 //adjust this value to change label distance
                    }
                }
            },
        },
        title: {
            text: '550<br>AVISOS',
            align: 'center',
            verticalAlign: 'middle'
        },
        legend: {
            enabled: true
        },
        series: [{
            name: 'Avisos',
            innerSize: '50%'
        }, {
            name: 'Plataforma',
            size: '80%',
            innerSize: '65%',
            showInLegend: true,
            data: data
        }],
        loading: false
    }

});

小提琴

  

fiddle with updated label

     

Fiddle with updated legend display