我正在使用highcharts,但首先讓我解釋一下。 圖表需要這些項目/選項 - 每個條應該有它自己的寬度(完成)
- 每個條應該有它自己的顏色(完成)
- 與avarage水平(完成)
HighCharts - 顯示xaxis標題
一個線然而,有一件事我不能工作:在x軸上需要條的名稱(如:http://www.highcharts.com/demo/column-rotated-labels)。
我試過不同的方法,如果我使用方法1,我不能設置自定義欄寬度,如果我使用方法2我不能在x軸上設置標題。任何人有個想法?
我迄今爲止代碼:
$(function() {
// Create the chart
$('#container').highcharts({
chart: {
type: 'column',
},
credits: {
enabled: false,
},
title: {
text: ''
},
xAxis: {
type: 'category',
title: {
text: 'Kerntaken',
},
labels: {
enabled: true,
},
categories: ['Apples', 'Bananas', 'Oranges']
},
yAxis: [{
title: {
text: 'Gemiddeld niveau',
},
allowDecimals: false,
plotLines: [{
color: 'black',
value: '2', // Insert your average here
width: '1',
zIndex: 5, // To not get stuck below the regular plot lines
label: {
text: 'gemiddeld niveau',
align: 'right',
y: 12,
x: 0
}
}],
},{
title: {
text: ''
},
allowDecimals: false,
},{
title: {
text: ''
},
allowDecimals: false,
},{
title: {
text: '',
},
opposite: true,
}],
legend: {
enabled: false
},
tooltip: {
pointFormat: '<b>{point.y:.2f}</b><br/>',
},
series: [{
name: "Kerntaken",
colorByPoint: true,
colors: ['#c8173c', '#f2d38d', '#e2584d', '#6f2236', '#4e787a', '#867e97', '#000000'],
pointWidth: 20,
data: [{
name: "Adviseren",
y: 3.2,
drilldown: "Adviseren",
}],
}, {
name: "Kerntaken",
colorByPoint: true,
colors: ['#f2d38d', '#e2584d', '#6f2236', '#4e787a', '#867e97', '#000000'],
pointWidth: 50,
data: [{
name: "Analyseren",
y: 1.5,
drilldown: "Analyseren",
}]
}, {
name: "Kerntaken",
colorByPoint: true,
colors: ['#e2584d', '#6f2236', '#4e787a', '#867e97', '#000000'],
pointWidth: 30,
data: [{
name: "Organiseren",
y: 3.9,
drilldown: "Organiseren",
}]
}, {
name: 'CP niveau',
type: 'spline',
data: [2],
tooltip: {
headerFormat: 'gemiddeld niveau<br>',
},
}],
});
我與我的代碼到目前爲止小提琴:https://jsfiddle.net/Mik3yZ/L181kpqt/2/
在您的代碼鑽取id中,但沒有向下鑽取sereis,您真的需要深入鑽取系列還是錯誤地進行了深入鑽取? –
我需要向下鑽取,只能將其刪除,因爲它與此問題無關 –
我會使用下面的答案之一。只有一件事是缺少'plotOptions.column.grouping = false',請參閱:http://jsfiddle.net/xkjqtcq3/2/;) –