我正在使用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/;) –