使用Highcharts在cloumn图表的条形图上显示计数和Y轴上显示百分比
我的系列数据和柱状图如下所示。 系列数据数组值是我需要显示在条形图顶部的计数,而fiddle中的系列百分比WithingGroupValues数组数据应该是我的Y轴数据。 如何实现这一点?下面是我的数据使用Highcharts在cloumn图表的条形图上显示计数和Y轴上显示百分比,highcharts,Highcharts,我的系列数据和柱状图如下所示。 系列数据数组值是我需要显示在条形图顶部的计数,而fiddle中的系列百分比WithingGroupValues数组数据应该是我的Y轴数据。 如何实现这一点?下面是我的数据 series: [{ name: 'John', data: [5, 3, 4, 7, 2], /*Percentage is calculated as Below values
series: [{
name: 'John',
data: [5, 3, 4, 7, 2],
/*Percentage is calculated as
Below values are random
(5)*100/(5+2+3)
*/
percentwithingroupvalues:[20,20,20,20,20]
}, {
name: 'Jane',
data: [2, 2, 3, 2, 1],
percentwithingroupvalues:[20,20,20,20,20]
}, {
name: 'Joe',
data: [3, 4, 4, 2, 5],
percentwithingroupvalues:[20,20,20,20,20]
}]
您需要为每个点对象
{}
,而不是值y
,请参见:
您需要为每个点对象
{}
,而不是值y
,请参见:
plotOptions: {
column: {
dataLabels: {
enabled: true,
formatter: function () {
return this.point.custom;
}
}
}
},
series: [{
name: 'John',
data: [{
custom: 5,
y: 20
}, {
custom: 3,
y: 15
}, {
custom: 4,
y: 11
}, {
custom: 22,
y: 7
}, {
custom: 33,
y: 2
}],
}]