实现效果:
代码呈上:
Highcharts.chart('container', {
chart: {
type: 'column'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
column:{
pointPadding: -.3,
dataLabels:{ //柱状图数据标签
enabled:true, //是否显示数据标签
shape: 'rect',
x: 0,
y: 30,
style:{
color:'#f00',
},
useHTML:true,
formatter:function(){
return '<span style="width:58px;height:5px;display:block;background-color:#f00;"></span><span style="display:block;padding-top:5px;text-align:center;">'+this.y+'</span>'
// return '<img src="https://img.hcharts.cn/static/common/weibo_logo.png" width=50px><br/><span>123</span>';
}
}
}
},
series: [{
data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
}]
});