0

当我尝试使用上面显示的代码时,但无法在条形图上获取数据值我希望数据值显示在条形图上。当我通过添加数据标签值来尝试它时,它会显示在栏中而不是栏上。请在这方面提供帮助。

$(function () {
    $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: 'Monthly Average Rainfall'
        },
        subtitle: {
            text: 'Source: WorldClimate.com'
        },
        xAxis: {
            categories: [
                'Jan',
                'Feb',
                'Mar',
                'Apr',
                'May',
                'Jun',
                'Jul',
                'Aug',
                'Sep',
                'Oct',
                'Nov',
                'Dec'
            ]
        },
        yAxis: {
            min: 0,
            title: {
                text: 'Rainfall (mm)'
            }
        },
        tooltip: {
            headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
            pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: [{
            name: 'Tokyo',
            data: [49.9]

        }, {
            name: 'New York',
            data: [83.6]

        }, {
            name: 'London',
            data: [48.9]

        }, {
            name: 'Berlin',
            data: [42.4]

        }]
    });
});
4

1 回答 1

3

只需dataLabels: { enabled: true }在 plotOptions 下设置。见:http: //jsfiddle.net/3bQne/499/

于 2013-09-20T11:27:52.860 回答