HighCharts在栏上放置标签 [英] HighCharts Place Label on Bar
问题描述
给出下图-我想从图例中为每列获取标签,并将其打印在列本身上.我无法在HighCharts API中找到任何可以执行此操作的东西.有没有人能想到这样的想法或例子?
Given the below image - I would like to take the label from the legend for each column and print it on the column itself. I have not been able to find anything in the HighCharts API that will allow me to do this. Does anyone have any ideas or examples of something like this I could look at?
谢谢!
编辑
有一个我想完成的更好的例子
There is a better example of what I want to accomplish
我认为这很容易辨认.用例是这些统计信息显示在呼叫中心周围的大型监视器上.图例通常太小,无法从任何给定距离读取.
I think that is easily discernible. The use case is these stats are displayed on large monitors around a call center. The legend is typically too small to read from any given distance.
推荐答案
只需尝试格式化柱形图上的数据标签,这是一个入门的示例.
Just try formatting the data label on a column chart, here is an example to get you started.
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
xAxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
dataLabels: {
enabled: true,
color: '#000',
style: {fontWeight: 'bolder'},
formatter: function() {return this.x + ': ' + this.y},
inside: true,
rotation: 270
},
pointPadding: 0.1,
groupPadding: 0
}
},
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]
}]
});
});
这篇关于HighCharts在栏上放置标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!