Hightcharts - 当图表类型为列时,不显示列数据标签 [英] Hightcharts - Not showing column datalabels when chart type is column

查看:150
本文介绍了Hightcharts - 当图表类型为列时,不显示列数据标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是显示高图的代码小提琴。当图表类型为列时,它不显示数据标签。当它是'酒吧'它显示数据标签。

Below is the code fiddle to display highchart. It doesn't show datalabels when chart type is column. when it is 'bar' it shows datalabels.

http://jsfiddle.net/LuxRK/embedded/result/

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'bar'
        },
        title: {
            text: 'Historic World Population by Region'
        },
        subtitle: {
            text: 'Source: Wikipedia.org'
        },
        xAxis: {
            categories: ['Nominated', 'Approved','Rejected', 'Pending']

        },
        yAxis: {
            labels:
            {
                enabled:false
            }

        },

        plotOptions: {
            bar: {
                dataLabels: {
                    enabled: true
                }
            }
        },


        series: [{
            name: 'Employment',
            data: [107, 31, 635, 203]
        }, {
            name: 'Internship',
            data: [973, 914, 4054, 732]
        }]
    });
});

有什么我缺少的?

Is there anything which I am missing?

推荐答案

是的,当您将类型从'bar'更改为'column'时,同样必须在plotOptions中完成也将'bar'更改为'column',如下所示

yes when you change the type from 'bar' to 'column', the same has to be done in plotOptions also change 'bar' to 'column' as shown below

$(function () {
        $('#container').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Historic World Population by Region'
            },
            subtitle: {
                text: 'Source: Wikipedia.org'
            },
            xAxis: {
                categories: ['Nominated', 'Approved','Rejected', 'Pending']

            },
            yAxis: {
                labels:
                {
                    enabled:false
                }

            },

            plotOptions: {
                column: {
                    dataLabels: {
                        enabled: true
                    }
                }
            },


            series: [{
                name: 'Employment',
                data: [107, 31, 635, 203]
            }, {
                name: 'Internship',
                data: [973, 914, 4054, 732]
            }]
        });
    });

http://jsfiddle.net/LuxRK/1/

这篇关于Hightcharts - 当图表类型为列时,不显示列数据标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆