在绘图列中显示两个数据标签?
Show two data labels in plotting column?
这是一个简单的例子:http://jsfiddle.net/vecmftmh/
这是示例的数据标签部分:
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0,
dataLabels: {
enabled: true,
allowOverlap: true
}
}
}
此图在每列顶部显示了一个数据标签。我怎样才能在每列中显示数据标签?
Highcharts 上没有任何选项可以处理两个数据标签。但是您可以将此解决方法与 dataLabels.formatter
和 useHTML:true
:
一起使用
useHTML:true,
formatter: function() {
return '<div class="datalabel" style="position: relative; top: 20px"><b>'+ this.y +
'</div><br/><div class="datalabelInside" style="position: absolute; top: 45px"><b>'+ this.y +'</div>';
}
这样你可以手动添加两个 dataLabels
自定义位置和样式。在您的情况下,一个内部列和一个外部列。这是 DEMO.
看到这个:Since v6.2.0, multiple data labels can be applied to each single point by defining them as an array of configs.
这是一个简单的例子:http://jsfiddle.net/vecmftmh/
这是示例的数据标签部分:
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0,
dataLabels: {
enabled: true,
allowOverlap: true
}
}
}
此图在每列顶部显示了一个数据标签。我怎样才能在每列中显示数据标签?
Highcharts 上没有任何选项可以处理两个数据标签。但是您可以将此解决方法与 dataLabels.formatter
和 useHTML:true
:
useHTML:true,
formatter: function() {
return '<div class="datalabel" style="position: relative; top: 20px"><b>'+ this.y +
'</div><br/><div class="datalabelInside" style="position: absolute; top: 45px"><b>'+ this.y +'</div>';
}
这样你可以手动添加两个 dataLabels
自定义位置和样式。在您的情况下,一个内部列和一个外部列。这是 DEMO.
看到这个:Since v6.2.0, multiple data labels can be applied to each single point by defining them as an array of configs.