Highcharts 柱形图

2017-07-17  本文已影响0人  皮蛋馅儿

效果图:


image.png
$(function () {
    var chart = $('#container').highcharts({
        chart: {
            type: 'column'
        },
        title: {
            text: '时长'
        },
        xAxis: {
            categories: [
                '0~30min',
                '30~120min',
                '大于2H'
            ],
            crosshair: true
        },
        yAxis: {
            min: 0,
            title: {
                text: '百分比(%)'
            },
            labels: {
                formatter: function () {
                    return this.value + '%'; // y轴加上%
                }
            }
        },
        credits: {
            enabled: false // 右下角图表版权信息不显示
        },
        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} %</b></td></tr>',
            footerFormat: '</table>',
            shared: true,
            useHTML: true
        },
        plotOptions: {
            column: {
                pointPadding: 0.2,
                borderWidth: 0
            }
        },
        series: [{
            name: '东京',
            data: [49.9, 71.5, 106.4]
        }, {
            name: '纽约',
            data: [83.6, 78.8, 98.5]
        }, {
            name: '伦敦',
            data: [48.9, 38.8, 39.3]
        }]
    });
});
上一篇下一篇

猜你喜欢

热点阅读