Highchart在值工具提示后添加文本

时间:2017-12-28 09:04:51

标签: javascript highcharts

此链接是在Highchart中使用组栏的示例:

http://jsfiddle.net/jlbriggs/KWPsv/

series: [{
    name:'Total',
    groupPadding:.16,
    color:'rgba(204,204,204,.5)',
    grouping:false,
    data:[55,108,87,51,92]       
},{
    name:'Group 1',
    data: [7,12,16,32,64]
},{
    name:'Group 2',
    data: [16,32,64,7,12]
},{
    name:'Group 3',
    data: [32,64,7,12,16]
}]

目前,我想在工具提示中的每个值之后添加更多文字。

示例:组1:7(%)...

请帮助我!

1 个答案:

答案 0 :(得分:1)

插入工具提示位,如下所示:

xAxis:{
    categories:['A','B','C','D','E'],
    lineColor:'#999',
    lineWidth:1,
    tickColor:'#666',
    tickLength:3,
    title:{
        text:'X Axis Title',
        style:{
            color:'#333'
        }
    }
},
--------------------------------------
tooltip: {
    formatter: function () {
        var s = '<b>' + this.x + '</b>';
        $.each(this.points, function () {
            s += '<br/>' + this.series.name + ': ' +
                this.y + '%';
        });
        return s;
    },
    shared: true
},
----------------------------------------
yAxis:{
    lineColor:'#999',
    lineWidth:1,
    tickColor:'#666',
    tickWidth:1,
    tickLength:3,
    gridLineColor:'#ddd',
    title:{
        text:'Y Axis Title',
        rotation:0,
        margin:50,
        style:{
            color:'#333'
        }
    }
},