解决方法
您可以通过启用dataLabel并自定义它们来完成此操作.您还需要以特定方式格式化数据:
@H_502_6@$(function () {
$('#container').highcharts({
chart: { type:'bar',},xAxis: {
categories: ['Device 1','Device 2']
},plotOptions: {
series: {
dataLabels: {
enabled: true,formatter:function() {
return this.point.t;
}
}
}
},series: [{
data: [{y:29.9,t:"12:45"},{y:71.5,t:"14:45"}]
}]
});
});
此示例中的数据有一个额外的字段’t’,其中包含您想要在条形图上显示的时间.在dataLabel formatter函数中,您可以引用每个点内的所有数据,包括使用this.point.t的’t’.