下面是显示高图的代码。当图表类型为列时,它不显示数据标签。当它是'bar'时它会显示数据标签。
http://jsfiddle.net/LuxRK/embedded/result/
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: 'Historic World Population by Region'
},
subtitle: {
text: 'Source: Wikipedia.org'
},
xAxis: {
categories: ['Nominated', 'Approved','Rejected', 'Pending']
},
yAxis: {
labels:
{
enabled:false
}
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
series: [{
name: 'Employment',
data: [107, 31, 635, 203]
}, {
name: 'Internship',
data: [973, 914, 4054, 732]
}]
});
});
我有什么遗失的吗?
答案 0 :(得分:3)
是的,当你将类型从'bar'更改为'column'时,必须在plotOptions中完成同样的操作,同时将'bar'更改为'column',如下所示
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
title: {
text: 'Historic World Population by Region'
},
subtitle: {
text: 'Source: Wikipedia.org'
},
xAxis: {
categories: ['Nominated', 'Approved','Rejected', 'Pending']
},
yAxis: {
labels:
{
enabled:false
}
},
plotOptions: {
column: {
dataLabels: {
enabled: true
}
}
},
series: [{
name: 'Employment',
data: [107, 31, 635, 203]
}, {
name: 'Internship',
data: [973, 914, 4054, 732]
}]
});
});
更新了你的小提琴