我生成的圖表。[鏈接] http://jsfiddle.net/sunman/XRr8M/2/。在這裏我想顯示我的總堆棧值是1/10,2/10,5/10像這樣但是我正在嘗試這個。這個代碼不像1/10,2/10那樣顯示,它顯示0.00/10像這樣。我如何在列的頂部顯示我的總stackvalue/10。所以請給我建議。Highcharts問題補充像柱形圖頂部1/10
這裏是我的代碼
$(document).ready(function() {
var options = {
chart: {
renderTo: 'container',
type: 'column',
marginRight: 130,
marginBottom: 50
},
title: {
text: 'Top Rating',
x: -20 //center
},
subtitle: {
text: 'testing',
x: -20
},
xAxis: {
categories: []
},
yAxis: {
title: {
text: 'monthly Rating'
},
stackLabels: {
enabled: true,
formatter:function(){
// return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y +'/10'
return Highcharts.numberFormat(this.y) + '/10'
},
style: {
fontWeight: 'bold',
color: (Highcharts.theme && Highcharts.theme.textColor) || 'gray'
}
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
formatter: function() {
return '<b>' + this.series.name + '</b><br/>' + this.x + ': ' + this.y;
}
},
plotOptions:{
dataLabels: {
enabled: true,
},
column: {
stacking: 'normal',
dataLabels: {
enabled: true,
color:'white',
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
borderWidth: 0
},
series: [{
name: 'RATING',
data: [],
id: 'dataseries'
}, {
type: 'flags',
onSeries: 'dataseries',
data: [{
x: 0,
text: 'Minimum Facilites Rating',
title: 'Min'
}, {
x: 10,
text: 'Maximum Facilites Rating',
title: 'max'
}],
width: 30,
showInLegend: false
}]
};
//imitate AJAX:
json = [{
data: ['a', 'b', 'c','d','e', 'f', 'g','h','i', 'j', 'k','l']
}, {
data: [1, 2, 3, 1, 2, 3, 4, 1, 3, 3, 3, 3, 3, 3, 5, 1]
}];
options.xAxis.categories = json[0]['data'];
options.series[0].data = json[1]['data'];
chart = new Highcharts.Chart(options);
});
所以請請求大家給我的想法如何可能。
@Sebastian Bochan請幫助我在此查詢還 – sunman
@Pawel畢淑敏請解決這個問題 – sunman