如何在highcharts中隐藏多图表中的0值?

时间:2015-01-29 14:14:21

标签: javascript jquery charts highcharts

我想要隐藏0值,这是我的图表: http://jsfiddle.net/phsx2azc/

你在饼图下看到了四个值" 0",并且很容易看到,我需要隐藏" 0"值。所以我的问题是......我怎么能隐藏" 0"  多图表中的值? 我希望你能帮助我! :(

$(function () {
$('#container').highcharts({
  title: {
        text: 'Percepción y Satisfacción Origen DOM'
          },
     xAxis: {

         categories: ['Noviembre', 'Diciembre', 'Enero', 'Meta']
             },
    yAxis: {
        labels: {
            format: '{value=0}'
        }
    },
       labels: {
        items: [{
            html: 'Insatisfacción DOM',
            style: {
                left: '50px',
                top: '18px',
                color: (Highcharts.theme && Highcharts.theme.textColor) || 'black'
                    }
                 }]
                },
    plotOptions: {
        series: {

            depth: 45,
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {

                enabled: true,
                distance: 0.5,
                format: '{total} ',
                color: '#FFFFFF',
                style: {

                fontSize: '13px',
                fontFamily: 'Verdana, sans-serif',
                textShadow: '0 0 3px black'
            },


            },


            showInLegend: true,
            pointPadding: 0,
            groupPadding: 0,
            borderColor: '#303030',
            stacking: 'normal',
            //colorByPoint: true

        }


    },
    series: [{// columnas positivas  

        type: 'column',
        stacking: 'normal',
        name: 'Positivos',
        colors: ['#009999','#009999','#009999','#FFFF00'],
        data: [35,32,39,38,0,0,0,0],
        colorByPoint: true,

    }, 
             {//columnas negativas
        type:'column',
        name: 'Negativos',
        data: [-9, -8, -8],
        colorByPoint: false,
    },                 
             {
                 //aquí empieza el pie chart
        type: 'pie',
        name: 'Percepción Origen',


        data: [{
            name: 'Check in',
            y: 14,
            color: '#13035f', 
        }, {
            name: 'Embarque',
            y: 24,
            color: '#f03215', 
        }, {
            name: 'Falta información',
            y: 20,
            color: '#FE7943',
        },
              {
            name: 'Infraestructura',
            y: 20,
            color: '#DAFAA8', 
        },
               {
            name: 'Amabilidad',
            y: 20,
            color: '#BEF16D', 
        },
               {
            name: 'Comportamiento',
            y: 20,
            color: '#3ED72D',
        },
               {
            name: 'Atraso vuelo',
            y: 20,
            color: '#148307', 
        },
                {
            name: 'Solicitudes especiales',
            y: 20,
            color: '#41B9FB', // Joe's color
        }
              ],
        center: [380, 80],
        size: 200,
        showInLegend: true,
        dataLabels: {
            enabled: true
        }
    }]
});

});

1 个答案:

答案 0 :(得分:0)

您在dataLabels上使用了formatformatter。因此format会隐藏formatter,甚至不会运行该功能。删除它,并在您的fomatter中使用this.y而不是this.dataDEMO