在堆叠标签中添加总计数,并分组堆叠柱形图-Highcharts [英] add total count inside stack labels grouped stacked column chart- Highcharts
问题描述
我有一个堆叠的分组列高图,例如 http://jsfiddle.net/d_paul/d9yb1yy1/
I have a stacked grouped column highcharts like http://jsfiddle.net/d_paul/d9yb1yy1/
当前在stackLabels中,我正在添加堆栈名称,现在我试图在每一列的顶部添加一列的总数.但是,当我将它们添加到dataLabels中时,我还会看到其他系列的标签.
currently in stackLabels I'm adding the stack name, now I am trying to add the total count of a column at the top of every column. however when I add them into the dataLabels, I see other series of labels also showing up.
plotOptions: {
column: {
stacking: 'normal'
},
formatter : function() {
return "<span>" + this.total + "</span>";
}
},
这将显示每个堆叠系列的标签.我想简单地在图表中显示一个计数/列 有什么主意吗?
this will show the labels on every stacked series. I want to simple show one count / column in the chart any idea?
推荐答案
您可以按堆栈标签添加堆栈总值,并尝试使用grouped_categories
插件添加堆栈名称.
You can add stack-total values by stack labels and try to use the grouped_categories
plugin to add the stack name.
xAxis: {
categories: [{
name: 'category1',
categories: ['A', 'B']
}, {
name: 'category2',
categories: ['C', 'D']
}]
}
实时演示: http://jsfiddle.net/BlackLabel/L0pko9h5/
文档: https://blacklabel.github.io/grouped_categories/
另一种方法是使用Highcharts.SVGRenderer
类并手动呈现标签.
The other way is to use Highcharts.SVGRenderer
class and manually render the labels.
API参考: https://api .highcharts.com/class-reference/Highcharts.SVGRenderer#text
这篇关于在堆叠标签中添加总计数,并分组堆叠柱形图-Highcharts的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!